From 912cff79754ac1d2193039f0f6ad740a01e7a41a Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Sat, 2 Feb 2008 23:31:36 +0200 Subject: [PATCH] config: Use memacpy instead of stracpy. So there is no need to substitute a '\0' into the string, and undo that afterwards. --- src/config/conf.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/config/conf.c b/src/config/conf.c index a3d7ff6f..dd9cab7a 100644 --- a/src/config/conf.c +++ b/src/config/conf.c @@ -92,7 +92,6 @@ parse_set(struct option *opt_tree, unsigned char **file, int *line, { unsigned char *orig_pos = *file; unsigned char *optname; - unsigned char bin; *file = skip_white(*file, line); if (!**file) return ERROR_PARSE; @@ -102,11 +101,8 @@ parse_set(struct option *opt_tree, unsigned char **file, int *line, while (isident(**file) || **file == '*' || **file == '.' || **file == '+') (*file)++; - bin = **file; - **file = '\0'; - optname = stracpy(optname); + optname = memacpy(optname, *file - optname); if (!optname) return ERROR_NOMEM; - **file = bin; *file = skip_white(*file, line); @@ -164,7 +160,6 @@ parse_unset(struct option *opt_tree, unsigned char **file, int *line, { unsigned char *orig_pos = *file; unsigned char *optname; - unsigned char bin; /* XXX: This does not handle the autorewriting well and is mostly a * quick hack than anything now. --pasky */ @@ -177,11 +172,8 @@ parse_unset(struct option *opt_tree, unsigned char **file, int *line, while (isident(**file) || **file == '*' || **file == '.' || **file == '+') (*file)++; - bin = **file; - **file = '\0'; - optname = stracpy(optname); + optname = memacpy(optname, *file - optname); if (!optname) return ERROR_NOMEM; - **file = bin; /* Mirror what we have */ if (mirror) add_bytes_to_string(mirror, orig_pos, *file - orig_pos);