libsheepy
Macros | Functions
libsheepySmall.c File Reference

Functions for the small objects smallt. More...

#include "libsheepySmall.h"
#include <inttypes.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include <stdio.h>
Include dependency graph for libsheepySmall.c:

Go to the source code of this file.

Macros

#define internal   static
 
#define SDICT_MIN_ELEMENTS   12
 
#define SDICT_REALLOC_STEPS   4
 
#define SARRAY_MIN_ELEMENTS   4
 
#define SARRAY_REALLOC_STEPS   4
 

Functions

bool isSTypeF (smallt *obj, char sType)
 is Small Type true if obj has type sType More...
 
size_t sSizeTiny (smallt *obj)
 unused function and wrong result TODO update or remove More...
 
sBooltallocSBool (bool value)
 allocate a small bool More...
 
sContainertallocSContainer (void *data)
 allocate a small container The container holds a pointer to a user buffer More...
 
sDicttallocSDict (void)
 allocate a small dict More...
 
sDoubletallocSDouble (double value)
 allocate a small double More...
 
sInttallocSInt (int64_t value)
 allocate a small int More...
 
sStringtallocSStringTiny (const char *data)
 allocate a small string More...
 
sArraytallocSArray (void)
 allocate a small array More...
 
sUndefinedtallocSUndefined (void)
 allocate a small undefined object More...
 
sBytestallocSBytes (void)
 allocate a small bytes object More...
 
void sFree (smallt *obj)
 free non null objects More...
 
void sFreeTiny (smallt *obj)
 free any type of small object More...
 
void sDictFreeElement (sDictElemt *e)
 free a dictionary element More...
 
void sDictFreeElements (sDictt *dict)
 free dictionary elements More...
 
void sDictFreeTiny (sDictt *dict)
 free dictionary elements and dictionary object More...
 
void sArrayFreeElements (sArrayt *array)
 free array elements More...
 
void sArrayFreeTiny (sArrayt *array)
 free array elements and array object More...
 
smalltsDuplicate (smallt *o)
 duplicate small object More...
 
smalltsDuplicateTiny (smallt *obj)
 duplicate small object More...
 
sDicttsDictDuplicateTiny (sDictt *dict)
 duplicate dictionary More...
 
sArraytsArrayDuplicateTiny (sArrayt *array)
 duplicate array More...
 
char * sToStringTiny (smallt *obj)
 stringify a small object More...
 
char * sToString (smallt *obj)
 stringify object More...
 
char * sBoolToStringTiny (sBoolt *obj)
 stringify bool More...
 
char * sContainerToStringTiny (sContainert *obj UNUSED)
 stringify container More...
 
char * sDictToStringTiny (sDictt *obj)
 stringify dictionary More...
 
char * sDoubleToStringTiny (sDoublet *obj)
 stringify double More...
 
char * sIntToStringTiny (sIntt *obj)
 stringify int More...
 
char * sStringToStringTiny (sStringt *obj)
 stringify string More...
 
char * sArrayToStringTiny (sArrayt *obj)
 stringify array More...
 
char * sUndefinedToStringTiny (sUndefinedt *obj UNUSED)
 stringify undefined More...
 
char * sBytesToStringTiny (sBytest *obj)
 stringify small bytes More...
 
char * sEscapeTiny (smallt *obj)
 stringify a small object More...
 
char * sEscape (smallt *obj)
 stringify object More...
 
char * sDictEscapeTiny (sDictt *obj)
 stringify dictionary More...
 
char * sStringEscapeTiny (sStringt *obj)
 stringify string More...
 
char * sArrayEscapeTiny (sArrayt *obj)
 stringify array More...
 
char * sTypesTiny (smallt *obj)
 get list of object types string More...
 
sBytestsTypesToBytesTiny (smallt *obj)
 collect the types in an array or dictionary More...
 
const char ** sDictTypeStrings (sDictt *obj)
 list first level of dictionary types in a list of strings More...
 
const char ** sTypesToStrings (sBytest *types)
 convert a list of object types to a list of strings More...
 
sBytestsDictTypes (sDictt *obj)
 list first level of object types in dictionary More...
 
sBytestsDictTypesTiny (sDictt *obj)
 list first level of object types in dictionary More...
 
const char ** sArrayTypeStrings (sArrayt *obj)
 list first level of array types in a list of strings More...
 
