mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
config: Use memacpy instead of stracpy.
So there is no need to substitute a '\0' into the string, and undo that afterwards.
This commit is contained in:
parent
753aa3054b
commit
912cff7975
@ -92,7 +92,6 @@ parse_set(struct option *opt_tree, unsigned char **file, int *line,
|
|||||||
{
|
{
|
||||||
unsigned char *orig_pos = *file;
|
unsigned char *orig_pos = *file;
|
||||||
unsigned char *optname;
|
unsigned char *optname;
|
||||||
unsigned char bin;
|
|
||||||
|
|
||||||
*file = skip_white(*file, line);
|
*file = skip_white(*file, line);
|
||||||
if (!**file) return ERROR_PARSE;
|
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 == '+')
|
while (isident(**file) || **file == '*' || **file == '.' || **file == '+')
|
||||||
(*file)++;
|
(*file)++;
|
||||||
|
|
||||||
bin = **file;
|
optname = memacpy(optname, *file - optname);
|
||||||
**file = '\0';
|
|
||||||
optname = stracpy(optname);
|
|
||||||
if (!optname) return ERROR_NOMEM;
|
if (!optname) return ERROR_NOMEM;
|
||||||
**file = bin;
|
|
||||||
|
|
||||||
*file = skip_white(*file, line);
|
*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 *orig_pos = *file;
|
||||||
unsigned char *optname;
|
unsigned char *optname;
|
||||||
unsigned char bin;
|
|
||||||
|
|
||||||
/* XXX: This does not handle the autorewriting well and is mostly a
|
/* XXX: This does not handle the autorewriting well and is mostly a
|
||||||
* quick hack than anything now. --pasky */
|
* 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 == '+')
|
while (isident(**file) || **file == '*' || **file == '.' || **file == '+')
|
||||||
(*file)++;
|
(*file)++;
|
||||||
|
|
||||||
bin = **file;
|
optname = memacpy(optname, *file - optname);
|
||||||
**file = '\0';
|
|
||||||
optname = stracpy(optname);
|
|
||||||
if (!optname) return ERROR_NOMEM;
|
if (!optname) return ERROR_NOMEM;
|
||||||
**file = bin;
|
|
||||||
|
|
||||||
/* Mirror what we have */
|
/* Mirror what we have */
|
||||||
if (mirror) add_bytes_to_string(mirror, orig_pos, *file - orig_pos);
|
if (mirror) add_bytes_to_string(mirror, orig_pos, *file - orig_pos);
|
||||||
|
Loading…
Reference in New Issue
Block a user