Commit Graph

40 Commits

Author SHA1 Message Date
Christopher Michael 732e622a82 eina_value: Fix unchecked return value
Small patch to check return value of eina_value_type_setup reported by
Coverity

Fixes CID1401023
2021-02-25 09:23:23 -05:00
Felipe Magno de Almeida ccc1849263 eina: Rename EAPI macro to EINA_API in Eina library
Summary:
Patch from a series of patches to rename EAPI symbols to specific
library DSOs.

EAPI was designed to be able to pass
`__attribute__ ((visibility ("default")))` for symbols with
GCC, which would mean that even if -fvisibility=hidden was used
when compiling the library, the needed symbols would get exported.

MSVC __almost__ works like GCC (or mingw) in which you can
declare everything as export and it will just work (slower, but
it will work). But there's a caveat: global variables will not
work the same way for MSVC, but works for mingw and GCC.

For global variables (as opposed to functions), MSVC requires
correct DSO visibility for MSVC: instead of declaring a symbol as
export for everything, you need to declare it as import when
importing from another DSO and export when defining it locally.

With current EAPI definitions, we get the following example
working in mingw and MSVC (observe it doesn't define any global
variables as exported symbols).

Example 1:
dll1:
```
EAPI void foo(void);

EAPI void bar()
{
  foo();
}
```
dll2:
```
EAPI void foo()
{
  printf ("foo\n");
}
```

This works fine with API defined as __declspec(dllexport) in both
cases and for gcc defining as
`__atttribute__((visibility("default")))`

However, the following:
Example 2:

dll1:

```
EAPI extern int foo;
EAPI void foobar(void);

EAPI void bar()
{
  foo = 5;
  foobar();
}
```

dll2:

```
EAPI int foo = 0;
EAPI void foobar()
{
  printf ("foo %d\n", foo);
}
```

This will work on mingw but will not work for MSVC. And that's why
EAPI is the only solution that worked for MSVC.

Co-authored-by: João Paulo Taylor Ienczak Zanette <jpaulotiz@gmail.com>
Co-authored-by: Ricardo Campos <ricardo.campos@expertise.dev>
Co-authored-by: Lucas Cavalcante de Sousa <lucks.sousa@gmail.com>

Reviewers: jptiz, lucas, woohyun, vtorri, raster

Reviewed By: jptiz, lucas, vtorri

Subscribers: ProhtMeyhet, cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D12188
2020-11-25 09:42:47 -03:00
Elyes HAOUAS 032894a489 Get rid of trailing whitespaces (8 / 14)
Remove trailing whitespaces
Differential Revision: https://phab.enlightenment.org/D12007
2020-06-23 10:30:16 +02:00
Mike Blumenkrantz bc52776fd6 eina/value: use correct time types when comparing time types
these functions all expect struct timeval, as the name implies

../src/lib/eina/eina_value.c: In function ‘_eina_value_type_tm_compare’:
../src/lib/eina/eina_value.c:3358:19: warning: array subscript 1 is outside array bounds of ‘time_t[1]’ {aka ‘long int[1]’} [-Warray-bounds]
 3358 |    struct timeval ret = *input;
      |                   ^~~
../src/lib/eina/eina_value.c:3569:11: note: while referencing ‘ta’
 3569 |    time_t ta, tb;
      |           ^~
../src/lib/eina/eina_value.c:3358:19: warning: array subscript 1 is outside array bounds of ‘time_t[1]’ {aka ‘long int[1]’} [-Warray-bounds]
 3358 |    struct timeval ret = *input;
      |                   ^~~
../src/lib/eina/eina_value.c:3569:15: note: while referencing ‘tb’
 3569 |    time_t ta, tb;

Reviewed-by: Stefan Schmidt <stefan@datenfreihafen.org>
Differential Revision: https://phab.enlightenment.org/D11715
2020-04-17 11:14:54 +02:00
Xavi Artigas 80acb33898 Eina: Remove eina_prime_table
This has been present since ancient times and no current uses have been detected.
It's an array containing SOME prime numbers without a terminator, so the caller
needs to know the array length in advance.
This does not look very useful (or usable) and therefore it has been decided in
public IRC session to send this thing to hell.
Witnesses: raster stefan_schmidt bu5hm4n
2020-03-27 13:33:04 +01:00
Cedric Bail 2f1894d054 eina: only the type need to be NULL to assume EINA_VALUE_EMPTY.
This avoid comparison with potentially uninitialized byte.

Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Differential Revision: https://phab.enlightenment.org/D10479
2019-10-31 14:52:41 +01:00
Cedric Bail 2fdad92948 eina: add code to help debug leaking Eina_Value.
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Differential Revision: https://phab.enlightenment.org/D9942
2019-09-19 14:37:43 -07:00
Cedric BAIL c46a814391 eina: set EINA_VALUE_EMPTY during library init.
This is a work around compiler/linker limit on some system as reported
by Romain Naour.

Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Differential Revision: https://phab.enlightenment.org/D9348
2019-07-17 14:23:09 -07:00
Vincent Torri ce9cad3a3b Eina: replace Evil.h with evil_private.h and remove Evil.h when not necessary
Test Plan: compilation

Reviewers: raster, zmike, cedric

