Commit Graph

1022 Commits

Author SHA1 Message Date
Andy Williams bf8a0eead2 OSX: fix version detection in build 2017-07-17 13:04:30 +01:00
Carsten Haitzler 9d1a8bb082 eina debug bt sig handle - fix build on osx for clockid_t
fix #ifdefs so it should in theory build on osx 10.11.x

@fix
2017-07-17 16:04:01 +09:00
Mike Blumenkrantz 83ff889f6d eina: fix eina_tiler_equal to not always return true
ref e3f4f4457d
broken by D996

@fix
2017-07-14 18:43:00 -04:00
Mike Blumenkrantz 47ddbede05 eina: make tiler function params const where appropriate
stop throwing warnings when passing const params to functions which don't
modify the params
2017-07-14 18:43:00 -04:00
Stefan Schmidt 9e3ff96f7b eina: inarray: remove documentation pointer to non-existing functions
These do not longer exist in our current code base (did they ever?).

Thanks a lot to Vincent Torri for spotting this!
2017-07-13 11:21:59 +02:00
Al Poole 9aeaef55c4 eina_file: fix unmap of unmapped region when Eina_File has copied data and not a map;
Summary:
This was causing problems on non-Linux architectures as eina_file_real_close unmapped not mapped data. Added a "copied" flag to Eina_File which is set on eina_file_virtualize (on copied data), and tested for when eina_file_real_close does the unmap. I'm surprised Linux allowed this. Certainly all of the BSDs crashed with the previous behaviour.

@fix T5479

Test Plan: Example inlcude Rage and Enlightenment Thumb on BSD systems which use eina_file_virtualize with emotion to obtain album artwork.

Reviewers: raster, cedric, jpeg

Reviewed By: jpeg

Maniphest Tasks: T5479

Differential Revision: https://phab.enlightenment.org/D5006
2017-07-07 13:22:53 +09:00
Carsten Haitzler eeb1eb1b74 eina - fix eina_file_virtualize to copy data to an aligned addr
so we copy data to an UNALINED memory address (just after whatever
string we packed on the end of the eina file struct header). this is
bad. especially for non-intel architectures. this forces a 16 byte
alignment which should cover us.

@fix
2017-07-07 12:08:01 +09:00
Jean-Philippe Andre daf87093f8 eina file: Fix rare crash in line iteration
I'm not sure about the rest of this code, so it's possible that
the index is increased even if it shouldn't. But I've observed
a crash at this line, apparently when reaching the end pointer.
2017-07-03 16:23:40 +09:00
Jean Guyomarc'h 077791b7cc eina,ecore_cocoa: fix detection of the macOS SDK version
There was trouble with Homebrew's CI to build EFL on a macOS < 10.12
which uses a 10.12 SDK. See PR #13252 on github, Homebrew/homebrew-core
for details.

@fix
2017-06-27 23:14:31 +02:00
Mike Blumenkrantz 7b4e9f5d77 eina_log: make a log level of 0 disable the log domain
this has always been specified in the docs as the means by which a log domain
is disabled

@fix
2017-06-23 17:43:44 -04:00
Daniel Zaoui 716cc6be5b Eina Debug: include Evil for realpath support 2017-06-11 10:03:53 +03:00
Daniel Zaoui 0e947166aa Eina Debug: fix a bug resulting in registering opcodes twice
The opcodes registration request is sent directly in case the connection
is already made. Otherwise, the request is waiting for the connection to
be made by the dedicated thread (not the main loop).
That's why the request can be sent by the two different threads at the
same time, leading to send it twice. It means a callback for an opcode
would be invoked twice everytime a request with this opcode is received.

This patch fixes it by checking if the request has already been sent.
2017-06-11 09:44:57 +03:00
Al Poole a7e8dff3e4 eina: fix implicit declaration of pthread_set_name_np in eina_debug.
Summary: Checks and includes necessary headers (FreeBSD et. al)

Reviewers: cedric

