Commit Graph

1022 Commits

Author SHA1 Message Date
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
Derek Foreman 750e210f3a eina_cpu: Fix arm build
commit e2875cefc4 accidentally removed
some unrelated headers needed for testing ARM NEON support on linux.
2016-10-04 14:29:36 -05:00
Carsten Haitzler 2071366e3c eina_list prefetch macros - handle misstyped list ptr by casting
so it seems enlightenment someqhere uses a void * as a list per for
EINA_LIST_FREE ... so do some casing of that type to handle such badness
2016-10-02 12:07:36 +09:00
Jean Guyomarc'h 519207c7eb eina: fix macos spinlocks and upgrade API to sierra 2016-10-01 21:17:05 +02:00
Carsten Haitzler a2d507d3bf eina list - make use of prefetch for minor speedups
i see a speedup of about 8% over a series of list walking and freeing
functions given this change. it's a small speedup but still not too
shabby just for some prefetches thrown in. ymmv depending on memory
subsystem, memory speed itself, cpu and architecture.

@optimize
2016-10-01 22:41:02 +09:00
Carsten Haitzler a06f5c1024 eina - add prefetch macros to map to compiler builtins if they exist
this allows you to portably use prefetch compiler builtins. this adds
EINA_PREFETCH(), EINA_PREFETCH_WRITE(), EINA_PREFETCH_NOCACHE() and
EINA_PREFETCH_NOCACHE_WRITE() macros to do this that are "nothing" if
your compiler doesnt support it. of course it also requires your
compielr compile instructions for your architecture and it can only do
so if the architecture it compiles for has these instructions, so be
aware.

@feat
2016-10-01 15:38:23 +09:00
Jee-Yong Um 33df065681 eina_matrix/quad: clean up documentation
Summary: adjust grouping to show reference correctly

Reviewers: Hermet, cedric, jpeg

Differential Revision: https://phab.enlightenment.org/D4313
2016-09-26 15:04:15 +09:00
Derek Foreman e2875cefc4 eina_cpu, evas: Remove _eina_cpu_fast_core_get, don't set render thread affinity
We've decided it would be best to just let the scheduler do its job.
2016-09-20 11:38:57 -05:00
Carsten Haitzler 58d3328d80 eina - eina file map populate fallback to use log int not int... for size
this makes the size match other sizes in eina_file. doesn't affect
linux but i think bsd's get hit.
2016-09-20 21:57:47 +09:00
Carsten Haitzler 41c332b726 eina - redo a lot of the static inlines to have better instr cache usage
this moves a lot of logic that is rare away from the linear/flat asm
path of code so we et fewer l1 cache misses when executing chuncks of
our code. this also reduces the code size and takes some funcs like in
eina_inline_lock_posix.x and makes them real functions to reduce code
size thus better l1 cache usage - only for new/free of locks.
spinlocks, semaphores etc. as these will have no advantage being
inlined but simply bloat out code size instead.

overall this actually reduces efl lib binary sizes 0.4%, so that's a
good sign.

this passes make check and i think i got it right... let me know if i
didn't. i'm also not sure i should just keep the static inlines and
not make the formerly static inline funcs full EAPI ones now... good q.
2016-09-20 14:53:05 +09:00
Cedric BAIL 25aef34aa0 eina: populate memory in the right limit. 2016-09-19 14:02:43 -07:00
Derek Foreman 9799d45ee7 eina_cpu: Fix coverity defects in eina_cpu_map_init
Fixes a potential fd leak on failure and wrong core to
speed mapping on systems with > 31 cpu cores

CID: 1362860
CID: 1362859
CID: 1362857
2016-09-19 10:47:02 -05:00
Derek Foreman bd1de560a1 eina_cpu: Fix error handling in eina_cpu_fast_core_get
I introduced a crash on linux systems where the cpufreq directory
doesn't exist.  This fixes it.
2016-09-19 09:23:59 -05:00
Gustavo Sverzut Barbieri 76c3726ef0 eina_thread: don't leak on pthread_cancel().
if we cancel a thread we should still free the context, so use the new
EINA_THREAD_CLEANUP_PUSH() and EINA_THREAD_CLEANUP_POP()
2016-09-19 01:01:35 -03:00
Derek Foreman c98bb97ff0 Revert "eina: Actually call eina_cpu_init() and eina_cpu_shutdown()"
This reverts commit 1881b0d343.

This is called from an array constructed with pre-processor macros and
I didn't notice.
2016-09-16 19:39:38 -05:00
Derek Foreman 60f3f5fbfd eina_cpu: Fix broken E_API macro
Oops, I cut and paste it from a wrong file.

Thanks to Vincent Torri for the quick catch.
2016-09-16 15:57:42 -05:00
Derek Foreman a453599d26 eina_cpu: Detect NEON if available
We may have a few conditionals around that think this has actually been
set at some point, let's surprise them by actually doing that.
2016-09-16 14:10:49 -05:00
Derek Foreman 0f98e1c6d3 eina_thread: Don't ensure affinity core is lower than number of cpus
CPUs can be turned off after boot leading to a sparse mapping of core ids.

For example, if I turn off the first four cores on an exynos 5422 (these
are the low speed cores) then the high speed cores are still numbered 4-7
but there are only 4 cores present.

In that situation using affinity_core % num_cpus will prevent ever being
able to set affinity at all.

Just remove the pointless check and let the user set whatever core id they
want.
2016-09-16 14:10:49 -05:00
Derek Foreman 13da63d260 eina_cpu: Add an internal api for getting a random fast core
In a big.LITTLE ARM system cores can have different capabilities.  This
gives an internal API that randomly returns the core id of any of the
system's fastest cores.

On systems where all cores are the same, it will return any available core.

If we don't have cpufreq support we just return 0
2016-09-16 14:10:49 -05:00
Derek Foreman 1881b0d343 eina: Actually call eina_cpu_init() and eina_cpu_shutdown()
Without calling eina_cpu_init() the eina_cpu_features bits aren't
properly set up.

Let's call it and see if anything exciting happens.
2016-09-16 14:10:49 -05:00
Vincent Torri 79fadd184f Eina: fix colors messages in MSYS2
With MSYS1 or cygwin 1.5, or DOS console, the display is done by redirecting
stdout and al. So to change the colors, the Win32 API of the console must be
used.
On the contrary, the terminals based on mintty (like cygwin 1.8 terminal or MSYS2)
the redirection is done with pipes, so the Win32 API of the console does not
work when changing the colors and we can use the POSIX colors of printf.

This patch is fixing the eina code which alwayss use the Win32 API of the console
on Windows, even if mintty-based terminals are used
2016-09-16 14:48:33 +01:00
Cedric Bail 4d69f472fe eina: allow graceful failure when calling eina_thread_cancel with NULL. 2016-09-14 16:50:05 -07:00
Gustavo Sverzut Barbieri 960e1a1d16 eina/ecore: allow threads to be canceled, use in ecore_con.
As discussed in the mailing list, many people will use worker threads
to execute blocking syscalls and mandating ecore_thread_check() for
voluntary preemption reduces the ecore_thread usefulness a lot.

A clear example is ecore_con usage of connect() and getaddrinfo() in
threads. If the connect timeout expires, the thread will be cancelled,
but it was blocked on syscalls and they will hang around for long
time. If the application exits, ecore will print an error saying it
can SEGV.

Then enable access to pthread_setcancelstate(PTHREAD_CANCEL_ENABLE)
via eina_thread_cancellable_set(EINA_TRUE), to pthread_cancel() via
eina_thread_cancel(), to pthread_cleanup_push()/pthread_cleanup_pop()
via EINA_THREAD_CLEANUP_PUSH()/EINA_THREAD_CLEANUP_POP() and so on.

Ecore threads will enforce non-cancellable threads on its own code,
but the user may decide to enable that and allow cancellation, that's
not an issue since ecore_thread now plays well and use cleanup
functions.

Ecore con connect/resolve make use of that and enable cancellable
state, efl_net_dialer_tcp benefits a lot from that.

A good comparison of the benefit is to run:

   ./src/examples/ecore/efl_io_copier_example tcp://google.com:1234 :stdout:

before and after. It will timeout after 30s and with this patch the
thread is gone, no ecore error is printed about possible SEGV.
2016-09-14 01:47:23 -03:00
Carsten Haitzler 1d26e61478 eina - add recursive mutex lock - apparently these are portable
new feature - recursive lock. same as normal lock just with recursive
attr set

@feature
2016-09-08 00:09:31 +09:00
Andrii Kroitor 605694ed2a eina: fix error reporting in cond_timedwait
Summary: EINA_FALSE was set into wrong variable.

Reviewers: jpeg, raster, Hermet, cedric

Reviewed By: cedric

Subscribers: NikaWhite

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

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2016-09-06 14:59:47 -07:00
Jee-Yong Um 1d281906f2 eina_matrix: add missing "*" for doxygen
Summary:
"/**" requires for doxygen, but one "*" is omitted for the reference
of eina_matrix3_multiply().

Reviewers: Hermet

Reviewed By: Hermet

Subscribers: cedric, jpeg

Differential Revision: https://phab.enlightenment.org/D4266
2016-09-01 20:05:23 +09:00
Amitesh Singh d88f08f7e9 eina: module - Add macros for adding module informations
Summary:
These macros allow you to define module informations like
author/description/version/license

e.g.
// Use "Name <email id>" or just "Name"
EINA_MODULE_AUTHOR("Enlightenment Community");
// Mention license
EINA_MODULE_LICENSE("GPL v2");
// What your module does
EINA_MODULE_DESCRIPTION("This is what this module does");
// Module version
EINA_MODULE_VERSION("0.1");

Now eina_modinfo can show these informations to users

$ eina_modinfo module.so
 version: 0.1
 description:   Entry test
 license: GPLv2
 author:  Enlightenment Community

@feature

Reviewers: cedric, tasn, raster, jpeg

Subscribers: seoz

Differential Revision: https://phab.enlightenment.org/D4257
2016-08-31 16:17:53 +05:30
Jean Guyomarc'h 3f79cf8748 eina: fix behaviour break of eina_error_msg_get()
eina_error_msg_get() must return NULL if an incorrect error is provided.
The XSI strerror_r() returns EINVAL when an invalid error is passed to
it, so we can end the function here. If we kept on, we would have tested
against the 'unknown_prefix' ("Unknown error ") which is implementation
defined, and registered a new error when the invalid error message
didn't match the 'unknown_prefix'. This new error message would have
been returned, which is not what we expected.

This case arised on Mac OS X where the 'unkwown prefix' is
"Unknown error: " instead of "Unknown error ".

It fixes eina test suite on Mac OS X.
2016-08-29 20:03:52 +02:00
Jean Guyomarc'h 5db3357f40 eina: overhaul Mac OS X semaphores
Mac OS X does not support POSIX unnamed semaphores, only named
semaphores, which are persistant IPC: when the program exits,
and if semaphores where not released, they stay forever...

All EFL programs were "leaking" a semaphore, due to how
eina_log_monitor manages its resources. Therefore, after building
EFL a lot (which run eolian_gen, eolian_cxx, elua, edje_cc, ...)
we were not able to create any semaphore...

Now, we get rid of these semaphores and use Mac OS X's own
semaphores. Code is less cumbersome, and we don't have any
disavantage of the named semaphores.

Fixes T4423

@fix
2016-08-26 21:16:39 +02:00
Cedric BAIL 0ef07d6095 eina: readdir_r has been deprecated.
So glibc has decided that readdir_r is hard to use safely and deprecated it
this summer. They recommand to use readdir, which was in the past unsafe to
use in a multi thread scenario, but is now on most system (and all system
we care, including our own implementation in evil). It is basically safe
as long the same DIRP is not accessed from another thread. This is true in
our code base, so we are fine to go with this.

For further reading: https://lwn.net/Articles/696474/
2016-08-25 15:23:14 -07:00
Gustavo Sverzut Barbieri 45c0002929 eina_slice: startswith and endswith.
these helpers around memcmp() make the code more readable.
2016-08-23 21:25:02 -03:00
Gustavo Sverzut Barbieri 9944c164bd eina_slice: fix multi-byte find function, add tests. 2016-08-23 20:17:13 -03:00
Jean Guyomarc'h 5d527fffc8 eina: remove references to win32 and winCE in threads 2016-08-23 21:15:25 +02:00
Jean Guyomarc'h 180b24f2a0 eina: fixtures on OSX semaphores
So actually there is quite a big issue with semaphores
on OSX. We use (named) POSIX semaphores, but this was
a (my) mistake... I'll fix it later...
The real issue is that named semaphore are persistants:
when the program dies, it stays alive. This is pretty
bad with eina_debug_monitor because we create a semaphore
we never release, due to a wild thread...

This leak of semaphores went unnoticed before commit
4a40ff95de because the
name of the semaphore was unique per process, and
overriden when another process was launched. This
was very bad, but saved us from overflowing the
semaphore pool. It is now overflowed pretty fast when
building a lot EFL, because of Eolian that runs A LOT!

So that's one problem that still needs to be fixed,
by using OSX' own semaphores (see T4423).
Another big issue, which is now fixed is that the
buffer in which we generated the semaphore ID was
too small, and therefore we were reduced to one shared
semaphore for a whole process... This buffer has been
now set to 31 characters, which seems to be the maximum
length of a semaphore ID.

So now things are better, but still with a deadly issue.
2016-08-23 21:15:25 +02:00
Gustavo Sverzut Barbieri 12850d4e25 remove EINA_ERROR_TIMEOUT
As pointed out in the mailing list, it was introduced in this release,
so it's better to remove the symbol instead of deprecating it.

People should use ETIMEDOUT directly.
2016-08-23 10:14:17 -03:00
Gustavo Sverzut Barbieri 0d96ba9734 binbuf, strbuf and ustrbuf: add slice_get() and rw_slice_get(). 2016-08-22 18:25:14 -03:00
Gustavo Sverzut Barbieri 77faebde67 eina_stringshare: add slice_get() 2016-08-22 18:25:14 -03:00
Gustavo Sverzut Barbieri 9062bbd8e0 eina: introduce Eina_Slice and Eina_Rw_Slice.
A plain simple pointer + length describing a linear memory region.
2016-08-22 18:25:14 -03:00
Gustavo Sverzut Barbieri 602a98c8b9 eina_error: provide a fallback when strerror_r() is not available. 2016-08-22 18:25:14 -03:00
Jean Guyomarc'h 26a26f2304 eina: fix use of strerror_r()
So, first, the wrong strerror_r() was detected on
Mac OS X. Instead of using a complex set of macros
to try to detect which strerror_r() to use, when
it is defined, let the autotools handle that clerverness
for us.
2016-08-22 20:02:02 +02:00
Gustavo Sverzut Barbieri e56811ed4d eina_error: allow errno.h codes.
we have some duplication of errors between Eina_Error and errno.h,
however we should use Eina_Error to extend the traditional errno.h
system.