sBytestsArrayTypes (sArrayt *obj)
 list first level of object types in array More...
 
sBytestsArrayTypesTiny (sArrayt *obj)
 list first level of object types in array More...
 
smalltsDictGet (sDictt *dict, const char *key)
 get object stored at key More...
 
smallt ** sDictGetP (sDictt *dict, const char *key)
 get pointer to object at key More...
 
smalltsDictGetTiny (sDictt *dict, const char *key)
 get object stored at key More...
 
void sDictSetP (sDictt **dict, const char *key, smallt *data)
 dictionary set pointer More...
 
void sDictSetTiny (sDictt **dict, const char *key, smallt *data)
 dictionary set key, value More...
 
void sDictPushTiny (sDictt **dict, const char *key, smallt *data)
 push new key-value More...
 
void sDictDelTiny (sDictt *dict, const char *key)
 delete dictionary element More...
 
char * sStringGetTiny (sStringt *string)
 get string in a small string object More...
 
void sStringSetTiny (sStringt **string, const char *news)
 set string in small string More...
 
void sArrayPushTiny (sArrayt **array, smallt *data)
 push data to array More...
 
void sArrayPrependTiny (sArrayt **array, smallt *data)
 prepend data in array More...
 
smalltsArrayPopTiny (sArrayt *array)
 pop object from array More...
 
smalltsArrayDequeueTiny (sArrayt *array)
 dequeue object from array More...
 
smallt ** sArrayGetP (sArrayt *array, uint32_t index)
 get pointer to object at index More...
 
smalltsArrayGetTiny (sArrayt *array, uint32_t index)
 get object at index More...
 
void sArraySetShortTiny (sArrayt *array, uint32_t index, smallt *value)
 set value at index More...
 
void sArraySetP (sArrayt *array, uint32_t index, smallt *value)
 set value at index More...
 
void sArraySetTiny (sArrayt *array, uint32_t index, smallt *value)
 set value at index More...
 
int sArrayReverseTiny (sArrayt *array)
 reverse element order More...
 
void sArrayDelTiny (sArrayt *array, uint32_t index)
 delete element at index More...
 
void sArrayDelRangeTiny (sArrayt *array, uint32_t start, uint32_t end)
 delete range and shift elements More...
 
void * sBytesGet (sBytest *bytes)
 get buffer in small bytes More...
 
void * sBytesGetTiny (sBytest *bytes)
 get buffer in small bytes More...
 
void sBytesPush (sBytest **bytes, char data)
 push char to bytes More...
 
void sBytesPushBuffer (sBytest **bytes, void *data, uint32_t size)
 push data buffer to bytes More...
 
void sBytesPushBufferTiny (sBytest **bytes, void *data, uint32_t size)
 push data buffer to bytes More...
 
sBytestsSerial (smallt *obj)
 serialize object to small bytes More...
 
sBytestsSerialTiny (smallt *obj)
 serialize object to small bytes More...
 
void sDictSerialElementsTiny (sBytest **r, sDictt *dict)
 serialize dictionary More...
 
void sArraySerialElementsTiny (sBytest **r, sArrayt *array)
 serialize array More...
 
smalltsDeserial (sBytest *obj)
 deserialize small bytes object More...
 
smalltsDeserialTiny (sBytest *obj)
 deserialize small bytes object More...
 
void sDictDeserialElementsTiny (sDictt **dict, char **data)
 deserialize dictionary from data More...
 
void sArrayDeserialElementsTiny (sArrayt **array, char **data)
 deserialize array from data More...
 

Detailed Description

Functions for the small objects smallt.

The small objects are used internally in the small baset objects: smallBoolt, smallContainert...

The functions here implement basic functionnality.

The *Tiny functions dont sanitize the parameters. The *Short functions dont create objects and do the minimum possible and have no checks.

Adjust SDICT_MIN_ELEMENTS, SDICT_REALLOC_STEPS, SARRAY_MIN_ELEMENTS and SARRAY_REALLOC_STEPS to balance speed and memory usage.

Definition in file libsheepySmall.c.

Macro Definition Documentation

◆ internal

#define internal   static

Definition at line 26 of file libsheepySmall.c.

◆ SDICT_MIN_ELEMENTS

#define SDICT_MIN_ELEMENTS   12

Definition at line 131 of file libsheepySmall.c.

