| 355 | */ |
| 356 | |
| 357 | char * /* 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 | /* |
no test coverage detected