| @@ -166,13 +166,13 @@ int array_list_add(struct array_list *arr, void *data) | |||||
| return 0; | return 0; | ||||
| } | } | ||||
| void array_list_sort(struct array_list *arr, int (*compar)(const void *, const void *)) | |||||
| void array_list_sort(struct array_list *arr, int(__cdecl *compar)(const void *, const void *)) | |||||
| { | { | ||||
| qsort(arr->array, arr->length, sizeof(arr->array[0]), compar); | qsort(arr->array, arr->length, sizeof(arr->array[0]), compar); | ||||
| } | } | ||||
| void *array_list_bsearch(const void **key, struct array_list *arr, | void *array_list_bsearch(const void **key, struct array_list *arr, | ||||
| int (*compar)(const void *, const void *)) | |||||
| int(__cdecl *compar)(const void *, const void *)) | |||||
| { | { | ||||
| return bsearch(key, arr->array, arr->length, sizeof(arr->array[0]), compar); | return bsearch(key, arr->array, arr->length, sizeof(arr->array[0]), compar); | ||||
| } | } | ||||
| @@ -68,10 +68,11 @@ extern int array_list_add(struct array_list *al, void *data); | |||||
| extern size_t array_list_length(struct array_list *al); | extern size_t array_list_length(struct array_list *al); | ||||
| extern void array_list_sort(struct array_list *arr, int (*compar)(const void *, const void *)); | |||||
| extern void array_list_sort(struct array_list *arr, | |||||
| int(__cdecl *compar)(const void *, const void *)); | |||||
| extern void *array_list_bsearch(const void **key, struct array_list *arr, | extern void *array_list_bsearch(const void **key, struct array_list *arr, | ||||
| int (*compar)(const void *, const void *)); | |||||
| int(__cdecl *compar)(const void *, const void *)); | |||||
| extern int array_list_del_idx(struct array_list *arr, size_t idx, size_t count); | extern int array_list_del_idx(struct array_list *arr, size_t idx, size_t count); | ||||
| @@ -1463,7 +1463,8 @@ struct array_list *json_object_get_array(const struct json_object *jso) | |||||
| } | } | ||||
| } | } | ||||
| void json_object_array_sort(struct json_object *jso, int (*sort_fn)(const void *, const void *)) | |||||
| void json_object_array_sort(struct json_object *jso, | |||||
| int(__cdecl *sort_fn)(const void *, const void *)) | |||||
| { | { | ||||
| assert(json_object_get_type(jso) == json_type_array); | assert(json_object_get_type(jso) == json_type_array); | ||||
| array_list_sort(JC_ARRAY(jso)->c_array, sort_fn); | array_list_sort(JC_ARRAY(jso)->c_array, sort_fn); | ||||
| @@ -1471,7 +1472,7 @@ void json_object_array_sort(struct json_object *jso, int (*sort_fn)(const void * | |||||
| struct json_object *json_object_array_bsearch(const struct json_object *key, | struct json_object *json_object_array_bsearch(const struct json_object *key, | ||||
| const struct json_object *jso, | const struct json_object *jso, | ||||
| int (*sort_fn)(const void *, const void *)) | |||||
| int(__cdecl *sort_fn)(const void *, const void *)) | |||||
| { | { | ||||
| struct json_object **result; | struct json_object **result; | ||||
| @@ -556,7 +556,7 @@ JSON_EXPORT size_t json_object_array_length(const struct json_object *obj); | |||||
| * @param sort_fn a sorting function | * @param sort_fn a sorting function | ||||
| */ | */ | ||||
| JSON_EXPORT void json_object_array_sort(struct json_object *jso, | JSON_EXPORT void json_object_array_sort(struct json_object *jso, | ||||
| int (*sort_fn)(const void *, const void *)); | |||||
| int(__cdecl *sort_fn)(const void *, const void *)); | |||||
| /** Binary search a sorted array for a specified key object. | /** Binary search a sorted array for a specified key object. | ||||
| * | * | ||||
| @@ -574,7 +574,7 @@ JSON_EXPORT void json_object_array_sort(struct json_object *jso, | |||||
| */ | */ | ||||
| JSON_EXPORT struct json_object * | JSON_EXPORT struct json_object * | ||||
| json_object_array_bsearch(const struct json_object *key, const struct json_object *jso, | json_object_array_bsearch(const struct json_object *key, const struct json_object *jso, | ||||
| int (*sort_fn)(const void *, const void *)); | |||||
| int(__cdecl *sort_fn)(const void *, const void *)); | |||||
| /** Add an element to the end of a json_object of type json_type_array | /** Add an element to the end of a json_object of type json_type_array | ||||
| * | * | ||||
| @@ -60,7 +60,7 @@ static struct | |||||
| // Enabled during tests | // Enabled during tests | ||||
| static int _json_c_strerror_enable = 0; | static int _json_c_strerror_enable = 0; | ||||
| extern char *getenv(const char *name); // Avoid including stdlib.h | |||||
| extern char * __cdecl getenv(const char *name); // Avoid including stdlib.h | |||||
| #define PREFIX "ERRNO=" | #define PREFIX "ERRNO=" | ||||
| static char errno_buf[128] = PREFIX; | static char errno_buf[128] = PREFIX; | ||||