From bca99e6379065f086c813ac52386b1223df5ad23 Mon Sep 17 00:00:00 2001 From: tasn Date: Tue, 27 Jul 2010 09:41:34 +0000 Subject: [PATCH] Eina: implement the macro eina_binshare_add. git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/eina@50535 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/include/Eina.h | 1 + src/include/eina_binshare.h | 21 ++++++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/include/Eina.h b/src/include/Eina.h index f44d184..717e59c 100644 --- a/src/include/Eina.h +++ b/src/include/Eina.h @@ -53,6 +53,7 @@ * @author Raphael Kubo da Costa * @author Tilman Sauerbeck * @author Vincent "caro" Torri + * @author Tom Hacohen * @date 2008-2010 * * @section eina_intro_sec Introduction diff --git a/src/include/eina_binshare.h b/src/include/eina_binshare.h index 3d67f39..03f5653 100644 --- a/src/include/eina_binshare.h +++ b/src/include/eina_binshare.h @@ -68,13 +68,32 @@ 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)) + +/** * @} */ -- 2.7.4