Subscribers: jpeg

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

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2017-06-08 13:36:25 -07:00
Cedric BAIL 634715a2ca eina: as we use string.h function in this inline function, we better include it.
Reported by @netstar, thanks.
2017-06-08 11:41:39 -07:00
Cedric BAIL 1aa2b6de14 eina: enable fallthrough warning suppression only on GCC 7 and above. 2017-06-06 09:57:14 -07:00
Jérémy Zurcher 81bcc14615 eina: fix clang compilation with EINA_FALLTHROUGH
btw, using clang 4.0.0, I can't produce fallthrough warnings using
-Weverything, -Wall or -Wimplicit-fallthrough
2017-06-06 09:58:06 +02:00
Cedric BAIL 2995cc16b7 eina: add EINA_FALLTHROUGH to disable warning on useful case serie with no break.
GCC has started introducing a detection for series of case in a switch statement
without break for each case. We do use that trick a lot to reduce our code base.
Even if in most case we have documented this so that people using coverity don't
try to fix it. Now with GCC we need to silence it properly to avoid future
problem.
2017-06-05 12:07:57 -07:00
Cedric BAIL e83914d496 eina: silence gcc warning.
Code is correct and won't lead to a case where size is > 0 and buffer
isn't set, but gcc can't see the relation between both variable.
2017-06-05 12:07:57 -07:00
Jean Guyomarc'h cc4c40769d eina: attempt to make the code more portable
This fixes the build on macOS.
2017-06-05 19:06:35 +02:00
Jeeyong Um 89c55209cf Eina_Debug: Fix missing include of signal.h 2017-06-05 20:18:46 +09:00
Daniel Zaoui fa3e54b15e Eina_Debug: Fix config.h usage
It was used inside eina_debug.h that is a public header.
Terminology compilation was failing when including its own config.h.
2017-06-05 11:49:08 +03:00
Daniel Zaoui c0eb231edb Fix Windows compilation
Thanks to vtorri for his help on this delicate issue named Windows
2017-06-05 08:55:38 +03:00
Daniel Zaoui 897fc331ce Set Eina Debug APIs as Beta 2017-06-05 08:55:38 +03:00
Daniel Zaoui ea50cbd2b3 Support endianness 2017-06-05 08:55:38 +03:00
Daniel Zaoui 758bb0557c Support opcodes registration for Windows
A standard static array with symbols whose addresses are only known at
runtime is not supported in Windows.
2017-06-05 08:55:38 +03:00
Daniel Zaoui ab01f3f696 Rename opcodes for a better readability 2017-06-05 08:55:38 +03:00
Daniel Zaoui 9e47089311 Remove alloca of potential big size 2017-06-05 08:55:38 +03:00
Daniel Zaoui 6e1eb7193d Bt: Remove special handling for mainloop 2017-06-05 08:55:38 +03:00
Daniel Zaoui 253d3ffe44 Remove thread management
The handling to forward requests is let to the callbacks.
2017-06-05 08:55:37 +03:00
Daniel Zaoui 2ff96adcc1 Removes modules feature 2017-06-05 08:55:37 +03:00
Daniel Zaoui 6e93528f41 Init the communication with the daemon from the debug thread 2017-06-05 08:55:37 +03:00
Daniel Zaoui d6e3ab67db Replace shell remote connection with localhost TCP connection 2017-06-05 08:55:37 +03:00
Daniel Zaoui 36959014d3 Remove _session variable as it is not needed anymore 2017-06-05 08:55:37 +03:00
Daniel Zaoui 27228d3dc1 Add data to opcode registration callback 2017-06-05 08:55:37 +03:00
Daniel Zaoui 8babb55646 Add API to get/set data to session 2017-06-05 08:55:36 +03:00
Daniel Zaoui d970c855ea Add API to get the session dispatcher 2017-06-05 08:55:36 +03:00
Daniel Zaoui bb87302808 Clean code and add comments 2017-06-05 08:55:36 +03:00
Daniel Zaoui 87e68e3ed0 Adapt bt stuff to Eina Debug signal infras 2017-06-05 08:55:36 +03:00
Daniel Zaoui 9fadbc00ad Move internals constants to private h file 2017-06-05 08:55:36 +03:00
Daniel Zaoui 76e5a8f268 Fix Coverity issues 2017-06-05 08:55:36 +03:00
Daniel Zaoui f5cbb61bf4 Add a better support of timers
Now, the timers are handled in one dedicated thread. Multiple timers are
supported.
2017-06-05 08:55:36 +03:00
Daniel Zaoui 39c6a9562b Add shell remote connection
This feature is essential to debug remote applications.
2017-06-05 08:55:36 +03:00
Daniel Zaoui 5251ee326d Fix typo 2017-06-05 08:55:36 +03:00
Daniel Zaoui 6ad0d6ab22 Free packet buffer outside of the dispatcher 2017-06-05 08:55:36 +03:00
Daniel Zaoui cd8b2fc66b Close file descriptor when the session is terminated 2017-06-05 08:55:36 +03:00
Daniel Zaoui 5f268ec26a First patch of the Eina Debug layer rewriting
Eina Debug is a new layer aimed for EFL debugging. It offers scalability
by allowing registration of operations not specific to EFL core.

The protocol is simple and the APIs try to provide as much
functionalities/freedom as possible.
2017-06-05 08:51:49 +03:00
Jeeyong Um 0e78ecb325 eina: Fix broken link in doc to introduce integer hash algorithms 2017-05-30 13:34:34 +09:00
Cedric BAIL 26d401351d eina: fix reproductible build.
This make eina hamster depend on when configure was generated. This
should only happen really when we make a new tarball for release.

@fix

T5495
2017-05-18 16:20:06 -07:00
Prasoon Singh 9c62ab525b eina: fix for escapable charachters not getting escaped if it comes after '\t' or '\n'
Summary:
Escaping is not happening whenever any escapable characters is coming after
'\t' or '\n'. It will also fix invalid read of 1 byte which happens for string where
last charachter is '\t' or '\n' like "eina\t".

Test Plan:
Take a string like "eina\t ". Observe space which is followed by tab is not getting
escaped.

Signed-off-by: Prasoon Singh <prasoon.16@samsung.com>

Reviewers: shilpasingh, rajeshps, govi, cedric

Reviewed By: shilpasingh

Subscribers: cedric, jpeg

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

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2017-05-09 10:37:16 -07:00
Mike Blumenkrantz ab67217434 eina_tiler: use int size matching Eina_Rectangle internally to avoid overflow
since this code's creation it seems that the internal int size was set to use
short in order to micro-optimize memory usage, while the api function parameters
used Eina_Rectangle which had a larger int size. when initializing the internal
rect struct, this would lead to overflows which resulted in broken tilers which
returned iterators with no valid rects after having valid rects added

test case: run weston-subsurfaces

@fix
2017-04-21 16:16:12 -04:00
Cedric Bail 8187e34741 eina: some architecture don't like prefetch on NULL apparently. 2017-04-21 11:29:38 -07:00
Carsten Haitzler f077fb1e0d eina mmap - fix warnings thanks to missing include
add include for eina_file.h
2017-04-21 16:38:40 +09:00
Carsten Haitzler b26276a7e9 eina debug - fix include of eina_file.h that was missing
fixes new warnings
2017-04-21 16:38:18 +09:00
Cedric BAIL b2893dfc77 eina: use new API eina_file_close_on_exec. 2017-04-18 16:54:03 -07:00
Cedric BAIL 9d8549f7a3 eina: add an API to correctly do close on exec. 2017-04-18 16:53:26 -07:00
Carsten Haitzler 330368c10c eina log - try and fix coverity complaint about integer overflow again
it seems coverity didn't like our checks like if end - start > 0xffff
then dont do anything. this should effectively stop any issues but
seemingly not, so try another way to keep coverity happy.

