diff options
author | Not Zed <NotZed@Ximian.com> | 2001-04-26 09:07:44 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2001-04-26 09:07:44 +0800 |
commit | 36cac270be19b769530a7b68ca6d4e3b79452e41 (patch) | |
tree | 6130550502a82dada101bc0b19a8155c6cd49403 /e-util/e-memory.h | |
parent | 4994d35be03b281011c6ce5e8ff5489eed7486d6 (diff) | |
download | gsoc2013-evolution-36cac270be19b769530a7b68ca6d4e3b79452e41.tar gsoc2013-evolution-36cac270be19b769530a7b68ca6d4e3b79452e41.tar.gz gsoc2013-evolution-36cac270be19b769530a7b68ca6d4e3b79452e41.tar.bz2 gsoc2013-evolution-36cac270be19b769530a7b68ca6d4e3b79452e41.tar.lz gsoc2013-evolution-36cac270be19b769530a7b68ca6d4e3b79452e41.tar.xz gsoc2013-evolution-36cac270be19b769530a7b68ca6d4e3b79452e41.tar.zst gsoc2013-evolution-36cac270be19b769530a7b68ca6d4e3b79452e41.zip |
Modified to match e_strv_get behaviour. Assert on bad cases, and return ""
2001-04-26 Not Zed <NotZed@Ximian.com>
* e-memory.c (e_poolv_get): Modified to match e_strv_get
behaviour. Assert on bad cases, and return "" rather than NULL
for empty/unset strings.
(e_poolv_new): Simplify the mutex cases, only have a single mutex
for mempool and hashtable references.
(e_poolv_set): Simplify mutex code. Fixed a #ifdef orde prob in
profile stuff. Always copy string to our own memory when we add
it to the hash, even if we free it; I think this would have led to
dangling references otherwise.
(e_poolv_destroy): Renamed from poolv_free, for consistency with
the rest of the allocators here.
(e_poolv_set): Add optional refcounting code here, not currently
enabled/used, but should make proper string collection work
easily.
(e_poolv_destroy): Unrefcount the strings here.
(e_poolv_cpy): Add refcounting code here.
* e-memory.[ch]: Applied Jacob's patches <jacob@ximian.com> for
'e-poolv' type, added his name to the authors list.
svn path=/trunk/; revision=9570
Diffstat (limited to 'e-util/e-memory.h')
-rw-r--r-- | e-util/e-memory.h | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/e-util/e-memory.h b/e-util/e-memory.h index 911bb36b7a..c271914d5f 100644 --- a/e-util/e-memory.h +++ b/e-util/e-memory.h @@ -1,7 +1,8 @@ /* - * Copyright (C) 2000, Helix Code Inc. + * Copyright (C) 2001, Helix Code Inc. * - * Author: Michael Zucchi <notzed@helixcode.com> + * Authors: Michael Zucchi <notzed@ximian.com> + * Jacob Berkman <jacob@ximian.com> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -62,4 +63,13 @@ EStrv *e_strv_pack(EStrv *strv); char *e_strv_get(EStrv *strv, int index); void e_strv_destroy(EStrv *strv); +/* poolv's are similar to strv's, but they store common strings */ +typedef struct _EPoolv EPoolv; + +EPoolv *e_poolv_new(unsigned int size); +EPoolv *e_poolv_cpy(EPoolv *dest, const EPoolv *src); +EPoolv *e_poolv_set(EPoolv *poolv, int index, char *str, int freeit); +const char *e_poolv_get(EPoolv *poolv, int index); +void e_poolv_destroy(EPoolv *poolv); + #endif /* ! _E_MEMORY_H */ |