Reviewed By: zmike

Subscribers: #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D8903
2019-05-16 13:48:59 -04:00
Cedric BAIL 805128dbf3 eina: allow copy of EINA_VALUE_EMPTY type.
This is usefule to allow timeout future to be propagated through eina_future_all
or eina_future_race for example.

Reviewed-by: Xavi Artigas <xavierartigas@yahoo.es>
Differential Revision: https://phab.enlightenment.org/D8655
2019-04-26 11:32:40 -07:00
Cedric BAIL 842b2ec381 eina: make it possible to return an EINA_VALUE_EMPTY by just requesting a new value of type NULL. 2018-05-24 16:02:19 -07:00
Cedric BAIL b1883c7989 eina: make eina_value_pget on an EINA_VALUE_TYPE_STRINGSHARE return a new reference to a stringshare. 2018-05-01 10:39:01 -07:00
Cedric Bail 473ed10c02 eina: add an EINA_VALUE_TYPE_BOOL. 2018-05-01 10:39:01 -07:00
Cedric Bail 7821367b1a eina: properly initialize EINA_ERROR_VALUE_FAILED. 2017-11-17 11:12:06 -08:00
Amitesh Singh 04fe5e10a2 eina: eina_value - Add "struct tm" support
Ref T6204

@feature
2017-10-30 16:04:53 +09:00
Vincent Torri 0cdd501246 EFL For WIN32: Replace HAVE_EVIL define with _WIN32 2017-09-22 05:06:10 -05:00
Cedric Bail 8fbfab83e9 eina: add an ability to quickly convert from an Eina_Value to an Eina_Binbuf. 2017-09-13 17:26:04 -07:00
Cedric Bail f5487c5d3e eina: fix Eina_Rectangle support in Eina_Value.
Thanks for the review Gustavo.
2017-09-13 10:39:31 -07:00
Cedric Bail 430095d4f1 eina: allow convertion to BLOB from Eina_File Eina_Value by mmap the file. 2017-09-13 10:38:36 -07:00
Cedric Bail af452c439d eina: improve Eina_File support in Eina_Value.
Thanks Gustavo.
2017-09-13 10:36:05 -07:00
Vincent Torri 966577ffed eina: add an Eina_Value helper for Eina_Rectangle. 2017-09-12 17:03:49 -07:00
Cedric BAIL 95dd799715 eina: add an Eina_Value helper for Eina_File. 2017-09-12 17:03:17 -07:00
Guilherme Iscaro 6cbfe100d5 Eina_Value type EINA_value. 2017-08-23 18:32:13 -03:00
Guilherme Iscaro 3ed176370d Eina: Add EINA_VALUE_TYPE_ERROR
This new type will be used by the new promise/future implementation,
which will be used to flag errors.
2017-08-23 18:32:13 -03: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
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
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
vivek e1eff60c80 eina: Eina_Value - use eina_mempool_free to cleanup the memory
Summary:
The new value is allocated using Eina_Mempool, it should be freed using
eina_mempool, not using libc free.

@fix

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

Reviewers: cedric

Reviewed By: cedric

Subscribers: cedric

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

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-02-05 15:37:15 +01:00
Srivardhan Hebbar 1d25d6da79 eina: fix memory leak issue in Eina_Value.
Summary:
eina_inarray_free was not called. So calling it to fix the memory leak.

@fix

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

Reviewers: devilhorns

Subscribers: cedric

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

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2014-12-25 21:37:05 +01:00
Cedric BAIL f7fd1f1c84 eina: simplifie logic to not go with multiple level of callback for just getting the first entry in a hash.
CID 1039937.
2014-06-05 03:02:06 +02:00
Jérémy Zurcher f8c2c57406 do not use EINA_FALSE instead of NULL 2014-05-07 17:45:11 +02:00
Mike Blumenkrantz a3927ca1a7 eina_value_free() now takes NULL like the rest of the efl free functions 2014-04-26 02:21:51 -04:00
Carsten Haitzler 69e27abdc3 eina - and e3fl in general - stop using eina_error_get/set - useless really 2013-10-11 16:50:40 +09:00
Sebastian Dransfeld 068f1ddc62 efl: formatting 2013-06-20 13:08:36 +02:00
Cedric Bail 5fc7829c96 eina, evil: fix warning on 64 bits 2013-03-10 20:32:53 +09:00
Gustavo Sverzut Barbieri 0a2d116119 efl: eina_alloca.h to simplify alloca() usage.
having to replicate 18 lines per file just to access alloca() is
insane. Let's do that in Eina.h and avoid that crap :-/



SVN revision: 82082
2013-01-03 15:10:34 +00:00
Gustavo Lima Chaves a4b2a48dc0 [eina] Better pretty printing of eina_value timeval buddies.
SVN revision: 79154
2012-11-12 12:26:07 +00:00
Vincent Torri 7fe3d35994 merge: __UNUSED__ --> EINA_UNUSED and some fixes in eo.
SVN revision: 77542
2012-10-05 20:09:47 +00:00
Vincent Torri 785f2a6b3a merge : add eina
currently, examples, tests and benchmark are not set. That's the next things i'll do


SVN revision: 76710
2012-09-16 10:57:48 +00:00