◆ SDICT_REALLOC_STEPS

#define SDICT_REALLOC_STEPS   4

Definition at line 132 of file libsheepySmall.c.

◆ SARRAY_MIN_ELEMENTS

#define SARRAY_MIN_ELEMENTS   4

Definition at line 134 of file libsheepySmall.c.

◆ SARRAY_REALLOC_STEPS

#define SARRAY_REALLOC_STEPS   4

Definition at line 135 of file libsheepySmall.c.

Function Documentation

◆ isSTypeF()

bool isSTypeF ( smallt obj,
char  sType 
)

is Small Type true if obj has type sType

Parameters
objsmall object to check
Returns
true if object has type sType

Definition at line 146 of file libsheepySmall.c.

◆ sSizeTiny()

size_t sSizeTiny ( smallt obj)

unused function and wrong result TODO update or remove

Definition at line 158 of file libsheepySmall.c.

◆ allocSBool()

sBoolt * allocSBool ( bool  value)

allocate a small bool

Parameters
valueinitialize object with value
Returns
new object initialized with value

Definition at line 221 of file libsheepySmall.c.

Here is the caller graph for this function:

◆ allocSContainer()

sContainert * allocSContainer ( void *  data)

allocate a small container The container holds a pointer to a user buffer

Parameters
datainitialize object with data pointer
Returns
new object initialized with data pointer

Definition at line 239 of file libsheepySmall.c.

Here is the caller graph for this function:

◆ allocSDict()

sDictt * allocSDict ( void  )

allocate a small dict

Returns
new empty dict

Definition at line 256 of file libsheepySmall.c.

Here is the caller graph for this function:

◆ allocSDouble()

sDoublet * allocSDouble ( double  value)

allocate a small double

Parameters
valueinitialize object with value
Returns
new object initialized with value

Definition at line 274 of file libsheepySmall.c.

Here is the caller graph for this function:

◆ allocSInt()

sIntt * allocSInt ( int64_t  value)

allocate a small int

Parameters
valueinitialize object with value
Returns
new object initialized with value

Definition at line 291 of file libsheepySmall.c.

Here is the caller graph for this function:

◆ allocSStringTiny()

sStringt * allocSStringTiny ( const char *  data)

allocate a small string

Parameters
valueinitialize object with value
Returns
new object initialized with value

Definition at line 308 of file libsheepySmall.c.

Here is the caller graph for this function:

◆ allocSArray()

sArrayt * allocSArray ( void  )

allocate a small array

Returns
new empty array

Definition at line 329 of file libsheepySmall.c.

Here is the caller graph for this function:

◆ allocSUndefined()

sUndefinedt * allocSUndefined ( void  )

allocate a small undefined object

Returns
new undefined object

Definition at line 345 of file libsheepySmall.c.

Here is the caller graph for this function:

◆ allocSBytes()

sBytest * allocSBytes ( void  )

allocate a small bytes object

Returns
new small bytes object

Definition at line 359 of file libsheepySmall.c.

Here is the caller graph for this function:

◆ sFree()

void sFree ( smallt obj)

free non null objects

Definition at line 371 of file libsheepySmall.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sFreeTiny()

void sFreeTiny ( smallt obj)

free any type of small object

objects that are not of type sDict or sArray are freed with the standard free

Parameters
objobject to free

Definition at line 386 of file libsheepySmall.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sDictFreeElement()

void sDictFreeElement ( sDictElemt e)

free a dictionary element

the key and the object are freed

Parameters
eelement to free

Definition at line 417 of file libsheepySmall.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sDictFreeElements()

void sDictFreeElements ( sDictt dict)

free dictionary elements

Parameters
dictdictionary to free

Definition at line 432 of file libsheepySmall.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sDictFreeTiny()

void sDictFreeTiny ( sDictt dict)

free dictionary elements and dictionary object

Parameters
dictdictionary to free

Definition at line 445 of file libsheepySmall.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sArrayFreeElements()

void sArrayFreeElements ( sArrayt array)

free array elements

Parameters
arrayarray to free

Definition at line 457 of file libsheepySmall.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sArrayFreeTiny()

void sArrayFreeTiny ( sArrayt array)

free array elements and array object

Parameters
arrayarray to free

Definition at line 470 of file libsheepySmall.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sDuplicate()

smallt * sDuplicate ( smallt o)

