RFR-8008118 (original) (raw)
Christos Zoulas christos at zoulas.com
Thu Mar 28 19:10:27 UTC 2013
- Previous message: RFR-8008118
- Next message: RFR-8008118
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Mar 28, 11:12am, martinrb at google.com (Martin Buchholz) wrote: -- Subject: Re: RFR-8008118
| My apologies for unrelenting perfectionism - I noticed that we can: | - colocate the pathv and path in one malloc'ed chunk | - can discard xstrdup | - can iterate through path with only one char* pointer. || Making this code even cleaner, more concise and efficient.
- for (i = 0; i < count; i++, p++) {
pathv[i] = ((*p == ':') || (*p == '\0')) ? "." : p;
while (! ((*p == ':') || (*p == '\0')))
p++;
*p = '\0';
}
pathv[count] = NULL;
for (i = 0; (pathv[i] = strsep(&p, ":")) != NULL; i++)
- if (!pathv[i][0])
pathv[i] = ".";
christos
- Previous message: RFR-8008118
- Next message: RFR-8008118
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]