[lkml]   [2001]   [Oct]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    Subject[off topic?] Re: [PATCH] strtok --> strsep in framebuffer drivers (part 2)
    > René Scharfe wrote:

    > NAME
    > strsep - extract token from string
    > [...]
    > The strsep() function returns a pointer to the token, or
    > NULL if delim is not found in stringp.
    > If strsep returns NULL, and you dereference it -> Oops.
    > ! if (!this_opt)
    > continue;

    Is that manual page incorrect?

    I would think that

    strsep() returns NULL when *stringp points to '\0' character

    and that if delim is not found in stringp then stringp
    is just advanced to '\0' character of string (and original
    *stringp value is returned)

    If that is not true, then these all patches are incorrect.
    Namely last token will be skipped.

    /"\ | Kari
    \ / ASCII Ribbon Campaign | Hurtta
    X Against HTML Mail |
    / \ |
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to
    More majordomo info at
    Please read the FAQ at

     \ /
      Last update: 2005-03-22 13:11    [W:0.035 / U:0.176 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site