diff --git a/srcs/libs/misc/unique_instance.c b/srcs/libs/misc/unique_instance.c index 6ca88b8..cbaa38e 100644 --- a/srcs/libs/misc/unique_instance.c +++ b/srcs/libs/misc/unique_instance.c @@ -5,7 +5,6 @@ #include #include #include -#include #include #include "user_errno.h" #include "misc.h" diff --git a/srcs/opendhcp183/query.cpp b/srcs/opendhcp183/query.cpp index 69467c9..77c5c9f 100644 --- a/srcs/opendhcp183/query.cpp +++ b/srcs/opendhcp183/query.cpp @@ -550,30 +550,27 @@ static int delete_dhcpd_rangeset(const char **pRsp, const char *pRequest) { } } //The input parameter does not exist - do { - PHASH_MAP s; - PHASH_MAP tmp; - char saddr[128]; - char eaddr[128]; - char del_range[256]; - memset(del_range, 0, 256); + PHASH_MAP s; + PHASH_MAP tmp; + char saddr[128]; + char eaddr[128]; + char del_range[256]; + memset(del_range, 0, 256); + HASH_ITER(hh, delMap, s, tmp) HASH_ITER(hh, delMap, s, tmp) { + cJSON *pdel_Item = cJSON_CreateObject(); + IP2String(saddr, ntohl(s->key)); + IP2String(eaddr, ntohl(s->value)); - HASH_ITER(hh, delMap, s, tmp) { - cJSON *pdel_Item = cJSON_CreateObject(); - IP2String(saddr, ntohl(s->key)); - IP2String(eaddr, ntohl(s->value)); + sprintf(del_range, "%s-%s", saddr, eaddr); + cJSON_AddStringToObject(pdel_Item, "dhcpRange", del_range); - sprintf(del_range, "%s-%s", saddr, eaddr); - cJSON_AddStringToObject(pdel_Item, "dhcpRange", del_range); + cJSON_AddNumberToObject(pdel_Item, "status", ERR_ITEM_UNEXISTS); + cJSON_AddStringToObject(pdel_Item, "message", getErrorEnumDesc(ERR_ITEM_UNEXISTS)); + cJSON_AddItemToArray(pdelArray, pdel_Item); - cJSON_AddNumberToObject(pdel_Item, "status", ERR_ITEM_UNEXISTS); - cJSON_AddStringToObject(pdel_Item, "message", getErrorEnumDesc(ERR_ITEM_UNEXISTS)); - cJSON_AddItemToArray(pdelArray, pdel_Item); - - HASH_DEL(delMap, s); - free(s); - } - } while (0); + HASH_DEL(delMap, s); + free(s); + } //Rewrite cfig.dhcpRanges for (int i = 0; i < cfig.rangeCount; i++) {