CID 1361219
2017-04-18 17:30:50 +09:00
Carsten Haitzler f3f032e63f eina log - try and fix coverity complaint about integer overflow again
it seems coverity didn't like our checks like if end - start > 0xffff
then dont do anything. this should effectively stop any issues but
seemingly not, so try another way to keep coverity happy.

CID 1361220
2017-04-18 17:30:50 +09:00
Ivan Furs 0e7ee821cd eina: For Windows fix crash when the file was opened many times.
Summary:
A similar problem as:
    commit 62b469749a

Reviewers: NikaWhite, t.naumenko, an.kroitor, FurryMyad, cedric, raster, vtorri, rimmed

Reviewed By: raster

Subscribers: artem.popov, cedric, jpeg

Tags: #windows, #efl

Differential Revision: https://phab.enlightenment.org/D4788
2017-04-17 11:51:05 +09:00
Gustavo Sverzut Barbieri 13a8842614 eina: fix compilation warning on _WIN32 due missing strndup()
Eina.h will include Evil.h, but those using direct include of internal
headers must include it as well.
2017-03-29 12:44:19 -03:00
Vincent Torri eff7bab48f Eina_Value: strdup() is used, so include string.h 2017-03-27 08:22:06 +09:00
Artem Popov 8d6c90351c Eina_Xattr: fix memory corruption
Summary:
There should be reallocation +1 (for last '\0') and also
checking >0, not !=0, because of getxattr can return -1 in case of error
@fix

Reviewers: cedric, raster, NikaWhite, jpeg

Reviewed By: NikaWhite

Subscribers: myoungwoon

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D4734
2017-03-23 16:27:22 +02:00
Marcel Hollerbach 12d01c1259 eina_debug: do not leak a spinlock when the path is not given 2017-03-18 22:10:43 +01:00
Ivan Furs 4d13273e3b eina_file: fixed T2244
Summary:
dirty fix for 'eet' problems with file deletion on WINDOWS
to work with the commit: D4698, D4699

Reviewers: cedric, NikaWhite, rimmed, vtorri, raster

Reviewed By: cedric

Subscribers: artem.popov, cedric, jpeg

Maniphest Tasks: T2244

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

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2017-03-15 10:49:55 -07:00
Chris Michael 3fa7570bda eina: Fix more typo in doxygen
The eina_(rw)_slice_startswith functions both incorrectly describe how
the 'prefix' parameter is used, so fix those also

@fix

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2017-03-13 15:50:37 -04:00
Chris Michael 47f34bb7a3 eina: Fix typo in doxygen
eina_(rw)_slice_startswith functions both incorrectly describe the
return value as 'slice ends with', when clearly the function is used
to find if a slice 'starts with' a prefix

@fix

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2017-03-13 12:11:46 -04:00
Cedric Bail 4766316935 eina: force copy of not copied virtualized file while doing an eina_file_dup.
The other way around is pretty much impossible as you don't know who does
an eina_file_dup and for how long they keep there reference.

T5234
2017-03-08 12:24:41 -08:00
Ivan Furs 8a10ef10cb eina_file: delete handle->fm(handel of function CreateFileMapping)
Summary: CreateFileMapping return handle. The handle before use is always closed. This handle can be immediately closed after use.

Reviewers: cedric, raster, vtorri, rimmed, an.kroitor, FurryMyad, NikaWhite

Reviewed By: raster

Subscribers: artem.popov, cedric, jpeg

Tags: #windows

Differential Revision: https://phab.enlightenment.org/D4699
2017-03-06 19:18:46 +09:00
Marcel Hollerbach 86fe6609c2 eina: move the _eina_main_loop set before we init anything
otherwise we could get into problems.

fix T4891

@fix
2017-02-28 11:46:56 +01:00
Jean-Philippe Andre 1974f5d511 eina_value: Fix min/max values of long for Windows
long is 32 bit on Windows (both 32, 64 bit).

I wonder why eina_value doesn't simply use LONG_MIN/MAX O_o

Fixes T5204
2017-02-28 16:25:18 +09:00
Flavio Ceolin 1cbd32aca1 eina:list: Fix resource leak
Summary:
The usage of the macro EINA_MAGIC_CHECK_LIST can
lead (in some cases) to leaks.

Signed-off-by: Flavio Ceolin <flavio.ceolin@gmail.com>

Reviewers: jpeg

Reviewed By: jpeg

Subscribers: cedric, jpeg

Differential Revision: https://phab.enlightenment.org/D4679
2017-02-28 16:00:45 +09:00
Myoungwoon Roy, Kim ec71f6607a docs: Fix typos and some wrong expressions in Eina API reference doxygen.
Summary: I had fixed some typos and some wrong expressions, such as capital letters, singular, and orders of groups in Eina API reference doxygen.

Test Plan: Doxygen Revision

Reviewers: stefan, cedric, raster, Jaehyun_Cho, jpeg

Reviewed By: jpeg

Subscribers: conr2d

Differential Revision: https://phab.enlightenment.org/D4674
2017-02-21 10:46:28 +09:00
Mykyta Biliavskyi 94eaa792c2 eina utils: fix build without getpwent.
If HAVE_GETPWENT isn't defined - the closing brace was missed.
Also prevent situation when strdup() tried to duplicate NULL
pointer, because that could cause segfault.

