Audacious  $Id:Doxyfile42802007-03-2104:39:00Znenolod$
Classes | Defines | Functions | Variables
stringpool.c File Reference
#include <glib.h>
#include <mowgli.h>
#include "audstrings.h"

Go to the source code of this file.

Classes

struct  PooledString
 Structure to handle string refcounting. More...

Defines

#define MAXLEN   100

Functions

static void noopcanon (gchar *str)
static gboolean stringpool_should_cache (const gchar *string)
gchar * stringpool_get (const gchar *str)
 Fetches or allocates a given string from the stringpool.
void stringpool_unref (gchar *str)
 Unreference a pooled string.

Variables

static mowgli_patricia_t * stringpool_tree = NULL
static GStaticMutex stringpool_mutex = G_STATIC_MUTEX_INIT

Define Documentation

#define MAXLEN   100

Definition at line 46 of file stringpool.c.

Referenced by stringpool_should_cache().


Function Documentation

static void noopcanon ( gchar *  str) [static]

Definition at line 49 of file stringpool.c.

Referenced by stringpool_get().

gchar* stringpool_get ( const gchar *  str)

Fetches or allocates a given string from the stringpool.

If string already exists in the pool, reference to it is returned. Otherwise, a new string is created in the pool with one reference.

Parameters:
[in]strString to be poolified.
Returns:
Reference to the pooled string, or NULL if the given string was NULL or an error occured.

Definition at line 70 of file stringpool.c.

Referenced by tuple_associate_string(), and tuple_copy_value().

static gboolean stringpool_should_cache ( const gchar *  string) [inline, static]

Definition at line 63 of file stringpool.c.

Referenced by stringpool_get(), and stringpool_unref().

void stringpool_unref ( gchar *  str)

Unreference a pooled string.

When there are no references left, the string is unallocated and removed from the pool.

Parameters:
[in]strPointer to a string in the pool.

Definition at line 102 of file stringpool.c.

Referenced by tuple_associate_data(), tuple_destroy(), tuple_disassociate(), and tuple_value_destroy().


Variable Documentation

GStaticMutex stringpool_mutex = G_STATIC_MUTEX_INIT [static]

Definition at line 61 of file stringpool.c.

Referenced by stringpool_get(), and stringpool_unref().

mowgli_patricia_t* stringpool_tree = NULL [static]

Definition at line 60 of file stringpool.c.

Referenced by stringpool_get(), and stringpool_unref().