then change eina_error_msg_register() and
eina_error_msg_static_register() to return a magic bit to state the
number was registered, and on other functions test this bit in order
to operate on registered values, otherwise fallback to errno.h, such
as strerror().

It also deprecates 2 clear duplicated errors:

- EINA_ERROR_OUT_OF_MEMORY -> ENOMEM

- EINA_ERROR_TIMEOUT -> ETIMEDOUT

There are two details when using strerror():

 - old behavior did not return strings for non-error, such as
   "Success" or "Unknown error ${N}"

 - thread-safety issues: since we must be thread safe, then use
   strerror_r() and eina_stringshare_add() that value, keeping a hash
   of cached values
2016-08-18 13:36:05 -03:00
Jean-Philippe Andre cb24d5f489 eina: Set EINA_ERROR_TIMEOUT to cond_timedwait
This adds a new error code.

I'm using a weak symbol (were supported, ie GCC on linux) for
some kind of forward compatibility.

Fixes T1780

@feature
2016-08-16 16:14:21 +09:00
Jean-Philippe Andre 67ab4e3b4d eina: Move EWAPI and EAPI_WEAK to Eina.h from Eo.h
So it may be used outside EO (eina error is what I have in mind).
I believe it doesn't need to be redefined in all EFL libs, especially
since it's not used on Windows yet.
2016-08-16 16:14:21 +09:00
Carsten Haitzler 825e60e023 efl api release - fix @since in new eina iterator api 2016-08-12 18:04:54 +02:00
Stefan Schmidt d126107782 Revert "eina threadqueue - for paranoia lock+ulock+free in order locks taken"
This reverts commit d19cd4e63c.

This causes a SIGBUS error on OpenBSD when closing any application. As this
was safety patch only I will revert it for the 1.18 release and we can work
out what breaks OpenBSD here for 1.19

Fixes T4332
2016-08-11 15:25:32 +02:00
Stefan Schmidt 72b88e51f4 eina: add includes for getpid() to work on MacOSX
Without this I get errors from the clang compiler used on Travis for some OSX
builds:
../src/lib/eina/eina_inline_lock_posix.x:845:27: error: use of undeclared identifier 'getpid'
2016-08-08 16:49:55 +02:00
Stefan Schmidt a5fd63067d eina: safepointer: add since tags to new eina safepointer EAPI 2016-08-08 14:59:57 +02:00
Carsten Haitzler 933c0a6b04 eina_module - check result of module load from an array of modules
we don't give any debug or info if a module in a list fails to load.
we should at least offer debug info. do that. this fixes coverity
issue CID 1039687
2016-08-08 18:38:25 +09:00
Carsten Haitzler 83752435cf eina log - handle possible overflow from high mem (last few bytes) or env
fixes CID 1361219
if you had an env var a few gb in size or we had stuff in the last bit
of memory address space this might be an issue, but that won't happen.

@fix
2016-08-06 15:53:18 +09:00
Carsten Haitzler 20c6bd296b eina log - keep coverity happy with potential ptr comparison overflow
fixes CID 1361220

in theory yes end minus start could be insanely huge or end be very
high in memory thus causing an overflow. this would have to be in the
last few bytes of memory space, so it never going to happen. and the
input from the env var has to be sane anyway as its user controlled.

@fix
2016-08-06 15:50:17 +09:00
Carsten Haitzler d19cd4e63c eina threadqueue - for paranoia lock+ulock+free in order locks taken
so mimic order of locks taken to be paranoid ... this wouldnt be a
deadlock issue but just to be safe instead of sorry.
2016-08-06 09:56:02 +09:00
Carsten Haitzler 26db5d5056 eina thread queue - ensure blocks cannot be freed until lock+unlock
just in case... check blocks cannot be freed until locked and unlocked
just in case someone still is holding a lock.
2016-08-05 23:52:20 +09:00
Carsten Haitzler 4a40ff95de eina lock semaphores - do not use shared semaphores and fix osx names
the way eina does sempahores, they can NEVER be sensibly shared
cross-process portably. so enabling sharing is a pointless idea. in
fact some os's like openbsd check if the sempahore addres is in a
sharable mem region and deny init if it is not. on osx you dont use
shared memory but a sempahore name you share instead... and this is
not exposed thus it can't be shared either. if we did process sharable
semaphores we'd make shm segments and/or name them in a sharable way
were you can share the idenitifer of the shm segment and/or the offset
address or name from osx. but we don't, so making them
process-private is the right thing. sharable sempahores will need a
whole new api.

this also fixes osx naming to make the name pretty unguessable/private
and opened exclusive (or it fails) by using pid, sem counter, and 4
random numbers. it's not a security mechanism as the create will fail
if there is a clash. chances are low. we unlink before anyway. good
enough for osx for now.

@fix
2016-08-05 18:11:42 +09:00
Carsten Haitzler 8fd224b4d6 eina thread queue/semaphores - check even more unlikely errors + complain
check some really unlikely alloc errors and semaphore deadlock errors
and report if that has happened. just in case.
2016-08-05 17:38:02 +09:00
Carsten Haitzler 07924f26f1 eina thread queue - check returns fo semaphore new/lock/release to debug
so openbsd may have issues with semaphores - maybe. this would catch
them if it it. why - if sem_init/sem_wait are different... i dont know.
2016-08-05 17:09:34 +09:00
Carsten Haitzler 6b6823e5af eina_threadqueue - fix const ptr warning on spinlocks if atomic disabled
atomics SHOULDNT be disabled anyway, but if they are... fix this
warning. (no real bug)
2016-08-05 13:42:50 +09:00
Cedric BAIL dd1d3f0d2d autotools: since it has been broken for some times and nobody noticed, let's remove per directory support. 2016-08-01 13:36:47 -07:00
Stefan Schmidt 3bd4c19f55 eina: promise: fix memory leak in error path
If we would not get a promise back here the allocated array would leak when we
return. Make sure we also free it in this case.

CID: 1360468
2016-07-29 14:53:36 +02:00
Chris Michael 89234ce6bc eina: Fix null pointer derefernce
Coverity reports that eina_safepointer_get returns a NULL promise here
(checked 20 out of 21 times). As eina_safepointer_get can return NULL,
we should check the validity of 'promise' here before trying to
derefernce it later.

Fixes Coverity CID1356625

@fix

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2016-07-21 13:07:26 -04:00
Carsten Haitzler ad1bfac960 eina rbtree iterator - fix leak found while debugging other problems
there was a leak of elements on  the itrator stack when the stack was
flushed still having some items on it, thus losing their pointers and
never freeing them.

@fix
2016-07-19 15:43:22 +09:00
Carsten Haitzler 4bbe5ee058 eina thread create - use pthread_sigmask as this can be called from thread
@fix
2016-07-14 08:39:31 +09:00
Jean-Philippe Andre 4d9de121d1 eina_safepointer: Fix coverity warning
I guess the overflow was badly handled. Fixing it by using
explicit int intermediate value.

Fixes CID 1356616 and 1356619:

Operands don't affect result
Logically dead code
2016-07-13 16:25:01 +09:00
Carsten Haitzler 25c63f726e eina thread - fix window build with sigprocmask
fixes T4048
2016-07-08 21:11:21 +09:00
Carsten Haitzler aeeda1f77d efl - threads and signals - make efl work on "insane" os's with signals
so. on linux signals are delivered to the main process thread/loop.
thats' where signal handlers are set up and always run. this is sane.
it's predicatble. but of course this is not the same in bsd land.
there "just send the signal to any old thread and call the signal
handler there" seems to tbe the order of the day. this explains why
wer are losing sigchld signals in edje_cc - it's heavily threaded and
bsd is just randombly picking a thread to call it on.

