Commit Graph

462 Commits

Author SHA1 Message Date
Mike Blumenkrantz 6817717ee4 Revert "eina: Eina_Module - check whether the file exists or not, before memory allocation of Eina_Module"
This reverts commit 971589bf56.

this completely breaks existing eina_module usage. elm_test->image remote
2014-07-27 18:53:20 -04:00
Daniel Kolesa 987cde5f35 Revert "eina: new API: eina_file_path_basename"
This reverts commit 68282f8c42.

This is actually not needed because of presence of basename in Evil.
2014-07-23 19:38:08 +01:00
Daniel Kolesa 68282f8c42 eina: new API: eina_file_path_basename 2014-07-23 17:04:04 +01:00
Shinwoo Kim 971589bf56 eina: Eina_Module - check whether the file exists or not, before memory allocation of Eina_Module
Summary:
I got an issue from emotion_basic_example, because my machine has following directories.

/usr/local/lib/emotion/modules/
├── gstreamer
│   ├── linux-gnu-i686-1.7.99
│   ├── linux-gnu-i686-1.8.0
│   └── linux-gnu-i686-1.8.99
└── gstreamer1
    ├── linux-gnu-i686-1.8.99
    └── v-1.10

The defined MODULE_ARCH is v-1.10, and the _emotion_modules which is returned by eina_module_arch_list_get(); has two items.
Because eina_module_new(); creates Eina_Module, even though the "/usr/local/lib/emotion/modules/gstreamer/v-1.10/module.so"
does not exist.

Test Plan: Create directory without MODULE_ARCH, run emotion_basic_example, and check whether it works properly or not.

Reviewers: raster, seoz, Hermet, woohyun, jpeg, cedric

Subscribers: cedric, seoz

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

Signed-off-by: Cedric BAIL <c.bail@partner.samsung.com>
2014-07-21 19:33:27 +02:00
Gwanglim Lee 3d534e87c3 eina: Eina_Tiler - return a NULL if intersection of two tilers doesn't exist
Summary:
change eina_tiler_intersection to return a NULL if intersection
of two tilers doesn't exist. and add test case to check it.

This doesn't break ABI/API as this call could already return a NULL value and it
should have been handled by the caller anyway. This just make an expected behavior
more correct.

Test Plan: run eina_suite after building eina test suite

Reviewers: cedric, raster, torori, devilhorns

Subscribers: cedric

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

Signed-off-by: Cedric BAIL <c.bail@partner.samsung.com>
2014-07-21 19:33:27 +02:00
Carsten Haitzler 7a7d3be140 eina - fix eina-module warning with global + stop using gcc extn for file 2014-07-18 08:05:25 +09:00
Cedric BAIL 1eccc2824f eina: forgotten return value. 2014-07-17 17:51:22 +02:00
Vincent Torri f61f8d30fc eina: make error message more precise. 2014-07-17 17:51:22 +02:00
Carsten Haitzler 45f01bd11c eina - thread queue - fix block pool shutdown 2014-07-16 20:43:32 +09:00
Carsten Haitzler 3c130836ad new eina api/object - eina thread queues
@feature

This is a new feature for eina (and EFL) - a zero-copy thread message
queue for sending messages from one thread to another or from the
ecore mainloop to or back to the mainloop from threads. It has a
complete test suite too.
2014-07-15 20:39:13 +09:00
Cedric BAIL 72aca66f8d eina: win32 and linux version code are the same. Sharing code is better. 2014-07-14 15:46:54 +02:00
Cedric BAIL f15fc9b0a5 eina: simplify logic. 2014-07-14 15:46:54 +02:00
Vincent Torri 4d68dfe603 eina: (Windows) fix creation of files with eina_file_open() in some cases
@fix
2014-07-13 15:17:46 +02:00
Vincent Torri ea8b4c82ed eina: call the function, then return 2014-07-13 15:17:34 +02:00
Vincent Torri 9631585f24 efl: remove Windows CE support 2014-07-13 15:17:17 +02:00
Cedric BAIL 8062d5d7e9 eina: make it possible to load module symbol into the global namespace. 2014-07-11 15:32:51 +02:00
ChunEon Park cc68ef1f22 eina - fixed typo 2014-07-07 20:22:06 +09:00
Cedric BAIL 201d9b567d windows: make those warning explicit about what they imply. 2014-06-27 17:00:23 +02:00
Cedric BAIL 546af159ff eina: silence warning of unused parameter on Windows. 2014-06-27 13:24:39 +02:00
Cedric BAIL 815002bcfc eina: use the right function prototype on Windows. 2014-06-27 13:24:39 +02:00
MinJeong Kim aa5e2c6132 eina-tiler: Fix invalid read on eina tiler
Summary:
Fix invalid read on eina tiler reported by valgrind.
This revision will prevent access to data that was gained from eina iterator, after free of eina_iterator.

