diff --git a/src/libopensubsonic/utils.c b/src/libopensubsonic/utils.c index 97fe080..baf5c6d 100644 --- a/src/libopensubsonic/utils.c +++ b/src/libopensubsonic/utils.c @@ -1,7 +1,6 @@ #include #include #include -#include #include "../external/cJSON.h" #include "logger.h" #include "utils.h" @@ -15,91 +14,39 @@ */ void OSS_Psoj(char** dest, cJSON* obj, char* child) { - if (obj == NULL) { - //void* ret_addr = __builtin_return_address(0); - //Dl_info info; - //if (dladdr(ret_addr, &info)) { - // logger_log_error(info.dli_sname, "Parent object is null."); - //} - } else { + if (obj != NULL) { cJSON* childObj = cJSON_GetObjectItem(obj, child); - if (cJSON_IsString(childObj) && childObj->valuestring != NULL) { *dest = strdup(childObj->valuestring); - } else { - //void* ret_addr = __builtin_return_address(0); - //Dl_info info; - //if (dladdr(ret_addr, &info)) { - // logger_log_error(info.dli_sname, "Object %s is not a string or string is null.", child); - //} } } } void OSS_Pioj(int* dest, cJSON* obj, char* child) { - if (obj == NULL) { - //void* ret_addr = __builtin_return_address(0); - //Dl_info info; - //if (dladdr(ret_addr, &info)) { - // logger_log_error(info.dli_sname, "Parent object is null."); - //} - } else { + if (obj != NULL) { cJSON* childObj = cJSON_GetObjectItem(obj, child); - if (cJSON_IsNumber(childObj)) { *dest = childObj->valueint; - } else { - //void* ret_addr = __builtin_return_address(0); - //Dl_info info; - //if (dladdr(ret_addr, &info)) { - // logger_log_error(info.dli_sname, "Object %s is not an int.", child); - //} } } } void OSS_Ploj(long* dest, cJSON* obj, char* child) { - if (obj == NULL) { - //void* ret_addr = __builtin_return_address(0); - //Dl_info info; - //if (dladdr(ret_addr, &info)) { - // logger_log_error(info.dli_sname, "Parent object is null."); - //} - } else { + if (obj != NULL) { cJSON* childObj = cJSON_GetObjectItem(obj, child); - if (cJSON_IsNumber(childObj)) { *dest = childObj->valueint; - } else { - //void* ret_addr = __builtin_return_address(0); - //Dl_info info; - //if (dladdr(ret_addr, &info)) { - // logger_log_error(info.dli_sname, "Object %s is not a long.", child); - //} } } } void OSS_Pboj(bool* dest, cJSON* obj, char* child) { - if (obj == NULL) { - //void* ret_addr = __builtin_return_address(0); - //Dl_info info; - //if (dladdr(ret_addr, &info)) { - // logger_log_error(info.dli_sname, "Parent object is null."); - //} - } else { + if (obj != NULL) { cJSON* childObj = cJSON_GetObjectItem(obj, child); - if (cJSON_IsBool(childObj)) { if (cJSON_IsTrue(childObj)) { *dest = true; } - } else { - //void* ret_addr = __builtin_return_address(0); - //Dl_info info; - //if (dladdr(ret_addr, &info)) { - // logger_log_error(info.dli_sname, "Object is not a bool."); - //} } } }