this fixes that. in theory. i hope. i can't test, but putting it in to
share

@fix
2016-07-04 23:47:25 +09:00
Jean Guyomarc'h e333175109 eina: fix typos in eina_rectangle doc 2016-06-26 18:48:15 +02:00
Jean Guyomarc'h 33bb4583b8 eina: fix compiling of safepointers on OSX
This is a reccurring compatibility issue...
MAP_ANONYMOUS is not defined on OSX, but MAP_ANON is.
I know MAP_ANON is marked as deprecated in the Linux man
pages, but it has the benefit of being more portable.
2016-06-15 22:33:39 +02:00
Carsten Haitzler fe9a9d8759 eina - alloca.h - include stdlib and stddef, usze size_t not long 2016-06-15 14:33:56 +09:00
Felipe Magno de Almeida f33b53e923 eina: Fix race wrong prototype for unref 2016-06-14 23:08:13 -03:00
Felipe Magno de Almeida 949af55947 eina: Add support for eina_safepointer in promises 2016-06-11 10:40:27 -03:00
Cedric BAIL 692b2c9fc9 eina: add generic infrastructure for a Eina_Safepointer
This is heavily inspired from Eo_Id infrastructure. Main change
are that the lower bit are always guaranteed to be zero and ignored
by all function. Also it may be a little bit less efficient in some
case, but we will tune it once we have real life usage of it.

Eo won't be migrated for 1.18 to it as Eo_Id is deeply integrated
and it is quite risky to touch it so close from a freeze. This can
wait.
2016-06-10 13:57:01 -07:00
Lauro Moura 2d2e57eccd eina: Smudge magic value on promise deletion 2016-06-09 22:39:25 -03:00
Lauro Moura 46843551c0 eina: Remove value type promises
All values in promises are now considered as by-pointer.
2016-06-09 22:38:54 -03:00
Lauro Moura 5a3331618e eolian: remove support for value-type promises 2016-06-09 19:14:18 -03:00
Lauro Moura 3b090b808b eina: Fixes on promises behavior when cancelling
- Free the cancel callbacks on promise delete
- Cancelling an ended promise should be a nop
- More tests to increase coverage
2016-06-09 19:14:14 -03:00
Jean Guyomarc'h dec1d251dc eina: ensure resource destruction on failure
In case of failure within eina_lock_new() (posix), a
pthread_mutexattr_t would have been left in an initialized state,
without any deinitialization being called.

Consequences would have been implementation defined.
2016-06-06 23:45:18 +02:00
Benjamin Jacobs 731e88061a eina_thread.c: fix include guard.
DragonFlyBSD has pthread_setname_np but no pthread_setaffinity_np;
we still need to include pthread_np though.

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2016-06-06 12:05:43 -07:00
Larry Jr 2e441c3f5e eina: eina_promise_all callback cast removed 2016-06-06 03:30:42 -03:00
Lauro Moura 47dea6abc1 eina: Avoid promise early deletion when cancelled.
Cancelling a promise will fulfill it but won't actually free the memory. This
memory is under custody of the owner, who must either call value_set or
error_set to finish it.
2016-06-06 03:09:40 -03:00
Lauro Moura b28f6f2fce eina: Fix promise tests and avoid early deletion
- Progress notify refcount fixes, avoiding early deletion
- Avoid leaking memory on tests
2016-06-05 21:58:19 -03:00
Tom Hacohen 4c3b7fb248 Eina promise: Fix broken return value.
I broke it in dc73f6644e.
Excuse of the day: I'm not working from my usual spot and there's screen glare
here that made me not see the *. Good excuse?
2016-06-05 11:00:55 +01:00
Tom Hacohen dc73f6644e Eina promise: Simplify code and remove shadow variable.
There was no need for the extra variable. This also fixes a shadow
warning.
2016-06-05 10:57:07 +01:00
Felipe Magno de Almeida 1c269cf24a eina: Fix magic check for eina_promise_owner_buffer_get 2016-06-03 21:53:29 -03:00
Felipe Magno de Almeida 2e4765bc88 eina: Fix EINA_MAGIC and eina_promise_then NULL check 2016-06-03 21:43:57 -03:00
Cedric BAIL af2b0c8629 eina: protect promise death during callbacks cancel. 2016-06-03 17:00:12 -07:00
Felipe Magno de Almeida cd91b02dd1 eina: Add NULL checks and EINA_MAGIC checks to promises
Add NULL checks and EINA_MAGIC checks that avoid crashing when it
shouldn't.
2016-06-03 20:02:02 -03:00
Felipe Magno de Almeida e79eb53e8d eina: Remove Eina_Promise* parameter in promise callback
Remove not very useful parameter to eina_promise_then callbacks.
2016-06-03 18:15:57 -03:00
Felipe Magno de Almeida 8fec0d5139 eina: Remove unnecessary indirection to promises
Now when dealing with pointer types, we will not get pointer to
pointer semantics in callbacks and eina_promise_owner_value_set
for Eina_Promise.

It will work as expected:

Eina_Promise_Owner* promise = eina_promise_add();

void* p = malloc(sizeof(T));
eina_promise_owner_value_set(promise, p, &free);
2016-06-03 17:22:12 -03:00
Larry Jr 507bbdb054 Eina: Fix eina_promise_all refcount ordering problem
The call to eina_promise_then steals the first ref'count, so it is
possible that the promise is freed after the eina_promise_then,
so we need to eina_promise_ref before eina_promise_then.
2016-06-03 11:19:52 -03:00
Cedric BAIL 9bcad265a7 eina: don't access dead promise.
We do properly unref promise while calling all the then callback. There
is no need to check it a second time (which actually lead to a 100%
bad access).

T3759
2016-05-31 14:59:26 -07:00
Jean Guyomarc'h 092ce1f83b eina: fix warning when clockid is not defined
Unused parameter was unused...
2016-05-28 21:49:33 +02:00
Jean Guyomarc'h 9ee8ea196b eina: make eina backtrace portable
Backtrace relied on non-portable code.
Platform-specific code is now enclosed
within macros defined at configuration-time.
2016-05-28 19:18:46 +02:00
Felipe Magno de Almeida b0b8109cd5 eina: Make cancelled promises use EINA_ERROR_PROMISE_CANCELLED error code 2016-05-26 13:35:07 -03:00
Felipe Magno de Almeida b7cdcff56a eina: Use pointer directly instead of by unnecessary indirection 2016-05-26 13:35:07 -03:00
Felipe Magno de Almeida 2457d6f595 eina: Fix crashing when accessing past-the-end of the malloc'ed promise
The promise race composition was calculating its size wrongly, making
the promise's size smaller than it should, causing heap corruption.
2016-05-26 13:35:07 -03:00
Felipe Magno de Almeida 3ffe38b0c3 eina: Fix then callbacks prototypes
Eina_Error is not passed by pointer anymore, which could cause invalid
pointer access in promise compositions (all and race).

Also added Eina_Promise* to prototypes.
2016-05-26 13:35:07 -03:00
Felipe Magno de Almeida a7e5487439 eina: Add missing buffer_get function in Eina_Promise
Function buffer_get was available only in Eina_Promise_Owner, despite
being defined in both classes.
2016-05-26 13:35:07 -03:00
Carsten Haitzler 7ee4eba33f efl - new cmp "fix" code - remove one duplicated cmp 2016-05-26 12:49:58 +09:00
Carsten Haitzler 41842ca9f9 efl - fix many bounds over/underflow where we use int for ptr cmp
this addresses more things brought up in comments in

fixes T3638 commentd

