common/string.h (view raw)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
/*! \file
* Defines several functions to manipulate C strings and arrays.
*/
#ifndef STRING_H
#define STRING_H
#include <stdint.h>
#define NULL ((void*)0)
#define WHITESPACE(c) ((c) == ' ' || (c) == '\t')
/*!
* Unsigned integral type.
*/
typedef uint32_t size_t;
/*!
* Copies a block of memory.
* \param destination Pointer to the destination array where the content is to be copied.
* \param source Pointer to the source of the data to be copied.
* \param num Number of bytes to be copied.
* \return \p destination is returned.
*/
void *memcpy (void *destination, const void *source, size_t num);
/*!
* Sets the \p num first bytes of the block of memory pointed to by \p ptr
* to the specified \p value
* \param ptr Pointer to the block of memory to be filled.
* \param value Value to be set (Passed as int, but converted to unsigned char)
* \param num Number of bytes to set to \p value.
* \return \p ptr is returned.
*/
void *memset (void *ptr, int value, size_t num);
unsigned int strlen (const char *str);
char *strcpy(char *destination, const char *source);
int strcmp(const char *str1, const char *str2);
const char * strchr ( const char * str, int character );
size_t strlstrip(char *, const char *, size_t);
size_t strrstrip(char *, const char *, size_t);
#endif