Ignore:
File:
1 edited

Legend:

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

    r560d79f r1737bfb  
    259259       
    260260        return offset;
    261 }
    262 
    263 /** Get size of string with size limit.
    264  *
    265  * Get the number of bytes which are used by the string @a str
    266  * (excluding the NULL-terminator), but no more than @max_size bytes.
    267  *
    268  * @param str      String to consider.
    269  * @param max_size Maximum number of bytes to measure.
    270  *
    271  * @return Number of bytes used by the string
    272  *
    273  */
    274 size_t str_nsize(const char *str, size_t max_size)
    275 {
    276         size_t size = 0;
    277        
    278         while ((*str++ != 0) && (size < max_size))
    279                 size++;
    280        
    281         return size;
    282 }
    283 
    284 /** Get size of wide string with size limit.
    285  *
    286  * Get the number of bytes which are used by the wide string @a str
    287  * (excluding the NULL-terminator), but no more than @max_size bytes.
    288  *
    289  * @param str      Wide string to consider.
    290  * @param max_size Maximum number of bytes to measure.
    291  *
    292  * @return Number of bytes used by the wide string
    293  *
    294  */
    295 size_t wstr_nsize(const wchar_t *str, size_t max_size)
    296 {
    297         return (wstr_nlength(str, max_size) * sizeof(wchar_t));
    298261}
    299262
Note: See TracChangeset for help on using the changeset viewer.