@fix
2016-05-26 12:17:07 +09:00
Felipe Magno de Almeida de9be13d45 eina: Add promise parameter to then calllbacks
Added promise parameter to then callbacks so callbacks can steal
ownership of the value from the promise.
2016-05-25 21:32:03 -03:00
Carsten Haitzler 636c8b48c7 eina hash - fix stringshare key comparison function
this fixes T3638

@fix

a note... thanks so much to aerodynamik for spotting this. i'm rather
surprised coverity didn't spot this... unless someone said to "shut up
coverity you're wrong" and they should not have.

i also might have expected compilers to spot this too... and add a
warning.

anyway ... this was a seriously subtle bug that could have caused all
kinds of havoc in efl.  keys that are different may be compared to be
the same. it could get ordering wrong and sorting thus maybe insert
keys that cannot be found anymore and oh so much more besides.
2016-05-26 09:28:23 +09:00
Carsten Haitzler 2c07846b7d eina vector - fix indenting and 80 col overflow in inline header 2016-05-21 23:37:07 +09:00
Carsten Haitzler 668e6091fb eina vector inline header - replace last equal with approx macro
rthis replaces double a == double b with a macro that keeps a close
enough range using epsilon (which is the error range for a dobule).

this fixes T3245
2016-05-21 23:36:38 +09:00
Carsten Haitzler f40a452ee1 fix warnings about double/float comparisons in eina vector
this should fix T3245

this is basicall where we go double a == double b and due to precision
issues this may not always be right, but this means that the
equivalent now checks for "really close values" rather than perfectly
exact.

@fix
2016-05-20 21:46:50 +09:00
Jean Guyomarc'h 147ef32b2b efl: fix misleading indentation
GCC's -Wmisleading-indentation is complaining...
It is a warning flag introduced in GCC 6.x, and
is enabled by -Wall.
2016-05-18 21:57:02 +02:00
Jean Guyomarc'h 64ce45b9b4 eina: add missing header guards 2016-05-18 21:56:58 +02:00
Cedric BAIL 0c4880e99d efl: everyone should now rely on Eina MIN/MAX redefinition. 2016-05-09 16:58:53 -07:00
Cedric BAIL d00643fcc4 eina: add MIN/MAX redefine as we use it everywhere.
This is done on an attempt to permanently fix our Windows port. Windows
doesn't have MIN/MAX, so we should always do a ifndef/define in every
piece of code that use it. Of course we always forget and it take times
to notice and fix. We have over the year added it in many private
headers, but as the issue continue to raise again and again, I prefer
to get this fixed in our main header.
2016-05-09 16:58:53 -07:00
Felipe Magno de Almeida 1c5ce16565 eina: Add eina_promise_race composition function
Added eina_promise_race function that composes multiple
promise objects into a new promise which is fulfilled
when one of the promises are fulfilled, or fails
when one of the promises have failed.
2016-05-09 19:10:26 -03:00
Felipe Magno de Almeida 6d43adaaf4 eina: Fix memory leaks in promise 2016-05-07 13:55:18 -03:00
Jean Guyomarc'h ccbe4579a3 eina: fix typos in tmpstr doc 2016-05-06 22:18:57 +02:00
Felipe Magno de Almeida 236c13df34 eina: Add progress notify callback feature for Promise Owners
Add a way for users of the promise owner to get notified when a
promise progress is registered. Also added a convenience composition
function that creates a promise which is fulfilled when another
promise has a progress notification.
2016-05-06 12:41:42 -03:00
Cedric BAIL 588b133c19 eina: make eina rectangle an allocated thread safe structure to use.
This is a better fix than D3913.
2016-04-25 12:48:08 -07:00
Cedric Bail b4456121be eina: implement a memory cache for Eina_Rbtree_Iterator.
So it seems we are using Eina_Hash_Iterator quite a lot more than before.
This lead to a huge amount of alloc/free of Eina_Rbtree_Iterator that
was noticable in Enlightenment callgrind trace. This patch make it vanish
from the trace :-)
2016-04-22 10:58:25 -07:00
Cedric BAIL 41f68ac0d3 eina: make it possible to build the library alone. 2016-04-14 15:52:50 -07:00
Felipe Magno de Almeida 35dd5b5cab eina: Fix promise error with eina_promise_all
Fix value_set and error_set signatures which were receiving a
owner. They actually receive the promise and not the owner, this
caused wrong access to memory and were not visible by warnings because
the functions are casted.

This problem caused errors in which it seemed that promise had
actually error'ed when questioned it.
2016-04-13 14:44:19 -03:00
Felipe Magno de Almeida 62841aee3c eolian: Make promise eolian generation use macros for hooks
Modify the way hooks are defined and used by promise generation in
Eolian in the Eo API.

Instead of passing macro names as parameters to EO_FUNC_BODY macros,
just re-define the actual hooks when it is needed.
2016-04-11 01:28:50 -03:00
Carsten Haitzler 0e5fee0041 eina tmp get - support other tmp dir env vars and dont use xdg runtime
xdg runtime dir is NOT a tmp dir in the normal sense. it's not world
writable nor world readable. only for the user.  using
eina_environment_tmp_get() would imply that it is a regular tmp dir,
not a per-user private only runtime dir. that is something else
entirely.

@fix
2016-04-08 11:03:44 +09:00
Felipe Magno de Almeida dc954d8dba eolian: add Eolian support for Eina Promises
Add a promise object to allows Eolian interface to include promises
as a way to have asynchronous value return and composibility.

The usage is like this in a .eo file:

class Foo {
   methods {
      bar {
         params {
            @inout promise: Promise<int>;
         }
      }
   }
}

Which will create the following API interface:

void foo_bar(Eo* obj, Eina_Promise** promise);

and a Eina_Promise_Owner for the implementation, like this:

void _foo_bar(Eo* obj, Private_Data* pdata, Eina_Promise_Owner* promise);

Signed-off-by: Cedric Bail <cedric@osg.samsung.com>
2016-04-06 14:34:15 -07:00
Felipe Magno de Almeida 09eea7bc01 eina: add promise
Add a promise object that will allows Eolian interface to include promises
as a way to have asynchronous value return and composibility.

To understand better, let see the coming usage in a .eo file:

class Foo {
   methods {
      bar {
         params {
            @inout promise: Promise<int>;
         }
      }
   }
}

Which will create the following API interface:

void foo_bar(Eo* obj, Eina_Promise** promise);

and the equivalent declaration for implementation.

However, the API function will instantiate the Promise for the user
and the implementer of the class automatically. So the user of this
function will treat it as a @out parameter, while the developer of the
function will treat it like a @inout parameter.

So, the user will use this function like this:

Eina_Promise* promise; // No need to instantiate
foo_bar(obj, &promise);
eina_promise_then(promise, callback);

Signed-off-by: Cedric Bail <cedric@osg.samsung.com>
2016-04-05 11:35:12 -07:00
Boris Faure 214883f099 eina_file: move doc block about eina_file_path_join from inline to file.h 2016-03-19 15:57:46 +01:00
Oleksandr Shcherbina 48f75713e5 eina: fix eina vector in case output vector the same as target vector
Summary:
Use aditional temporary vector for intermedia results in case output vector
the same as target vector in functions:
eina_vector2_transform,
eina_vector2_homogeneous_direction_transform,
eina_vector3_cross_product,
eina_vector3_transform,
eina_vector3_homogeneous_direction_transform
It was in original version (in evas_vecN, module evas_3d_utils.h)
Enrich test suit for this case.

Reviewers: jpeg, cedric

Reviewed By: cedric

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

