Commit Graph

295 Commits

Author SHA1 Message Date
Jérémy Zurcher 0078769f13 eina_tls: fix calls to TlsFree 2014-01-23 10:40:02 +01:00
Jérémy Zurcher 316dc52d2f eina_tls: add eina_tls_cb_new(Eina_TLS *key, Eina_TLS_Delete_Cb delete_cb)
Summary:
   delete_cb is called at thread exit for each Eina_TLS keys used by the thread

Details:
   posix:
      pthread_key_create(key, delete_cb); does it
   win32/wince:
      eina_tls_free/new un/registers key&&cb into a static eina_list.
      eina_tls_set add the key to an eina_list in Eina_Thread_Win3.
      this list is cleared and callbacks are called in _eina_thread_join()

Test Plan: win32/wince has to be tested, I have no setup to do it.

Reviewers: cedric

CC: cedric

Differential Revision: https://phab.enlightenment.org/D489
2014-01-23 14:50:08 +09:00
Carsten Haitzler 20d0015470 eina-inlist - handle prepend/append relative if list is null (empty)
stable release - cherry-pick me!
2014-01-20 15:16:56 +09:00
Cedric BAIL 55a56fe5c0 eina: add eina_{str,bin}buf_manage_read_only_new_length().
It is sometime useful to start from a defined buffer, but to not touch it
until needed. This make life of caller more easier as they don't need to
duplicate the buffer themself as Eina will now take care of that.
2014-01-20 13:04:07 +09:00
Cedric BAIL 342dd72e37 eina: add eina_binbuf_append_buffer() and eina_strbuf_append_buffer(). 2014-01-20 13:04:07 +09:00
Cedric Bail 3e89295c73 eina: fix memory leak of inserting the wrong value in the hash.
We where inserting the pointer data instead of the pointer, leading to
unaligned access on Sparc (Thanks Lutin to report it and Debian tools/infra
to help us catch it) and also a memory leak.
2014-01-11 21:38:55 +09:00
Carsten Haitzler 3a1d560c0c eina lock posix - remove dead code in eina_spinlock_take
this solves CID 1106340
2014-01-10 16:58:39 +09:00
Carsten Haitzler 555df8f510 Revert "fix allocator sizeof operand mismatch reported by clang"
This reverts commit 955cc579d4.

why? wrong. no. and it breaks actual execution/functioning. segv land
2014-01-09 10:02:26 +09:00
Jihoon Kim 955cc579d4 fix allocator sizeof operand mismatch reported by clang
https://build.enlightenment.org/job/nightly_efl_clang_x86_64/lastSuccessfulBuild/artifact/scan-build/build/2014-01-07-1/report-QL6MiM.html#EndPath
https://build.enlightenment.org/job/nightly_efl_clang_x86_64/lastSuccessfulBuild/artifact/scan-build/build/2014-01-07-1/report-a2l0Ci.html#EndPath
https://build.enlightenment.org/job/nightly_efl_clang_x86_64/lastSuccessfulBuild/artifact/scan-build/build/2014-01-07-1/report-McvqNf.html#EndPath
2014-01-09 09:10:02 +09:00
Carsten Haitzler e8c13118eb fix mingw build for setuid fix/checks 2014-01-08 22:06:41 +09:00
Carsten Haitzler b95ef3801f setuid safeness - ensure if an app that is setuid doesn't do bad things
this makes efl ignore certain env vars for thnigs and entirely removes
user modules (that no one ever used) etc. etc. to ensure that *IF* an
app is setuid, there isn't a priv escalation path that is easy.
2014-01-08 19:46:23 +09:00
Jihoon Kim 946a797e0d fix warning related to argument in generating doxygen 2014-01-07 11:27:15 +09:00
Jihoon Kim 8fcedfc017 fix 'found unknown command' warning in generating doxygen 2014-01-06 14:01:15 +09:00
Carsten Haitzler 6f685d7608 fixme notes - fixme: many instances of module loading that bloat our mem 2014-01-06 12:16:36 +09:00
Cedric Bail e450a8fec3 eina: Eina_File - don't leak memory when file is not found. 2014-01-05 10:59:43 +09:00
Cedric Bail 319766f837 eina: fix support for system requiring _XOPEN_SOURCE to use spinlock and barrier. 2014-01-04 11:25:19 +09:00
Cedric Bail 4225ef35e1 eina: fix build break on systemd based system. 2014-01-04 11:24:48 +09:00
Guillaume Friloux ec3d13d6c9 eina - Fix compilation warning in eina_log_print_cb_journald.
vasprintf can return -1, in which case the buffer is corrupted.
So we better handle this ...

gcc told me of this thanks to -Wunused-result when building package,
thank you gcc for your incredible powers.
2014-01-03 19:13:30 +01:00
Guillaume Friloux 1073bfcd44 eina - Fix coding style madness. 2014-01-03 19:10:16 +01:00
Cedric BAIL 37c1c4e9f6 eina: make eina_binbuf_free and eina_strbuff_free accept NULL.
We do follow free() logic here and accept NULL for all eina_*_free() functions.
This patch just do so for Eina_Binbuf and Eina_Strbuf.
2014-01-02 16:23:46 +09:00
Carsten Haitzler 73f91eb689 oops - and a printf crept in. i thought i was done. 2013-12-27 17:18:46 +09:00
Carsten Haitzler c8630c85a1 emotion - broken module loading loagic fixed that fixes gst 0.10/1 deadlock
so firstly the module loading logic in emotion is pretty bad. it
forcible loads into memory (dlopen + run code from) EVERY emotion
module whenever you use emotion anywhere. this is a fat memory cost and
startup cost. it should not ever have done this. so remove that code
and make it explicitly load only the backend requested and fall back
to using what is compiled in (generic by default) and otherwise
generic as a module, then xine, then gstreamer then gstreamer1.
gstreamer1 seems broke - all i see is a black box (no video).

this also fixes a deadlock problem. if you have BOTH gstreamer AND
gstreamer1 modules loaded i get a deadlock inside glib. this seemingly
fixes it as it'll only load the first one it finds, not both (unless
explicitly requested).
2013-12-27 17:18:01 +09:00
Dennis Schridde bf9c3aad24 eina: struct _Eina_Rbtree contains an enum bitfield, which is a GNU extension not specified by C99.
Reviewers: barbieri, raster, cedric

Reviewed By: cedric

CC: cedric

Differential Revision: https://phab.enlightenment.org/D412

Signed-off-by: Cedric BAIL <cedric.bail@samsung.com>
2013-12-27 12:07:01 +09:00
Daniel Juyung Seo 76d8532b54 efl: Unified eina critical manro to CRI.
Being annoyed by different types of eina critical macros - CRI, CRIT,
 CRITICAL -, I concluded to unify them to one. Discussed on IRC and
 finally, CRI was chosen to meet the consistency with other macros -
 ERR, WRN, INF, DBG - in terms of the number of characters.
If there is any missing bits, please let me know.
2013-12-26 12:27:13 +09:00
Iván Briano 99e3ce489a One ) too many. 2013-12-16 15:45:00 -02:00
Carsten Haitzler e4b029da0b eina - eina_file - fix leak of fd is fd is 0
this should fix CID 1039181
2013-12-13 21:26:05 +09:00
Sebastian Dransfeld 08978ddb56 eina: Set it to NULL before next iteration
it might have been free'd by the user, so set it to NULL before next
iteration. This is an attempt to fix CID 1039913 and 1039914.

We don't use the pointer value, only the pointer, so the error is wrong.
Could flag the error in coverity, but if this fixes it, we wont see the
error in other situations.
2013-12-07 21:11:32 +01:00
Cedric Bail 2e9f96cc24 eina: this is actually a better way of improving Eina_Hash performance.
This reduce the size of the rbtree part dedicated to the hash key match,
but reuse only bit that weren't matched by the bucket.
2013-12-05 16:32:02 +09:00
Cedric Bail ff845b0a7c eina: improve cmp function of eina_hash string related hash.
For strings, we already know the length, so let's just not call the
heavy strcmp if the length is not already the same. Get some easy
speedup here.
2013-12-04 19:05:03 +09:00
Cedric Bail df909605c5 eina: increase hash matching inside of Eina_Hash.
This is the correct implementation of the idea developped in Lucas De Marchi's blog :
http://www.politreco.com/2013/09/optimizing-hash-table-with-kmod-as-testbed/

