Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset c065743 in mainline


Ignore:
Timestamp:
2011-08-24T21:16:13Z (9 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
master
Children:
a5454cf
Parents:
ace588a
Message:

Remove str_reverse() and size_t_str().

Location:
uspace
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/str.c

    race588a rc065743  
    11601160        str_ncpy(dest, size + 1, src, size);
    11611161        return dest;
    1162 }
    1163 
    1164 void str_reverse(char* begin, char* end)
    1165 {
    1166     char aux;
    1167     while(end>begin)
    1168         aux=*end, *end--=*begin, *begin++=aux;
    1169 }
    1170 
    1171 int size_t_str(size_t value, int base, char* str, size_t size)
    1172 {
    1173     static char num[] = "0123456789abcdefghijklmnopqrstuvwxyz";
    1174     char* wstr=str;
    1175        
    1176         if (size == 0)
    1177                 return EINVAL;
    1178     if (base<2 || base>35) {
    1179         *str='\0';
    1180         return EINVAL;
    1181     }
    1182 
    1183     do {
    1184         *wstr++ = num[value % base];
    1185                 if (--size == 0)
    1186                         return EOVERFLOW;
    1187     } while(value /= base);
    1188     *wstr='\0';
    1189 
    1190     // Reverse string
    1191     str_reverse(str,wstr-1);
    1192         return EOK;
    11931162}
    11941163
  • uspace/lib/c/include/str.h

    race588a rc065743  
    9999extern char *str_ndup(const char *, size_t max_size);
    100100
    101 extern void str_reverse(char* begin, char* end);
    102 extern int size_t_str(size_t value, int base, char* str, size_t size);
    103 
    104101extern int str_uint64(const char *, char **, unsigned int, bool, uint64_t *);
    105102extern int str_size_t(const char *, char **, unsigned int, bool, size_t *);
  • uspace/srv/fs/fat/fat_directory.c

    race588a rc065743  
    4444#include <str.h>
    4545#include <align.h>
     46#include <stdio.h>
    4647
    4748int fat_directory_block_load(fat_directory_t *);
     
    347348        str_to_ascii(name, lname, name_len, FAT_SFN_CHAR);
    348349
    349         size_t idx;
     350        unsigned idx;
    350351        for (idx=1; idx <= FAT_MAX_SFN; idx++) {
    351                 if (size_t_str(idx, 10, number, FAT_NAME_LEN-2)!=EOK)
    352                         return EOVERFLOW;
     352                snprintf(number, sizeof(number), "%u", idx);
    353353
    354354                /* Fill de->name with FAT_PAD */
Note: See TracChangeset for help on using the changeset viewer.