duplicate small object

Parameters
osmall object
Returns
duplicated object NULL when o is NULL

Definition at line 485 of file libsheepySmall.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sDuplicateTiny()

smallt * sDuplicateTiny ( smallt obj)

duplicate small object

for containers, the pointer is copied to new object

Parameters
objsmall object
Returns
duplicated object

Definition at line 504 of file libsheepySmall.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sDictDuplicateTiny()

sDictt * sDictDuplicateTiny ( sDictt dict)

duplicate dictionary

Parameters
dictdictionary to duplicate
Returns
duplicated dictionary

Definition at line 559 of file libsheepySmall.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sArrayDuplicateTiny()

sArrayt * sArrayDuplicateTiny ( sArrayt array)

duplicate array

Parameters
arrayarray to duplicate
Returns
duplicated array

Definition at line 583 of file libsheepySmall.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sToStringTiny()

char * sToStringTiny ( smallt obj)

stringify a small object

the returned string has to be freed

Parameters
objobject
Returns
string representing the object

Definition at line 606 of file libsheepySmall.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sToString()

char * sToString ( smallt obj)

stringify object

the returned string has to be freed

Parameters
objobject
Returns
string representing the object NULL when obj is NULL

Definition at line 654 of file libsheepySmall.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sBoolToStringTiny()

char * sBoolToStringTiny ( sBoolt obj)

stringify bool

the returned string has to be freed

Parameters
objobject
Returns
string representing the object

Definition at line 672 of file libsheepySmall.c.

Here is the caller graph for this function:

◆ sContainerToStringTiny()

char * sContainerToStringTiny ( sContainert *obj  UNUSED)

stringify container

Returns
<data container>=""> string

Definition at line 688 of file libsheepySmall.c.

Here is the caller graph for this function:

◆ sDictToStringTiny()

char * sDictToStringTiny ( sDictt obj)

stringify dictionary

the returned string has to be freed

Parameters
objobject
Returns
string representing the object

Definition at line 703 of file libsheepySmall.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sDoubleToStringTiny()

char * sDoubleToStringTiny ( sDoublet obj)

stringify double

the returned string has to be freed

Parameters
objobject
Returns
string representing the object

Definition at line 757 of file libsheepySmall.c.

Here is the caller graph for this function:

◆ sIntToStringTiny()

char * sIntToStringTiny ( sIntt obj)

stringify int

the returned string has to be freed

Parameters
objobject
Returns
string representing the object

Definition at line 776 of file libsheepySmall.c.

Here is the caller graph for this function:

◆ sStringToStringTiny()

char * sStringToStringTiny ( sStringt obj)

stringify string

the returned string has to be freed

Parameters
objobject
Returns
string representing the object

Definition at line 795 of file libsheepySmall.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sArrayToStringTiny()

char * sArrayToStringTiny ( sArrayt obj)

stringify array

the returned string has to be freed

Parameters
objobject
Returns
string representing the object

Definition at line 810 of file libsheepySmall.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sUndefinedToStringTiny()

char * sUndefinedToStringTiny ( sUndefinedt *obj  UNUSED)

stringify undefined

the returned string has to be freed

Parameters
objobject
Returns
"null" string

Definition at line 862 of file libsheepySmall.c.

Here is the caller graph for this function:

◆ sBytesToStringTiny()

char * sBytesToStringTiny ( sBytest obj)

stringify small bytes

the returned string has to be freed

Parameters
objobject
Returns
bytes converted to decimal string representing the object

Definition at line 877 of file libsheepySmall.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sEscapeTiny()

char * sEscapeTiny ( smallt obj)

stringify a small object

Escape characters to produce a parsable json

the returned string has to be freed

Parameters
objobject
Returns
string representing the object

Definition at line 901 of file libsheepySmall.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sEscape()

char * sEscape ( smallt obj)

stringify object

the returned string has to be freed

Parameters
objobject
Returns
string representing the object NULL when obj is NULL

Definition at line 949 of file libsheepySmall.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sDictEscapeTiny()

char * sDictEscapeTiny ( sDictt obj)

stringify dictionary

the returned string has to be freed

Parameters
objobject
Returns
string representing the object

Definition at line 967 of file libsheepySmall.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sStringEscapeTiny()

char * sStringEscapeTiny ( sStringt obj)

stringify string