Test Plan:
1. Build enlightenment on devs/devilhorns/e_comp_wl branch with efl applyied this patch.
2. Run enlightenment with valgrind options.
3. build enlightenment with this patch
4. Run any wayland app on enlightenment
5. There will be no more invalid read message by valgrind.

Reviewers: cedric, devilhorns, raster, gwanglim, zmike

CC: cedric

Differential Revision: https://phab.enlightenment.org/D1080
2014-06-24 09:00:56 -04:00
Cedric BAIL 6dbdbee453 eina: fix build on windows.
Add necessary include for proper compilation.

@fix
2014-06-24 10:25:27 +02:00
Rajeev Ranjan 7a35f5ffdb evas: fix invalid read reported in eina_rectangle_pool_free by valgrind.
Summary:
This fixes an invalid read reported by valgrind in eina_rectangle_pool_free
Reference: T1360

Signed-off-by: Sanjay Nirankari <sanjay.n1@partner.samsung.com>
Signed-off-by: Rajeev Ranjan <rajeev.r@samsung.com>

Reviewers: cedric, raster

Reviewed By: cedric

CC: sreedeep.m, sanjay, cedric

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

Signed-off-by: Cedric BAIL <c.bail@partner.samsung.com>
2014-06-20 10:12:07 +02:00
Cedric BAIL 279fdd9c07 eina: don't leak ressource due to the use of CreateThread on Windows. 2014-06-20 09:47:06 +02:00
Rajeev Ranjan bd65b5db5d evas: improvement of Eina Rectangle Pool and integration with Evas GL backend.
Summary:
This patch introduce various new logic for packing/unpacking of Eina Rectangle in a pool.
It is then used by Evas GL backend texture allocation to improve how efficiently we pack
image in texture atlas. This lead to improved memory usage and reduced power consumption
with usually a more stable higher FPS (as it use less texture to do the same task, their
is less texture switch, so saving memory and speed at the same time).

This patch was developped on Cedric's suggestions to optimize the packing logic using Skyline
algorithm. This patch is based on master and is a new submission for earlier phab link
https://phab.enlightenment.org/D774.

Signed-off-by: Sanjay Nirankari <sanjay.n1@samsung.com>
Signed-off-by: Rajeev Ranjan <rajeev.r@samsung.com>
Signed-off-by: Sreedeep Moulik <sreedeep.m@samsung.com>

Reviewers: cedric, raster

CC: wonsik, jpeg, sreedeep.m, sanjay, govi

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

Signed-off-by: Cedric BAIL <c.bail@partner.samsung.com>
2014-06-19 16:48:45 +02:00
Gwanglim Lee e3f4f4457d eina-tiler: fix crash when trying to check intersection between two tilers
Summary:
If one of the given tilers is empty, then crash could be occurred in internal while loop of eina_tiler_intersection.
And fix some memory leaks in eina_tiler_intersection and eina_tiler_equal.

Reviewers: devilhorns, raster, cedric, torori

CC: cedric

