MCPcopy Create free account
hub / github.com/OpenPrinting/cups / cupsArrayNew3

Function cupsArrayNew3

cups/array.c:728–773  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

726 */
727
728cups_array_t * /* O - Array */
729cupsArrayNew3(cups_array_func_t f, /* I - Comparison function or @code NULL@ for an unsorted array */
730 void *d, /* I - User data or @code NULL@ */
731 cups_ahash_func_t h, /* I - Hash function or @code NULL@ for unhashed lookups */
732 int hsize, /* I - Hash size (>= 0) */
733 cups_acopy_func_t cf, /* I - Copy function */
734 cups_afree_func_t ff) /* I - Free function */
735{
736 cups_array_t *a; /* Array */
737
738
739 /*
740 * Allocate memory for the array...
741 */
742
743 a = calloc(1, sizeof(cups_array_t));
744 if (!a)
745 return (NULL);
746
747 a->compare = f;
748 a->data = d;
749 a->current = -1;
750 a->insert = -1;
751 a->num_saved = 0;
752 a->unique = 1;
753
754 if (hsize > 0 && h)
755 {
756 a->hashfunc = h;
757 a->hashsize = hsize;
758 a->hash = malloc((size_t)hsize * sizeof(int));
759
760 if (!a->hash)
761 {
762 free(a);
763 return (NULL);
764 }
765
766 memset(a->hash, -1, (size_t)hsize * sizeof(int));
767 }
768
769 a->copyfunc = cf;
770 a->freefunc = ff;
771
772 return (a);
773}
774
775
776/*

Callers 15

init_dataFunction · 0.85
with_distinct_valuesFunction · 0.85
cupsd_send_notificationFunction · 0.85
cupsdAddIPMaskFunction · 0.85
cupsdAddLocationFunction · 0.85
cupsdAddNameFunction · 0.85
cupsdAddNameMaskFunction · 0.85
colord_register_printerFunction · 0.85
cupsdAddPolicyFunction · 0.85
cupsdAddPolicyOpFunction · 0.85
cupsdAddStringFunction · 0.85
_ppdCacheCreateWithFileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected