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

Changeset 4482bc7 in mainline


Ignore:
Timestamp:
2009-04-14T19:21:25Z (13 years ago)
Author:
Jiri Svoboda <jirik.svoboda@…>
Branches:
lfn, master
Children:
6700ee2
Parents:
732bb0c
Message:

strcat() → str_append().

Location:
uspace/lib/libc
Files:
3 edited

Legend:

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

    r732bb0c r4482bc7  
    530530}
    531531
     532/** Append one string to another.
     533 *
     534 * Append source string @a src to string in destination buffer @a dest.
     535 * Size of the destination buffer is @a dest. If the size of the output buffer
     536 * is at least one byte, the output string will always be well-formed, i.e.
     537 * null-terminated and containing only complete characters.
     538 *
     539 * @param dst   Destination buffer.
     540 * @param count Size of the destination buffer.
     541 * @param src   Source string.
     542 */
     543void str_append(char *dest, size_t size, const char *src)
     544{
     545        size_t dstr_size;
     546
     547        dstr_size = str_size(dest);
     548        str_cpy(dest + dstr_size, size - dstr_size, src);
     549}
     550
    532551/** Copy NULL-terminated wide string to string
    533552 *
     
    821840}
    822841
    823 char *strcat(char *dest, const char *src)
    824 {
    825         char *orig = dest;
    826         while (*dest++)
    827                 ;
    828         --dest;
    829         while ((*dest++ = *src++))
    830                 ;
    831         return orig;
    832 }
    833 
    834842char *str_dup(const char *src)
    835843{
  • uspace/lib/libc/generic/vfs/vfs.c

    r732bb0c r4482bc7  
    8888                ncwd_path_nc[0] = '\0';
    8989        }
    90         strcat(ncwd_path_nc, path);
     90        str_append(ncwd_path_nc, cwd_size + 1 + size + 1, path);
    9191        ncwd_path = canonify(ncwd_path_nc, retlen);
    9292        if (!ncwd_path) {
  • uspace/lib/libc/include/string.h

    r732bb0c r4482bc7  
    7272extern void str_cpy(char *dest, size_t size, const char *src);
    7373extern void str_ncpy(char *dest, size_t size, const char *src, size_t n);
     74extern void str_append(char *dest, size_t size, const char *src);
    7475
    7576extern void wstr_nstr(char *dst, const wchar_t *src, size_t size);
     
    8990extern int stricmp(const char *, const char *);
    9091
    91 extern char *strcat(char *, const char *);
    92 
    9392extern long int strtol(const char *, char **, int);
    9493extern unsigned long strtoul(const char *, char **, int);
Note: See TracChangeset for help on using the changeset viewer.