Differential Revision: https://phab.enlightenment.org/D996
2014-06-12 12:40:24 +09:00
Cedric BAIL adbb9ca1e3 eina: fix possible access to NULL.
CID 1039422.
2014-06-05 22:50:20 +02:00
Cedric BAIL caa2ec1b29 eina: leave a comment for CID 1039688. 2014-06-05 22:26:07 +02:00
Cedric BAIL 2dd6e7f302 eina: fix typo in matrixsparce.
CID 98417.
2014-06-05 22:18:59 +02:00
Cedric BAIL 30a3df4c5c eina: removing more dead code looking for strange int.
CID 98377.
2014-06-05 03:30:43 +02:00
Cedric BAIL 344690554a eina: removing more dead code that expect strange int.
CID 1039941.
2014-06-05 03:29:16 +02:00
Cedric BAIL 74121c14cd eina: remove logically dead code.
I am wondering why this code was around, an useless variable and an if
that would never be taken...

CID 1039940.
2014-06-05 03:24:46 +02:00
Cedric BAIL c33acef5d7 eina: remove logically dead code.
Removing this code let me wonder what could be an int value that is not 0,
not < 0 and not > 0...

CID 1039938.
2014-06-05 03:22:27 +02:00
Cedric BAIL 8f817ff4a0 eina: let's check for returned value of realloc.
CID 1039689.
2014-06-05 03:20:56 +02:00
Cedric BAIL b67860e98f eina: remove logically dead code.
The for loop above would exit with at least length = 0, so < 0 is
just impossible.

CID 1039943.
2014-06-05 03:10:43 +02:00
Cedric BAIL f7fd1f1c84 eina: simplifie logic to not go with multiple level of callback for just getting the first entry in a hash.
CID 1039937.
2014-06-05 03:02:06 +02:00
Cedric BAIL ba53bf8533 eina: fix possible memory leak on failure in eina_tiler_equal.
CID 1216618, 1216615, 1216614.
2014-06-05 02:51:54 +02:00
ChunEon Park 328d28a7f4 eina/file - revert 18be4c50d9
I realized that's not a bug in eina but user usage was inccorect.
revert the patch

@fix
2014-05-31 18:34:48 +09:00
Guillaume Friloux 619987bc2e Remove warning by adding eina_cpu.h which expose eina_cpu_page_size() 2014-05-30 10:25:05 +02:00
Guillaume Friloux 88b3db4ccf Removed double inclusion of eina_thread.h 2014-05-30 10:04:45 +02:00
Guillaume Friloux a6240d9874 Fix warnings in eina_thread.c 2014-05-30 10:01:42 +02:00
Guillaume Friloux 19e0422adf Fix warnings on calls to iconv, on freebsd. 2014-05-30 09:31:11 +02:00
Guillaume Friloux 3ab1b8afd8 Fix unused var warning when not building on linux. 2014-05-30 09:25:33 +02:00
Jean-Philippe Andre f4a0c8054f Win64: Fix a bunch of warnings
Fix invalid casts.
Use printf("%z") where appropriate.
Fix unused variables warnings.

Thanks vtorri for the patch.

@fix
2014-05-29 20:02:16 +09:00
MinJeong Kim 61cecf1f3f eina-tiler:add union, subtract, intersection, equal apis for tilers
Summary:
Support union, subtract, intersection, equal(comparison) between tilers.
@feature

Test Plan: Test with added test case(src/tests/eina/eina_test_tiler.c) and the example(src/examples/eina/eina_tiler_02.c)

Reviewers: gwanglim, devilhorns, raster, zmike, cedric

CC: cedric

Differential Revision: https://phab.enlightenment.org/D880
2014-05-28 16:51:30 +09:00
Jérémy Zurcher f8c2c57406 do not use EINA_FALSE instead of NULL 2014-05-07 17:45:11 +02:00
Mike Blumenkrantz a3927ca1a7 eina_value_free() now takes NULL like the rest of the efl free functions 2014-04-26 02:21:51 -04:00
Mike Blumenkrantz b550d5becb eina_hash now has helper functions for managing lists inside hashes
@feature
2014-04-25 10:52:15 -04:00
Daniel Kolesa eeb53222d0 eina: a highly irritating error in eina_file documentation 2014-04-09 15:48:41 +01:00
Jean-Philippe Andre e50bcc937c Eina: Fix mistake in a previous patch
Suffix length was not computed properly.
Also, the change on eina_mkstemps was a @feature:
add file extension support when creating temporary files
2014-04-02 14:53:00 +09:00
Jean-Philippe Andre 0fdb02fb51 Eina: Add support for file extensions in eina_mkstemp
Using mkstemps
2014-04-02 11:54:44 +09:00
Jeff Grimshaw 74556a3f90 efl/eina: Update documentatin for Eina Lock
Summary: Updated documentation for Eina Lock and related files.

Test Plan: Reviewers

Reviewers: cedric, raster

CC: cedric, raster

Differential Revision: https://phab.enlightenment.org/D650
2014-03-25 17:30:43 +09:00
Jeff Grimshaw cf5192025f efl/eina: General cleanup of Eina documentation
Summary:
I've combed through the Eina source files and made enhancements to the
documentation, including:
- Document the undocumented
- Fixed some errors in Doxygen markup
- Moved some function documentation from implementation (.c or .x) to definition
  (.h)
- Edited some of the entries to improve clarity

Test Plan: Reviewers

Reviewers: cedric

Reviewed By: cedric

CC: cedric

Differential Revision: https://phab.enlightenment.org/D639
2014-03-20 16:35:42 +09:00
Tom Hacohen c6589ffc19 Eina Log: Fixed ABI break introduce by the addition of 'color'.
ABI break was introduced here 5913ce7ec8

Always add new members at the end of public structures.
2014-03-10 16:50:13 +00:00
Felipe Magno de Almeida 416376e03c eina-cxx: Added eina_log support for C++, using IOStreams syntax
Summary:
Added eina_log support for C++ using the following macros:

For logging into a domain:

EINA_CXX_DOM_LOG
EINA_CXX_DOM_LOG_CRIT
EINA_CXX_DOM_LOG_ERR
EINA_CXX_DOM_LOG_INFO
EINA_CXX_DOM_LOG_DBG
EINA_CXX_DOM_LOG_WARN

And for logging into the default domain:

EINA_CXX_LOG
EINA_CXX_LOG_CRIT
EINA_CXX_LOG_ERR
EINA_CXX_LOG_INFO
EINA_CXX_LOG_DBG
EINA_CXX_LOG_WARN

The usage is simple as can be seen in the tests:

  efl::eina::log_domain domain("error_domain_name");
  domain.set_level(efl::eina::log_level::critical);
  EINA_CXX_DOM_LOG_CRIT(domain, "something went wrong with the following error: " << error);

@feature

Reviewers: cedric

CC: raster, savio, cedric, sanjeev

Differential Revision: https://phab.enlightenment.org/D605
2014-03-10 12:35:00 +09:00
Sylvain Laperche 53e0a2d6bd eina: Fix bug in eina_convert_itoa
The current implementation of eina_convert_itoa cannot convert INT_MIN.

When the input number is negative, the function negates it and this is
an undefined behavior for INT_MIN since -INT_MIN cannot be represented
in a signed int.

@fix T1062

Signed-off-by: Cedric BAIL <cedric.bail@samsung.com>
2014-03-07 14:17:28 +09:00
Cedric BAIL c3e0f5c4ef eina: make Eina_Error thread safe.
@feature
2014-03-06 14:27:26 +09:00
Daniel Juyung Seo 13d1e5dcf0 eina_list: Optimize eina_list_nth() call in case of index 0.
Check null and return the list data directly if the index 'n' is 0.
2014-03-04 00:03:01 +09:00
Andy Williams 5913ce7ec8 eina_log: Update domain colouring when color_disable_set is called
After color_disable is set we should update the domain_str for each domain
as this cached the setting from when the domain was registered.
This required storing the colour within the domain for later use.
Fixes T1029
2014-02-26 04:02:33 +00:00
Cedric Bail 255dec60b6 eina: fix Windows compilation due to a typo. 2014-02-25 18:34:24 -03:00
Felipe Magno de Almeida d63507446f eina: add eina_accessor_clone and update all Eina_Accessor to take advantage of it.
@feature.

Signed-off-by: Cedric Bail <cedric.bail@free.fr>
2014-02-25 18:04:47 -03:00
Felipe Magno de Almeida 794bbcbca8 eina: add eina_inarray_resize @feature.
Signed-off-by: Cedric Bail <cedric.bail@free.fr>
2014-02-25 17:33:36 -03:00
Cedric Bail f5f9e44219 eina: reduce log to warning when not found. 2014-02-22 16:37:15 +09:00
Cedric BAIL 58f424a199 eina: add more debug information when failing to open a file. 2014-02-21 17:13:09 +09:00
Rajeev Ranjan 743d7da92f eina: fix in eina_rectangle_pool to make sorting effective
Summary: This patch fixes the bug related to sorting not happening in eina_rectangle_pool

Reviewers: cedric, raster, seoz, Hermet

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

Signed-off-by: Cedric BAIL <cedric.bail@samsung.com>
2014-02-14 10:04:15 +09:00
Albin Tonnerre ed06184077 eina: allow eina_time_get to fall back to other clocks if the first one fails
Summary:
eina_time_get tries to use only one clock which is defined at compile-time and
returns the result of that one. This causes problems on platforms where eg.
CLOCK_PROCESS_CPUTIME_ID is defined but the clock is actually not implemented
(ie. clock_gettime returns EINVAL), as we simply don't get any time at all.

Instead, make sure we include the code for all defined clocks and simply fall
back to other clocks if the previous ones aren't implemented.

Reviewers: cedric, raster

Reviewed By: cedric

CC: cedric

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

Signed-off-by: Cedric BAIL <cedric.bail@samsung.com>
2014-02-12 11:51:00 +09:00
Cedric BAIL 90cd40753d Patcna: fix wrong widgth and height in eina_rectangle computation logic.
Reviewers: cedric, raster, seoz, Hermet, bluezery

Reviewed By: cedric

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

Signed-off-by: Cedric BAIL <cedric.bail@samsung.com>
2014-02-03 15:35:44 +09:00
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
Cedric BAIL da559ee5d0 eina: use portable infrastructure to detect page size. 2013-11-10 09:26:12 +01:00
Cedric BAIL ecaca1d365 eina: detect page size in a portable way. 2013-11-10 09:25:16 +01:00
Cedric BAIL 81d2dc2681 eina: let's try to reduce the covered 64bits system. 2013-11-09 15:26:24 +01:00
Cedric Bail e6c4bcc57d eina: let pass the right size. 2013-11-09 20:43:20 +09:00
Cedric Bail 44f539e1a3 eina: fix eina_hash_int64 on Windows system. 2013-11-09 20:07:27 +09:00
Cedric Bail 926f4c5e84 efl: detect 64 bits correctly. 2013-11-09 19:48:31 +09:00
Ryuan Choi ec1ba32690 eina: Avoid increasing required alignment of target type warning on ARM in Eina_Hash.
Summary:
When building applications with -Wcast-align on ARM, there are following warnings.
increases required alignment of target type warnings. This impact eina_hash_murmur3.

Reviewers: cedric, seoz

Reviewed By: cedric

CC: cedric

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

Signed-off-by: Cedric Bail <cedric.bail@samsung.com>
2013-11-05 15:45:56 +09:00
Carsten Haitzler b07c0a76ce alpha1 release autofoo/build tree work to pass distcheck and actually work 2013-11-04 18:33:35 +09:00
Cedric Bail 613947ac0d eina: make eina_cow_free reset the pointer to the default read only value. 2013-11-04 12:45:25 +09:00
Cedric Bail 687e4ae744 eina: roll const into Eina_File API.
Note that eina_file_dup is const from the caller perspective as it
will return a fresh "non const" Eina_File that it will be able to
manipulate as it like.
2013-11-04 11:26:59 +09:00
Carsten Haitzler 9337af1187 eina thread - make note about valgrind complaint that is bogus 2013-11-03 20:51:41 +09:00
Jérémy Zurcher 1eb85fe746 fix raster's typo 2013-10-30 22:41:13 +01:00
Cedric Bail e35c7b19fb eina: long forgotten function in Eina_File for Windows. 2013-10-28 19:47:40 +09:00
Cedric Bail 570ce667f3 eina: fix API as we don't and never will touch memory for write in that function. 2013-10-28 18:32:40 +09:00
Cedric Bail 60a34c1cd0 eina: avoid possible race condition when unreffing an Eina_File. 2013-10-28 18:32:40 +09:00
Cedric Bail 91e76f791d eina: honor string length in eina_tmpstr_add_length. 2013-10-16 18:56:32 +09:00
Cedric Bail 46447c95aa eina: just for a little bit of better portability. 2013-10-16 16:54:36 +09:00
Sebastian Dransfeld 0b26b1bd89 eina: And guard the right function with umask
Thanks Cedric.
2013-10-16 04:56:51 +02:00
Sebastian Dransfeld 7576ff00f3 Set secure file permissions for temporary file
From glibc mkstemp man page:
       In glibc versions 2.06 and earlier, the file is created with
       permissions 0666, that is, read and write for all users.  This old
       behavior may be a security risk, especially since other UNIX flavors
       use 0600, and somebody might overlook this detail when porting
       programs.  POSIX.1-2008 adds a requirement that the file be created
       with mode 0600.

       More generally, the POSIX specification of mkstemp() does not say
       anything about file modes, so the application should make sure its
       file mode creation mask (see umask(2)) is set appropriately before
       calling mkstemp() (and mkostemp()).

And:
	http://cwe.mitre.org/data/definitions/377.html
2013-10-16 04:28:53 +02:00
Carsten Haitzler f93329d119 Revert "eina: fix CID 1106340: Logically dead code (DEADCODE) reported by coverity."
This reverts commit 1c1b48ca64.

this commit is causing all sorts of hell and crashes, hangs and what
not. like:

Thread 1 (Thread 0x7feb7389e780 (LWP 7149)):
No symbol table info available.
No symbol table info available.
    at lib/eina/eina_inlist.c:422
            l = 0xf38a50
                    __FUNCTION__ = "eina_inlist_demote"
                    #3  0x00007feb6a809867 in
_eina_chained_mempool_alloc_in (
    pool=pool@entry=0x8650a0, p=p@entry=0xf38a50)
        at modules/eina/mp/chained_pool/eina_chained_mempool.c:197
                mem = 0xf3a690
                #4  0x00007feb6a809dff in eina_chained_mempool_malloc
(data=0x8650a0,
    size=<optimized out>)
        at modules/eina/mp/chained_pool/eina_chained_mempool.c:300
                pool = 0x8650a0
                        p = 0xf38a50
                                mem = <optimized out>
                                #5  0x00007feb6a7e451f in
eina_mempool_malloc (size=40, mp=<optimized out>)
    at lib/eina/eina_inline_mempool.x:103
    No locals.
    #6  _eina_list_mempool_list_new (list=0x7feb5402a510)
        at lib/eina/eina_list.c:199
        No locals.
        #7  eina_list_append (list=0x7feb5402a510, data=0xf41720)
            at lib/eina/eina_list.c:534
                    l = <optimized out>
                            __FUNCTION__ = "eina_list_append"
                            #8  0x0000000000445d1a in
e_bindings_signal_add (ctxt=<optimized out>,
    sig=0x947e6c "mouse,clicked,[12]", src=0x92248c "e.event.close",
        mod=E_BINDING_MODIFIER_NONE, any_mod=1, action=0x93479c
"window_close",
    params=0x0) at e_bindings.c:1036
            binding = 0xf41720
            #9  0x00000000004469d4 in e_bindings_init () at