@fix
2017-02-20 11:29:56 +02:00
Stefan Schmidt 539bc7552b eina_strbuf / eina_ustrbuf: add since tags for newly added APIs
These six have been added in this cycle but missed the since tags.
2017-02-15 12:31:50 +01:00
Stefan Schmidt b9524b6aa5 eina_lock: add since tag to now exposed eina_lock_debug API
This function was static inline before but form 1.19 onwards its EAPI so give
it a since tag.
2017-02-15 12:31:50 +01:00
Stefan Schmidt b6f84653d4 eina: binbuf: add since tags new append_slice and insert_slice APIs 2017-02-15 12:31:50 +01:00
Stefan Schmidt 73349edc19 eina: make the ein_file_unlink symbol availbale form the ein_file header
It was only defined in the c file. Without any documentation, since tag, etc.

tests/eina/eina_test_file.c:855:4: warning: implicit declaration of function ‘eina_file_unlink’
[-Wimplicit-function-declaration]
2017-02-13 14:30:27 +01:00
Carsten Haitzler d04cd6af10 eina inlist - cast container via void ptr to avoid warnings
we really can't do much here but our direct casting causes warnings in
apps or anyone using this macro so keep things silent as our pointer
tricks are actually ok but the compiler can't figure it out.
2017-02-12 14:45:04 +09:00
Carsten Haitzler ba3ac16b62 evlog/log bt - fix size casting tot stop warning when printing errs 2017-02-12 00:32:22 +09:00
Carsten Haitzler 1a481cfe4d eina utils and vpath - use euid not uid if setuid for correct user
was using uid not euid for "if setuid use safe way to get location" -
ie the user that effectively owns the process, not nominally.

@fix
2017-02-09 18:50:15 +09:00
Carsten Haitzler bb9bb20000 eina debug monitor - dont use XDG_RUNTIME_DIR if setuid
avoids possible issues with debug monitor + setuid
2017-02-08 21:19:39 +09:00
Carsten Haitzler 944ce7ef41 elm config - handle profile name of ".." as its obviously invalid
this forbids .., as a profile name in addition to the existing "stip /
from profile name".
2017-02-08 21:19:39 +09:00
Carsten Haitzler 8094893877 eina utils - home and tmp environ - store statitcally and handle setuid
if setuod we dont want to trust HOME environ at all and get it from
passwd file... also we dont want to keep re-getting too... so store
statically as well as tmp.

this also kind of helps CID 1366469
2017-02-08 21:19:39 +09:00
Carsten Haitzler 7b736d20b8 eina share - fix spinlock release if magic check fails on share data
this fixes a potential double spinlock unrelease if magic check fails
on share data. this fixes CID 1367493
2017-02-08 21:19:39 +09:00
Carsten Haitzler 34883a12e7 eina freeq - fix possible seg with NULL freeq and pattern fill logic
this fixes handling of a NULL freeq handle - found by coverity.

fixes CID 1369021
2017-02-08 08:48:35 +09:00
Ivan Furs 808fcf4dae eina_file: add eina_file_unlink
Test Plan: split  D4423 - unlink

Reviewers: raster, vtorri, an.kroitor, jpeg, reutskiy.v.v, NikaWhite, cedric

Reviewed By: cedric

Subscribers: artem.popov, cedric, vtorri, jpeg

Tags: #windows, #efl

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

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2017-02-07 15:14:54 -08:00
Carsten Haitzler 1b53925b4c evlog - fix "remove setting stack var to 0" that broke evlogs
this fixes b38c610c7e - recent commit by
me. bad me! spank!
2017-02-02 14:01:10 +09:00
Carsten Haitzler b44093c193 eina log bt - make it an eaven easier copy & paste to get a bt now
just copy & paste into a terminal and hit enter.
2017-01-31 23:01:50 +09:00
Carsten Haitzler b38c610c7e evlog - remove setting stack var to 0 until it is needed later
we set stack var to 0 even if evlog was off and thus didn't use it.
this cleans up the evlog func a bit and also moves locking until later
so it's locked for the minimum period to punt something into the log
buffer. it's an improvement, but no bug fix.
2017-01-31 23:01:50 +09:00
Derek Foreman 853adace69 eina_evlog: Don't call get_time prematurely
If we're not logging events this generates a lot of wasted system
calls.  They probably don't amount to much, but it's trivial to
get rid of them, and they make a mess when logging with strace.
2017-01-30 15:28:29 -06:00
Gustavo Sverzut Barbieri 85a095f0a8 cmake: fix strlcpy() detection and usage.
Linux usually ship with strlcpy(), but it's inside bsd/string.h and
needs -lbsd.

On BSD it's inside string.h and libc.
2017-01-26 15:53:14 -02:00
Gustavo Sverzut Barbieri f74ca08be9 cmake/eina: check more required functions and link with unwind if found.
unwind is needed for debug, thus link to that.
2017-01-25 19:29:20 -02:00
Gustavo Sverzut Barbieri fd8865d0d0 cmake: EFL_OPTION() now supports DEPENDS to handle conditionals.
This is now used by ENABLE_SYSTEMD and ENABLE_VALGRIND, which moves to
"common.cmake" since they are shared among multiple libraries.

With that I found that LINK_FLAGS is indeed a string, not a CMake List
(space separated, not ";"), then fix that so compilation actually works.
2017-01-25 19:29:20 -02:00
Gustavo Sverzut Barbieri fa92926469 cmake: major rework of check and pkg-config dependencies.
make FUNC_CHECK(), TYPE_CHECK() and HEADER_CHECK() more general and
they can be set to a scope, like "eina", then all symbols are prefixed
with that. The scope is created with CHECK_INIT(), and
EFL_HEADER_CHECKS_FINALIZE() will finish that.

