fixed after breaking everything with errno.h and vector.h changes, config still borked
This commit is contained in:
parent
2df9f318a5
commit
cdd6c3976b
18 changed files with 86 additions and 84 deletions
|
|
@ -103,9 +103,11 @@ void ARC_Config_SetGroup(ARC_Config *config, ARC_String *groupname){
|
|||
}
|
||||
|
||||
ARC_Hashtable_Get(config->groups, (void *)groupname->data, groupname->length, (void **)&(config->currgroup));
|
||||
if(arc_errno && arc_errno != ARC_ERRNO_NULL){
|
||||
return;
|
||||
}
|
||||
arc_errno = 0;
|
||||
|
||||
// if(arc_errno && arc_errno != ARC_ERRNO_NULL){
|
||||
// return;
|
||||
// }
|
||||
|
||||
if(config->currgroup){
|
||||
return;
|
||||
|
|
@ -125,7 +127,7 @@ void ARC_Config_Get(ARC_Config *config, ARC_String *keyname, void **value){
|
|||
uint64_t length = ARC_String_FindCString(keyname, "::", 2);
|
||||
if(arc_errno){
|
||||
//TODO: Debug info here
|
||||
ARC_DEBUG_ERR("in ARC_Config_Get(config, keyname, value); length threw error");
|
||||
ARC_DEBUG_LOG_ERROR("in ARC_Config_Get(config, keyname, value); length threw error");
|
||||
*value = NULL;
|
||||
return;
|
||||
}
|
||||
|
|
@ -141,7 +143,7 @@ void ARC_Config_Get(ARC_Config *config, ARC_String *keyname, void **value){
|
|||
ARC_Hashtable *currgroup = config->currgroup;
|
||||
ARC_Config_SetGroup(config, group);
|
||||
if(arc_errno){
|
||||
ARC_DEBUG_ERR("in ARC_Config_Get(config, keyname, value); setting group threw error");
|
||||
ARC_DEBUG_LOG_ERROR("in ARC_Config_Get(config, keyname, value); setting group threw error");
|
||||
ARC_String_Destroy(group);
|
||||
*value = NULL;
|
||||
return;
|
||||
|
|
@ -211,7 +213,7 @@ void ARC_Config_LoadFromKey(ARC_Config *config, ARC_String *keyType, ARC_String
|
|||
ARC_Hashtable_Get(config->keys, keyType->data, keyType->length, (void **)&key);
|
||||
if(key == NULL){
|
||||
arc_errno = ARC_ERRNO_DATA;
|
||||
ARC_DEBUG_LOG(arc_errno, "in ARC_Config_LoadFromKey(config, string, value); no matching key: %s", keyType->data);
|
||||
ARC_DEBUG_LOG_ERROR_WITH_VARIABLES("in ARC_Config_LoadFromKey(config, string, value); no matching key: %s", keyType->data);
|
||||
}
|
||||
|
||||
if(arc_errno){
|
||||
|
|
@ -406,7 +408,7 @@ void ARC_Config_StripComment(ARC_String *original, ARC_String **stripped, ARC_St
|
|||
uint64_t endIndex = ARC_String_Find(commentString, lineEnd);
|
||||
ARC_String_Destroy(commentString);
|
||||
if(endIndex == ~(uint64_t)0){
|
||||
ARC_DEBUG_ERR("ARC_Config_RemoveComments(original, commentRemoved); No newline found when stripping single line comment");
|
||||
ARC_DEBUG_LOG_ERROR("ARC_Config_RemoveComments(original, commentRemoved); No newline found when stripping single line comment");
|
||||
arc_errno = ARC_ERRNO_DATA;
|
||||
ARC_String_Destroy(current);
|
||||
*stripped = NULL;
|
||||
|
|
@ -524,22 +526,17 @@ void ARC_Config_RemoveAndRunCommands(ARC_Config *config, ARC_String *original, A
|
|||
}
|
||||
|
||||
void ARC_Config_FileIO(ARC_Config *config, ARC_String *path, uint8_t command){
|
||||
arc_errno = 0; //TODO: Remove this, just testing
|
||||
ARC_String *data;
|
||||
ARC_IO_FileToStr(path, &data);
|
||||
if(arc_errno){
|
||||
ARC_DEBUG_LOG(arc_errno, "ARC_IO_FileToStr(%s, &data, &size);\n", path->data);
|
||||
ARC_DEBUG_LOG_ERROR_WITH_VARIABLES("ARC_IO_FileToStr(%s, &data, &size);\n", path->data);
|
||||
return;
|
||||
}
|
||||
|
||||
char *tempData = (char *)malloc(sizeof(char) * (data->length + 1));
|
||||
strncpy(tempData, data->data, data->length);
|
||||
tempData[data->length] = '\n';
|
||||
ARC_String_AppendCStringWithStrlen(&data, "\n");
|
||||
|
||||
ARC_String *temp = data;
|
||||
ARC_String_Create(&temp, tempData, data->length + 1);
|
||||
free(tempData);
|
||||
ARC_String_Destroy(data);
|
||||
|
||||
ARC_Config_RemoveComments(temp, &data);
|
||||
ARC_String_Destroy(temp);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue