some basic changes to try to fix for the -Wpedantic flag
This commit is contained in:
parent
19d6120871
commit
3f5e631388
4 changed files with 31 additions and 4 deletions
|
|
@ -58,6 +58,17 @@ void ARC_String_Copy(ARC_String **copy, ARC_String *original);
|
||||||
*/
|
*/
|
||||||
void ARC_String_CopySubstring(ARC_String **substring, ARC_String *original, uint64_t start, uint64_t length);
|
void ARC_String_CopySubstring(ARC_String **substring, ARC_String *original, uint64_t start, uint64_t length);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief replaces a string with a section of itself
|
||||||
|
*
|
||||||
|
* @note this uses ARC_String_CopySubstring so errors logs will be thrown in that function not this one
|
||||||
|
*
|
||||||
|
* @param string the string to replace, will not change on error
|
||||||
|
* @param start the starting index of the substring
|
||||||
|
* @param length the length of the substring
|
||||||
|
*/
|
||||||
|
void ARC_String_ReplaceWithSubstring(ARC_String **string, uint64_t start, uint64_t length);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief copy a subtring from a givin ARC_String
|
* @brief copy a subtring from a givin ARC_String
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -583,7 +583,7 @@ void ARC_Config_CreateGroup(ARC_Config *config, ARC_String *name){
|
||||||
|
|
||||||
void ARC_Config_DestroyGroup(ARC_HashtableNode *group, void *userdata){
|
void ARC_Config_DestroyGroup(ARC_HashtableNode *group, void *userdata){
|
||||||
free((char *)group->key);
|
free((char *)group->key);
|
||||||
return ARC_Hashtable_Destroy((ARC_Hashtable *)group->data, ARC_Config_DestroyGroupNode, userdata);
|
ARC_Hashtable_Destroy((ARC_Hashtable *)group->data, ARC_Config_DestroyGroupNode, userdata);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ARC_Config_DestroyGroupNode(ARC_HashtableNode *node, void *userdata){
|
void ARC_Config_DestroyGroupNode(ARC_HashtableNode *node, void *userdata){
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ void CRC32(void *key, size_t *keysize, uint32_t *hashval){
|
||||||
}
|
}
|
||||||
|
|
||||||
int8_t ARC_Default_Key_Compare(void *key1, size_t *key1size, void *key2, size_t *key2size){
|
int8_t ARC_Default_Key_Compare(void *key1, size_t *key1size, void *key2, size_t *key2size){
|
||||||
return key1 - key2;
|
return key1 == key2;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ARC_HashtableNode_Create(ARC_HashtableNode **node, void *key, size_t *keysize, void *data){
|
void ARC_HashtableNode_Create(ARC_HashtableNode **node, void *key, size_t *keysize, void *data){
|
||||||
|
|
|
||||||
|
|
@ -69,6 +69,22 @@ void ARC_String_CopySubstring(ARC_String **substring, ARC_String *original, uint
|
||||||
ARC_String_Create(substring, data, length);
|
ARC_String_Create(substring, data, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ARC_String_ReplaceWithSubstring(ARC_String **string, uint64_t start, uint64_t length){
|
||||||
|
ARC_String *substring;
|
||||||
|
ARC_String_CopySubstring(&substring, *string, start, length);
|
||||||
|
|
||||||
|
//if error or substring is null free memory and return
|
||||||
|
if(arc_errno || substring == NULL){
|
||||||
|
if(substring != NULL){
|
||||||
|
free(substring);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
free(*string);
|
||||||
|
*string = substring;
|
||||||
|
}
|
||||||
|
|
||||||
void ARC_String_RemoveSubstring(ARC_String **newString, ARC_String *original, ARC_String *substring){
|
void ARC_String_RemoveSubstring(ARC_String **newString, ARC_String *original, ARC_String *substring){
|
||||||
uint64_t index = ARC_String_Find(original, substring);
|
uint64_t index = ARC_String_Find(original, substring);
|
||||||
if(arc_errno){
|
if(arc_errno){
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue