Changeset 5310

Show
Ignore:
Timestamp:
02/24/08 11:21:16 (4 months ago)
Author:
morris
Message:

Optimize a bit

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • libwired/trunk/libwired/data/wi-string.c

    r5262 r5310  
    752752#pragma mark - 
    753753 
    754 void wi_string_set_string(wi_string_t *string, wi_string_t *otherstring) { 
    755         if(string->string != otherstring->string) { 
     754void wi_string_set_cstring(wi_string_t *string, const char *othercstring) { 
     755        if(string->string != othercstring) { 
    756756                string->string[0]       = '\0'; 
    757757                string->length          = 0; 
    758758 
    759                 wi_string_append_cstring(string, otherstring->string); 
    760         } 
     759                wi_string_append_cstring(string, othercstring); 
     760        } 
     761
     762 
     763 
     764 
     765void wi_string_set_string(wi_string_t *string, wi_string_t *otherstring) { 
     766        wi_string_set_cstring(string, otherstring->string); 
    761767} 
    762768 
     
    13051311        char                    *p, *pp, *ap; 
    13061312         
    1307         p = pp = strdup(path->string)
    1308          
    1309         while((ap = wi_strsep(&pp, "/"))) { 
     1313        p = path->string
     1314         
     1315        while((ap = wi_strsep(&p, "/"))) { 
    13101316                if(ap[0]) { 
    13111317                        wi_strlcat(fullpath, "/", sizeof(fullpath)); 
     
    13161322        } 
    13171323         
    1318         free(p); 
    1319          
    1320         if(strlen(fullpath) > 0 && strcmp(path->string, fullpath) != 0) { 
    1321                 string = wi_string_init_with_cstring(wi_string_alloc(), fullpath); 
    1322                 wi_string_set_string(path, string); 
    1323                 wi_release(string); 
    1324         } 
     1324        wi_string_set_cstring(path, fullpath); 
    13251325#endif 
    13261326} 
  • libwired/trunk/libwired/data/wi-string.h

    r5063 r5310  
    8585WI_EXPORT wi_string_t *                                         _wi_string_constant_string(const char *); 
    8686 
     87WI_EXPORT void                                                          wi_string_set_cstring(wi_string_t *, const char *); 
    8788WI_EXPORT void                                                          wi_string_set_string(wi_string_t *, wi_string_t *); 
    8889WI_EXPORT void                                                          wi_string_set_format(wi_string_t *, wi_string_t *, ...);