Changeset 92fd52d7 in mainline for uspace/lib/libc/generic


Ignore:
Timestamp:
2009-04-09T21:16:50Z (17 years ago)
Author:
Jiri Svoboda <jirik.svoboda@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
7afb4a5
Parents:
a2c58f6
Message:

Nuke strcpy() and strcmp().

Location:
uspace/lib/libc/generic
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/libc/generic/console.c

    ra2c58f6 r92fd52d7  
    220220        ssize_t rc;
    221221
    222         len = strlen(s);
     222        len = str_size(s);
    223223        while (len > 0) {
    224224                rc = console_write(s, len);
  • uspace/lib/libc/generic/getopt.c

    ra2c58f6 r92fd52d7  
    383383                        has_equal++;
    384384                } else
    385                         current_argv_len = strlen(current_argv);
     385                        current_argv_len = str_size(current_argv);
    386386           
    387387                for (i = 0; long_options[i].name; i++) {
     
    391391                                continue;
    392392
    393                         if (strlen(long_options[i].name) ==
     393                        if (str_size(long_options[i].name) ==
    394394                            (unsigned)current_argv_len) {
    395395                                /* exact match */
  • uspace/lib/libc/generic/string.c

    ra2c58f6 r92fd52d7  
    607607}
    608608
    609 /** Count the number of characters in the string, not including terminating 0.
    610  *
    611  * @param str           String.
    612  * @return              Number of characters in string.
    613  */
    614 size_t strlen(const char *str)
    615 {
    616         size_t counter = 0;
    617 
    618         while (str[counter] != 0)
    619                 counter++;
    620 
    621         return counter;
    622 }
    623 
    624 int strcmp(const char *a, const char *b)
    625 {
    626         int c = 0;
    627        
    628         while (a[c] && b[c] && (!(a[c] - b[c])))
    629                 c++;
    630        
    631         return (a[c] - b[c]);
    632 }
    633 
    634609int strncmp(const char *a, const char *b, size_t n)
    635610{
     
    871846char * strdup(const char *s1)
    872847{
    873         size_t len = strlen(s1) + 1;
     848        size_t len = str_size(s1) + 1;
    874849        void *ret = malloc(len);
    875850
Note: See TracChangeset for help on using the changeset viewer.