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

Function cupsRemoveDest

cups/dest.c:1936–1973  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1934 */
1935
1936int /* O - New number of destinations */
1937cupsRemoveDest(const char *name, /* I - Destination name */
1938 const char *instance, /* I - Instance name or @code NULL@ */
1939 int num_dests, /* I - Number of destinations */
1940 cups_dest_t **dests) /* IO - Destinations */
1941{
1942 int i; /* Index into destinations */
1943 cups_dest_t *dest; /* Pointer to destination */
1944
1945
1946 /*
1947 * Find the destination...
1948 */
1949
1950 if ((dest = cupsGetDest(name, instance, num_dests, *dests)) == NULL)
1951 return (num_dests);
1952
1953 /*
1954 * Free memory...
1955 */
1956
1957 _cupsStrFree(dest->name);
1958 _cupsStrFree(dest->instance);
1959 cupsFreeOptions(dest->num_options, dest->options);
1960
1961 /*
1962 * Remove the destination from the array...
1963 */
1964
1965 num_dests --;
1966
1967 i = (int)(dest - *dests);
1968
1969 if (i < num_dests)
1970 memmove(dest, dest + 1, (size_t)(num_dests - i) * sizeof(cups_dest_t));
1971
1972 return (num_dests);
1973}
1974
1975
1976/*

Callers 3

mainFunction · 0.85
cupsCopyDestFunction · 0.85
cups_get_cbFunction · 0.85

Calls 3

cupsGetDestFunction · 0.85
_cupsStrFreeFunction · 0.85
cupsFreeOptionsFunction · 0.85

Tested by

no test coverage detected