These functions provide memory slices in read-only and read-write forms. More...
| Data Structures | |
| struct | _Eina_Slice | 
| Defines a read-only memory region.  More... | |
| struct | _Eina_Rw_Slice | 
| Defines a read-and-write able memory region.  More... | |
| Macros | |
| #define | EINA_SLICE_ARRAY(buf) {.len = ((sizeof(buf) / sizeof((buf)[0])) * sizeof((buf)[0])), .mem = (buf)} | 
| Initializer for arrays of any kind.  More... | |
| #define | EINA_RW_SLICE_DECLARE(name, length) | 
| Declare a local (stack) array for storage at given length and initialize an Eina_Rw_Slice called name.  More... | |
| #define | EINA_SLICE_STR_LITERAL(buf) {.len = (sizeof("" buf) - 1), .mem = (buf)} | 
| Initializer for string literals (those declared as double-quoted).  More... | |
| #define | EINA_SLICE_STR(str) {.len = strlen((str)), .mem = (str)} | 
| Initializer for strings (uses strlen()).  More... | |
| #define | EINA_SLICE_STR_FMT "%.*s" | 
| To be used in printf()-like statements, prints the slice as a string, its lenis to be used, then it doesn't need the null terminator.  More... | |
| #define | EINA_SLICE_STR_PRINT(s) (int)(s).len, (const char *)(s).mem | 
| To be used in printf()-like statements when EINA_SLICE_STR_FMT was used, it will print the slice as a string up to len.  More... | |
| #define | EINA_SLICE_FMT "%p+%zu" | 
| To be used in printf()-like statements, prints the slice as 0x1234+12(mem+len).  More... | |
| #define | EINA_SLICE_PRINT(s) (s).mem, (s).len | 
| To be used in printf()-like statements when EINA_SLICE_FMT was used, it will print the slice memandlen.  More... | |
| #define | EINA_SLICE_FOREACH(s, itr) | 
| Iterate over the slice memory, using itr.  More... | |
| Typedefs | |
| typedef struct _Eina_Slice | Eina_Slice | 
| Defines a read-only memory region.  More... | |
| typedef struct _Eina_Rw_Slice | Eina_Rw_Slice | 
| Defines a read-and-write able memory region.  More... | |
| Functions | |
| static Eina_Slice | eina_rw_slice_slice_get (const Eina_Rw_Slice rw_slice) | 
| Convert the Read-write slice to read-only.  More... | |
| static Eina_Rw_Slice | eina_slice_dup (const Eina_Slice slice) EINA_WARN_UNUSED_RESULT | 
| Creates a duplicate of slice's memory.  More... | |
| static Eina_Rw_Slice | eina_rw_slice_dup (const Eina_Rw_Slice rw_slice) EINA_WARN_UNUSED_RESULT | 
| Creates a duplicate of slice's memory.  More... | |
| static int | eina_slice_compare (const Eina_Slice a, const Eina_Slice b) | 
| Compare two slices, similar to memcmp()  More... | |
| static int | eina_rw_slice_compare (const Eina_Rw_Slice a, const Eina_Rw_Slice b) | 
| Compare two slices, similar to memcmp()  More... | |
| static Eina_Rw_Slice | eina_rw_slice_copy (const Eina_Rw_Slice dest, const Eina_Slice src) | 
| Copy a read-only slice to a read-write one, similar to memcpy().  More... | |
| static Eina_Slice | eina_slice_seek (const Eina_Slice slice, ssize_t offset, int whence) | 
| Seek within a slice, similar to fseek().  More... | |
| static Eina_Rw_Slice | eina_rw_slice_seek (const Eina_Rw_Slice rw_slice, ssize_t offset, int whence) | 
| Seek within a read-write slice, similar to fseek().  More... | |
| static const void * | eina_slice_strchr (const Eina_Slice slice, int c) | 
| Find a character inside the slice, similar to memchr().  More... | |
| static const void * | eina_slice_find (const Eina_Slice slice, const Eina_Slice needle) | 
| Find a needle inside the slice, similar to memmem().  More... | |
| static Eina_Bool | eina_slice_startswith (const Eina_Slice slice, const Eina_Slice prefix) | 
| Checks if the slice starts with a prefix.  More... | |
| static Eina_Bool | eina_slice_endswith (const Eina_Slice slice, const Eina_Slice suffix) | 
| Checks if the slice ends with a suffix.  More... | |
| static void * | eina_rw_slice_strchr (const Eina_Rw_Slice rw_slice, int c) | 
| Find a character inside the slice, similar to memchr().  More... | |
| static void * | eina_rw_slice_find (const Eina_Rw_Slice rw_slice, const Eina_Slice needle) | 
| Find a needle inside the slice, similar to memmem().  More... | |
| static Eina_Bool | eina_rw_slice_startswith (const Eina_Rw_Slice slice, const Eina_Slice prefix) | 
| Checks if the slice starts with a prefix.  More... | |
| static Eina_Bool | eina_rw_slice_endswith (const Eina_Rw_Slice slice, const Eina_Slice suffix) | 
| Checks if the slice ends with a suffix.  More... | |
| static const void * | eina_slice_end_get (const Eina_Slice slice) | 
| The memory position where the slice ends.  More... | |
| static void * | eina_rw_slice_end_get (const Eina_Rw_Slice rw_slice) | 
| The memory position where the slice ends.  More... | |
| static char * | eina_slice_strdup (const Eina_Slice slice) | 
| A null-terminated string for this slice.  More... | |
| static char * | eina_rw_slice_strdup (const Eina_Rw_Slice rw_slice) | 
| A null-terminated string for this slice.  More... | |
These functions provide memory slices in read-only and read-write forms.
Memory slices define a contiguous linear memory starting at a given pointer (mem) and spanning for a given length (len).
They may be read-only (Eina_Slice) or read-write (Eina_Rw_Slice).
| #define EINA_SLICE_ARRAY | ( | buf | ) | {.len = ((sizeof(buf) / sizeof((buf)[0])) * sizeof((buf)[0])), .mem = (buf)} | 
Initializer for arrays of any kind.
| [in] | buf | The array to create the slice from. | 
It is often useful for globals.
| #define EINA_RW_SLICE_DECLARE | ( | name, | |
| length | |||
| ) | 
Declare a local (stack) array for storage at given length and initialize an Eina_Rw_Slice called name.
| [in] | name | the name of the variable to be the Eina_Rw_Slice. | 
| [in] | length | the size in bytes of the storage. | 
| #define EINA_SLICE_STR_LITERAL | ( | buf | ) | {.len = (sizeof("" buf) - 1), .mem = (buf)} | 
Initializer for string literals (those declared as double-quoted).
The size will NOT include the trailing null-terminator.
It is often useful for globals.
| [in] | buf | The array to create the slice from. | 
| #define EINA_SLICE_STR | ( | str | ) | {.len = strlen((str)), .mem = (str)} | 
Initializer for strings (uses strlen()).
| [in] | str | The string to create the slice from. | 
| #define EINA_SLICE_STR_FMT "%.*s" | 
To be used in printf()-like statements, prints the slice as a string, its len is to be used, then it doesn't need the null terminator. 
Use with EINA_SLICE_STR_PRINT()
| #define EINA_SLICE_STR_PRINT | ( | s | ) | (int)(s).len, (const char *)(s).mem | 
To be used in printf()-like statements when EINA_SLICE_STR_FMT was used, it will print the slice as a string up to len. 
| [in] | s | The slice. | 
Use with EINA_SLICE_STR_FMT.
| #define EINA_SLICE_FMT "%p+%zu" | 
To be used in printf()-like statements, prints the slice as 0x1234+12 (mem + len). 
Use with EINA_SLICE_PRINT()
| #define EINA_SLICE_PRINT | ( | s | ) | (s).mem, (s).len | 
To be used in printf()-like statements when EINA_SLICE_FMT was used, it will print the slice mem and len. 
Use with EINA_SLICE_FMT.
| [in] | s | The slice. | 
| #define EINA_SLICE_FOREACH | ( | s, | |
| itr | |||
| ) | 
Iterate over the slice memory, using itr. 
Each increment will be using the size of itr pointer (int32_t* will do in increments of 4 bytes).
| [in] | s | The slice. | 
| [in,out] | itr | the iterator to hold each byte. Use a proper type, not "void*" or "const void*" as it doesn't have an intrinsic size. | 
Defines a read-only memory region.
The slice is a memory starting at mem and accessible up to len bytes.
Defines a read-and-write able memory region.
The slice is a memory starting at mem and accessible up to len bytes.
| 
 | inlinestatic | 
Convert the Read-write slice to read-only.
| [in] | rw_slice | the read-write slice to convert. | 
| 
 | inlinestatic | 
Creates a duplicate of slice's memory.
| [in] | slice | the input to duplicate | 
mem that matches slice contents. The new mem is allocated with malloc() and must be released with free().| 
 | inlinestatic | 
Creates a duplicate of slice's memory.
| [in] | rw_slice | the input to duplicate | 
mem that matches slice contents. The new mem is allocated with malloc() and must be released with free().| 
 | inlinestatic | 
Compare two slices, similar to memcmp()
| [in] | a | the first slice to compare. | 
| [in] | b | the second slice to compare. | 
| 
 | inlinestatic | 
Compare two slices, similar to memcmp()
| [in] | a | the first slice to compare. | 
| [in] | b | the second slice to compare. | 
| 
 | inlinestatic | 
Copy a read-only slice to a read-write one, similar to memcpy().
| [in] | dest | where to write the memory. | 
| [in] | src | where to load memory. | 
len) will be the smallest of dest and src.| 
 | inlinestatic | 
Seek within a slice, similar to fseek().
| [in] | slice | the containing slice to seek inside. | 
| [in] | offset | how to get to the new position. | 
| [in] | whence | SEEK_SET, SEEK_END as fseek(). | 
| 
 | inlinestatic | 
