javar/jdk8-analysis/src/launcher/version_comp.c
/*
 *      Modeled after strcmp(), compare two version-ids for an Exact
 *      Match as defined in JSR 56.
 */
Modeled after strcmp(), compare two version-ids for an Exact
Match as defined in JSR 56.
Modeled after strcmp () compare two version - ids for an Exact Match as defined in JSR 56 .
int
JLI_ExactVersionId(const char *id1, char *id2)
{
    char        *s1 = JLI_StringDup(id1);
    char        *s2 = JLI_StringDup(id2);
    char        *m1 = s1;
    char        *m2 = s2;
    char        *end1 = NULL;
    char        *end2 = NULL;
    int res = 0;
    do {
        if ((s1 != NULL) && ((end1 = JLI_StrPBrk(s1, separators)) != NULL))
            *end1 = '\0';
        if ((s2 != NULL) && ((end2 = JLI_StrPBrk(s2, separators)) != NULL))
            *end2 = '\0';
        if ((s1 != NULL) && (s2 == NULL))
            res = comp_string(s1, zero_string);
        else if ((s1 == NULL) && (s2 != NULL))
            res = comp_string(zero_string, s2);
        else
            res = comp_string(s1, s2);
        if (end1 != NULL)
            s1 = end1 + 1;
        else
            s1 = NULL;
        if (end2 != NULL)
            s2 = end2 + 1;
        else
            s2 = NULL;
    } while (res == 0 && ((s1 != NULL) || (s2 != NULL)));
    JLI_MemFree(m1);
    JLI_MemFree(m2);
    return (res);
}
int JLI_ExactVersionId ( const char * id1 , char * id2 ) { char * s1 = JLI_StringDup ( id1 ) ; char * s2 = JLI_StringDup ( id2 ) ; char * m1 = s1 ; char * m2 = s2 ; char * end1 = NULL ; char * end2 = NULL ; int res = 0 ; do { if ( ( s1 != NULL ) && ( ( end1 = JLI_StrPBrk ( s1 , separators ) ) != NULL ) ) * end1 = ' \0 ' ; if ( ( s2 != NULL ) && ( ( end2 = JLI_StrPBrk ( s2 , separators ) ) != NULL ) ) * end2 = ' \0 ' ; if ( ( s1 != NULL ) && ( s2 == NULL ) ) res = comp_string ( s1 , zero_string ) ; else if ( ( s1 == NULL ) && ( s2 != NULL ) ) res = comp_string ( zero_string , s2 ) ; else res = comp_string ( s1 , s2 ) ; if ( end1 != NULL ) s1 = end1 + 1 ; else s1 = NULL ; if ( end2 != NULL ) s2 = end2 + 1 ; else s2 = NULL ; } while ( res == 0 && ( ( s1 != NULL ) || ( s2 != NULL ) ) ) ; JLI_MemFree ( m1 ) ; JLI_MemFree ( m2 ) ; return ( res ) ; }
Modeled after strcmp(), compare two version-ids for an Exact
      Match as defined in JSR 56.
Modeled after strcmp () compare two version - ids for an Exact Match as defined in JSR 56 .