This makes it possible for cmake/config/eina.cmake +
cmake/post/eina.cmake to add stuff to the generated file, better than
hand edit the template.

CHECK_APPEND_DEFINE(name val) is now the base to add symbols to the
generated file in the current scope.

Then convert cmake/config/eina.cmake to use that and match the
autotools values (were a bit off).

This exposed enabling valgrind was broken due incorrect pkg-config
usage with cmake (it's not obvious), it was using just the libraries,
while LDFLAGS are needed to get -L/usr/lib/valgrind. Then also convert
to CFLAGS provided by pkg-config and make that automatic for
PKG_CONFIG_REQUIRES and PKG_CONFIG_REQUIRES_PRIVATE.

Also, eina-mempool modules use valgrind and must use that now that's
propagating correctly.
2017-01-23 23:55:33 -02:00
Gustavo Sverzut Barbieri ec060b4fee cmake/eina: only pthread is public, rt/dl/m are all private. 2017-01-23 19:33:35 -02:00
Marcel Hollerbach f27323395a cmake: eina needs rt
for open_shm
2017-01-23 20:08:55 +01:00
Gustavo Sverzut Barbieri 76e68de5d6 EflMacros: auto-handling of pkg-config files. 2017-01-23 18:23:40 +01:00
Gustavo Sverzut Barbieri d9815a6837 CMake: move eina binaries to single dir, add helper macros.
For one-source directories, be smart and just define SOURCES to that,
will reduce the number of too-simplistic CMakeLists.txt in our tree.

This also fixes problems with libraries, they should be private, not
public. So specify both kinds as different variables.
2017-01-23 18:23:40 +01:00
Gustavo Sverzut Barbieri 3d5abc081f EflMacros: major improvements towards usability.
Stick to one target per directory and remove prefix from variables,
makes it cleaner and easier to use.

Document variables used and use a more consistent name that matches
CMake properties.
2017-01-23 18:23:40 +01:00
Gustavo Sverzut Barbieri dee24c3821 CMake: rework to use some helper macros.
This tries to defines some macros to create a cleaner build system.
2017-01-23 18:23:40 +01:00
Marcel Hollerbach 88283204c1 build: switch eina to half baked cmake 2017-01-23 18:23:40 +01:00
Jean-Philippe Andre ffbc0645e5 eina: Remove EAPI eina_freeq_main_set()
I believe this function is not required and should not be
used by applications. If there is a very good use case to
use your own main freeq, then the API could be added again.

For now, removing the set() is probably the safer option.

Note: the API was introduced in the upcoming 1.19
2017-01-17 14:21:17 +09:00
Jean-Philippe Andre 4550b4cf83 eina: Introduce Eina_Slstr for short-lived strings
Built on top of the new 'postponed' free queue, the short-lived
strings API allows users to return new strings without caring
about freeing them. EFL main loop will do this automatically for
them you at a later point in time (at the end of an iteration).

The APIs provided will either duplicate (copy) or more generally
steal an existing string (char *, stringshare, tmpstr, strbuf),
taking ownership of it and controling its lifetime. Those strings
can then be safely returned by an API. From a user point of view,
those strings must be considered like simple const char *, ie.
no need to free() them and their validity is limited to the
local scope.

There is no function to remove such a string from the freeq.

The short lived strings API is not thread-safe: do not send a
short-lived object from one thread to another.

@feature
2017-01-17 14:20:55 +09:00
Jean-Philippe Andre 4f5e64fdea eina_freeq: Add mode for postponed deletion
While this reuses the existing (but new) infrastructure of
eina_freeq, the mode of operation and objective is very different
from the default freeq.

By default, any object added to the freeq is basically already
freed from the user point of view, and the freeq itself only adds
a tiny layer of memory safety by deferring the actual call to free
and optionally filling the memory blob with a pattern ('wwwww...').
This is mostly thread-safe (requires thread-safe free functions).

This new type I called postponed is intended to store objects that
will be short lived. This is not thread safe as the life of the
objects added to this queue depends on the thread that adds to
the queue. The main intent is to introduce a new API for short-lived
strings.

@feature
2017-01-17 14:05:16 +09:00
Cedric BAIL 8e7d7d9d58 eina: move to use memcmp and rename eina_{flt,dbl}eq to eina_{flt,dbl}_exact. 2017-01-06 15:58:46 -08:00
Cedric BAIL 89f429c0e7 eina: switch to equal FP_ZERO with fpclassify. 2017-01-06 15:58:46 -08:00
Cedric BAIL 8f1c071d6a eina: rename EINA_{FLT,DBL}_CMP to EINA_{FLT,DBL}_EQ. 2017-01-06 15:58:46 -08:00
Mike Blumenkrantz 16d28c6bc8 eina: add macros for determining whether floats are nonzero
this is a commonly-used functionality, so make it faster to write

@feature
2017-01-06 12:57:08 -05:00
Mike Blumenkrantz 1b4c26be8e eina: add functions for warningless exact comparisons of floats
in some cases a user does want to check exact values, so these functions
should be used to indicate this intent

needs windows support

@feature
2017-01-06 12:57:08 -05:00
Marcel Hollerbach 04c0e5609c eina: fix up last commit
i am sorry. I missed that i just freed the string and not the complete
buf. This now really frees the buf.
2017-01-06 13:02:37 +01:00
Marcel Hollerbach 4d6d177ff7 eina_buf: replace eina_strbuf_free_return with eina_xXxbuf_release
The api name free_return wasnt a good choice so it is changed to
release. This also moves the implementation to binbuf template so it is
available in all buf types.
2017-01-06 12:45:27 +01:00
Carsten Haitzler c7d23534d9 eina - fix redefinition of word size if already defined 2017-01-06 19:25:50 +09:00
Cedric BAIL 273238d725 eina: try to provide __WORDSIZE to system that don't have it aka OpenBSD. 2017-01-05 16:33:59 -08:00
Marcel Hollerbach 2f1d0fb189 eina_strbuf: add eina_strbuf_free_return
Summary:
For a function which just composes a string with strbuf its quite
usefull to return the string while its freed.

This makes a function like:

{
   Eina_Strbuf *buf;
   char *path;

   buf = eina_strbuf_new();
   eina_strbuf_append(buf, "test");
   eina_strbuf_append_printf(buf, "%s-%d.edj", "test", 0);
   path = eina_strbuf_string_steal(buf);
   eina_strbuf_free(buf);
   return path;
}

To:

{
   Eina_Strbuf *buf;

   buf = eina_strbuf_new();
   eina_strbuf_append(buf, "test");
   eina_strbuf_append_printf(buf, "%s-%d.edj", "test", 0);
   return eina_strbuf_free_return(buf);
}

Which is a bit more handy.

Test Plan: just run make check

Reviewers: raster, cedric

Subscribers: jpeg

Differential Revision: https://phab.enlightenment.org/D4545
2017-01-05 14:08:23 +01:00
Carsten Haitzler d5e88e4cf9 eina freeq - add ability to set freeval and add a final freeval
this allows environment variables to set the byte falue to fill a
freeq item added to the queue and then another item to actually fill
memory with just before the free function so memory content difference
will tell you if its inside the free queue or already freed from it
completely. if you set tyhe freed value to 0 this will not fill with a
value just before free and leave the value as-is determined by the
first fill pattern value.
2016-12-21 15:44:15 +09:00
Carsten Haitzler ffefbe0718 eina freeq - add explicit bypass on/off env var controls
this fixes T5032
2016-12-21 15:44:15 +09:00
Jee-Yong Um f1ab136abc doxygen: remove reference warnings.
Reviewers: cedric, jpeg

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

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2016-12-20 16:39:30 -08:00
Marcel Hollerbach 4e9656feac eina: add api for assessing the relative position of two rectangles
Summary:
the api returns if a rectangle is positioned above/below/right or left
of a other rectangle.

Code which does simular things are part of verne and e, i think its a good idea to provide api for that.

Test Plan: Just run the test suite

Reviewers: raster, jpeg, cedric

Reviewed By: cedric

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

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2016-12-20 16:39:30 -08:00
Gustavo Sverzut Barbieri 09825cbe5d eina_binbuf: allow expand & usage of extra bytes.
Some code needs to read directly into eina_binbuf to avoid an extra
copy from eina_binbuf_append* variants.

This can be achieved by using eina_binbuf_expand(), which returns a
write-able slice of the spare bytes. Once they are used,
eina_binbuf_use() should be called to increment "buf->len", which is
used by all other binbuf functions such as eina_binbuf_length_get() or
eina_binbuf_append_slice().
2016-12-20 10:18:32 -02:00
Cedric BAIL 701aa35e6e eina fixup bezier 2016-12-19 16:33:46 -08:00
Cedric BAIL 3d0c4ac0f6 eina: fix double comparison in eina quaternion. 2016-12-19 16:33:46 -08:00
Cedric BAIL d94a186584 eina: fix double comparison in eina matrix. 2016-12-19 16:33:46 -08:00
Cedric BAIL 1f6c4b1370 eina: fix double comparison in eina bezier. 2016-12-19 16:33:46 -08:00
Cedric BAIL 7bb229d4be eina: add general purpose function to compar float and double. 2016-12-19 16:33:46 -08:00
Marcel Hollerbach 712ec60012 eina: add free cb to eina_iterator_filter_new
if you allocate memory for the data param data you can free it in this callback.
2016-12-09 10:16:08 +01:00
Jean-Philippe Andre 509cce5e43 eina: Set magic number in eina_file_virtualize
This fixes make check
2016-12-09 11:08:38 +09:00
Jean-Philippe Andre f1d546df5d eina: Set magic type name for Eina_File 2016-12-08 16:30:34 +09:00
Jean-Philippe Andre 208e152baf eina: Reinstall magic checks on Eina_File
file != NULL does not mean it's valid. Since Eina_File is
a basic eina type a magic check is still better than nothing.
It can avoid doing eina_file_dup() on a closed file for instance.

This "fixes" a crash in eina_file_close with invalid files.

Now I can go hunt the root cause...
2016-12-08 16:30:34 +09:00
Stefan Schmidt e90622ec41 all: use void if we really want to make sure we do not accept parameters
In C we need this to make clear that we really do not accept parameters.
Found by the smatch source code matcher. I had run and fixed this before
but it seems to creep in again over time.
2016-12-06 17:16:24 +01:00
Stefan Schmidt 9d37fa2b8b eina: fix same wrong indenting
Brought up by running smatch. We have way to many of such things in tree though
to fix them all without annoying a lot of people. I will just stop here.
2016-12-06 17:16:24 +01:00
Bruno Dilly adb95630ef eina: remove tests, examples and docs for eina_model
Summary:
Since eina_model was dropped some years ago.
Also a few other points where related stuff is just commented out.

Reviewers: iscaro, barbieri

Reviewed By: barbieri

Subscribers: cedric, jpeg

Differential Revision: https://phab.enlightenment.org/D4442
2016-11-30 18:37:34 -02:00
Artem Popov 05246782dc eina/log: add ARG_NONNULL to eina_log* APIs for Eina_Log_Domain * parameter
@fix

Summary: add ARG_NONNULL to eina_log* APIs for Eina_Log_Domain * parameter that is always in use, can not be NULL.

Reviewers: cedric, Hermet, myoungwoon, NikaWhite

Reviewed By: NikaWhite

Subscribers: t.naumenko, jpeg

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

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2016-11-28 11:35:27 -08:00
Gustavo Sverzut Barbieri a9d9936a08 eina_slice: fix eina_slice_endswith() for same-sized slices. 2016-11-25 17:25:18 -02:00
Vyacheslav Reutskiy 56c202614b eina_file_win32: close handler in case of error
Func _eina_file_win32_first_file try to find the first file in directory
but if any file not found the file handler stay open, and func will
return error. But in this case while handle is open impossible to do
any actions. For example call eina_file_ls for empty folder, func will
return error and fold folder open. And if we try to remove this folder
Windows only mark it to delete, and remove it after the process is
complete.

Solution: close handler in error case.
2016-11-23 16:19:55 +02:00
Jee-Yong Um 0f97d45dac fix doxygen warnings
Summary:
fix warnings while generating documents
- end of file while inside a group (eina_util.h)
- missing title after \defgroup
- ignoring title "Ecore_Con_Lib_Group" that does not match old title

Reviewers: Hermet

Subscribers: cedric, jpeg

Differential Revision: https://phab.enlightenment.org/D4420
2016-11-22 11:47:04 +09:00
Marcel Hollerbach c34e4b6312 eina_iterator: add new api to have a filtered iterator
Summary:
the new iterator represents the order from the elements of the original
iterator, elements where the filter callback return false will be
skipped.

The container of this iterator is the original iterator.

Test Plan: Just run `make check` there is a testcase

Reviewers: cedric, jpeg, raster, herdsman

Differential Revision: https://phab.enlightenment.org/D4417
2016-11-21 12:13:02 +01:00
Carsten Haitzler 6a3a4a4124 eina log - explain how to humanify the output for bts when printed 2016-11-17 18:41:32 +09:00
Jean Guyomarc'h a1e1bb01ba
eina: don't make eina_thread_cancellable_run() inline
Seems to me there is little benefit of inlining this function, but this
also had a pervert effect on Windows and C++ with some recent mingw
versions. Mingw failed its implementation of pthread_cleanup_pop(). It
does not compile when compiled in C++. There is a type mismatch that is
caught by the compiler, and everything goes nuts...

This made the EFL build fail because some files of ecore_win32 are C++
sources, and they require Eina... so this macro appears in a C++ code
indirectly, because of its inlining.

By removing the inlining, this build issue is fixed. Will also fix
builds of other programs that would have used Eina.h in their C++
programs :)
2016-11-15 22:19:58 +01:00
Carsten Haitzler 5c8dfe9873 eina freeq - make bypass setup only on new freeq creation and changable
this will make a freeq bypass that is enabled by using valgrind or env
var not affect a freeq that has manually changed its queue count max
or mem max. these now become explicit deferred freeers.
2016-11-10 16:22:34 +09:00
Carsten Haitzler ce3685f001 evlog - reduce overhead of getting time a little by pre-checking clock
this checks for clock_gettime + CLOCK_MONOTONIC or CLOCK_REALTIME at
evlog init to avoid a cmp+brang and l1 instr cache hit every get.
slightly less overhead when this is on.
2016-11-10 16:22:34 +09:00
Carsten Haitzler 42ebfa863f evlog - no need to take lock to check if evlog is on. fix
this should reduce oerhead of evlog when on by a bit by not
taking+releasing a lock at all in this case.
2016-11-10 16:22:34 +09:00
Carsten Haitzler 9f32f83d45 evlog + efl dbug - add logging of cpu freq and cpu usage per thread
this runs a 1000hz (or as best the kernel will allow) polling system
monitor thread that will logg the cpu frequencies of all cores (linux
only) as well as cpu usage per thread. this leads to much more
information able to be logged from an efl app (any efl app).

@feature
2016-11-10 01:02:22 +09:00
Artem Popov a061f211c0 Eina: add NULL check to eina_module_symbol_global_set API @fix
Summary: Add checking on NULL like in other API in module, to avoid segmentation fault

Reviewers: NikaWhite, cedric

Reviewed By: cedric

Subscribers: myoungwoon, jpeg

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

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2016-11-07 14:42:54 -08:00
Cedric BAIL de131bf5d0 eina: remove Eina_Promise. 2016-11-07 13:43:11 -08:00
Carsten Haitzler f18d9d7237 remove memcmp calls for better performance where size is known
so i have been doing some profiling on my rpi3 ... and it seems
memcmp() is like the number one top used function - especially running
e in wayland compositor mode. it uses accoring to perf top about 9-15%
of samples (samples are not adding up to 100%). no - i cant seem to
get a call graph because all that happens is the whole kernel locks up
solid if i try, so i can only get the leaf node call stats. what
function was currently active at the sample time. memcmp is the
biggest by far. 2-3 times anything else.

  13.47%  libarmmem.so                [.] memcmp
   6.43%  libevas.so.1.18.99          [.] _evas_render_phase1_object_pro
   4.74%  libevas.so.1.18.99          [.] evas_render_updates_internal.c
   2.84%  libeo.so.1.18.99            [.] _eo_obj_pointer_get
   2.49%  libevas.so.1.18.99          [.] evas_render_updates_internal_l
   2.03%  libpthread-2.24.so          [.] pthread_getspecific
   1.61%  libeo.so.1.18.99            [.] efl_data_scope_get
   1.60%  libevas.so.1.18.99          [.] _evas_event_object_list_raw_in
   1.54%  libevas.so.1.18.99          [.] evas_object_smart_changed_get
   1.32%  libgcc_s.so.1               [.] __udivsi3
   1.21%  libevas.so.1.18.99          [.] evas_object_is_active
   1.14%  libc-2.24.so                [.] malloc
   0.96%  libevas.so.1.18.99          [.] evas_render_mapped
   0.85%  libeo.so.1.18.99            [.] efl_isa