e_bindings.c:68
        ebs = 0x947df0
                ebm = <optimized out>
                        ebw = <optimized out>
                                ebe = <optimized out>
                                        ebk = <optimized out>
                                                eba = <optimized out>
                                                        l = 0x9532e0
                                                        #10
0x0000000000437516 in main (argc=<optimized out>, argv=<optimized out>)
    at e_main.c:941
            safe_mode = 0 '\000'
                    after_restart = 1 '\001'
                            waslocked = 0 '\000'
                                    t = <optimized out>
                                            tstart = <optimized out>
                                                    s = <optimized out>
                                                            buff =
"1381800872.3", '\000' <repeats 19 times>
        action = {__sigaction_handler = {
                    sa_handler = 0x4fca00 <e_sigabrt_act>,
                                sa_sigaction = 0x4fca00
<e_sigabrt_act>}, sa_mask = {__val = {
              0 <repeats 16 times>}}, sa_flags = -1073741820,
                        sa_restorer = 0x0}
                                __FUNCTION__ = "main"
                                Detaching from program:
/usr/local/bin/enlightenment, process 7149
2013-10-15 10:42:26 +09:00
Cedric BAIL 1c1b48ca64 eina: fix CID 1106340: Logically dead code (DEADCODE) reported by coverity. 2013-10-14 13:32:46 +02:00
Cedric Bail 68a4e85483 eina: that stuff was just for adding a bug in fact. 2013-10-11 17:30:35 +09:00
Carsten Haitzler 69e27abdc3 eina - and e3fl in general - stop using eina_error_get/set - useless really 2013-10-11 16:50:40 +09:00
Cedric Bail 0aa77d7dde eina: use Eina_Spinlock in Eina_Stringshare instead of Eina_Lock. 2013-10-11 11:08:17 +09:00
Cedric Bail 82d86ea42d eina: use Eina_Spinlock for Eina_Log. 2013-10-11 11:08:17 +09:00
Cedric Bail 1b07350a46 eina: add Eina_Spinlock API. 2013-10-11 11:08:17 +09:00
Cedric Bail fe25608edd eina: handle more compiler strangeness for bswap.
So current order is :
- __builtin_bswap*() for compiler that provide it
- _byteswap_*() for MSVC
- bswap_*() for older Linux and some BSD
- own C code when everything else fall appart.

The reason for this order is that the builtin will always generate
the best assembly possible. On my system bswap_*() are not changing
in all version to the best solution as they are almost equivalent to
the C macro.
2013-10-04 12:49:02 +09:00
Cedric Bail d52f825de6 eina: in case of an error we should exit not continue and manipulate dead data.
This should fix a warning catched by LLVM/Clang.
2013-10-04 10:56:05 +09:00
ChunEon Park 18be4c50d9 eina/eina_file - fix eina_file_map_lines() to not drop of one character in the last line. 2013-10-04 01:58:35 +09:00
Cedric Bail ff3d2a68d5 eina: add infrastructure to handle more CPU and compiler builtin information. 2013-10-02 20:54:50 +09:00
Tom Hacohen de6f57fac0 Eina inlist: Removed redundant if in EINA_INLIST_FOREACH_SAFE.
If it is not NULL, so will EINA_INLIST_GET. As that returns a pointer to an
area after it.
2013-09-30 14:28:38 +01:00
Cedric Bail 295babadb1 eina: check if the complete hash match before checking if the key match during children walk.
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.

This idea was given by Lucas De Marchi's blog :
http://www.politreco.com/2013/09/optimizing-hash-table-with-kmod-as-testbed/

I do believe that rolling a crc32 implementation as a hash function should give interesting result
in our test.
2013-09-26 15:51:25 +09:00
Lucas De Marchi ad76ce025c Revert "eina: add functions to alloc strings from a printf fmt"
This reverts commit b5fce696c7 and fixes
to NEWS and @since that came later.

These functions are pretty trivial and their functionality can be
obtained with asprintf() and snprintf. The first is not available only
on windows, but there's an implementation for that one on Evil, that
should be used instead.
2013-09-25 22:51:03 -03:00