the returned string has to be freed

Parameters
objobject
Returns
string representing the object

Definition at line 1029 of file libsheepySmall.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sArrayEscapeTiny()

char * sArrayEscapeTiny ( sArrayt obj)

stringify array

the returned string has to be freed

Parameters
objobject
Returns
string representing the object

Definition at line 1044 of file libsheepySmall.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sTypesTiny()

char * sTypesTiny ( smallt obj)

get list of object types string

only the types in the first level are listed

Parameters
objsmall array or dictionary
Returns
string listing types in array or dictionary

Definition at line 1104 of file libsheepySmall.c.

Here is the call graph for this function:

◆ sTypesToBytesTiny()

sBytest * sTypesToBytesTiny ( smallt obj)

collect the types in an array or dictionary

Parameters
objarray or dictionary
Returns
sBytes list of types in array or dictionary

Definition at line 1145 of file libsheepySmall.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sDictTypeStrings()

const char ** sDictTypeStrings ( sDictt obj)

list first level of dictionary types in a list of strings

free the return value because the strings are const - dont use listFreeS

Parameters
objdictionary
Returns
list of strings representing the types

Definition at line 1170 of file libsheepySmall.c.

Here is the call graph for this function:

◆ sTypesToStrings()

const char ** sTypesToStrings ( sBytest types)

convert a list of object types to a list of strings

Parameters
typesobject types in a sBytes object, this parameter is freed at the end of the function, except when there is an error
Returns
list of strings representing the object types, use free to free the list (not listFreeS) NULL error, types is not freed

Definition at line 1186 of file libsheepySmall.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sDictTypes()

sBytest * sDictTypes ( sDictt obj)

list first level of object types in dictionary

Parameters
objdictionary
Returns
list of object types in a sBytes object NULL when obj is NULL or not a dictionary

Definition at line 1218 of file libsheepySmall.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sDictTypesTiny()

sBytest * sDictTypesTiny ( sDictt obj)

list first level of object types in dictionary

Parameters
objdictionary
Returns
list of object types in a sBytes object

Definition at line 1235 of file libsheepySmall.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sArrayTypeStrings()

const char ** sArrayTypeStrings ( sArrayt obj)

list first level of array types in a list of strings

free the return because the strings are const - dont use listFreeS

Parameters
objarray
Returns
list of strings representing the types

Definition at line 1257 of file libsheepySmall.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sArrayTypes()

sBytest * sArrayTypes ( sArrayt obj)

list first level of object types in array

Parameters
objarray
Returns
list of object types in a sBytes object NULL when obj is NULL or not an array

Definition at line 1273 of file libsheepySmall.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sArrayTypesTiny()

sBytest * sArrayTypesTiny ( sArrayt obj)

list first level of object types in array

Parameters
objarray
Returns
list of object types in a sBytes object

Definition at line 1290 of file libsheepySmall.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sDictGet()

smallt * sDictGet ( sDictt dict,
const char *  key 
)

get object stored at key

Parameters
dictdictionary key key to search in dictionary
Returns
object stored at key NULL when dict is NULL or when key is NULL

Definition at line 1312 of file libsheepySmall.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sDictGetP()

smallt ** sDictGetP ( sDictt dict,
const char *  key 
)

get pointer to object at key

Parameters
dictdictionary
keykey to search in dictionary
Returns
pointer to object stored at key NULL when the key is not found

Definition at line 1332 of file libsheepySmall.c.

Here is the call graph for this function:

◆ sDictGetTiny()

smallt * sDictGetTiny ( sDictt dict,
const char *  key 
)

get object stored at key

Parameters
dictdictionary key key to search in dictionary
Returns
object stored at key NULL when the key is not found

Definition at line 1357 of file libsheepySmall.c.

Here is the caller graph for this function:

◆ sDictSetP()

void sDictSetP ( sDictt **  dict,
const char *  key,
smallt data 
)

dictionary set pointer

when the key already exists, the associated object is not freed. This is useful for updating arrays, dictionaries and strings in the dictionary

when dict is NULL, a new dictionary is allocated

when the key doesn't exist, a new element is created

when data is NULL, the element is not set

Parameters
dictdictionary key key associated with data data object to store

Definition at line 1386 of file libsheepySmall.c.

Here is the call graph for this function:

◆ sDictSetTiny()

