Structure for storing a compact group of mutable, variable-length character strings.  
More...
|  | 
| #define | MDATA_STRPOOL_FLAG_IS_LOCKED   0x01 | 
|  | 
| #define | MDATA_STRPOOL_FLAG_DEDUPE   0x02 | 
|  | 
| #define | mdata_strpool_sz(sp)   ((sp)->str_sz_max) | 
|  | 
| #define | mdata_strpool_is_locked(sp) | 
|  | 
| #define | mdata_strpool_lock(sp) | 
|  | 
| #define | mdata_strpool_unlock(sp) | 
|  | 
| #define | mdata_strpool_get(sp,  idx)      ((idx >= 1 && idx < (sp)->str_sz) ? &((sp)->str_p[idx]) : NULL) | 
|  | 
| #define | mdata_strpool_get_sz(sp,  idx) | 
|  | 
| #define | mdata_strpool_padding(str_sz)      (sizeof( size_t ) - ((str_sz + 1 /* NULL */) % sizeof( size_t ))) | 
|  | 
|  | 
| typedef size_t | mdata_strpool_idx_t | 
|  | 
|  | 
| MERROR_RETVAL | mdata_strpool_check_idx (struct MDATA_STRPOOL *sp, mdata_strpool_idx_t idx) | 
|  | Verify if the given mdata_strpool_idx_t is valid in the given strpool. 
 | 
|  | 
| mdata_strpool_idx_t | mdata_strpool_find (struct MDATA_STRPOOL *sp, const char *str, size_t str_sz) | 
|  | 
| MAUG_MHANDLE | mdata_strpool_extract (struct MDATA_STRPOOL *sp, mdata_strpool_idx_t idx) | 
|  | Return a dynamically-allocated memory handle containing the contents of the string at the given index. 
 | 
|  | 
| mdata_strpool_idx_t | mdata_strpool_append (struct MDATA_STRPOOL *sp, const char *str, size_t str_sz, uint8_t flags) | 
|  | 
| MERROR_RETVAL | mdata_strpool_remove (struct MDATA_STRPOOL *sp, mdata_strpool_idx_t idx) | 
|  | 
| MERROR_RETVAL | mdata_strpool_alloc (struct MDATA_STRPOOL *sp, size_t alloc_sz) | 
|  | 
| void | mdata_strpool_free (struct MDATA_STRPOOL *sp) | 
|  | 
Structure for storing a compact group of mutable, variable-length character strings. 
◆ mdata_strpool_get_sz
      
        
          | #define mdata_strpool_get_sz | ( |  | sp, | 
        
          |  |  |  | idx | 
        
          |  | ) |  |  | 
      
 
Value:   ((idx >= sizeof( size_t ) && idx < (sp)->str_sz) ? \
      (size_t)(*(&((sp)->str_p[idx - sizeof( size_t )]))) : 0)
 
 
◆ mdata_strpool_is_locked
      
        
          | #define mdata_strpool_is_locked | ( |  | sp | ) |  | 
      
 
Value:   (MDATA_STRPOOL_FLAG_IS_LOCKED == \
   (MDATA_STRPOOL_FLAG_IS_LOCKED & (sp)->flags))
 
 
◆ mdata_strpool_lock
      
        
          | #define mdata_strpool_lock | ( |  | sp | ) |  | 
      
 
Value:   mdata_debug_printf( "locking strpool %p...", sp ); \
   if( NULL != (sp)->str_p ) { \
      error_printf( "str_p not null! double lock?" ); \
      retval = MERROR_ALLOC; \
      goto cleanup; \
   } \
   maug_mlock( (sp)->str_h, (sp)->str_p ); \
   maug_cleanup_if_null_lock( char*, (sp)->str_p ); \
   (sp)->flags |= MDATA_STRPOOL_FLAG_IS_LOCKED;
 
 
◆ mdata_strpool_unlock
      
        
          | #define mdata_strpool_unlock | ( |  | sp | ) |  | 
      
 
Value:   mdata_debug_printf( "unlocking strpool %p...", sp ); \
   if( NULL != (sp)->str_p ) { \
      maug_munlock( (sp)->str_h, (sp)->str_p ); \
      (sp)->flags &= ~MDATA_STRPOOL_FLAG_IS_LOCKED; \
   }