gboolean eel_g_lists_sort_and_check_for_intersection (GList **list_1, GList **list_2) { GList *node_1, *node_2; int compare_result; *list_1 = g_list_sort (*list_1, compare_pointers); *list_2 = g_list_sort (*list_2, compare_pointers); node_1 = *list_1; node_2 = *list_2; while (node_1 != NULL && node_2 != NULL) { compare_result = compare_pointers (node_1->data, node_2->data); if (compare_result == 0) { return TRUE; } if (compare_result <= 0) { node_1 = node_1->next; } if (compare_result >= 0) { node_2 = node_2->next; } } return FALSE; }
static int compare_fixElements_by_name(const void *ap, const void *bp) { const fixElement *fix1 = ap, *fix2 = bp; int answer= compare_strings(fix1->name, fix2->name); if(!answer) answer = compare_pointers(fix1->name, fix2->name); return answer; }
static int compare_IDEs_by_name(const void *ap, const void *bp) { const XPTInterfaceDirectoryEntry *ide1 = ap, *ide2 = bp; int answer = compare_strings(ide1->name, ide2->name); if(!answer) answer = compare_pointers(ide1->name, ide2->name); return answer; }
static cJSON *get_item_from_pointer(cJSON * const object, const char * pointer, const cJSON_bool case_sensitive) { cJSON *current_element = object; /* follow path of the pointer */ while ((pointer[0] == '/') && (current_element != NULL)) { pointer++; if (cJSON_IsArray(current_element)) { size_t index = 0; if (!decode_array_index_from_pointer((const unsigned char*)pointer, &index)) { return NULL; } current_element = get_array_item(current_element, index); } else if (cJSON_IsObject(current_element)) { current_element = current_element->child; /* GetObjectItem. */ while ((current_element != NULL) && !compare_pointers((unsigned char*)current_element->string, (const unsigned char*)pointer, case_sensitive)) { current_element = current_element->next; } /* skip to the next path token or end of string */ while ((pointer[0] != '\0') && (pointer[0] != '/')) { pointer++; } } else { return NULL; } } return current_element; }
/** Returns order relation between two objects of same type. This needs to be * implemented by each class. It may never return anything else than 0, * signalling equality, or +1 and -1 signalling inequality and determining * the canonical ordering. (Perl hackers will wonder why C++ doesn't feature * the spaceship operator <=> for denoting just this.) */ int basic::compare_same_type(const basic & other) const { return compare_pointers(this, &other); }