Signed-off-by: Cedric Bail <cedric@osg.samsung.com>
2016-03-15 11:20:55 -07:00
Jean Guyomarc'h 20df2a5d60 eina: mix possibly misleading indentation 2016-03-12 22:57:21 +01:00
Jean Guyomarc'h 8034a96108 eina: remove un-necessary tests before freeing memory
free() is specified to do nothing at all when taking NULL as input.
2016-03-12 22:57:21 +01:00
Stefan Schmidt 96bb964dd5 Revert "eina: split Makefile with files/headers in preparation for additional per sub directory compilation"
This reverts commit 7f4ea1a79c.

This reverts one of three parts of the try to get sub directory
compilation back into eina. It breaks our distcheck though and I
talked to Cedric about it and he prefers to revert these as we might
need to go another route to bring this functionality back. Details
will come to the mailing list.
2016-03-08 00:18:08 +01:00
Stefan Schmidt bb0d161d8f Revert "eina: reintroduce additional support for eina sub directory compilation."
This reverts commit 1affc60d00.

This reverts one of three parts of the try to get sub directory
compilation back into eina. It breaks our distcheck though and I
talked to Cedric about it and he prefers to revert these as we might
need to go another route to bring this functionality back. Details
will come to the mailing list.
2016-03-08 00:18:08 +01:00
Stefan Schmidt c55625aec4 Revert "eina: rely on GNU make to find file at their correct location."
This reverts commit e26fcbb1dc.

This reverts one of three parts of the try to get sub directory
compilation back into eina. It breaks our distcheck though and I
talked to Cedric about it and he prefers to revert these as we might
need to go another route to bring this functionality back. Details
will come to the mailing list.
2016-03-08 00:18:08 +01:00
Felipe Magno de Almeida d723990955 eina: Add Eina_Iterator implementation for C-array
This iterator is convenient when you already have a C-Array and you
need to pass this array to a function receiving an Eina_Iterator.

int array[] = {1, 2, 3, 4};
int* array2[] = {&array[0], &array[1], &array[2], &array[3], NULL};

Eina_Iterator* iterator = eina_carray_iterator_new((void**)array);
2016-03-06 17:24:34 -03:00
Jean Guyomarc'h 793e4e0b5a eina: fix typos in doxygen 2016-03-06 12:35:13 +01:00
Cedric Bail e26fcbb1dc eina: rely on GNU make to find file at their correct location. 2016-03-03 21:10:00 -08:00
Cedric Bail 1affc60d00 eina: reintroduce additional support for eina sub directory compilation.
This is still experimental and quite hacky. Let me know if you face issue.
It should just work with make -C src/lib/eina normally...
2016-03-03 15:10:59 -08:00
Cedric Bail 7f4ea1a79c eina: split Makefile with files/headers in preparation for additional per sub directory compilation 2016-03-03 15:10:59 -08:00
Carsten Haitzler 7920e66f29 efl - fix threadqueue spinlock destruction on openbsd - doesn't like it
so the spinlock on the threadqueue block pool it taken on shutdownn,
while the block pool is freed up then its is destroyed, but openbsd
very much doesnt like this and returns an error, so release the lock
before destroying it.

@fix
2016-03-02 10:33:40 +09:00
Jean-Philippe Andre a4270b25a3 eina log: print formatted string when log domain is invalid
Before this patch, eina_log would simply record a non-formatted
entry like:
  unknown domain -1, original message format 'proxy=%p, obj=%p'

This was not very useful as even if the log domain is invalid, the
message itself might be relevant (often those are ERR logs).

Now the message format is roughly the same as the default format,
except that the line info comes from the original message (and
doesn't refer to eina_log.c).

Backtrace printing will happen at the same level as the original
log level, in order to avoid log pollution in case DBG logs are
printed with an invalid domain (and CRI would trigger bt).

I actually wonder if the logs shouldn't actually be forwarded
to the standard log callback instead of just stderr. This may
be useful for logging with dlog or journald (atm we will simply
lose all logs without a valid domain). This would mean eina_log
itself requires a log domain.
2016-02-17 16:12:35 +09:00
se.osadchy a1584c8a5d evas: Update eina_vector, add new function.
Summary: Add direction transform for eina_vector3.

Reviewers: cedric, Hermet, jpeg

Reviewed By: jpeg

Subscribers: jpeg

Differential Revision: https://phab.enlightenment.org/D3692
2016-02-17 16:12:35 +09:00
Jean-Philippe Andre 32fedb1e6d eina: eina_array_free() now silently ignores NULL
This is a follow-up patch after 56a4535ada.
Also, remove now invalid documentation.
2016-02-17 13:40:43 +09:00
Mike Blumenkrantz 56a4535ada eina: accept NULL in eina_array_free() without erroring
@fix
2016-02-13 11:26:03 -05:00
Mike Blumenkrantz 6a93062b25 eina: invalidate last add/del rects when the opposite operation occurs
applying this optimization to prevent the same rectangle from being added
or removed repeatedly in succession would result in the rejecting of successive
operations of the same type when the other operation occurred in between.

as an example:

add(0, 0, 100, 100)
del(0, 0, 100, 100)
add(0, 0, 100, 100)

should yield (0, 0, 100, 100), not zero rects and a failure to add the
second rect

this fixes a serious issue in enlightenment where stacking three windows
on top of each other with the first and third windows having the same geometry
would result in the top window receiving no input geometry (oops)

@fix
2016-02-05 14:35:28 -05:00
se.osadchy b216d15fe7 eina: add eina_vector3 as static inline.
Summary: Move evas_vec3 to eina_vector3 and add documentation.

Reviewers: stefan_schmidt, jpeg, cedric

Reviewed By: cedric

Subscribers: jpeg

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

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2016-02-05 08:07:45 +01:00
Vincent Torri cedeb0c455 Eina_Value: do not mix declarations and code
Reviewers: cedric, jpeg

Reviewed By: jpeg

Differential Revision: https://phab.enlightenment.org/D3624
2016-02-01 12:34:48 +01:00
Jean Guyomarc'h 40f162fbc5 eina: fix invalid prototype
The prototype means "unspecified arguments". However, the implementation
specifies no parameters (void).
GCC's warning -Wstrict-prototypes complains a lots about this old-style
prototype, spamming the console when compiling more than one compiling
units including Eina.

@fix
2016-01-29 10:16:31 +01:00
Jean-Philippe Andre e472f97d96 Eina: Fix eina_file_mk[ds]temp when a path is passed
If the template is a path, mkstemp and mkdtemp would fail
miserably as they would try to create a file inside
/run/user/1000//path/to/file.XXXXXX even if the path did not
exist.

This patch fixes that by creating temp files inside the sys temp
dir iif the templatename is just a basic name without path
separator.

@fix
2016-01-19 18:18:29 +09:00
Oleksandr Shcherbina 93df8720f9 eina: Fix possible wrong value due to null in determinant of matrix
Reviewers: cedric, Hermet

Subscribers: jpeg

Differential Revision: https://phab.enlightenment.org/D3563
2016-01-13 14:04:35 +01:00
Stefan Schmidt 117ccbd98c eina_inline_value: use void to force empty function parameters
We have to use void in a function declaration if we want no function
parameters. Using just empty parenthesis means the function takes an
unspecified number of parameters.
2016-01-11 22:55:34 +01:00
Cedric BAIL bb921aff04 emile: move all eina_str_base64 to emile_base64. 2016-01-07 16:27:57 -08:00
Jean-Philippe Andre d488926cb6 Eina: Move vector2 to eina_inline_vector.x
For consistency.

Also, include inside Eina.h
Thanks @vtorri for the remark.
2016-01-07 19:18:35 +09:00
Jean-Philippe Andre dd05e72ab0 Eina Vector2: Move EAPI to static inline
This removes lots of unnecessary symbols
2016-01-07 18:05:44 +09:00
Srivardhan Hebbar 9de3520c87 eina: Updated documentation of strbuf_substr_get.
Summary:
Fixes T2949.
In the bug, its been mentioned about updating the documentation, so added this.

Signed-off-by: Srivardhan Hebbar <sri.hebbar@samsung.com>

Reviewers: cedric, jpeg

Reviewed By: jpeg

Maniphest Tasks: T2949

Differential Revision: https://phab.enlightenment.org/D3462
2016-01-07 15:37:30 +09:00
Stefan Schmidt 92bab5115a eina_value: correct the since tag for new symbols
Thiese symbols are only available since after 1.16, thus the since 1.17 tag.
2016-01-06 16:21:52 +01:00
Stefan Schmidt 30a98b7bcd eina_strbuf: add missing since tag to new symbols 2016-01-06 15:55:32 +01:00
Stefan Schmidt aba7512154 eina_bezier: correct since version for two new APIs.
These are only available from 1.17 and not already from 1.16.
2016-01-06 15:31:48 +01:00
Cedric BAIL 116fe3c65c ector: initial implementation of our own Ector GL backend. 2016-01-05 15:43:44 +09:00
Srivardhan Hebbar 7ded7cb707 eina: update .h file to make decodeurl api visible.
Summary: Signed-off-by: Srivardhan Hebbar <sri.hebbar@samsung.com>

Reviewers: jpeg, cedric

Reviewed By: cedric

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

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2016-01-04 15:42:59 -08:00
Cedric BAIL 5aa6a73b34 eina: return NULL iterator in all case, not only when safety check is turned on. 2016-01-04 15:13:06 -08:00
se.osadchy 2127547cb9 evas: create Eina_Vector2 structure and add functions.
Summary: Only copy code from evas_3d_utils, rename evas to eina and add documentation.

Reviewers: Hermet, raster, jpeg, cedric

Reviewed By: jpeg, cedric

Subscribers: jpeg

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

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2016-01-04 15:06:00 -08:00
Vincent Torri 47ed848a87 Evil: integrate the dlfcn code into Evil
This will remove some incompatibilities with other packages,
especially for win-builds
2015-12-29 22:13:58 +09:00
Jean-Philippe Andre cda8ccf770 Eina: Fix potential crash in eina_convert_dtoa
Infinity and NaN should probably just not be converted.

An error would happen in make check while saving evas 3d models.
2015-12-29 16:18:53 +09:00
Srivardhan Hebbar 1243b24f9b eina: API for base64url decode.
Summary:
eina_base64url_decode API.

Signed-off-by: Srivardhan Hebbar <sri.hebbar@samsung.com>

Reviewers: jpeg, cedric

Differential Revision: https://phab.enlightenment.org/D3434
2015-12-16 16:15:44 +09:00
Jean-Philippe Andre 7fd907a132 Eina safety: Set error flag in case of safety check error
Eina_Error is almost not used at all. Meh.
2015-12-15 17:43:39 +09:00
Jean-Philippe Andre 5ad9654fbc Eina safety: Add internal function to log errors
The main reason is convenience for debugging when using GDB,
this will give a simple breakpoint for all safety check failures.

Also, this creates a more visible log domain (red).
2015-12-15 17:32:50 +09:00
Jean-Philippe Andre 1f75cfc3cf Eina log: Disable backtrace by default for dev builds
The EINA_LOG_BACKTRACE thing is aimed at production environments,
so we can extract a backtrace from a log file post-mortem, but not
for continuous development of EFL itself.

I know this should make a few people happy.
2015-12-15 16:01:51 +09:00
Jean-Philippe Andre 6bc24b4794 Eina log: Fix meaning of EINA_LOG_BACKTRACE env
Most eina log env vars mean "if loglevel <= val then print log"
but eina_log_backtrace was "if loglevel < val" which I thought
was a bit confusing. The default behaviour is unchanged.
2015-12-15 15:25:55 +09:00
Jean-Philippe Andre 2960b70340 Eina Xml: Fix clang warnings 2015-12-15 14:35:46 +09:00
Jean-Philippe Andre 9e68f0524b Eina value: Fix clang warnings (use NULL instead of bool) 2015-12-15 14:12:21 +09:00
Felipe Magno de Almeida 5d4038d74d eina: add EINA_VALUE_TYPE_OPTIONAL, a single-element container that can be empty.
Eina Value Optional can be used to create a eina value that can be set
or be empty and can be embedded in a eina_value_struct.

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-12-10 11:10:46 -08:00
Conrad Meyer 76f9739f21 eina_inline_lock_posix: Be far more careful with pthread function error returns
Summary:
Related to T2287.

Log lock errors (printf to avoid eina_log locks) and continue or abort,
conditional on EINA_HAVE_DEBUG_THREADS.

Reviewers: raster, cedric

Subscribers: stefan_schmidt, cedric, seoz

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

Note - fixed review comments on macro names and some formatting and
error strings too - raster.
2015-12-10 20:07:59 +09:00
Stefan Schmidt 94978a3567 eina_quaternion: fix ein matrix type comparison
Fixing a bug that I fixed before. Sadly got introduced again. See
a486671bce for the details.

CID: 1341769
2015-12-09 01:22:38 +01:00
Srivardhan Hebbar 326d0e548d eina: Adding API for base64 url encoding.
Summary:
I have put the common encoding code in the common function. The 2 API's
call them with a flag. Thinking of doing the same way to decode
function also.
T2880

Signed-off-by: Srivardhan Hebbar <sri.hebbar@samsung.com>

Reviewers: cedric, jpeg

Differential Revision: https://phab.enlightenment.org/D3414
2015-12-08 20:50:40 +09:00
se.osadchy 785f4c1a5e evas: fix mistake in descriptions of matrix
Summary: Wrong word in documentation eina_matrix.h.

Reviewers: Hermet, raster, jpeg, cedric

Reviewed By: jpeg, cedric

Subscribers: jpeg

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

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-12-07 16:51:58 -08:00
se.osadchy 82504d9d77 evas: recognize duplicated data structure with eina_quternion and ector.
Summary:
Move data structure and functionality to eina_quaternion from evas_vec4.

Reviewers: raster, Hermet, cedric

Subscribers: jpeg, Oleksander

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

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-12-07 16:36:16 -08:00
Srivardhan Hebbar 7d84c19bec eina: Adding API for base64 decode.
Summary:
Added eina_str_base64_decode API.

Signed-off-by: Srivardhan Hebbar <sri.hebbar@samsung.com>

Reviewers: cedric, jpeg

Reviewed By: jpeg

Subscribers: jpeg

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

@feature
2015-12-07 19:29:36 +09:00
Vincent Torri 3b44645363 efl: add binary mode to f(re)open() calls
This allows better compatibility with Windows

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-12-05 21:04:36 +01:00
se.osadchy ce4146ec63 evas: fix bug with logic with eina_matrix in evas_3d_utils
Summary: Also need to fix logically dead code in coverity.

Reviewers: raster, Hermet, cedric

Subscribers: jpeg

Maniphest Tasks: T2832

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

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-12-02 14:15:01 -08:00
Vincent Torri 9e5852fcfb eina: use eina_file_path_join() and eina_environment_tmp_get() when needed
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-12-01 12:13:12 -08:00
Subhransu Mohanty 8212f2aee3 eina: add new api eina_bezier_on_interval()
I couldn't come up with a better name, if anyone has a suggestion.

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-11-30 15:40:01 -08:00
Cedric BAIL 78eb21296c eina: fix bad use of calloc. 2015-11-30 14:10:35 -08:00
Jean Guyomarc'h b6a43da447 eina: fix missing header
This caused functions from eina_util to be undefined at compile time.
The compiler would make implicit casts of return values into ints,
which had major side effects (e.g. segfault edje_cc)

@fix

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-11-30 14:08:56 -08:00
Stefan Schmidt a486671bce eina_matrix: optimize multiply and inverse calls by actually using the shortcut
We had this nice shortcuts for multiply and inverse with the identity matrix.
Pity we never used it! The EINA_MATRIX_TYPE_IDENTITY is coming from an enum
without and direct assignments to its internals. Being the first item in the
enum it is most likely will be 0 which makes the whole bitwise AND zero and thus
the optimized path will never get called. If our compiler now decides hew wants
to handle enums differently and does not assign the 0 to the first item this
bitwise operation will be even more screwed. What we really want is to check is
if the type we get for the matrix matches EINA_MATRIX_TYPE_IDENTITY. So better
do this. Made me look into matrix multply and inverse. Fun!

Thanks to smatch for poiting this out.
2015-11-27 00:13:04 +01:00
Daniel Hirt 89ef4b70b8 Eina unicode: add eina_unicode_unicode_to_utf8_range
Required some special treatment to get words (substring) out of an
input Unicode string to a utf8 one. This saves the trouble converting
the whole string: you input an offset in the Eina_Unicode array, and
provide the required length. That's is, now you can extract words and
whatnot in utf8 form.

To save code I wrapped the original one to get the whole length.
2015-11-24 14:22:57 +02:00
Anand 120305b08e eina: Applied NULL check
Summary:
In _eina_list_setup_accounting function
{
...
...
if (!list->accounting)
     goto on_error;
...
...
on_error:
   _eina_list_mempool_list_free(list);
}

_eina_list_mempool_list_free function deference the "list->accounting"
variable which is already NULL.

Reviewers: JackDanielZ, jpeg

Reviewed By: jpeg

Subscribers: cedric, jpeg

Differential Revision: https://phab.enlightenment.org/D3376
2015-11-24 17:50:21 +09:00
Cedric BAIL 8616e22c7e eina: always terminate the string with a '\0'. 2015-11-23 11:57:04 -08:00
Subhransu Mohanty 07bb5483b4 eina: added bounds_get api to Eina_Bezier
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-11-22 23:28:09 +01:00
Stefan Schmidt 038c4fed6c eina_thread_queue: use Eina_Bool for one-bit bitfield
Make sure we are using a unsigned var here. Best go with a Eina_Bool directly.
2015-11-13 13:31:34 +01:00
Srivardhan Hebbar 95117bc515 eina: Added API to get substring from Eina_Strbuf.
Summary:
This API is analogous to c++ substr. It returns a Eina_Strbuf with
substring of passed buf.

Signed-off-by: Srivardhan Hebbar <sri.hebbar@samsung.com>

Reviewers: cedric

Reviewed By: cedric

Differential Revision: https://phab.enlightenment.org/D3224
2015-11-10 15:04:17 -08:00
Jean-Philippe Andre d99ca361de Eina: Micro-optimize eina_main_loop_is
This is useful when Eo calls it to get the current frame stack.
This improves the performance of this function by ~50% which meant
from ~3% total CPU time to ~1.5% CPU time (if called at each eo_do).

Now this patch is a bit irrelevant since eo uses __thread instead.

This optimization is still useful for evas_eglGetCurrentXXX.
2015-11-10 16:12:21 +09:00
Carsten Haitzler 43ef6152ed efl - fix eina after misnaming of piblic api
this fixes 3d77f55f91 which added
eina_normal3_matrix_get in the headers as the api, but the actual func
was eina_normal_matrix3_get.
2015-11-10 11:56:01 +09:00
Cedric BAIL b9913d52e8 eina: fix wrong API since documentation. 2015-11-09 15:46:25 -08:00
Srivardhan Hebbar 4af4867748 eina: add an API for base64 encoding.
Summary: Signed-off-by: Srivardhan Hebbar <sri.hebbar@samsung.com>

Reviewers: cedric

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

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-11-09 15:44:09 -08:00
se.osadchy 3d77f55f91 evas: refactor duplicated data structure with eina_matrix.
Summary: Move data structure and functionality to eina_matrix from evas_mat.

Reviewers: raster, Hermet, cedric

Subscribers: Oleksander, cedric

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

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-11-09 15:27:26 -08:00
Shilpa Singh 0c1bb7d7b3 eina: add API eina_strftime
Summary:
Add new API eina_strftime API in eina_str

@feature

Test Plan: test case and example also updated

Reviewers: tasn, cedric

Reviewed By: cedric

Subscribers: cedric

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

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-11-09 12:42:50 -08:00
Shilpa Singh 297ea39a5c eina: add eina_tmpstr_manage_new, eina_tmpstr_manage_new_length APIs
Summary:
Add eina_tmpstr_manage_new, eina_tmpstr_manage_new_length APIs, these APIs create new tmpstr but reuse the input string memory.

@feature

Test Plan: Test case and example updated

Reviewers: tasn, cedric

Reviewed By: cedric

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

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-11-09 10:42:35 -08:00
Cedric BAIL e45b801577 eina: fix computation of sqrt near 1.
This is still not so good below 1.

@fix
2015-11-09 10:42:35 -08:00
Srivardhan Hebbar a356c4e3e8 eina: add API for converting strbuf to lowercase.
Summary:
This API would be used in efl_network_websocket.

Signed-off-by: Srivardhan Hebbar <sri.hebbar@samsung.com>

Reviewers: cedric

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

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-11-09 10:42:35 -08:00
Vincent Torri a1243410a7 eina/efreet: open file with binary file on Windows
@fix

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-11-06 10:53:29 -08:00
Vivek Ellur 0080ee0d60 eina_quaternion: correct the API name in header file
Summary:
This is not an ABI break as we never did provide the broken name symbol, just a typo
in the header that wasn't detected until now.

@fix

Signed-off-by: Vivek Ellur <vivek.ellur@samsung.com>

Reviewers: cedric

Subscribers: cedric

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

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-10-31 02:12:06 +01:00
Cedric BAIL a089818335 eina: correctly prepare path before sanitizing it. 2015-10-28 06:45:10 +01:00
Cedric BAIL 046d806388 Revert "Eina: Fix 58b194e0ad56fe83cce3946a5deb0045ee0cbce2"
This reverts commit 22b45f220c.

eina_file_cleanup always does an eina_tmpstr_del. This is now capable of doing
double or even triple free in some case.
2015-10-28 06:38:14 +01:00
Vincent Torri 22b45f220c Eina: Fix 58b194e0ad
Fixes the windows build as it has a matching implementation for eina_file_cleanup.

Fixes T2804
2015-10-28 03:34:10 +01:00
Cedric BAIL 58b194e0ad eina: make sure to cleanup the right string. 2015-10-23 12:32:02 -07:00
Vincent Torri d8008f4625 Eina: fix memory leak in eina_file_open()
@fix
2015-10-14 09:44:48 +01:00
Vincent Torri 8854b9f727 Eina: fix eina_file_current_directory_get()
the length was not correctly computed and eina_file_path_sanitize() was
was writing beyond the limit of the string

@fix
2015-10-14 09:44:48 +01:00
Vincent Torri cfe1817315 Eina: fix spelling in eina_tmpstr documentation 2015-10-14 09:44:48 +01:00