yeah. it's perf. it's sampling so not 100% accurate, but close to
"good enough" for the bigger stuff. so interestingly memcmp() is
actually in a special library/module (libarmmem.so) and is a REAL
function call. so doing memcmp's for small bits of memory ESPECIALLY
when we know their size in advance is not great. i am not sure our own
use of memcmp() is the actual culprit because even with this patch
memcmp still is right up there. we use it for stringshare which is
harder to remove as stringshare has variable sized memory blobs to
compare.

but the point remains - memcmp() is an ACTUAL function call. even on
x86 (i checked the assembly). and replacing it with a static inline
custom comparer is better. in fact i did that and benchmarked it as a
sample case for eina_tiler which has 4 ints (16 bytes) to compare
every time. i also compiled to assembly on x86 to inspect and make sure
things made sense.

the text color compare was just comparing 4 bytes as a color (an int
worth) which was silly to use memcmp on as it could just cast to an
int and do a == b. the map was a little more evil as it was 2 ptrs
plus 2 bitfields, but the way bitfields work means i can assume the
last byte is both bitfields combined. i can be a little more evil for
the rect tests as 4 ints compared is the same as comparing 2 long
longs (64bit types). yes. don't get pedantic. all platforms efl works
on work this way and this is a base assumption in efl and it's true
everywhere worth talking about.

