iPXE
string.h
Go to the documentation of this file.
1#ifndef _STRING_H
2#define _STRING_H
3
4/** @file
5 *
6 * String functions
7 *
8 */
9
10FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
11FILE_SECBOOT ( PERMITTED );
12
13#include <stddef.h>
14
15extern void * generic_memset ( void *dest, int character,
16 size_t len ) __nonnull;
17extern void * generic_memcpy ( void *dest, const void *src,
18 size_t len ) __nonnull;
19extern void * generic_memcpy_reverse ( void *dest, const void *src,
20 size_t len ) __nonnull;
21extern void * generic_memmove ( void *dest, const void *src,
22 size_t len ) __nonnull;
23
24#include <bits/string.h>
25
26/* Architecture-specific code is expected to provide these functions,
27 * but may instead explicitly choose to use the generic versions.
28 */
29void * memset ( void *dest, int character, size_t len ) __nonnull;
30void * memcpy ( void *dest, const void *src, size_t len ) __nonnull;
31void * memmove ( void *dest, const void *src, size_t len ) __nonnull;
32
33extern int __pure memcmp ( const void *first, const void *second,
34 size_t len ) __nonnull;
35extern void * __pure memchr ( const void *src, int character,
36 size_t len ) __nonnull;
37extern void * memswap ( void *dest, void *src, size_t len ) __nonnull;
38extern int __pure strcmp ( const char *first, const char *second ) __nonnull;
39extern int __pure strncmp ( const char *first, const char *second,
40 size_t max ) __nonnull;
41extern size_t __pure strlen ( const char *src ) __nonnull;
42extern size_t __pure strnlen ( const char *src, size_t max ) __nonnull;
43extern char * __pure strchr ( const char *src, int character ) __nonnull;
44extern char * __pure strrchr ( const char *src, int character ) __nonnull;
45extern char * __pure strstr ( const char *haystack,
46 const char *needle ) __nonnull;
47extern char * stpcpy ( char *dest, const char *src ) __nonnull;
48extern char * strcpy ( char *dest, const char *src ) __nonnull;
49extern char * strncpy ( char *dest, const char *src, size_t max ) __nonnull;
50extern char * strcat ( char *dest, const char *src ) __nonnull;
51extern char * __malloc strdup ( const char *src ) __nonnull;
52extern char * __malloc strndup ( const char *src, size_t max ) __nonnull;
53extern char * __pure strpbrk ( const char *string,
54 const char *delim ) __nonnull;
55extern char * strsep ( char **string, const char *delim ) __nonnull;
56
57extern char * __pure strerror ( int errno );
58
59#endif /* _STRING_H */
Optimised string operations.
if(len >=6 *4) __asm__ __volatile__("movsl" if(len >=5 *4) __asm__ __volatile__("movsl" if(len >=4 *4) __asm__ __volatile__("movsl" if(len >=3 *4) __asm__ __volatile__("movsl" if(len >=2 *4) __asm__ __volatile__("movsl" if(len >=1 *4) __asm__ __volatile__("movsl" if((len % 4) >=2) __asm__ __volatile__("movsw" if((len % 2) >=1) __asm__ __volatile__("movsb" retur dest)
Definition string.h:151
static const void * src
Definition string.h:48
#define max(x, y)
Definition ath.h:41
ring len
Length.
Definition dwmac.h:226
int errno
Global "last error" number.
Definition errno.c:21
#define __malloc
Declare a pointer returned by a function as a unique memory address as returned by malloc-type functi...
Definition compiler.h:598
#define __nonnull
Declare a function's pointer parameters as non-null - i.e.
Definition compiler.h:592
#define __pure
Declare a function as pure - i.e.
Definition compiler.h:578
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
Definition compiler.h:896
#define FILE_SECBOOT(_status)
Declare a file's UEFI Secure Boot permission status.
Definition compiler.h:926
char * strcat(char *dest, const char *src) __nonnull
Concatenate string.
Definition string.c:382
void * memcpy(void *dest, const void *src, size_t len) __nonnull
void * generic_memset(void *dest, int character, size_t len) __nonnull
Fill memory region.
Definition string.c:48
int __pure strncmp(const char *first, const char *second, size_t max) __nonnull
Compare strings.
Definition string.c:187
void * memswap(void *dest, void *src, size_t len) __nonnull
Swap memory regions.
Definition string.c:154
char * strncpy(char *dest, const char *src, size_t max) __nonnull
Copy string.
Definition string.c:361
void * generic_memcpy_reverse(void *dest, const void *src, size_t len) __nonnull
Copy memory region (backwards)
Definition string.c:81
char *__malloc strndup(const char *src, size_t max) __nonnull
Duplicate string.
Definition string.c:406
char * strcpy(char *dest, const char *src) __nonnull
Copy string.
Definition string.c:347
char * strsep(char **string, const char *delim) __nonnull
strsep - Split a string into tokens @s: The string to be searched @ct: The characters to search for
Definition stringextra.c:73
char *__pure strpbrk(const char *string, const char *delim) __nonnull
strpbrk - Find the first occurrence of a set of characters @cs: The string to be searched @ct: The ch...
Definition stringextra.c:47
void *__pure memchr(const void *src, int character, size_t len) __nonnull
Find character within a memory region.
Definition string.c:136
void * generic_memcpy(void *dest, const void *src, size_t len) __nonnull
Copy memory region (forwards)
Definition string.c:64
int __pure strcmp(const char *first, const char *second) __nonnull
Compare strings.
Definition string.c:174
size_t __pure strnlen(const char *src, size_t max) __nonnull
Get length of string.
Definition string.c:256
char *__pure strstr(const char *haystack, const char *needle) __nonnull
Find substring.
Definition string.c:310
char *__pure strerror(int errno)
Retrieve string representation of error number.
Definition strerror.c:79
void * generic_memmove(void *dest, const void *src, size_t len) __nonnull
Copy (possibly overlapping) memory region.
Definition string.c:98
size_t __pure strlen(const char *src) __nonnull
Get length of string.
Definition string.c:244
void * memset(void *dest, int character, size_t len) __nonnull
char *__malloc strdup(const char *src) __nonnull
Duplicate string.
Definition string.c:394
int __pure memcmp(const void *first, const void *second, size_t len) __nonnull
Compare memory regions.
Definition string.c:115
char *__pure strchr(const char *src, int character) __nonnull
Find character within a string.
Definition string.c:272
void * memmove(void *dest, const void *src, size_t len) __nonnull
char * stpcpy(char *dest, const char *src) __nonnull
Copy string.
Definition string.c:327
char *__pure strrchr(const char *src, int character) __nonnull
Find rightmost character within a string.
Definition string.c:290
uint32_t first
First block in range.
Definition pccrr.h:1