Seek within a read-write slice, similar to fseek().
| [in] | rw_slice | the containing slice to seek inside. | 
| [in] | offset | how to get to the new position. | 
| [in] | whence | SEEK_SET, SEEK_END as fseek(). | 
| 
 | inlinestatic | 
Find a character inside the slice, similar to memchr().
| [in] | slice | the reference memory. | 
| [in] | c | the byte (character) to find. | 
NULL if not found.| 
 | inlinestatic | 
Find a needle inside the slice, similar to memmem().
| [in] | slice | the reference memory. | 
| [in] | needle | what to find. | 
NULL if not found.| 
 | inlinestatic | 
Checks if the slice starts with a prefix.
| [in] | slice | the reference memory. | 
| [in] | prefix | the slice to check if slice starts with. | 
| 
 | inlinestatic | 
Checks if the slice ends with a suffix.
| [in] | slice | the reference memory. | 
| [in] | suffix | the slice to check if slice ends with. | 
| 
 | inlinestatic | 
Find a character inside the slice, similar to memchr().
| [in] | rw_slice | the reference memory. | 
| [in] | c | the byte (character) to find. | 
NULL if not found.| 
 | inlinestatic | 
Find a needle inside the slice, similar to memmem().
| [in] | rw_slice | the reference memory. | 
| [in] | needle | what to find. | 
NULL if not found.| 
 | inlinestatic | 
Checks if the slice starts with a prefix.
| [in] | slice | the reference memory. | 
| [in] | prefix | the slice to check if slice starts with. | 
| 
 | inlinestatic | 
Checks if the slice ends with a suffix.
| [in] | slice | the reference memory. | 
| [in] | suffix | the slice to check if slice ends with. | 
| 
 | inlinestatic | 
The memory position where the slice ends.
| [in] | slice | the reference memory. | 
| 
 | inlinestatic | 
The memory position where the slice ends.
| [in] | rw_slice | the reference memory. | 
| 
 | inlinestatic | 
A null-terminated string for this slice.
| [in] | slice | the reference memory. | 
NULL on error| 
 | inlinestatic | 
A null-terminated string for this slice.
| [in] | slice | the reference memory. | 
NULL on error