Eina: implement the macro eina_binshare_add.
authortasn <tasn@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 27 Jul 2010 09:41:34 +0000 (09:41 +0000)
committertasn <tasn@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 27 Jul 2010 09:41:34 +0000 (09:41 +0000)
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/eina@50535 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/include/Eina.h
src/include/eina_binshare.h

index f44d184..717e59c 100644 (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
index 3d67f39..03f5653 100644 (file)
 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))
+
+/**
  * @}
  */