void sDictSetTiny ( sDictt **  dict,
const char *  key,
smallt data 
)

dictionary set key, value

when the key already exists, the associated object is freed. The new data replaces the previous data

when dict is NULL, a new dictionary is allocated

when the key doesn't exist, a new element is created

when data is NULL, the element is not set

Parameters
dictdictionary key key associated with data data object to store

Definition at line 1426 of file libsheepySmall.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sDictPushTiny()

void sDictPushTiny ( sDictt **  dict,
const char *  key,
smallt data 
)

push new key-value

when data is NULL, the element is not created

this function doesnt check if key already exists

when dict is NULL, a new dictionary is allocated

the dictionary is reallocated when count is greater than maxCount

Parameters
dictdictionary key key associated with data data object to store

Definition at line 1468 of file libsheepySmall.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sDictDelTiny()

void sDictDelTiny ( sDictt dict,
const char *  key 
)

delete dictionary element

Parameters
dictdictionary key key to search

Definition at line 1518 of file libsheepySmall.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sStringGetTiny()

char * sStringGetTiny ( sStringt string)

get string in a small string object

Parameters
stringsmall string object
Returns
string in small string the returned value can't be reallocated since it is not a pointer to a mallocated buffer

Definition at line 1538 of file libsheepySmall.c.

Here is the caller graph for this function:

◆ sStringSetTiny()

void sStringSetTiny ( sStringt **  string,
const char *  news 
)

set string in small string

Parameters
stringsmall string news new string

Definition at line 1550 of file libsheepySmall.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sArrayPushTiny()

void sArrayPushTiny ( sArrayt **  array,
smallt data 
)

push data to array

when array is NULL, a new array is allocated

the array is reallocated when count is greater than maxCount

Parameters
arraydata data to store

Definition at line 1569 of file libsheepySmall.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sArrayPrependTiny()

void sArrayPrependTiny ( sArrayt **  array,
smallt data 
)

prepend data in array

when array is NULL, a new array is allocated

the array is reallocated when count is greater than maxCount

Parameters
arraydata data to store

Definition at line 1617 of file libsheepySmall.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sArrayPopTiny()

smallt * sArrayPopTiny ( sArrayt array)

pop object from array

Definition at line 1660 of file libsheepySmall.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sArrayDequeueTiny()

smallt * sArrayDequeueTiny ( sArrayt array)

dequeue object from array

Definition at line 1674 of file libsheepySmall.c.

Here is the caller graph for this function:

◆ sArrayGetP()

smallt ** sArrayGetP ( sArrayt array,
uint32_t  index 
)

get pointer to object at index

Parameters
arrayindex in array
Returns
pointer to object at index

Definition at line 1699 of file libsheepySmall.c.

◆ sArrayGetTiny()

smallt * sArrayGetTiny ( sArrayt array,
uint32_t  index 
)

get object at index

Parameters
arrayindex in array
Returns
object at index

Definition at line 1713 of file libsheepySmall.c.

Here is the caller graph for this function:

◆ sArraySetShortTiny()

void sArraySetShortTiny ( sArrayt array,
uint32_t  index,
smallt value 
)

set value at index

the previous element is not freed. This is useful for updating arrays, dictionaries and strings in the array

Parameters
arrayindex where the value is set value to store

Definition at line 1729 of file libsheepySmall.c.

Here is the caller graph for this function:

◆ sArraySetP()

void sArraySetP ( sArrayt array,
uint32_t  index,
smallt value 
)

set value at index

the previous element is not freed. This is useful for updating arrays, dictionaries and strings in the array

Parameters
arrayindex where the value is set value to store

Definition at line 1745 of file libsheepySmall.c.

Here is the call graph for this function:

◆ sArraySetTiny()

void sArraySetTiny ( sArrayt array,
uint32_t  index,
smallt value 
)

set value at index

the previous element is freed. The new data replaces the previous data

Parameters
arrayindex where the value is set value to store

Definition at line 1761 of file libsheepySmall.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sArrayReverseTiny()

int sArrayReverseTiny ( sArrayt array)

reverse element order

the last element becomes the first one

Parameters
arrayto reverse
Returns
1 success 0 error

Definition at line 1782 of file libsheepySmall.c.

Here is the caller graph for this function:

◆ sArrayDelTiny()

void sArrayDelTiny ( sArrayt array,
uint32_t  index 
)