yes - i tried __int128 too. it was not faster on x86 anyway and can't
compile on armv7. in my speed tests on x86-64, comparing 2 rects by
casting to a struct of 2 long long's and comparing just those is 70%
faster than comapring 4 ints. and the 2 long longs is 360% faster than
a memcmp. on arm (my rpi3) the long long is 12% faster than the 4 ints,
and it is 226% faster than a memcmp().

it'd be best if we didnt even have to compare at all, but with these
algorithms we do, so doing it faster is better.

we probably should nuke all the memcmp's we have that are not of large
bits of memory or variable sized bits of memory.

i set breakpoints for memcmp and found at least a chunk in efl. but
also it seems the vc4 driver was also doing it too. i have no idea how
much memory it was doing this to and it may ultimately be the biggest
culprit here, BUT we may as well reduce our overhead since i've found
this anyway. less "false positives" when hunting problems.

why am i doing this? i'm setting framerate hiccups. eg like we drop 3,
5 or 10 frames, then drop another bunch, then go back to smooth, then
this hiccup again. finding out WHAT is causing that hiccup is hard. i
can only SEE the hiccups on my rpi3 - not on x86. i am not so sure
it's cpufreq bouncing about as i've locked cpu to 600mhz and it still
happens. it's something else. maybe something we are polling? maybe
it's something in our drm/kms backend? maybe its in the vc4 drivers or
kernel parts? i have no idea. trying to hunt this is hard, but this is
important as this is something that possibly is affecting everyone but
other hw is fast enough to hide it...

in the meantime find and optimize what i find along the way.

@optimize
2016-11-06 13:13:10 +09:00
Carsten Haitzler ac861be550 eina list - use free queue to defer freeing list nodes and accting
this should help with robustness a little bit by keeping nodes in the
free queue purgatory until enteirng idle etc.

@feature
2016-11-06 13:13:10 +09:00
Carsten Haitzler 0ee33e7b4b eina - add a free queue (eina_freeq) for deferring frees of data
this adds eina_freeq api's for c land for deferring freeing of
pointers and can be used a s a simple copy & paste drop-in for free()
just to "do this later". the pointer will eveentually be freed as
eina_shutdown will free the main free queue and this will in turn free
everything in it. as long as the main lo0op keeps pumping things will
og on the queue and then be freed from it. free queues have limits so
if they get full they will clear out old pointers and free them so it
won't grow without bound. the default max is 1mb of data or 16384
items whichever limit is hit first and at that point the oldest item
will be freed to make room for the newest. the mainloop whenever it
finishes idle enterers will add an idler to spin and free while idle.
the sizes can be tuned and aruged about as to what defaults should be.

this also allows for better memory debugging too by being able to fill
freed memory with patterns if its small enough etc. etc.

@feature
2016-11-06 13:13:10 +09:00
Gustavo Sverzut Barbieri 2f2bb1fc45 eina: documment envvars at eina_init().
following my commit for ecore_init(), do that for eina_init() as well,
sometimes it's hard to find the vars and their meaning without looking
at the code.
2016-10-27 10:31:29 -02:00
Marcel Hollerbach cf643b627c eina: fix shutdown
in eina_file we are using eina_hash, eina_hash is using eina_rbtree, so
we should ensure that rbtree is shutted down AFTER file is shutted down.

fix T4753
2016-10-24 21:42:28 +02:00
Carsten Haitzler ed1101d994 fix possible eina file shutdown issue
i am not sure as i cannto reproduce this, but i hope this fixes T4677
by ensuring if eina_file_shutdown is called it cannto double-free a
hash.
2016-10-14 16:40:09 +09:00
Jean-Philippe Andre 119e35b791 eina: Fix compilation with clang
It's not because the bug with __builtin_prefetch is inside
clang/llvm that we must break the build for people who prefer it
over gcc. As soon as a non-broken version is out, the ifdef must
be either removed (and ask people to update their clang install)
or add a version check based on __clang_xxx__.

Compilation tested with clang 3.8.1 and gcc 6.2.1.
2016-10-05 19:40:50 +09:00