[BUGFIX]group2group support sub_group_id array => TSG-18025

This commit is contained in:
liuwentan
2023-12-21 02:13:39 +00:00
parent 580a594806
commit cc1e1d2f7f
6 changed files with 104 additions and 59 deletions

View File

@@ -593,4 +593,31 @@ int ip_format2range(int ip_type, enum ip_format format, const char *ip1, const c
}
}
return 0;
}
int ids_str2longlong_array(const char *ids_str, UT_array *ids_array)
{
int counter = 0;
char *str = NULL;
char *saveptr = NULL;
char *subtoken = NULL;
const char *seps = ",";
char *dup_line = maat_strdup(ids_str);
for (str = dup_line; ; str = NULL) {
subtoken = strtok_r(str, seps, &saveptr);
if (subtoken == NULL)
break;
long long group_id = atoll(subtoken);
utarray_push_back(ids_array, &group_id);
counter++;
}
FREE(dup_line);
if (0 == counter) {
return -1;
}
return 0;
}