XenevaOS
Loading...
Searching...
No Matches
Macros | Functions
string.cpp File Reference
#include <string.h>
#include <values.h>
#include <stdlib.h>
#include <ctype.h>
Include dependency graph for string.cpp:

Macros

#define SS   (sizeof(size_t))
 
#define ALIGN   (sizeof(size_t)-1)
 
#define ONES   ((size_t)-1/UCHAR_MAX)
 
#define HIGHS   (ONES * (UCHAR_MAX/2+1))
 
#define HASZERO(x)   ((x)-ONES & ~(x) & HIGHS)
 

Functions

void *_cdecl memset (void *targ, unsigned char val, size_t len)
 
void memset (void *targ, unsigned char val, uint32_t len)
 
int memcmp (const void *vl, const void *vr, size_t n)
 
void * memcpy (void *dest, void *src, size_t count)
 
void * memcpy (void *dest, void *src, uint32_t count)
 
int strcmp (const char *str1, const char *str2)
 
char * strcpy (char *__restrict s1, const char *__restrict s2)
 
size_t strlen (const char *s)
 
size_t strnlen (const char *string, size_t maxlen)
 
int strncmp (const char *s1, const char *s2, size_t n)
 
char * strncpy (char *destString, const char *sourceString, size_t maxLength)
 
char * strchrnul (const char *s, int c)
 
char * strchr (const char *str, int character)
 locates first occurance of character in string
 
int strcasecmp (const char *s1, const char *s2)
 
int strncasecmp (const char *s1, const char *s2, size_t length)
 
char * strcasestr (const char *s1, const char *s2)
 
char * strcat (char *destString, const char *sourceString)
 
char * strncat (char *destString, const char *sourceString, size_t maxLength)
 
char * strdup (const char *srcString)
 
char * strerror (int error)
 
char * strrchr (const char *string, int character)
 
size_t strspn (const char *s1, const char *s2)
 
char * strstr (const char *s1, const char *s2)
 
char * strtok (char *string, const char *delim)
 
char * strtok_r (char *string, const char *delim, char **saveptr)
 
long long int strtoll (const char *string, char **endString, int base)
 
void bzero (void *string, size_t number)
 
void bcopy (const void *src, void *dest, size_t len)
 
int ffs (int i)
 
void * memmove (void *dest, void const *src, unsigned __int64 bytes)
 
void * memchr (const void *src, int c, size_t n)
 

Macro Definition Documentation

◆ ALIGN

#define ALIGN   (sizeof(size_t)-1)

◆ HASZERO

#define HASZERO (   x)    ((x)-ONES & ~(x) & HIGHS)

◆ HIGHS

#define HIGHS   (ONES * (UCHAR_MAX/2+1))

◆ ONES

#define ONES   ((size_t)-1/UCHAR_MAX)

◆ SS

#define SS   (sizeof(size_t))

BSD 2-Clause License

Copyright (c) 2022-2023, Manas Kamal Choudhury All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Function Documentation

◆ bcopy()

void bcopy ( const void *  src,
void *  dest,
size_t  len 
)

◆ bzero()

void bzero ( void *  string,
size_t  number 
)

===========================================================

Memory Functions


◆ ffs()

int ffs ( int  i)

◆ memchr()

void * memchr ( const void *  src,
int  c,
size_t  n 
)

◆ memcmp()

int memcmp ( const void *  vl,
const void *  vr,
size_t  n 
)

◆ memcpy() [1/2]

void * memcpy ( void *  dest,
void *  src,
size_t  count 
)

◆ memcpy() [2/2]

void * memcpy ( void *  dest,
void *  src,
uint32_t  count 
)

◆ memmove()

void * memmove ( void *  dest,
void const *  src,
unsigned __int64  bytes 
)

◆ memset() [1/2]

void *_cdecl memset ( void *  targ,
unsigned char  val,
size_t  len 
)

=====================================================

M E M O R Y G L O B A L F U N C T I O N S

◆ memset() [2/2]

void memset ( void *  targ,
unsigned char  val,
uint32_t  len 
)

BSD 2-Clause License

Copyright (c) 2023-2025, Manas Kamal Choudhury All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

◆ strcasecmp()

int strcasecmp ( const char *  s1,
const char *  s2 
)

◆ strcasestr()

char * strcasestr ( const char *  s1,
const char *  s2 
)

◆ strcat()

char * strcat ( char *  destString,
const char *  sourceString 
)

◆ strchr()

char * strchr ( const char *  str,
int  character 
)

locates first occurance of character in string

◆ strchrnul()

char * strchrnul ( const char *  s,
int  c 
)

◆ strcmp()

int strcmp ( const char *  str1,
const char *  str2 
)

BSD 2-Clause License

Copyright (c) 2022, Manas Kamal Choudhury All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

◆ strcpy()

char * strcpy ( char *__restrict  s1,
const char *__restrict  s2 
)

◆ strdup()

char * strdup ( const char *  srcString)

◆ strerror()

char * strerror ( int  error)

◆ strlen()

size_t strlen ( const char *  s)

◆ strncasecmp()

int strncasecmp ( const char *  s1,
const char *  s2,
size_t  length 
)

◆ strncat()

char * strncat ( char *  destString,
const char *  sourceString,
size_t  maxLength 
)

◆ strncmp()

int strncmp ( const char *  s1,
const char *  s2,
size_t  n 
)

◆ strncpy()

char * strncpy ( char *  destString,
const char *  sourceString,
size_t  maxLength 
)

◆ strnlen()

size_t strnlen ( const char *  string,
size_t  maxlen 
)

◆ strrchr()

char * strrchr ( const char *  string,
int  character 
)

◆ strspn()

size_t strspn ( const char *  s1,
const char *  s2 
)

◆ strstr()

char * strstr ( const char *  s1,
const char *  s2 
)

◆ strtok()

char * strtok ( char *  string,
const char *  delim 
)

◆ strtok_r()

char * strtok_r ( char *  string,
const char *  delim,
char **  saveptr 
)

◆ strtoll()

long long int strtoll ( const char *  string,
char **  endString,
int  base 
)