Ignore:
Timestamp:
2018-06-25T15:49:26Z (6 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
fbfe59d
Parents:
bfe90b6
git-author:
Jiri Svoboda <jiri@…> (2018-06-24 19:48:37)
git-committer:
Jiri Svoboda <jiri@…> (2018-06-25 15:49:26)
Message:

Move memchr to libc and add tests for other memxxx functions.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/posix/include/posix/string.h

    rbfe90b6 r2498b95  
    3636#ifndef POSIX_STRING_H_
    3737#define POSIX_STRING_H_
    38 
    39 #include "sys/types.h"
    40 
    4138/*
    4239 * TODO: not implemented due to missing locale support
     
    4845
    4946#include <_bits/NULL.h>
     47#include <_bits/size_t.h>
    5048
    51 /*
    52  * These are the same as in HelenOS libc.
    53  * It would be possible to directly include <str.h> and <mem.h> but
    54  * it is better not to pollute POSIX namespace with other functions
    55  * defined in that header.
    56  *
    57  * Because libposix is always linked with libc, providing only these
    58  * forward declarations ought to be enough.
    59  */
    60 
    61 /* From mem.h */
    62 // #define bzero(ptr, len)  memset((ptr), 0, (len))
    63 extern void *memset(void *, int, size_t)
    64     __attribute__((nonnull(1)));
    65 extern void *memcpy(void *, const void *, size_t)
    66     __attribute__((nonnull(1, 2)));
    67 extern void *memmove(void *, const void *, size_t)
    68     __attribute__((nonnull(1, 2)));
    69 
     49#include "libc/mem.h"
    7050
    7151/* Copying and Concatenation */
     
    8060extern char *strndup(const char *s, size_t n);
    8161
    82 /* String/Array Comparison */
    83 extern int memcmp(const void *mem1, const void *mem2, size_t n);
     62/* String Comparison */
    8463extern int strcmp(const char *s1, const char *s2);
    8564extern int strncmp(const char *s1, const char *s2, size_t n);
    8665
    8766/* Search Functions */
    88 extern void *memchr(const void *mem, int c, size_t n);
    8967extern char *strchr(const char *s, int c);
    9068extern char *strrchr(const char *s, int c);
     
    122100#endif
    123101
    124 
    125102#endif  // POSIX_STRING_H_
    126103
Note: See TracChangeset for help on using the changeset viewer.