pulseaudio  14.2
About: PulseAudio is a networked sound server (for POSIX OSes), a proxy for your sound applications.
  Fossies Dox: pulseaudio-14.2.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

database-simple.c File Reference
#include <errno.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdio.h>
#include <pulse/xmalloc.h>
#include <pulsecore/core-util.h>
#include <pulsecore/log.h>
#include <pulsecore/core-error.h>
#include <pulsecore/hashmap.h>
#include "database.h"
Include dependency graph for database-simple.c:

Go to the source code of this file.

Data Structures

struct  simple_data
 This file is part of PulseAudio. More...
 
struct  entry
 

Typedefs

typedef struct simple_data simple_data
 This file is part of PulseAudio. More...
 
typedef struct entry entry
 

Functions

void pa_datum_free (pa_datum *d)
 
static int compare_func (const void *a, const void *b)
 
static unsigned hash_func (const void *p)
 
static entrynew_entry (const pa_datum *key, const pa_datum *data)
 
static void free_entry (entry *e)
 
static int read_uint (FILE *f, uint32_t *res)
 
static int read_data (FILE *f, void **data, ssize_t *length)
 
static int fill_data (simple_data *db, FILE *f)
 
const char * pa_database_get_filename_suffix (void)
 
pa_databasepa_database_open_internal (const char *path, bool for_write)
 
void pa_database_close (pa_database *database)
 
pa_datumpa_database_get (pa_database *database, const pa_datum *key, pa_datum *data)
 
int pa_database_set (pa_database *database, const pa_datum *key, const pa_datum *data, bool overwrite)
 
int pa_database_unset (pa_database *database, const pa_datum *key)
 
int pa_database_clear (pa_database *database)
 
signed pa_database_size (pa_database *database)
 
pa_datumpa_database_first (pa_database *database, pa_datum *key, pa_datum *data)
 
pa_datumpa_database_next (pa_database *database, const pa_datum *key, pa_datum *next, pa_datum *data)
 
static int write_uint (FILE *f, const uint32_t num)
 
static int write_data (FILE *f, void *data, const size_t length)
 
static int write_entry (FILE *f, const entry *e)
 
int pa_database_sync (pa_database *database)
 

Typedef Documentation

◆ entry

typedef struct entry entry

◆ simple_data

typedef struct simple_data simple_data

This file is part of PulseAudio.

Copyright 2009 Nokia Corporation Contact: Maemo Multimedia multi.nosp@m.medi.nosp@m.a@mae.nosp@m.mo.o.nosp@m.rg

PulseAudio is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

PulseAudio is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with PulseAudio; if not, see http://www.gnu.org/licenses/.

Function Documentation

◆ compare_func()

static int compare_func ( const void *  a,
const void *  b 
)
static

◆ fill_data()

◆ free_entry()

static void free_entry ( entry e)
static

Definition at line 102 of file database-simple.c.

References entry::data, pa_datum::data, entry::key, and pa_xfree().

Referenced by pa_database_open_internal(), and pa_database_set().

◆ hash_func()

static unsigned hash_func ( const void *  p)
static

◆ new_entry()

static entry* new_entry ( const pa_datum key,
const pa_datum data 
)
static

Definition at line 88 of file database-simple.c.

References entry::data, pa_datum::data, entry::key, pa_assert, pa_xmemdup(), pa_xnew0, and pa_datum::size.

Referenced by pa_database_set().

◆ pa_database_clear()

int pa_database_clear ( pa_database database)

Definition at line 330 of file database-simple.c.

References simple_data::map, pa_assert, and pa_hashmap_remove_all().

Referenced by fill_data().

◆ pa_database_close()

void pa_database_close ( pa_database database)

◆ pa_database_first()

pa_datum* pa_database_first ( pa_database database,
pa_datum key,
pa_datum data 
)

◆ pa_database_get()

pa_datum* pa_database_get ( pa_database database,
const pa_datum key,
pa_datum data 
)

◆ pa_database_get_filename_suffix()

const char* pa_database_get_filename_suffix ( void  )

Definition at line 225 of file database-simple.c.

◆ pa_database_next()

pa_datum* pa_database_next ( pa_database database,
const pa_datum key,
pa_datum next,
pa_datum data 
)

◆ pa_database_open_internal()

◆ pa_database_set()

int pa_database_set ( pa_database database,
const pa_datum key,
const pa_datum data,
bool  overwrite 
)

◆ pa_database_size()

signed pa_database_size ( pa_database database)

Definition at line 340 of file database-simple.c.

References simple_data::map, pa_assert, and pa_hashmap_size().

◆ pa_database_sync()

◆ pa_database_unset()

int pa_database_unset ( pa_database database,
const pa_datum key 
)

Definition at line 321 of file database-simple.c.

References simple_data::map, pa_assert, and pa_hashmap_remove_and_free().

◆ pa_datum_free()

void pa_datum_free ( pa_datum d)

Definition at line 50 of file database-simple.c.

References pa_datum::data, pa_assert, pa_xfree(), and pa_datum::size.

◆ read_data()

static int read_data ( FILE *  f,
void **  data,
ssize_t *  length 
)
static

Definition at line 134 of file database-simple.c.

References depmod::f, pa_assert, pa_xfree(), pa_xmalloc0(), read_uint(), and reset().

Referenced by fill_data().

◆ read_uint()

static int read_uint ( FILE *  f,
uint32_t *  res 
)
static

Definition at line 112 of file database-simple.c.

References depmod::f.

Referenced by read_data().

◆ write_data()

static int write_data ( FILE *  f,
void *  data,
const size_t  length 
)
static

Definition at line 427 of file database-simple.c.

References depmod::f, and write_uint().

Referenced by write_entry().

◆ write_entry()

static int write_entry ( FILE *  f,
const entry e 
)
static

◆ write_uint()

static int write_uint ( FILE *  f,
const uint32_t  num 
)
static

Definition at line 410 of file database-simple.c.

References depmod::f.

Referenced by write_data().