This give an interesting +15% for all Eina_Hash user whatever hash function they use. The inlined
djb2 is still the fastest one and all other give very close result. It does increase memory foot
print, but as much as the previous way of doing it.
2013-12-04 18:33:05 +09:00
Cedric Bail 3a15c5bbb3 Revert "eina: work around current strange behavior seen in eina_cow."
This reverts commit e4107b2936.
2013-12-04 18:33:05 +09:00
Cedric Bail 4f161f0c8d Revert "eina: more work around to limit problem."
This reverts commit c5db264e0a.
2013-12-04 18:33:05 +09:00
Cedric Bail 3c7185e880 Revert "eina: check if the complete hash match before checking if the key match during children walk."
This reverts commit 295babadb1.

The implementation of that said optimization is actually wrong.
2013-12-04 18:33:04 +09:00
Cedric Bail c5db264e0a eina: more work around to limit problem. 2013-12-04 16:31:49 +09:00
Cedric Bail e4107b2936 eina: work around current strange behavior seen in eina_cow.
This is not perfect, it will just limit the propagation of the problem
for some time. Yes, it does hide it under the carpet, but that's better
than having a crash. Problem seems to be in Eina_Hash, but is really
difficult to reproduce and fix for the moment.
2013-12-04 15:36:17 +09:00
Carsten Haitzler 0f21e4cfa7 eina - fix set-but-unused warning in eina_cow when valgrind off 2013-12-01 13:52:53 +09:00
Boris Faure f45618d15b fix eina_cow issues. Closes T581, T527 2013-11-30 15:41:08 +01:00
Sebastian Dransfeld 3ebebbca1a eina: formatting 2013-11-29 22:20:50 +01:00
Cedric Bail aefd608453 eina: fix rounding logic to avoid making the array to short.
I have no idea how the previous formula was supposed to work at all, but
this one is the same as our alignof code to make sure we do allocate to
the really nearest size and don't do over allocation. Additionnaly it works.
2013-11-29 15:33:51 +09:00
Carsten Haitzler 523d8607d1 fix eina_array_remove to actually realloc down in size to remove bloat
eina_array_remove() didnt ever realloc down unless we went to 0
members. this wasn't very good as you'd expect the array to be reduced
in size if enough items were removed. not only that the old code was
stupid and ALWAYS malloc()ed a new array of the exact same size and
copied items over in the most complex way possible, then freed the old
one. this would have added overhead wherever used (evas_render) that
should not have been there.

this is based on the idea in a patch from
Viacheslav Lvov <v.lvov@samsung.com>, but this is a re-do of it
entirely, reducing the codebase massively even compared to the patch
and making it much simpler to read, maintain, actually reduce memory
and cut overhead.
2013-11-28 18:03:54 +09:00
Cedric Bail 62b469749a eina: fix the crash seen by some during rebuild.
Before this patch, we were unconditionnaly destroying the Eina_File if that one
did change on disk. We also make sure that we remove the right entry from the cache
if the file did change there.
2013-11-21 14:49:08 +09:00
Cedric Bail 0cfb40b7fb eina: cleanup file destruction and reintroduce EINA_MAGIC use. 2013-11-20 20:08:44 +09:00
Jérémy Zurcher 58b578c9b0 eina: fix a possible race condition during eina_file_close.
replay 7e8fb93 without the breakage
2013-11-20 10:22:00 +01:00
Jérémy Zurcher 8a3e021298 Revert "eina: fix a possible race condition during eina_file_close."
it breaks everything

This reverts commit 7e8fb93206.
2013-11-20 10:22:00 +01:00
Cedric Bail 7e8fb93206 eina: fix a possible race condition during eina_file_close.
The lock on the main hash was taken to late (after we took the decision
to remove the targeted Eina_File from the cache), this means it was possible
to get an Eina_File from the cache that was going to be removed. This patch
attempt to fix that potential race condition.

Hopefully should fix T461.
2013-11-20 13:02:37 +09:00
Cedric Bail 30fa53c13d eina: try to handle all possible 64bits pointers environment. 2013-11-18 19:21:06 +09:00
Cedric BAIL 425b399172 eina: remove the value from the hash before changing it !
This should fix bug T439.
2013-11-17 12:20:02 +01:00
Cedric Bail 1281a8369f eina: fix uninitialized data use. 2013-11-12 19:01:10 +09:00
Cedric BAIL 1027e7d59c eina: avoid warning. 2013-11-10 12:07:59 +01:00
Cedric BAIL 7241f07f9c eina: let's copy va_list when passing it around to be more portable.
NOTE: EINA_VALUE_TYPE_DISPATCH_RETURN macro is a bit weird, it does
use external variable not passed to the macro and half of the parameter
given to it are just ignored...
2013-11-10 09:43:57 +01:00