No point to the "n" and max here; we already know max >= strlen(string), so just xstrdup(string) is good enough and skips a bunch of "... and i < max" checks in a loop that's checking "string[i] != '\0' ...".