Hi,

2008/7/24 Michael Karcher <[EMAIL PROTECTED]>:
>
> What is the advantage of that compared to
>        major = strtol(gl_string, &gl_string_cursor,10);
> ?
>
> Or even replace the whole scanning code by
>
>        if(sscanf(gl_string, "%d.%d", &major, &minor) != 2)
>                ERR_(d3d_caps)(...)
>

It looks much better.

This patch was copied & modified from existing code:

            /* Apple and Mesa version strings look differently, but
both provide intel drivers */
            if(strstr(gl_string, "APPLE")) {
                /* [0-9]+.[0-9]+ APPLE-[0-9]+.[0.9]+.[0.9]+
                 * We only need the first part, and use the APPLE as
identification
                 * "1.2 APPLE-1.4.56"
                 */
                gl_string_cursor = gl_string;
                major = atoi(gl_string_cursor);
                while (*gl_string_cursor <= '9' && *gl_string_cursor >= '0') {
                    ++gl_string_cursor;
                }

>
>


-- 
$ apt-get moo
 (__)
 (oo)
 /------\/
 / | ||
 * /\---/\
 ~~ ~~
...."Have you mooed today?"...


Reply via email to