Commit Graph

18 Commits

Author SHA1 Message Date
Mike Blumenkrantz dd2dc39bff this was supposed to go with the last commit...
SVN revision: 50502
2010-07-26 05:09:20 +00:00
Mike Blumenkrantz 7ff1096672 +eina_stringshare_printf
+eina_stringshare_nprintf
the long awaited printf functions for stringshare!


SVN revision: 50490
2010-07-25 19:18:26 +00:00
Mike Blumenkrantz c146935917 +eina_stringshare_replace_length to replace a stringshared string with a given length of another string
SVN revision: 50320
2010-07-18 07:39:21 +00:00
Vincent Torri 990576cd0e news is a valid stringshare
SVN revision: 45095
2010-01-13 21:20:32 +00:00
Gustavo Sverzut Barbieri e4af7c100c EINA API BREAK: no more individual modules init/shutdown.
Being able to indivually initialize individual modules was initially
"good", but at end it's putting complexities on users that would try
to "optimize" by doing just what they used, but in the end most people
would get them wrong, users would have to do lots of code and etc. At
the end it does not worth.

Most module init just register handful errors and log domains, so are
cheap. The exception is mempool users, that would dlopen() stuff, but
people that are concerned (embedded) can just compile those statically
in eina.

Since at the end any real application would use most of modules, we
actually end saving lots of function calls that would do nothing other
than increment a global counter.

I also did the init/shutdown use an array, making it easier to
maintain. The inital dependencies were analysed by a script I wrote, I
hope it's all right.

Please fix any breakages you find!



SVN revision: 42300
2009-09-06 22:21:56 +00:00
Cedric BAIL 6ca987941f * eina: Fix declaration according to Vincent Torri review.
SVN revision: 41359
2009-07-16 12:09:29 +00:00
Gustavo Sverzut Barbieri ebeabe3735 enable adding just part of a string.
this allows us to add stringshare from a larger buffer that cannot be
modified.


SVN revision: 40516
2009-05-06 04:11:01 +00:00
Gustavo Sverzut Barbieri 2e9a9a9700 eina_stringshare_replace() gets in!
I was replicating this code in many places, it should go into eina itself.

It's the right way to change strings that you don't know are
stringshared before, since it will first add a reference and then
remove, making it impossible to have references to go 0 and string
being released before adding new references, fixing the following
possible problem:

   x = eina_stringshare_add("x");
   replace(x, x);

   then:
   incorrect_replace(const char **b, const char *a) {
      eina_stringshare_del(*b); /* reference gets to 0 */
      eina_stringshare_add(a); /* BUG!!! */
      *b = a;
   }




SVN revision: 39903
2009-04-08 18:25:02 +00:00
Gustavo Sverzut Barbieri b0ee5696a6 eina gets lots of gcc attributes to its api.
this should help with optimizations and code correctness, please see
"info gcc" for detailed explanation on these.

if you experience some functions not working as expected, please
double check if they're not marked with EINA_PURE or EINA_CONST, maybe
I misused them. Remove the macro and try again.

brief explanation:

 * EINA_WARN_UNUSED_RESULT: if you forgot to use the return of some
   function, it will emit a warning (and -Werror will make it an
   error). This way it will be harder to miss the attribution
   "l = eina_list_append(l, v)".

 * EINA_ARG_NONNULL(index, index...): if you give it an explicit NULL
   argument, or some tool (ie: clang) finds it could get a NULL but
   this is not accepted by API, then a warning will be emitted.  This
   will help those that still use eina_hash_add() as if it is
   evas_hash_add().

 * EINA_MALLOC: any non-NULL pointer it returns cannot alias any other
   pointer valid when function returns.

 * EINA_PURE: function have no effects other than the return and this
   return just depend on parameters and/or globals. You might call
   this function in a loop a thousand times and it will return the
   same value, thus you may move this function outside the loop and
   remove it.

 * EINA_CONST: stricter version of EINA_PURE, it will not check for
   global parameters, that is, you cannot consider pointer
   arguments. Use it for math things like "int sqrt(int)".

 * EINA_PRINTF(fmt, arg): will check format parameter specified in
   position "fmt" and passed arguments starting at position "arg", it
   will check for things like giving integers where short or strings
   were expected.

 * EINA_SCANF(fmt, arg): similar to eina_printf().

 * EINA_FORMAT(fmt): for use with things like dgettext(), it will get
   a printf-like format string and modifies it.

Please review and test it with your software, make sure you make clean
before you install the new version so it has any effect.

If you find some functions are missing EINA_WARN_UNUSED_RESULT and
EINA_ARG_NONNULL or others, please add them.



SVN revision: 38323
2008-12-26 13:17:51 +00:00
Gustavo Sverzut Barbieri 9e80a086f6 Add and use eina_stringshare_ref().
This is a faster "add", if we know we're using a shared string we know
the node without any need to search it, just increment reference and
exit.



SVN revision: 37458
2008-11-04 16:25:12 +00:00
Gustavo Sverzut Barbieri 24ee564949 Cheap way to get strlen of a shared string.
it's not safe, but it's faster and can help for large strings, maximum
cost is 4 comparisons plus one pointer access.



SVN revision: 37257
2008-10-28 00:31:09 +00:00
Carsten Haitzler 089b8ac181 add a stringshare dumper so we can examine what's in there and improve usage.
SVN revision: 37186
2008-10-27 00:36:22 +00:00
Vincent Torri f50feadeae * add benchmark and file documentation
* reorganize a bit more. it's not finished
 * fix spellingg and formatting 
 * gnuplot file names generated by our bechmarks tests have an
   absolute time description and not H:M:S description, as this
   breaks the check out of the repo on Windows.


SVN revision: 36090
2008-09-19 05:22:43 +00:00
Vincent Torri 7fd7cc717c * update the doc of stringshre
* fix minor warnings from doxygen


SVN revision: 36004
2008-09-15 19:58:36 +00:00
Cedric BAIL ddaa7d4d8f License changes (BSD -> LGPL)
SVN revision: 35360
2008-08-06 18:15:24 +00:00
Cedric BAIL d8ee8aee6c Fix eina_stringshare_shutdown to return value like all eine shutdown funtion.
Cleanup hash function call.


SVN revision: 35352
2008-08-06 15:49:50 +00:00
Peter Wehrfritz 0eefad12bd - add init() and shutdown() functions
- add doxy


SVN revision: 35256
2008-07-30 14:42:37 +00:00
Cedric BAIL 6e74d01030 Adding stringshare from evas inside eina.
SVN revision: 35249
2008-07-30 13:05:13 +00:00