Eina: implement the macro eina_binshare_add.

SVN revision: 50535
This commit is contained in:
Tom Hacohen 2010-07-27 09:41:34 +00:00
parent 279da003e0
commit d928a9ded8
2 changed files with 21 additions and 1 deletions

View File

@ -53,6 +53,7 @@
* @author Raphael Kubo da Costa <kubo@@profusion.mobi>
* @author Tilman Sauerbeck <tilman@@code-monkey.de>
* @author Vincent "caro" Torri <vtorri at univ-evry dot fr>
* @author Tom Hacohen <tom@@stosb.com>
* @date 2008-2010
*
* @section eina_intro_sec Introduction

View File

@ -68,12 +68,31 @@
EAPI Eina_Bool eina_binshare_init(void);
EAPI Eina_Bool eina_binshare_shutdown(void);
EAPI const char *eina_binshare_add_length(const char *str, unsigned int slen) EINA_WARN_UNUSED_RESULT;
EAPI const char *eina_binshare_add(const char *str) EINA_WARN_UNUSED_RESULT;
EAPI const char *eina_binshare_ref(const char *str);
EAPI void eina_binshare_del(const char *str);
EAPI int eina_binshare_length(const char *str) EINA_CONST EINA_WARN_UNUSED_RESULT;
EAPI void eina_binshare_dump(void);
/**
* @brief Retrieve an instance of a blob for use in a program.
*
* @param str The binary blob to retrieve an instance of.
* @return A pointer to an instance of the string on success.
* @c NULL on failure.
*
* This macro retrieves an instance of @p str. If @p str is
* @c NULL, then @c NULL is returned. If @p str is already stored, it
* is just returned and its reference counter is increased. Otherwise
* it is added to the blobs to be searched and a duplicated blob
* of @p str is returned.
*
* This macro essentially calls eina_binshare_add_length with ptr and sizeof(*ptr)
* as the parameters. It's useful for pointers to structures.
*
* @see eina_stringshare_add_length()
*/
#define eina_binshare_add(ptr) eina_binshare_add_length(ptr, sizeof(*ptr))
/**
* @}
*/