delete element at index

the element is freed and NULL is set at index count is unchanged

Parameters
arrayindex

Definition at line 1806 of file libsheepySmall.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sArrayDelRangeTiny()

void sArrayDelRangeTiny ( sArrayt array,
uint32_t  start,
uint32_t  end 
)

delete range and shift elements

the elements are freed and count is reduced

the range [start, end] is not checked for validity

Parameters
array
start
end

Definition at line 1826 of file libsheepySmall.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sBytesGet()

void * sBytesGet ( sBytest bytes)

get buffer in small bytes

Parameters
bytessmall bytes
Returns
pointer to data in small bytes NULL when bytes is NULL or bytes is not of type sBytes

Definition at line 1852 of file libsheepySmall.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sBytesGetTiny()

void * sBytesGetTiny ( sBytest bytes)

get buffer in small bytes

Parameters
bytessmall bytes
Returns
pointer to data in small bytes

Definition at line 1869 of file libsheepySmall.c.

Here is the caller graph for this function:

◆ sBytesPush()

void sBytesPush ( sBytest **  bytes,
char  data 
)

push char to bytes

when bytes is NULL, a new small bytes object is allocated

the small bytes object is reallocated

Parameters
bytessmall bytes data char to push

Definition at line 1885 of file libsheepySmall.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sBytesPushBuffer()

void sBytesPushBuffer ( sBytest **  bytes,
void *  data,
uint32_t  size 
)

push data buffer to bytes

when bytes is NULL, a new small bytes object is allocated

the small bytes object is reallocated

when data is NULL, the function does nothing

Parameters
bytessmall bytes data buffer to push size size of buffer

Definition at line 1925 of file libsheepySmall.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sBytesPushBufferTiny()

void sBytesPushBufferTiny ( sBytest **  bytes,
void *  data,
uint32_t  size 
)

push data buffer to bytes

the small bytes object is reallocated

Parameters
bytessmall bytes data buffer to push size size of buffer

Definition at line 1950 of file libsheepySmall.c.

Here is the caller graph for this function:

◆ sSerial()

sBytest * sSerial ( smallt obj)

serialize object to small bytes

Parameters
objobject
Returns
small bytes object representing obj NULL when obj is NULL

Definition at line 1986 of file libsheepySmall.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sSerialTiny()

sBytest * sSerialTiny ( smallt obj)

serialize object to small bytes

All elements are serialized recursively

the data in containers is not serialized

Parameters
objobject
Returns
small bytes object representing obj

Definition at line 2009 of file libsheepySmall.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sDictSerialElementsTiny()

void sDictSerialElementsTiny ( sBytest **  r,
sDictt dict 
)

serialize dictionary

the serialized dict is pushed to r. All elements are serialized recursively

the data in containers is not serialized

Parameters
rsmall bytes object dict dictionary to serialize

Definition at line 2066 of file libsheepySmall.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sArraySerialElementsTiny()

void sArraySerialElementsTiny ( sBytest **  r,
sArrayt array 
)

serialize array

the serialized array is pushed to r. All elements are serialized recursively

the data in containers is not serialized

Parameters
rsmall bytes object array to serialize

Definition at line 2131 of file libsheepySmall.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sDeserial()

smallt * sDeserial ( sBytest obj)

deserialize small bytes object

Parameters
objsmall bytes
Returns
new deserialized object NULL when obj is NULL or obj is empty

Definition at line 2196 of file libsheepySmall.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sDeserialTiny()

smallt * sDeserialTiny ( sBytest obj)

deserialize small bytes object

Parameters
objsmall bytes
Returns
new deserialized object NULL when there is a malloc error

Definition at line 2215 of file libsheepySmall.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sDictDeserialElementsTiny()

void sDictDeserialElementsTiny ( sDictt **  dict,
char **  data 
)

deserialize dictionary from data

a new dictionary is allocated

Parameters
dictdictionary holding the elements data serialized dictionary

Definition at line 2283 of file libsheepySmall.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sArrayDeserialElementsTiny()

void sArrayDeserialElementsTiny ( sArrayt **  array,
char **  data 
)

deserialize array from data

a new array is allocated

Parameters
arrayholding the elements data serialized dictionary

Definition at line 2384 of file libsheepySmall.c.

Here is the call graph for this function:
Here is the caller graph for this function: