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

Function _cupsStrRetain

cups/string.c:357–384  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

355 */
356
357char * /* O - Pointer to string */
358_cupsStrRetain(const char *s) /* I - String to retain */
359{
360 _cups_sp_item_t *item; /* Pointer to string pool item */
361
362
363 if (s)
364 {
365 item = (_cups_sp_item_t *)(s - offsetof(_cups_sp_item_t, str));
366
367#ifdef DEBUG_GUARDS
368 if (item->guard != _CUPS_STR_GUARD)
369 {
370 DEBUG_printf(("5_cupsStrRetain: Retaining string %p(%s), guard=%08x, "
371 "ref_count=%d", item, s, item->guard, item->ref_count));
372 abort();
373 }
374#endif /* DEBUG_GUARDS */
375
376 _cupsMutexLock(&sp_mutex);
377
378 item->ref_count ++;
379
380 _cupsMutexUnlock(&sp_mutex);
381 }
382
383 return ((char *)s);
384}
385
386
387/*

Callers 4

_ppdCacheCreateWithPPDFunction · 0.85
cupsAddDestFunction · 0.85
cupsCopyDestFunction · 0.85
cupsPrintFiles2Function · 0.85

Calls 2

_cupsMutexLockFunction · 0.85
_cupsMutexUnlockFunction · 0.85

Tested by

no test coverage detected