RFR-8008118 (original) (raw)

Martin Buchholz martinrb at google.com
Fri Mar 29 03:42:54 UTC 2013


Latest webrev does it this way:

for (i = 0; i < count; i++) {
    char *q = p + strcspn(p, ":");
    pathv[i] = (p == q) ? "." : p;
    *q = '\0';
    p = q + 1;
}

On Thu, Mar 28, 2013 at 5:07 PM, Martin Buchholz <martinrb at google.com>wrote:

strsep is nice, but not standard enough to use in the JDK. OTOH, strcspn is already used in the JDK, but doesn't really buy much:

for (i = 0; i < count; i++) { int len = strcspn(p, ":"); pathv[i] = (len == 0) ? "." : p; p[len] = '\0'; p += len + 1; }

On Thu, Mar 28, 2013 at 12:10 PM, Christos Zoulas <christos at zoulas.com>wrote:

+ for (i = 0; (pathv[i] = strsep(&p, ":")) != NULL; i++) + if (!pathv[i][0]) + pathv[i] = "."; christos



More information about the core-libs-dev mailing list