Blame src/proplist.h

Packit 3ae693
/*-*- Mode: C; c-basic-offset: 8 -*-*/
Packit 3ae693
Packit 3ae693
#ifndef foocanberraproplisthfoo
Packit 3ae693
#define foocanberraproplisthfoo
Packit 3ae693
Packit 3ae693
/***
Packit 3ae693
  This file is part of libcanberra.
Packit 3ae693
Packit 3ae693
  Copyright 2008 Lennart Poettering
Packit 3ae693
Packit 3ae693
  libcanberra is free software; you can redistribute it and/or modify
Packit 3ae693
  it under the terms of the GNU Lesser General Public License as
Packit 3ae693
  published by the Free Software Foundation, either version 2.1 of the
Packit 3ae693
  License, or (at your option) any later version.
Packit 3ae693
Packit 3ae693
  libcanberra is distributed in the hope that it will be useful, but
Packit 3ae693
  WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 3ae693
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Packit 3ae693
  Lesser General Public License for more details.
Packit 3ae693
Packit 3ae693
  You should have received a copy of the GNU Lesser General Public
Packit 3ae693
  License along with libcanberra. If not, see
Packit 3ae693
  <http://www.gnu.org/licenses/>.
Packit 3ae693
***/
Packit 3ae693
Packit 3ae693
#include <stdarg.h>
Packit 3ae693
Packit 3ae693
#include "canberra.h"
Packit 3ae693
#include "mutex.h"
Packit 3ae693
Packit 3ae693
#define N_HASHTABLE 31
Packit 3ae693
Packit 3ae693
typedef struct ca_prop {
Packit 3ae693
        char *key;
Packit 3ae693
        size_t nbytes;
Packit 3ae693
        struct ca_prop *next_in_slot, *next_item, *prev_item;
Packit 3ae693
} ca_prop;
Packit 3ae693
Packit 3ae693
#define CA_PROP_DATA(p) ((void*) ((char*) (p) + CA_ALIGN(sizeof(ca_prop))))
Packit 3ae693
Packit 3ae693
struct ca_proplist {
Packit 3ae693
        ca_mutex *mutex;
Packit 3ae693
Packit 3ae693
        ca_prop *prop_hashtable[N_HASHTABLE];
Packit 3ae693
        ca_prop *first_item;
Packit 3ae693
};
Packit 3ae693
Packit 3ae693
int ca_proplist_merge(ca_proplist **_a, ca_proplist *b, ca_proplist *c);
Packit 3ae693
ca_bool_t ca_proplist_contains(ca_proplist *p, const char *key);
Packit 3ae693
Packit 3ae693
/* Both of the following two functions are not locked! Need manual locking! */
Packit 3ae693
ca_prop* ca_proplist_get_unlocked(ca_proplist *p, const char *key);
Packit 3ae693
const char* ca_proplist_gets_unlocked(ca_proplist *p, const char *key);
Packit 3ae693
Packit 3ae693
int ca_proplist_merge_ap(ca_proplist *p, va_list ap);
Packit 3ae693
int ca_proplist_from_ap(ca_proplist **_p, va_list ap);
Packit 3ae693
Packit 3ae693
#endif