Linus Torvalds <torvalds@xxxxxxxx> writes: > I could have made it a more obvious "stupid" parser, I just think it's > better to do it this way. > > + else if (!strncmp(arg, "--stat", 6)) { > + char *end; > + int width = options->stat_width; > + int name_width = options->stat_name_width; > + arg += 6; > + end = arg; > + > + switch (*arg) { > + case '-': > + if (!strncmp(arg, "-width=", 7)) > + width = strtoul(arg + 7, &end, 10); > + else if (!strncmp(arg, "-name-width=", 12)) > + name_width = strtoul(arg + 12, &end, 10); > + break; > + > + case '=': > + width = strtoul(arg+1, &end, 10); > + if (*end == ',') > + name_width = strtoul(end+1, &end, 10); > + } > + > + /* Important! This checks all the error cases! */ > + if (*end) > + return 0; > options->output_format |= DIFF_FORMAT_DIFFSTAT; > + options->stat_name_width = name_width; > + options->stat_width = width; > } This is simply too clever; -pedantic does not like assignment of arg to end (constness -- and strtoul takes pointer to non-const char *, so making the type of end const char * is not an answer either). And I do not like casting constness away: end = (char *) arg. Hmmmm. - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html