示例#1
0
static Bool WdeAddStyleString( char **text, char *str )
{
    int slen;
    int tlen;

    if( text == NULL || str == NULL ) {
        return( FALSE );
    }

    slen = strlen( str );

    if( *text == NULL ) {
        *text = WdeMemAlloc( slen + 1 );
        if( *text != NULL ) {
            strcpy( *text, str );
        }
    } else {
        tlen = strlen( *text );
        tlen += slen + 3 + 1;
        *text = (char *)WdeMemRealloc( *text, tlen );
        if( *text != NULL ) {
            strcat( *text, " | " );
            strcat( *text, str );
        }
    }

    return( *text != NULL );
}
示例#2
0
void *MemReAlloc ( void *ptr, unsigned size )
{
    void *p;

    p = WdeMemRealloc ( ptr, size );

    return ( p );
}
示例#3
0
Bool WdeSetFlagText( flag_map *map, flag_style fs, unsigned long flags, char **text )
{
    int         tlen;
    int         new_tlen;
    int         slen;
    int         not_first;

    if( map == NULL || text == NULL ) {
        return( FALSE );
    }

    tlen = 0;
    not_first = 0;
    if( *text != NULL ) {
        tlen = strlen( *text );
        not_first = 1;
    }

    while( map->text ) {
        if( (flags & map->check_mask) == map->flag && (fs & map->style) ) {
            slen = strlen( map->text );
            new_tlen = tlen + 3 * not_first + slen + 1;
            *text = (char *)WdeMemRealloc( *text, new_tlen );
            if( not_first == 1 ) {
                strcat( *text, " | " );
                strcat( *text, map->text );
            } else {
                strcpy( *text, map->text );
                not_first = 1;
            }
            tlen = new_tlen;
            flags &= ~map->erase_mask;
        }
        map++;
    }

    return( TRUE );
}