summaryrefslogtreecommitdiff
path: root/libpwdgrp/pwd_grp.c
diff options
context:
space:
mode:
authorDenys Vlasenko2009-09-23 17:17:53 +0200
committerDenys Vlasenko2009-09-23 17:17:53 +0200
commit1f27ab0d4bb65425496ff4ed0fbbd0f5bb32786f (patch)
treea7181ba3c498570257040c8663f125938ecad0a6 /libpwdgrp/pwd_grp.c
parent8d338173a4668740b1ab4a40d1d26cd25402e406 (diff)
downloadbusybox-1f27ab0d4bb65425496ff4ed0fbbd0f5bb32786f.zip
busybox-1f27ab0d4bb65425496ff4ed0fbbd0f5bb32786f.tar.gz
*: optimize code size in strtoul calls
function old new delta bb_parse_mode 433 431 -2 rtnl_rtntype_a2n 202 198 -4 ParseField 511 498 -13 bb_init_module_24 4730 4675 -55 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/4 up/down: 0/-74) Total: -74 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libpwdgrp/pwd_grp.c')
-rw-r--r--libpwdgrp/pwd_grp.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/libpwdgrp/pwd_grp.c b/libpwdgrp/pwd_grp.c
index e2077ad..947f48d 100644
--- a/libpwdgrp/pwd_grp.c
+++ b/libpwdgrp/pwd_grp.c
@@ -816,7 +816,7 @@ static int bb__parsepwent(void *data, char *line)
i = 0;
do {
- p = ((char *) ((struct passwd *) data)) + pw_off[i];
+ p = (char *) data + pw_off[i];
if ((i & 6) ^ 2) { /* i!=2 and i!=3 */
*((char **) p) = line;
@@ -873,7 +873,7 @@ static int bb__parsegrent(void *data, char *line)
end_of_buf = ((struct group *) data)->gr_name; /* Evil hack! */
i = 0;
do {
- p = ((char *) ((struct group *) data)) + gr_off[i];
+ p = (char *) data + gr_off[i];
if (i < 2) {
*((char **) p) = line;
@@ -966,15 +966,15 @@ static const unsigned char sp_off[] ALIGN1 = {
offsetof(struct spwd, sp_flag) /* 8 - not a char ptr */
};
-static int bb__parsespent(void *data, char * line)
+static int bb__parsespent(void *data, char *line)
{
char *endptr;
char *p;
int i;
i = 0;
- do {
- p = ((char *) ((struct spwd *) data)) + sp_off[i];
+ while (1) {
+ p = (char *) data + sp_off[i];
if (i < 2) {
*((char **) p) = line;
line = strchr(line, ':');
@@ -982,10 +982,10 @@ static int bb__parsespent(void *data, char * line)
break;
}
} else {
- *((long *) p) = (long) strtoul(line, &endptr, 10);
+ *((long *) p) = strtoul(line, &endptr, 10);
if (endptr == line) {
- *((long *) p) = ((i != 8) ? -1L : ((long)(~0UL)));
+ *((long *) p) = (i != 8) ? -1L : (long)(~0UL);
}
line = endptr;
@@ -1003,9 +1003,9 @@ static int bb__parsespent(void *data, char * line)
}
- *line++ = 0;
+ *line++ = '\0';
++i;
- } while (1);
+ }
return EINVAL;
}