Changeset eccd20e6 in mainline for uspace/lib/posix/strings.c


Ignore:
Timestamp:
2011-07-21T22:34:14Z (13 years ago)
Author:
Petr Koupy <petr.koupy@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c6f4681, e478cebf
Parents:
df0956ee (diff), cfbb5d18 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge libposix changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/posix/strings.c

    rdf0956ee reccd20e6  
    3131 * @{
    3232 */
    33 /** @file
     33/** @file Additional string manipulation.
    3434 */
    3535
     
    4545
    4646/**
     47 * Find first set bit (beginning with the least significant bit).
    4748 *
    48  * @param i
    49  * @return
     49 * @param i Integer in which to look for the first set bit.
     50 * @return Index of first set bit. Bits are numbered starting at one.
    5051 */
    5152int posix_ffs(int i)
     
    8283
    8384/**
     85 * Compare two strings (case-insensitive).
    8486 *
    85  * @param s1
    86  * @param s2
    87  * @return
     87 * @param s1 First string to be compared.
     88 * @param s2 Second string to be compared.
     89 * @return Difference of the first pair of inequal characters,
     90 *     or 0 if strings have the same content.
    8891 */
    8992int posix_strcasecmp(const char *s1, const char *s2)
     
    9396
    9497/**
     98 * Compare part of two strings (case-insensitive).
    9599 *
    96  * @param s1
    97  * @param s2
    98  * @param n
    99  * @return
     100 * @param s1 First string to be compared.
     101 * @param s2 Second string to be compared.
     102 * @param n Maximum number of characters to be compared.
     103 * @return Difference of the first pair of inequal characters,
     104 *     or 0 if strings have the same content.
    100105 */
    101106int posix_strncasecmp(const char *s1, const char *s2, size_t n)
     
    116121
    117122/**
     123 * Compare two memory areas.
    118124 *
    119  * @param mem1
    120  * @param mem2
    121  * @param n
    122  * @return
     125 * @param mem1 Pointer to the first area to compare.
     126 * @param mem2 Pointer to the second area to compare.
     127 * @param n Common size of both areas.
     128 * @return If n is 0, return zero. If the areas match, return
     129 *     zero. Otherwise return non-zero.
    123130 */
    124131int posix_bcmp(const void *mem1, const void *mem2, size_t n)
     
    128135
    129136/**
     137 * Copy bytes in memory with overlapping areas.
    130138 *
    131  * @param dest
    132  * @param src
    133  * @param n
     139 * @param src Source area.
     140 * @param dest Destination area.
     141 * @param n Number of bytes to copy.
    134142 */
    135 void posix_bcopy(const void *dest, void *src, size_t n)
     143void posix_bcopy(const void *src, void *dest, size_t n)
    136144{
    137145        /* Note that memmove has different order of arguments. */
    138         memmove(src, dest, n);
     146        memmove(dest, src, n);
    139147}
    140148
    141149/**
     150 * Reset bytes in memory area to zero.
    142151 *
    143  * @param mem
    144  * @param n
     152 * @param mem Memory area to be zeroed.
     153 * @param n Number of bytes to reset.
    145154 */
    146155void posix_bzero(void *mem, size_t n)
     
    150159
    151160/**
     161 * Scan string for a first occurence of a character.
    152162 *
    153  * @param s
    154  * @param c
    155  * @return
     163 * @param s String in which to look for the character.
     164 * @param c Character to look for.
     165 * @return Pointer to the specified character on success,
     166 *     NULL pointer otherwise.
    156167 */
    157168char *posix_index(const char *s, int c)
     
    161172
    162173/**
    163  *
    164  * @param s
    165  * @param c
    166  * @return
     174 * Scan string for a last occurence of a character.
     175 *
     176 * @param s String in which to look for the character.
     177 * @param c Character to look for.
     178 * @return Pointer to the specified character on success,
     179 *     NULL pointer otherwise.
    167180 */
    168181char *posix_rindex(const char *s, int c)
Note: See TracChangeset for help on using the changeset viewer.