Compare commits

...

107 Commits

Author SHA1 Message Date
Felipe Magno de Almeida 3179089b49 windows: Create basename function 2020-05-04 23:52:13 -03:00
Felipe Magno de Almeida d7fa5eab99 windows: Disable compilation of eina_btlog on Windows 2020-05-04 23:51:55 -03:00
Felipe Magno de Almeida 17f5baf498 windows: Do not use thread_push and thread_pop 2020-05-04 23:51:21 -03:00
Felipe Magno de Almeida e84115e135 windows: Add test batch file 2020-05-04 23:49:54 -03:00
Felipe Magno de Almeida 5a98a48bd2 windows: Do not use S_ISREG in windows platform 2020-05-04 23:21:03 -03:00
João Antônio Cardoso 7b9e078cc7 windows: Add vasprintf as helper 2020-05-04 23:17:09 -03:00
Felipe Magno de Almeida d40f4e87d9 windows: Add PCRE_STATIC define to link with PCRE statically 2020-05-04 22:50:29 -03:00
João Antônio Cardoso 64964ed930 windows: Add fnmatch win32 implementation 2020-05-04 22:28:13 -03:00
Felipe Magno de Almeida cb1b57ec6a windows: Fix use of S_ISREG and S_ISDIR in windows code 2020-05-04 22:11:45 -03:00
Felipe Magno de Almeida 9669af7298 Remove wrongful use of pthread.h include and windows.h include 2020-05-04 22:11:45 -03:00
Felipe Magno de Almeida db2fe9bfcc Fix EVIL_API for mmap functions 2020-05-04 22:11:45 -03:00
Felipe Magno de Almeida 253f8eaa77 Implement time functions in eina for WIN32 2020-05-04 22:11:45 -03:00
Felipe Magno de Almeida df3a9dab23 windows: Squash with lock and threads 2020-05-04 22:11:44 -03:00
carlos 6d37a46e2b eina_debug.c now use eina_threads functions instead of pthreads 2020-05-04 22:11:44 -03:00
Felipe Magno de Almeida 019828797c More things to squash 2020-05-04 22:11:44 -03:00
Felipe Magno de Almeida 4d714f44e1 Commit to be squashed in other commits 2020-05-04 22:11:44 -03:00
Felipe Magno de Almeida df31f3b168 windows: Comment out compilation of anything else besides eina 2020-05-04 22:11:44 -03:00
Felipe Magno de Almeida a6ea29e03f Windows: Rename EAPI macro in Eina to EINA_API to handle __declspec by DSO 2020-05-04 22:11:44 -03:00
Felipe Magno de Almeida 3c1425c23e windows: Replace EAPI with EVIL_API in evil library 2020-05-04 22:11:44 -03:00
Felipe Magno de Almeida a5caa53f8f windows: Add evil_windows.h before socket includes in eina 2020-05-04 22:11:43 -03:00
Felipe Magno de Almeida b92dfa461c windows: Add some tooling information to native windows file 2020-05-04 22:11:43 -03:00
Felipe Magno de Almeida afe812acdb windows: Add direct.h for functions similar to unistd.h 2020-05-04 22:11:43 -03:00
Felipe Magno de Almeida 0bb295fadc windows: Add more debug information to build.bat 2020-05-04 22:11:43 -03:00
Joao Antonio Cardoso cf62ea7bab alternative: using definitions to map ucrt 2020-04-30 14:40:34 -03:00
Lucas ea6d1c40ee
Windows:eina: Add Thread synchronization (#34)
This should add all needed functions/structures for thread synchronization besides:
- eina_condition initialization;
- cond_timedwait.
2020-04-30 14:11:51 -03:00
Felipe Magno de Almeida 728e1afde9 efl-windows: Create windows.yml for github CI 2020-04-30 11:56:50 -03:00
carlos 513b166b97 code style 2020-04-29 12:13:38 -03:00
carlos 6436feb57c code style 2020-04-29 12:13:38 -03:00
carlos 1b45bef154 default thread priority, and default stack size posix like 2020-04-29 12:13:38 -03:00
carlos c8960c2006 code style 2020-04-29 12:13:38 -03:00
carlos 59f07e1f86 _eina_thread_join return int 2020-04-29 12:13:38 -03:00
carlos 8b4b7d0e64 meson.build verify if exists symbols thread_setname and thread_setaffinity for win32 2020-04-29 12:13:38 -03:00
carlos 0c7d90a12c EINA_THREAD_JOIN_CANCELED in eina_thread.h 2020-04-29 12:13:38 -03:00
carlos 5c89d47bdc EINA_HAVE_PTHREAD_SETNAME to EINA_HAVE_THREAD_SETNAME 2020-04-29 12:13:38 -03:00
carlos 3c09795607 just on if sys_windows 2020-04-29 12:13:38 -03:00
carlos 00dd023f12 EINA_THREAD_JOIN_CANCELED just in eina_thread.h and removed some unecessary cast 2020-04-29 12:13:38 -03:00
carlos 39adc0b580 eina_sched_win32 code convention 2020-04-29 12:13:38 -03:00
carlos 4e346e2c06 eina_sched_posix code convention 2020-04-29 12:13:38 -03:00
carlos 9577601d06 eina_inline_thread_win32 code convention 2020-04-29 12:13:38 -03:00
carlos 2a29c410aa eina_inline_thread_posix code convention 2020-04-29 12:13:38 -03:00
carlos 4cee97de7e eina_debug_timer code convention 2020-04-29 12:13:38 -03:00
carlos 1b3f60780e headers comuns agora estao em eina_thread.h 2020-04-29 12:13:38 -03:00
carlos 845c323190 adicionado static inline functions no.x 2020-04-29 12:13:38 -03:00
carlos 2894e8459d #undef _WIN32_LEAN_AND_MEAN 2020-04-29 12:13:38 -03:00
carlos 807ba9b1ce eapi const moved from eina_inline_thread_win32.x to eina_thread_win32.h 2020-04-29 12:13:38 -03:00
carlos 2ed5fe3ccc Renamed eina_thread_{win32,posix}.c to eina_inline_thread_{win32,posix}.x
All includes and types from these files were moved to eina_thread_{win32,posix}.h
No more private functions of eina_sched_prio_drop and this functions are defined acording to SO, in eina_sched_{win32,posix}.c
2020-04-29 12:13:38 -03:00
carlos b852570013 Removed unnecessary comments and lines.
Created eina_sched_{win32,posix}.c Now _eina_sched_prio_drop is in this file, not in eina_thread{win32,posix}.c
No more function about pthreads in eina_thread.c
Functions wrappers declared into eina_thread.h
Removed somes #ifdef linux
2020-04-29 12:13:38 -03:00
carlos 3bd220796f aplying review from coquinho 2020-04-29 12:13:38 -03:00
carlos 8666e10639 tiz answer 2020-04-29 12:13:38 -03:00
carlos ac9e9cbce8 removed a false #ifndef _WIN32 2020-04-29 12:13:38 -03:00
carlos da4b9ec858 divided eina_sched_prio_drop into eina_thread_win32.c and eina_thread_posix.c; Code convention 2020-04-29 12:13:38 -03:00
carlos 74dd7e2a4f Apply suggestions of jptiz and lucas 2020-04-29 12:13:38 -03:00
carlos 268178b9d5 removed unnecessary comments 2020-04-29 12:13:38 -03:00
carlos b7c43d51c1 fix the use of WIN32_LEAN_AND_MEAN 2020-04-29 12:13:38 -03:00
carlos 912ffe04a8 add WIN32_LEAN_AND_MEAN to prevent window.h from including unnecessarily headers 2020-04-29 12:13:38 -03:00
carlos a3bfef027d eina_sched.c with win32 api 2020-04-29 12:13:38 -03:00
caiosignor d51f5295e5 eina_sched.c win32 implementation 2020-04-29 12:13:38 -03:00
caiosignor cb61d63cb8 pthread to win32 2020-04-29 12:13:38 -03:00
caiosignor f9b57e5569 merged from devs/coquinho/lock 2020-04-29 12:13:38 -03:00
caiosignor 425a9a5fbd Separate eina_thred.c into eina_thread_posix.c and eina_thread_win32.c; Changed the meson.build to call theses files according to SO. 2020-04-29 12:13:38 -03:00
João Paulo Taylor Ienczak Zanette ed0287d23b windows: Add wrap for getopt 2020-04-29 11:07:36 -03:00
Lucas Cavalcante de Sousa 65278b6438 Windows: Fix JPTIZ comments
Remove debugging `asserts` and unnecessary parenthesis ta `if`.
2020-04-23 16:01:14 -03:00
Lucas Cavalcante de Sousa f7d1061a35 Bug: Compile `devs/expertise/native-windows` on Linux
Summary:
========
This PR makes `devs/expertise/native-windows` compile on linux.

lua was a little problematic:
luajit is a default option to bindings in `master` but at
`devs/expertise/native-windows` it was changed to lua, This PR brings
luajit back as a default option, but make a Windows build always use
lua - semantically equal to what happened at
`devs/expertise/native-windows`

Ref Issue #38

Linux Test plan:
================
- `meson` configured with `-Dbindigns=cxx,mono`;
- `ninja` should return every warning that `master` does, nothing else;
- `meson test -C <build dir>` should pass in everything that `master`
  does;

Windows Test plan:
==================
- Run `configure.bat` normally;
- Run `build.bat` it should yield the same erros/warnigs that
  `devs/expertise/native-windows` does;
2020-04-23 16:01:14 -03:00
João Paulo Taylor Ienczak Zanette 8437d20dc8 windows: Use correct pcre header, fix missing evil_unposix declaration 2020-04-23 15:14:47 -03:00
João Paulo Taylor Ienczak Zanette 23459a4eb5 windows: Add evil_unposix as declare_dependency when not in windows 2020-04-23 15:14:47 -03:00
João Paulo Taylor Ienczak Zanette 9af77e4929 windows: Stop wrong inclusion of unposix in subprojects 2020-04-23 15:14:47 -03:00
João Paulo Taylor Ienczak Zanette ae4f052980 windows: Transform zlib and pcre into wrap dependencies 2020-04-23 15:14:47 -03:00
Lucas Cavalcante de Sousa 160587f260 windows: Enable implicit-function-declaration error.
As implicit-function-declaration is a really important error for who is
reviewing/creating PR's I suggest to disable
`Wno-implicit-function-declaration` at meson build. The ones who need
the warning disabled can do it themselves.
2020-04-23 13:04:39 -03:00
Lucas Cavalcante de Sousa 7af8f90828 Windows:sys/time.h: Reamove linking error at localtime_s
Summary:
Remove the following linking error:
```
[18/1920] Linking target src/lib/evil/unposix/sys/evil_unposix_sys-1.dll.
FAILED: src/lib/evil/unposix/sys/evil_unposix_sys-1.dll
lld-link @src/lib/evil/unposix/sys/evil_unposix_sys-1.dll.rsp
lld-link: error: undefined symbol: localtime_s
>>> referenced by src/lib/evil/unposix/sys/f1142d4@@evil_unposix_sys@sha/time.c.obj:(l
ocaltime_r)
```

`localtime_t` is from `ucrt/time.h`. `#include <time.h>` was not picking
`UCRT` implementation of `time.h`, now it is changed to `#include
<../ucrt/time.h>`, forcing `UCRT`'s implementation.

If at some point `time.h` (`time.h` not `sys/time.h`) is add to
`unposix` this should be changed to `#include <../time.h>` as there
shoud be a `#include_next <time.h>`.

Test Plan:
- added -k0 to NINJAFLAGS at build.bat;
- there should not be any errors/warnings about sys/time.h.
- there will be a lot of other linkge errors, but none about finding
  methods defined at `sys/time.{h,c}`.
2020-04-03 15:54:03 -03:00
João Paulo Taylor Ienczak Zanette 1c6e5d314e windows: Pass flags to build.bat straight-forwardly 2020-04-02 09:51:17 -03:00
João Paulo Taylor Ienczak Zanette 5892e25875 windows: Define WIN32_LEAN_AND_MEAN only when in Windows 2020-04-01 18:24:53 -03:00
Lucas Cavalcante de Sousa d631343888 indows:sys/types.h: Should add every needed non pthread_* type
It does so by:
- including definitions that Windows already has;
- `typedef` the ones that Windows doesn't have, following `sys/types.h`
  manual guidelines;
- `pid_t` is a process id, so on this implementation is
  `typedef` as an `DWORD`, the type returned by `GetCurrentProcessId`
  function, and thus it is an `unsigned long`. `sys\types.h` manual
  establishes that it should be a `signed int` and when changed, it
  should not be larger than a `long`;

Test Plan:
- merged #PR16 then reset to my last commit, doing so to use
  `src/lib/evil/unposix/{meson.build,sys/meson.build};
- comment `-Wno-missing-variable-declarations` at `meson.build`;
- added `-k0` to `NINJAFLAGS` at `build.bat`;
- there should not be any errors/warnings about sys/types.h.
2020-04-01 18:24:53 -03:00
Lucas Cavalcante de Sousa f06c1747dd Windows:sys/time.h: Correct sys/time.h errors
Summary:
The way sys/time.h was added it was not being compiled in the right way.
PR#16 makes possible to compile unposix/sys, so it was possible to
detect some errors.
The errors were about fault includes.
Now there should be no compile errors at sys/time.h.

Depends on PR#16

Test Plan:
- comment -Wno-missing-variable-declarations at meson.build;
- added -k0 to NINJAFLAGS at build.bat;
- there should not be any errors/warnings about sys/types.h.
2020-04-01 18:24:52 -03:00
João Paulo Taylor Ienczak Zanette 135415bac7 windows: Link unposix statically 2020-04-01 18:24:52 -03:00
Joao Antonio Cardoso dced42bbfa automatic_pkgfile using sys_windows now 2020-04-01 18:24:52 -03:00
Joao Antonio Cardoso 50c6cc6cfc Integrating with elf meson build and build.bat 2020-04-01 18:24:52 -03:00
Joao Antonio Cardoso 66f4e10049 time restored 2020-04-01 18:24:52 -03:00
Joao Antonio Cardoso e499002bdd Fixing requested changes on version and pkgfile
- a project version was described, enabling the library version to
be used in the same way others meson.build from EFL describes it.
- another (but compatible) variable is used here to set the value
of 'automatic_pkgfile' because 'sys_windows' wasn't declared.
2020-04-01 18:24:52 -03:00
João Antônio Cardoso 73db22be20 Delete time.h 2020-04-01 18:24:52 -03:00
João Antônio Cardoso e6fe763b7d Delete time.c 2020-04-01 18:24:52 -03:00
Joao Antonio Cardoso 9eab181022 headers separated from sources 2020-04-01 18:24:52 -03:00
Joao Antonio Cardoso 633d5cec91 dumb mod just to test meson 2020-04-01 18:24:52 -03:00
Joao Antonio Cardoso d0033ba6d4 meson: compiling without efl meson project 2020-04-01 18:24:52 -03:00
Lucas Cavalcante de Sousa e291ab2005 Windows: sys/time.h: Fix jptiz comments 2020-04-01 18:24:52 -03:00
Lucas Cavalcante de Sousa 7257d900d1 Windows: sys/time.h: Now implementation is separeted from declaration as should be.
- `src/lib/evil/unposix/sys/time.c` was add to `src/lib/evil/meson.build`;
- .c and .h were separeted;
- Faulty timezone structure implemented

Test plan:
- Ninja with `-k0` flag compiles as much as with
`src/lib/evil/unposix/sys/time.c` as with the stub and there is no
aditional error.
2020-04-01 18:24:52 -03:00
Lucas Cavalcante de Sousa 5d5ae6860f sys/time.h: add WIN32_LEAN_AND_MEAN guards 2020-04-01 18:24:52 -03:00
Lucas Cavalcante de Sousa 82e9fb78a5 sys/time.h: add gettimeofday and localtime_r 2020-04-01 18:24:52 -03:00
João Paulo Taylor Ienczak Zanette c12949c9fa windows: Send -Wno-* flags to meson.build for a while 2020-04-01 18:24:52 -03:00
João Paulo Taylor Ienczak Zanette 77fb4f9fe4 windows: Fixed Coquinho's comments 2020-04-01 18:24:52 -03:00
João Paulo Taylor Ienczak Zanette e42a4ca13b windows: Fix possible missing quotes in -D directory paths 2020-04-01 18:24:52 -03:00
João Paulo Taylor Ienczak Zanette f372afa94f windows: Ignore some more warnings 2020-04-01 18:24:52 -03:00
João Paulo Taylor Ienczak Zanette 88859bc850 windows: Remove (now) duplicate mkdir define 2020-04-01 18:24:52 -03:00
João Paulo Taylor Ienczak Zanette 4163277e28 windows: Add unposix to include path 2020-04-01 18:24:52 -03:00
João Paulo Taylor Ienczak Zanette f91b6786b3 windows: Add tons of posix header stubs. 2020-04-01 18:24:52 -03:00
João Paulo Taylor Ienczak Zanette 0d2fdc2bb9 windows: Add --verbose option 2020-04-01 18:24:52 -03:00
João Paulo Taylor Ienczak Zanette 8f50025309 windows: Fix zlib_dir description 2020-04-01 18:24:52 -03:00
João Paulo Taylor Ienczak Zanette 95fdd19a44 windows: Use ZLIB_DIR for zlib dependency lookup 2020-04-01 18:24:51 -03:00
João Paulo Taylor Ienczak Zanette 8ceea9ce08 windows: Create an evil_eapi.h to define EAPI 2020-04-01 18:24:51 -03:00
João Paulo Taylor Ienczak Zanette 641a58ebba windows: Ignore some warnings and add unistd, pthread and time.h. 2020-04-01 18:24:51 -03:00
João Paulo Taylor Ienczak Zanette e596cc2e31 windows: Ignore all warnings for a while. 2020-04-01 18:24:51 -03:00
Lucas Cavalcante de Sousa 452b6925fb `vcvarsx64` was not being saved for aftwords, not it is
Tested %vcvarsx64%:
1. `@echo %vcvarsx64% > test1`
2. run `build.bat` may times
3. `@echo %vcvarsx64% > test2`
4. `diff test1 test2` there should be no diference
Tested %path%:
1. `@echo %path% > test1`
2. run `build.bat` may times
3. `@echo %path% > test2`
4. `diff test1 test2` there should be no diference
2020-04-01 18:24:51 -03:00
João Paulo Taylor Ienczak Zanette dca0792fa8 windows: Prevent path from stacking in every configure/build call. 2020-04-01 18:24:51 -03:00
João Paulo Taylor Ienczak Zanette df92a0ec6a windows: Use env.bat for paths (Fixes #1). 2020-04-01 18:24:51 -03:00
João Paulo Taylor Ienczak Zanette 73082c6489 windows: Use labels as functions. 2020-04-01 18:24:51 -03:00
João Paulo Taylor Ienczak Zanette a60f5c2c14 windows: Use --wipe only if build dir does not exist. 2020-04-01 18:24:51 -03:00
João Paulo Taylor Ienczak Zanette f9e21cd841 windows: Clearer build scripts and set colored output 2020-04-01 18:24:51 -03:00
Tiz 464fffac86 [WIP] Using native-file for windows. 2020-04-01 18:24:51 -03:00
247 changed files with 5759 additions and 2674 deletions

88
.github/workflows/windows.yml vendored Normal file
View File

@ -0,0 +1,88 @@
name: EFL on Windows
on:
push:
pull_request:
branches: [ devs/expertise/native-windows ]
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Cache Nasm install
uses: actions/cache@v1
id: cache-nasm
env:
cache-name: cache-nasm
with:
path: "C:\\Program Files\\Nasm"
key: cache-nasm-v1
restore-keys: cache-nasm-v1
- name: Cache LLVM install
uses: actions/cache@v1
id: cache-llvm
env:
cache-name: cache-llvm
with:
path: "C:\\Program Files\\LLVM"
key: cache-llvm-v10.0.0.0-1
restore-keys: cache-llvm-v10.0.0.0-1
- name: Install LLVM
if: steps.cache-llvm.outputs.cache-hit != 'true'
run: choco install llvm
- name: Add clang-cl to PATH
run: echo "::add-path::C:\Program Files\LLVM\bin"
- name: Search clang-cl
run: clang-cl -v
- name: install nasm
if: steps.cache-nasm.outputs.cache-hit != 'true'
run: choco install nasm
- name: Add Nasm to PATH
run: echo "::add-path::C:\Program Files\Nasm"
# - name: test nasm
# run: nasm.exe -v
- name: install ninja
# unexplicably, installation returns error code 1 if a cache location is used
run: choco install ninja
- name: test ninja
run: ninja --version
- name: install meson
run: py -3 -m pip install meson
- name: add meson to path
run: echo "::add-path::C:\hostedtoolcache\windows\Python\3.8.2\x64\Scripts"
- name: test meson
run: meson -v
- name: Cache OpenSSL compilation
id: cache-openssl
uses: actions/cache@v1
env:
cache-name: cache-openssl-compilation
with:
path: openssl
key: openssl-1_1_1g
restore-keys: openssl-1_1_1g
- name: Download openssl source
if: steps.cache-openssl.outputs.cache-hit != 'true'
run: git clone -b OpenSSL_1_1_1g https://github.com/openssl/openssl
- uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64
- name: Show from where clang-cl
run: where clang-cl
- name: Configure OpenSSL
if: steps.cache-openssl.outputs.cache-hit != 'true'
run: perl Configure VC-WIN64A
working-directory: .\openssl
- name: Compile OpenSSL
if: steps.cache-openssl.outputs.cache-hit != 'true'
run: nmake
working-directory: .\openssl
- name: configure
run: .\configure.bat
env:
OPENSSL_DIR: ${{ github.workspace }}\openssl
- name: Build
run: .\build.bat

9
.gitignore vendored
View File

@ -95,3 +95,12 @@ Session.vim
efl_libs.csv efl_libs.csv
.vscode/ .vscode/
.uuid .uuid
#native windows files
env.bat
# Subprojects
subprojects/pcre-*
subprojects/zlib-*
subprojects/getopt
subprojects/packagecache

22
build.bat Normal file
View File

@ -0,0 +1,22 @@
@echo off
set __OLD_vcvars64=%vcvars64%
set vcvars64="C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvars64.bat"
set CLICOLOR_FORCE=1
set NINJAFLAGS=%*
set vcvars64="C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvars64.bat"
set CLICOLOR_FORCE=1
if not defined DevEnvDir (
echo DevEnvDir not defined. Running vcvars64...
call %vcvars64%
@set DevEnvDir=%cd%
)
ninja %NINJAFLAGS% -C build
set vcvars64=%__OLD_vcvars64%
set __OLD_vcvars64=
exit /B %ERRORLEVEL%

150
configure.bat Normal file
View File

@ -0,0 +1,150 @@
@echo off
setlocal EnableDelayedExpansion
if "%~1"=="--verbose" (
echo Verbose ON.
set VERBOSE=ON
) else (
echo Verbose OFF.
)
call :main || (echo Build configure failed.)
exit /B %errorlevel%
:check_env_vars
@echo Checking if necessarry environment variables were set...
set envfile=env.bat
if exist %envfile% (
@echo - Found %envfile% file.
call %envfile%
) else (
@echo - File %envfile% doesn't exists. Relying on previously set environment variables...
)
set envfile=
set all_set=1
if not defined OPENSSL_DIR set all_set=0
if %all_set%==1 (
@echo - Using OpenSSL: %OPENSSL_DIR%
) else (
@echo At least one of the following variables were not set:
@echo - OPENSSL_DIR: %OPENSSL_DIR%
@echo Please define them using by creating a "env.bat" file containing:
@echo @set OPENSSL_DIR=^<your OpenSSL directory^>
exit /B 1
)
set all_set=
exit /B 0
:setup_flags
@echo ------------------------------
@echo Setting up build flags...
:: ---------------------------------
:: Compilers
set CC=clang-cl
@echo - C Compiler: %CC%
set CXX=clang-cl
@echo - C++ Compiler: %CXX%
:: ---------------------------------
:: Windows terminal specific options
set CFLAGS=-fansi-escape-codes -Wno-implicit-fallthrough %CFLAGS%
if defined VERBOSE (
set CFLAGS=-v %CFLAGS%
)
@echo - Using CFLAGS=%CFLAGS%
:: ------------------------------------------------------
set MESONFLAGS=^
-Dopenssl_dir="%OPENSSL_DIR:"=%"^
-Dcrypto=openssl^
-Dnls=false^
-Dsystemd=false^
-Dglib=false^
-Dgstreamer=false^
-Ddbus=false^
-Daudio=false^
-Davahi=false^
-Dv4l2=false^
-Delua=false^
-Dx11=false^
-Dphysics=false^
-Deeze=false^
-Dpulseaudio=false^
-Dharfbuzz=false^
-Dfribidi=false^
-Dfontconfig=false^
-Dedje-sound-and-video=false^
-Dlibmount=false^
"-Devas-loaders-disabler=gst,pdf,ps,raw,svg,rsvg,xcf,bmp,dds,eet,generic,gif,ico,jp2k,jpeg,pmaps,png,psd,tga,tgv,tiff,wbmp,webp,xpm,json"^
-Dopengl=none^
"-Demotion-loaders-disabler=gstreamer1,libvlc,xine"^
-Dbuild-tests=false^
-Dbuild-examples=false^
-Dbindings=^
--native-file native-file-windows.txt
if exist build (
@echo "- Build directory ("build") already exists. Old config will be wiped with `--wipe`."
set MESONFLAGS=%MESONFLAGS% --wipe
) else (
@echo No Creating new build directory.
)
set NLM=^
set NL=^^^%NLM%%NLM%%NLM%%NLM%
@echo Here %NL%we go
@echo Meson flags: %MESONFLAGS: =!NL!%
@echo ------------------------------
exit /B 0
:generate_build
@echo ------------------------------
@echo Generating build...
set vcvars64="C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvars64.bat"
if not defined DevEnvDir (
call %vcvars64%
)
meson build %MESONFLAGS: = %
exit /B %ERRORLEVEL%
:save_old_vars
@echo ------------------------------
set __OLD_vcvars64=%vcvars64%
set __OLD_CC=%CC%
set __OLD_CXX=%CXX%
set __OLD_CFLAGS=%CFLAGS%
set __OLD_MESONFLAGS=%MESONFLAGS%
exit /B 0
:restore_old_vars
@echo ------------------------------
set vcvars64=%__OLD_vcvars64%
set CC=%__OLD_CC%
set CXX=%__OLD_CXX%
set CFLAGS=%__OLD_CFLAGS%
set MESONFLAGS=%__OLD_MESONFLAGS%
set __OLD_vcvars64=
set __OLD_CC=
set __OLD_CXX=
set __OLD_CFLAGS=
set __OLD_MESONFLAGS=
exit /B 0
:main
call :save_old_vars
call :check_env_vars || (echo Environment Variables check failed) && exit /B 1
call :setup_flags
call :generate_build || (echo Meson failed) && exit /B 1
call :restore_old_vars

View File

@ -154,10 +154,14 @@ if strerror_r_char_p
endif endif
#for later use, a bunch of librarie findings #for later use, a bunch of librarie findings
if host_machine.system() != 'windows'
m = cc.find_library('m') m = cc.find_library('m')
endif
#just keep this here as required false, if it is not inplace the library rt will just be linked as NOP #just keep this here as required false, if it is not inplace the library rt will just be linked as NOP
if host_machine.system() != 'windows'
dl = cc.find_library('dl', required: false) dl = cc.find_library('dl', required: false)
rt = cc.find_library('rt', required: false) rt = cc.find_library('rt', required: false)
endif
thread_dep = dependency('threads') thread_dep = dependency('threads')
@ -208,21 +212,34 @@ if sys_linux and config_h.has('HAVE_LISTXATTR') and config_h.has('HAVE_SETXATTR'
config_h.set10('HAVE_XATTR', true) config_h.set10('HAVE_XATTR', true)
endif endif
regexp = [] if sys_windows
if sys_windows == true # pcre
regexp = cc.find_library('regex', pcre_project = subproject('pcre')
has_headers: ['regex.h', 'fnmatch.h'],
required: true) pcre = pcre_project.get_variable('pcre8')
if regexp.found() == false pcre_dep = pcre_project.get_variable('pcre_dep')
error('regex can not be found')
endif # zlib
zlib_project = subproject('zlib')
zlib = zlib_project.get_variable('zlib')
zlib_dep = zlib_project.get_variable('zlib_dep')
zlib_include_dir = zlib_project.get_variable('incdir')
getopt_project = subproject('getopt')
getopt = getopt_project.get_variable('getopt')
getopt_dep = getopt_project.get_variable('getopt_dep')
else else
if cc.has_header_symbol('fnmatch.h', 'fnmatch') == false zlib_dep = dependency('zlib')
error('fnmatch can not be found') if not cc.has_header_symbol('regex.h', 'regcomp')
endif error('regcomp can not be found')
if cc.has_header_symbol('regex.h', 'regcomp') == false endif
error('regcomp can not be found')
endif if not cc.has_header_symbol('fnmatch.h', 'fnmatch')
error('fnmatch can not be found')
endif
getopt_dep = declare_dependency()
endif endif
config_h.set('VMAJ', version_major) config_h.set('VMAJ', version_major)
@ -234,7 +251,9 @@ config_h.set('VREV', '0')
jpeg = dependency('libjpeg', required: false) jpeg = dependency('libjpeg', required: false)
if jpeg.found() == false if jpeg.found() == false
jpeg = cc.find_library('jpeg') if not sys_windows
jpeg = cc.find_library('jpeg')
endif
endif endif
if sys_bsd == true if sys_bsd == true

View File

@ -8,7 +8,9 @@ if host_machine.system() == 'darwin'
add_languages('objc') add_languages('objc')
endif endif
if host_machine.system() != 'windows'
pkgconfig = import('pkgconfig') pkgconfig = import('pkgconfig')
endif
test_env = environment() test_env = environment()
test_env.set('EFL_RUN_IN_TREE', '1') test_env.set('EFL_RUN_IN_TREE', '1')
@ -85,9 +87,98 @@ foreach cf: dev_cflags_try
dev_cflags += cf dev_cflags += cf
endif endif
endforeach endforeach
add_global_arguments(dev_cflags, language: 'c') add_global_arguments(dev_cflags, language: 'c')
add_global_arguments(dev_cflags, language: 'cpp') add_global_arguments(dev_cflags, language: 'cpp')
if sys_windows
if not get_option('dbus')
dbus = declare_dependency()
eldbus = declare_dependency()
endif
dl = declare_dependency()
m = declare_dependency()
# ---------------------------------
# Ignored warnings
# TODO: Re-enable warnings one by one and solve them.
add_global_arguments([
# Compiler-specific
'-Wno-reserved-id-macro',
'-Wno-deprecated-declarations',
'-Wno-gnu-zero-variadic-macro-arguments',
'-Wno-nonportable-system-include-path',
'-Wno-microsoft-enum-forward-reference',
# Syntax/Parsing
#'-Wno-implicit-function-declaration',
'-Wno-missing-prototypes',
'-Wno-unreachable-code',
'-Wno-unreachable-code-return',
'-Wno-extra-semi',
'-Wno-extra-semi-stmt',
# Declaration not visible outside function:
'-Wno-visibility',
# A global variable declared in a .c file is not static and hasn't
# been declarated with `extern` anywhere.
'-Wno-missing-variable-declarations',
'-Wno-missing-noreturn',
# Possible misuse of comma operator
'-Wno-comma',
'-Wno-unreachable-code-break',
# Architectural
'-Wno-cast-align',
'-Wno-shorten-64-to-32',
# Type system
# When a switch-case misses one possible enum vlaue
'-Wno-switch-enum',
# Discarding `const` qualifier in cast (`(T)const_value`
'-Wno-cast-qual',
'-Wno-pedantic',
'-Wno-double-promotion',
'-Wno-float-conversion',
'-Wno-implicit-float-conversion',
'-Wno-int-conversion',
# Implicit conversion like int -> short, short -> char or long -> char
'-Wno-implicit-int-conversion',
'-Wno-sign-conversion',
'-Wno-bad-function-cast',
# Assign enum to a value not in range defined by the enum type
'-Wno-assign-enum',
# uchar_value > 255 is always false
'-Wno-tautological-type-limit-compare',
# Comparing float with == is unsafe (since floats not necessarily will
# have that specific value)
'-Wno-float-equal',
# Implicit conversion turns string literal into bool
'-Wno-string-conversion',
'-Wno-sign-compare',
'-Wno-shadow',
# Pointer-related
'-Wno-pointer-integer-compare',
# Safety (important!)
'-Wno-uninitialized',
# Others
'-Wno-covered-switch-default',
'-Wno-documentation',
'-Wno-documentation-unknown-command',
'-Wno-format-nonliteral',
# Using an undefined macro (which will be evaluated to 0)
'-Wno-undef',
'-Wno-unused-variable',
'-Wno-unused-function',
'-Wno-unused-macros',
'-Wno-unused-parameter',
'-Wno-class-varargs',
# Leave until functions are going to be implemented
'-Wno-#warnings',
# ------------------------------------
# Default flags for native compilation
'-Wno-language-extension-token',
'-DWIN32_LEAN_AND_MEAN',
], language : 'c')
endif
foreach lang : ['c', 'objc', 'cpp'] foreach lang : ['c', 'objc', 'cpp']
add_global_arguments('-DHAVE_CONFIG_H=1', language: lang) add_global_arguments('-DHAVE_CONFIG_H=1', language: lang)
@ -221,7 +312,11 @@ elif (get_option('crypto') == 'gnutls')
crypto = [dependency('gnutls'), cc.find_library('gcrypt')] crypto = [dependency('gnutls'), cc.find_library('gcrypt')]
config_h.set('HAVE_GNUTLS', '1') config_h.set('HAVE_GNUTLS', '1')
elif (get_option('crypto') == 'openssl') elif (get_option('crypto') == 'openssl')
crypto = dependency('openssl') if (get_option('openssl_dir') != '')
crypto = cc.find_library('crypto', dirs : [get_option('openssl_dir')])
else
crypto = dependency('openssl')
endif
config_h.set('HAVE_OPENSSL', '1') config_h.set('HAVE_OPENSSL', '1')
endif endif
@ -266,7 +361,11 @@ luaold_interpreters = [
lua_pc_name = '' lua_pc_name = ''
if get_option('lua-interpreter') == 'lua' if false # sys_windows or get_option('lua-interpreter') == 'lua'
if sys_windows and get_option('lua-interpreter') != 'lua'
warning('There is no "' + get_option('lua-interpreter')
+ '" binding option for Windows, backing up to "lua"')
endif
foreach l : luaold_interpreters foreach l : luaold_interpreters
lua = dependency(l[0], version: l[1], required:false) lua = dependency(l[0], version: l[1], required:false)
lua_pc_name = l[0] lua_pc_name = l[0]
@ -275,8 +374,8 @@ if get_option('lua-interpreter') == 'lua'
endif endif
endforeach endforeach
else else
lua = dependency(get_option('lua-interpreter')) # lua = dependency(get_option('lua-interpreter'))
lua_pc_name = 'luajit' # lua_pc_name = 'luajit'
endif endif
if sys_osx == true and get_option('lua-interpreter') == 'luajit' if sys_osx == true and get_option('lua-interpreter') == 'luajit'
@ -291,13 +390,21 @@ subprojects = [
# name | option | mod | lib | bin | bench | tests | examples | pkg-config options | name of static libs # name | option | mod | lib | bin | bench | tests | examples | pkg-config options | name of static libs
['evil' ,[] , false, true, false, false, false, false, [], []], ['evil' ,[] , false, true, false, false, false, false, [], []],
['eina' ,[] , false, true, true, true, true, true, [], []], ['eina' ,[] , false, true, true, true, true, true, [], []],
['eolian' ,[] , false, true, true, false, true, false, ['eina'], []], #['eolian' ,[] , false, true, true, false, true, false, ['eina'], []],
['eo' ,[] , false, true, false, true, true, false, ['eina'], []], #['eo' ,[] , false, true, false, true, true, false, ['eina'], []],
['efl' ,[] , false, true, false, false, true, false, ['eo'], []], #['efl' ,[] , false, true, false, false, true, false, ['eo'], []],
['emile' ,[] , false, true, false, false, true, true, ['eina', 'efl'], ['lz4', 'rg_etc']], #['emile' ,[] , false, true, false, false, true, true, ['eina', 'efl'], ['lz4', 'rg_etc']],
['eet' ,[] , false, true, true, false, true, true, ['eina', 'emile', 'efl'], []], #['eet' ,[] , false, true, true, false, true, true, ['eina', 'emile', 'efl'], []],
['ecore' ,[] , false, true, false, false, false, false, ['eina', 'eo', 'efl'], ['buildsystem']], #['ecore' ,[] , false, true, false, false, false, false, ['eina', 'eo', 'efl'], ['buildsystem']]
['eldbus' ,[] , false, true, true, false, true, true, ['eina', 'eo', 'efl'], []], ]
if false# not sys_windows
subprojects += [['eldbus' ,[] , false, true,
true, false, true, true, ['eina', 'eo', 'efl'], []]]
endif
if false
subprojects += [
['ecore' ,[] , true, false, false, false, true, true, ['eina', 'eo', 'efl'], []], #ecores modules depend on eldbus ['ecore' ,[] , true, false, false, false, true, true, ['eina', 'eo', 'efl'], []], #ecores modules depend on eldbus
['ecore_audio' ,['audio'] , false, true, false, false, false, false, ['eina', 'eo'], []], ['ecore_audio' ,['audio'] , false, true, false, false, false, false, ['eina', 'eo'], []],
['ecore_avahi' ,['avahi'] , false, true, false, false, false, true, ['eina', 'ecore'], []], ['ecore_avahi' ,['avahi'] , false, true, false, false, false, true, ['eina', 'ecore'], []],
@ -312,8 +419,16 @@ subprojects = [
['ecore_win32' ,[] , false, true, false, false, false, false, ['eina'], []], ['ecore_win32' ,[] , false, true, false, false, false, false, ['eina'], []],
['ecore_ipc' ,[] , false, true, false, false, false, false, ['eina'], []], ['ecore_ipc' ,[] , false, true, false, false, false, false, ['eina'], []],
['ecore_buffer' ,['buffer'] , true, true, true, false, false, false, ['eina'], []], ['ecore_buffer' ,['buffer'] , true, true, true, false, false, false, ['eina'], []],
['ector' ,[] , false, true, false, false, true, false, ['eina', 'efl'], ['draw', 'triangulator', 'freetype']], ['ector' ,[] , false, true, false, false, true,
['elput' ,['drm'] , false, true, false, false, true, false, ['eina', 'eldbus'], []], false, ['eina', 'efl'], ['draw', 'triangulator', 'freetype']],]
endif
if false # not sys_windows
subprojects += [['elput' ,['drm'] , false, true,
false, false, true, false, ['eina', 'eldbus'], []]]
endif
if false
subprojects += [
['ecore_drm2' ,['drm'] , false, true, false, false, false, false, ['ecore'], ['libdrm']], ['ecore_drm2' ,['drm'] , false, true, false, false, false, false, ['ecore'], ['libdrm']],
['ecore_cocoa' ,['cocoa'] , false, true, false, false, false, false, ['eina'], []], ['ecore_cocoa' ,['cocoa'] , false, true, false, false, false, false, ['eina'], []],
['evas' ,[] , true, true, false, false, true, true, ['eina', 'efl', 'eo'], ['vg_common', 'libunibreak']], ['evas' ,[] , true, true, false, false, true, true, ['eina', 'efl', 'eo'], ['vg_common', 'libunibreak']],
@ -330,24 +445,38 @@ subprojects = [
['emotion' ,[] , true, true, false, false, true, true, ['eina', 'efl', 'eo'], []], ['emotion' ,[] , true, true, false, false, true, true, ['eina', 'efl', 'eo'], []],
['ethumb' ,[] , true, true, true, false, false, false, ['eina', 'efl', 'eo'], []], ['ethumb' ,[] , true, true, true, false, false, false, ['eina', 'efl', 'eo'], []],
['ethumb_client' ,[] , false, true, true, false, false, true, ['eina', 'efl', 'eo', 'ethumb'], []], ['ethumb_client' ,[] , false, true, true, false, false, true, ['eina', 'efl', 'eo', 'ethumb'], []],
['elementary' ,[] , true, true, true, true, true, true, ['eina', 'efl', 'eo', 'eet', 'evas', 'ecore', 'ecore-evas', 'ecore-file', 'ecore-input', 'edje', 'ethumb-client', 'emotion', 'ecore-imf', 'ecore-con', 'eldbus', 'efreet', 'efreet-mime', 'efreet-trash', 'eio'], ['atspi']], ['elementary' ,[] , true, true, true, true, true, true, ['eina', 'efl', 'eo', 'eet', 'evas', 'ecore', 'ecore-evas', 'ecore-fle', 'ecore-input', 'edje', 'ethumb-client', 'emotion', 'ecore-imf', 'ecore-con', 'eldbus', 'efreet', 'efreet-mime', 'efreet-trash', 'eio'], ['atspi']],
['efl_canvas_wl' ,['wl'] , false, true, true, false, false, false, ['eina', 'efl', 'eo', 'evas', 'ecore'], []], ['efl_canvas_wl' ,['wl'] , false, true, true, false, false,
['elua' ,['elua'] , false, true, true, false, true, false, ['eina', 'luajit'], []], false, ['eina', 'efl', 'eo', 'evas', 'ecore'], []],
]
endif
if false
if not sys_windows
subprojects += [['elua' ,['elua'] , false, true,
true, false, true, false, ['eina', 'luajit'], []]]
else
subprojects += [['elua' ,['elua'] , false, true,
true, false, true, false, ['eina', 'lua'], []]]
endif
endif
if false
subprojects += [
['ecore_wayland' ,['wl-deprecated'] , false, true, false, false, false, false, ['eina'], []], ['ecore_wayland' ,['wl-deprecated'] , false, true, false, false, false, false, ['eina'], []],
['ecore_drm' ,['drm-deprecated'] , false, true, false, false, false, false, ['eina'], []], ['ecore_drm' ,['drm-deprecated'] , false, true, false, false, false, false, ['eina'], []],
['exactness' ,[] , false, false, true, false, false, false, ['eina, evas, eet'], []], ['exactness' ,[] , false, false, true, false, false, false, ['eina, evas, eet'], []],
] ]
endif
# We generate Efl_Config.h and config.h later, they will be available here # We generate Efl_Config.h and config.h later, they will be available here
config_dir += include_directories('.') config_dir += include_directories('.')
#we have to do that first, eina modules are required by eina #we have to do that first, eina modules are required by eina
#the other modules require theire package #the other modules require theire package
subdir(join_paths(local_module, 'eina')) #subdir(join_paths(local_module, 'eina'))
#List of dependency objects that might be disabled due to configurations #List of dependency objects that might be disabled due to configurations
#If they are enabled, the object gets overwritten by the library file. #If they are enabled, the object gets overwritten by the library file.
ecore_audio = declare_dependency() #ecore_audio = declare_dependency()
test_dirs = [] test_dirs = []
example_dirs = [] example_dirs = []
@ -360,7 +489,7 @@ foreach package : subprojects
'-DPACKAGE_DATA_DIR="'+ join_paths(dir_data, package_name)+'"', '-DPACKAGE_DATA_DIR="'+ join_paths(dir_data, package_name)+'"',
'-DNEED_RUN_IN_TREE=1', '-DNEED_RUN_IN_TREE=1',
] ]
automatic_pkgfile = true automatic_pkgfile = (sys_windows == false)
if package[1].length() == 0 or get_option(package[1][0]) if package[1].length() == 0 or get_option(package[1][0])
config_h.set('HAVE_'+package_name.to_upper().underscorify(), '1') config_h.set('HAVE_'+package_name.to_upper().underscorify(), '1')
@ -405,13 +534,13 @@ foreach package : subprojects
if (package[4]) if (package[4])
subdir(join_paths(local_bin, package_name)) subdir(join_paths(local_bin, package_name))
endif endif
if (package[5]) if (package[5] and not sys_windows)
subdir(join_paths(local_benchmark, package_name)) subdir(join_paths(local_benchmark, package_name))
endif endif
if (package[6]) if (package[6] and not sys_windows)
test_dirs += [package_name] test_dirs += [package_name]
endif endif
if (package[7]) if (package[7] and not sys_windows)
example_dirs += [package_name] example_dirs += [package_name]
endif endif
@ -453,13 +582,13 @@ foreach package : subprojects
endforeach endforeach
#build this later, as the debug services are depending on ecore #build this later, as the debug services are depending on ecore
subdir(join_paths('src', 'bin', 'efl')) #subdir(join_paths('src', 'bin', 'efl'))
subdir(join_paths('src', 'generic', 'evas')) #subdir(join_paths('src', 'generic', 'evas'))
subdir('cmakeconfig') #subdir('cmakeconfig')
subdir(join_paths('src', 'bindings')) #subdir(join_paths('src', 'bindings'))
subdir(join_paths('src', 'edje_external')) #subdir(join_paths('src', 'edje_external'))
subdir(join_paths('data')) #subdir(join_paths('data'))
if get_option('build-tests') if get_option('build-tests')
check = dependency('check') check = dependency('check')
@ -469,28 +598,28 @@ if get_option('build-tests')
endforeach endforeach
endif endif
if get_option('build-examples') # if get_option('build-examples')
foreach example : example_dirs # foreach example : example_dirs
subdir(join_paths(local_examples, example)) # subdir(join_paths(local_examples, example))
endforeach # endforeach
endif # endif
subdir(join_paths(local_scripts)) # subdir(join_paths(local_scripts))
meson.add_install_script('meson/meson_modules.sh', module_files) # meson.add_install_script('meson/meson_modules.sh', module_files)
foreach evas_loader_map_inst : evas_loader_map # foreach evas_loader_map_inst : evas_loader_map
evas_loader_original = evas_loader_map_inst[0] # evas_loader_original = evas_loader_map_inst[0]
evas_loader_link_types = evas_loader_map_inst[1] # evas_loader_link_types = evas_loader_map_inst[1]
meson.add_install_script('meson/evas_loader_conf.sh', evas_loader_original, evas_loader_link_types) # meson.add_install_script('meson/evas_loader_conf.sh', evas_loader_original, evas_loader_link_types)
endforeach # endforeach
doxygen = find_program('doxygen', required : false) # doxygen = find_program('doxygen', required : false)
if doxygen.found() # if doxygen.found()
subdir('doc') # subdir('doc')
endif # endif
# #
# Configure files # Configure files
@ -517,29 +646,34 @@ configure_file(
configuration: efl_config_h configuration: efl_config_h
) )
configure_file( # configure_file(
input: 'elm_intro.h.in', # input: 'elm_intro.h.in',
output: 'elm_intro.h', # output: 'elm_intro.h',
configuration: config_h, # configuration: config_h,
install_dir : join_paths(dir_include,'elementary-'+version_major) # install_dir : join_paths(dir_include,'elementary-'+version_major)
) # )
subdir(join_paths('systemd-services')) # subdir(join_paths('systemd-services'))
subdir(join_paths('dbus-services'))
#output the three new efl-* .pc files # if not sys_windows and get_option('dbus')
efl_20_pc_files = [ # subdir(join_paths('dbus-services'))
['efl-ui', ['elementary']], # endif
['efl-core', ['ecore', 'efl', 'emile']],
['efl-net', ['ecore', 'ecore-con', 'emile']],
]
foreach pc_file : efl_20_pc_files # if sys_windows == false
name = pc_file[0] # #output the three new efl-* .pc files
libraries = pc_file[1] # efl_20_pc_files = [
pkgconfig.generate( # ['efl-ui', ['elementary']],
name : '-'.join(name.split('_')), # ['efl-core', ['ecore', 'efl', 'emile']],
description: name+' configutation file', # ['efl-net', ['ecore', 'ecore-con', 'emile']],
requires : libraries, # ]
)
endforeach # foreach pc_file : efl_20_pc_files
# name = pc_file[0]
# libraries = pc_file[1]
# pkgconfig.generate(
# name : '-'.join(name.split('_')),
# description: name+' configutation file',
# requires : libraries,
# )
# endforeach
# endif

View File

@ -64,6 +64,11 @@ option('eeze',
description : 'Device abstraction (udev wrapper) in efl' description : 'Device abstraction (udev wrapper) in efl'
) )
option('dbus',
type : 'boolean',
value : true
)
option('opengl', option('opengl',
type : 'combo', type : 'combo',
choices : ['full', 'es-egl', 'none'], choices : ['full', 'es-egl', 'none'],
@ -107,6 +112,12 @@ option('crypto',
description : 'Which SSL Crypto library used in efl' description : 'Which SSL Crypto library used in efl'
) )
option('openssl_dir',
type : 'string',
value : '',
description : 'Which directory is SSL library installed. Used only if crypto is set to openssl'
)
option('glib', option('glib',
type : 'boolean', type : 'boolean',
value : false, value : false,
@ -286,7 +297,7 @@ option('nls',
option('bindings', option('bindings',
type : 'array', type : 'array',
choices : ['luajit', 'cxx', 'mono'], choices : ['luajit','cxx', 'mono'],
value : ['luajit', 'cxx'], value : ['luajit', 'cxx'],
description : 'Which auto-generated language bindings for efl to enable', description : 'Which auto-generated language bindings for efl to enable',
) )

14
native-file-windows.txt Normal file
View File

@ -0,0 +1,14 @@
[binaries]
c = 'clang-cl'
cpp = 'clang-cl'
[host_machine]
system = 'windows'
cpu_family = 'x86_64'
cpu = 'x86_64'
endian = 'little'
[properties]
c_args = ['-D_WIN32_WINNT=0x0601', '-march=x86-64']
cpp_args = ['-D_WIN32_WINNT=0x0601', '-march=x86-64']

View File

@ -3,7 +3,7 @@
#endif #endif
#include <locale.h> #include <locale.h>
#include <fnmatch.h> #include <Eina.h>
#include <Ecore.h> #include <Ecore.h>
#include <Ecore_Getopt.h> #include <Ecore_Getopt.h>
@ -56,7 +56,7 @@ module_matches(const char *name)
if (!module_patterns) return EINA_TRUE; if (!module_patterns) return EINA_TRUE;
for (itr = module_patterns; *itr != NULL; itr++) for (itr = module_patterns; *itr != NULL; itr++)
if (fnmatch(*itr, name, 0) == 0) return EINA_TRUE; if (eina_fnmatch(*itr, name, 0) == 0) return EINA_TRUE;
return EINA_FALSE; return EINA_FALSE;
} }
@ -65,7 +65,7 @@ static inline Eina_Bool
type_matches(const char *name) type_matches(const char *name)
{ {
if (!type_glob) return EINA_TRUE; if (!type_glob) return EINA_TRUE;
return fnmatch(type_glob, name, 0) == 0; return eina_fnmatch(type_glob, name, 0) == 0;
} }
static int static int

View File

@ -3,7 +3,7 @@
#endif #endif
#include <locale.h> #include <locale.h>
#include <fnmatch.h> #include <Eina.h>
#include <unistd.h> #include <unistd.h>
#include <errno.h> #include <errno.h>
@ -101,7 +101,7 @@ static inline Eina_Bool
matches(const char *name, const char *pattern) matches(const char *name, const char *pattern)
{ {
if (!pattern) return EINA_TRUE; if (!pattern) return EINA_TRUE;
return fnmatch(pattern, name, 0) == 0; return eina_fnmatch(pattern, name, 0) == 0;
} }
static void static void

View File

@ -92,8 +92,12 @@ if meson.is_cross_build()
edje_codegen_path = _edje_codegen.path() edje_codegen_path = _edje_codegen.path()
edje_codegen_exe = [_edje_codegen] edje_codegen_exe = [_edje_codegen]
else else
env = find_program('env', native: true) if sys_windows == true
edje_codegen_exe = [env, 'EFL_RUN_IN_TREE=1', edje_codegen.full_path()] edje_codegen_exe = [edje_codegen.full_path()]
else
env = find_program('env', native: true)
edje_codegen_exe = [env, 'EFL_RUN_IN_TREE=1', edje_codegen.full_path()]
endif
endif endif
edje_pick = executable('edje_pick', edje_pick = executable('edje_pick',

View File

@ -1,5 +1,10 @@
if not sys_windows
executable('eina_btlog', executable('eina_btlog',
'eina_btlog.c', 'eina_btlog.c',
dependencies: eina, dependencies: eina,
install: true, install: true,
) )
endif

View File

@ -239,6 +239,8 @@ elementary_codegen = executable('elementary_codegen',
if meson.is_cross_build() if meson.is_cross_build()
elementary_codegen_exe = [find_program('elementary_codegen', native: true)] elementary_codegen_exe = [find_program('elementary_codegen', native: true)]
elif sys_windows
elementary_codegen_exe = [elementary_codegen.full_path()]
else else
env = find_program('env', native: true) env = find_program('env', native: true)
elementary_codegen_exe = [env, 'EFL_RUN_IN_TREE=1', elementary_codegen.full_path()] elementary_codegen_exe = [env, 'EFL_RUN_IN_TREE=1', elementary_codegen.full_path()]
@ -265,6 +267,8 @@ if meson.is_cross_build()
_elm_prefs_cc = find_program('elm_prefs_cc', native: true) _elm_prefs_cc = find_program('elm_prefs_cc', native: true)
elm_prefs_cc_path = _elm_prefs_cc.path() elm_prefs_cc_path = _elm_prefs_cc.path()
elm_prefs_cc_exe = [_elm_prefs_cc] elm_prefs_cc_exe = [_elm_prefs_cc]
elif sys_windows
elm_prefs_cc_exe = [elm_prefs_cc.full_path()]
else else
env = find_program('env', native: true) env = find_program('env', native: true)
elm_prefs_cc_exe = [env, 'EFL_RUN_IN_TREE=1', elm_prefs_cc.full_path()] elm_prefs_cc_exe = [env, 'EFL_RUN_IN_TREE=1', elm_prefs_cc.full_path()]

View File

@ -9,8 +9,13 @@ cxx_sublibs = [
['Eet', true, true, false, []], ['Eet', true, true, false, []],
['Eio', false, false, true, []], ['Eio', false, false, true, []],
['Evas', false, true, true, []], ['Evas', false, true, true, []],
['Edje', false, false, true, []], ['Edje', false, false, true, []],]
['Eldbus', true, true, true, []],
if not sys_windows
cxx_sublibs += [['Eldbus', true, true, true, []]]
endif
cxx_sublibs += [
['Elementary', true, true, true, []] ['Elementary', true, true, true, []]
] ]
@ -116,7 +121,7 @@ foreach lib : cxx_sublibs
install_headers(cxx_header_src, install_headers(cxx_header_src,
subdir: package_version_name, subdir: package_version_name,
) )
if sys_windows == false
pkgconfig.generate( pkgconfig.generate(
name : '-'.join(package_name.split('_')) + '-cxx', name : '-'.join(package_name.split('_')) + '-cxx',
description : lib[0]+' cxx bindings', description : lib[0]+' cxx bindings',
@ -126,4 +131,5 @@ foreach lib : cxx_sublibs
requires : growing_deps + [package_name], requires : growing_deps + [package_name],
) )
growing_deps += package_name + '-cxx' growing_deps += package_name + '-cxx'
endif
endforeach endforeach

View File

@ -1,6 +1,10 @@
bindings = get_option('bindings') bindings = get_option('bindings')
bindings_order = ['luajit', 'cxx', 'mono'] if not sys_windows
bindings_order = ['luajit', 'cxx', 'mono']
else
bindings_order = ['lua', 'cxx', 'mono']
endif
if (get_option('dotnet') and not bindings.contains('mono')) if (get_option('dotnet') and not bindings.contains('mono'))
message('dotnet support requires the C# bindings') message('dotnet support requires the C# bindings')

View File

@ -9,10 +9,18 @@ generic_deps = []
subdir('common') subdir('common')
inc_dir = config_dir
common_deps = generic_deps
if sys_windows
inc_dir = [inc_dir, zlib_include_dir]
else
common_deps = [generic_deps, rt]
endif
common = static_library('evas_loader_common', common = static_library('evas_loader_common',
generic_src, generic_src,
include_directories : config_dir, include_directories : inc_dir,
dependencies: [generic_deps, rt], dependencies: common_deps,
) )
bin_ext='' bin_ext=''
@ -32,7 +40,7 @@ foreach loader : generic_loaders
generic_src, generic_src,
include_directories : config_dir + [include_directories('common')], include_directories : config_dir + [include_directories('common')],
link_with : common, link_with : common,
dependencies: [eina, generic_deps], dependencies: [eina, generic_deps, evil_unposix],
install_dir : join_paths(dir_lib, 'evas', 'utils'), install_dir : join_paths(dir_lib, 'evas', 'utils'),
install : true, install : true,
) )

View File

@ -4,5 +4,9 @@ generic_src = files([
'pixelfuncs.c' 'pixelfuncs.c'
]) ])
generic_deps = [eina, dependency('zlib')] if not sys_windows
generic_deps = [eina, dependency('zlib')]
else
generic_deps = [eina, zlib]
endif
generic_support = ['xcf.gz'] generic_support = ['xcf.gz']

View File

@ -196,10 +196,17 @@ if get_option('systemd') == true
ecore_deps += systemd ecore_deps += systemd
endif endif
if not sys_windows
ecore_lib_deps = [m, buildsystem, ecore_deps]
else
ecore_lib_deps = [buildsystem, ecore_deps]
endif
ecore_lib = library('ecore', ecore_lib = library('ecore',
ecore_src, pub_eo_file_target, ecore_src, pub_eo_file_target,
dependencies: ecore_pub_deps + [m, buildsystem, ecore_deps], dependencies: ecore_pub_deps + ecore_lib_deps,
include_directories : config_dir + [include_directories(join_paths('..','..'))], include_directories : config_dir +
[include_directories(join_paths('..','..'))],
install: true, install: true,
c_args : package_c_args, c_args : package_c_args,
version : meson.project_version() version : meson.project_version()

View File

@ -177,7 +177,9 @@ else
'efl_net_control-connman.c', 'efl_net_control-connman.c',
'efl_net_session-connman.c' 'efl_net_session-connman.c'
] ]
ecore_con_deps += eldbus if get_option('dbus')
ecore_con_deps += eldbus
endif
endif endif
ecore_con_deps += crypto ecore_con_deps += crypto

View File

@ -15,7 +15,7 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/select.h> #include <sys/select.h>
#include <fcntl.h> #include <fcntl.h>
#include <fnmatch.h> #include <Eina.h>
#ifdef HAVE_PRCTL #ifdef HAVE_PRCTL
# include <sys/prctl.h> # include <sys/prctl.h>
@ -457,7 +457,7 @@ glob_match(const char *glob, const char *str)
{ {
if (!glob) return EINA_TRUE; if (!glob) return EINA_TRUE;
if (!str) return EINA_FALSE; if (!str) return EINA_FALSE;
if (!fnmatch(glob, str, 0)) return EINA_TRUE; if (!eina_fnmatch(glob, str, 0)) return EINA_TRUE;
return EINA_FALSE; return EINA_FALSE;
} }

View File

@ -9,7 +9,6 @@
#include <time.h> #include <time.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#include <fnmatch.h>
#include <fcntl.h> #include <fcntl.h>
#include <Eina.h> #include <Eina.h>
@ -2607,7 +2606,7 @@ eet_list(Eet_File *ef,
* check for * explicitly, because on some systems, * isn't well * check for * explicitly, because on some systems, * isn't well
* supported * supported
*/ */
if ((!glob) || !fnmatch(glob, efn->name, 0)) if ((!glob) || !eina_fnmatch(glob, efn->name, 0))
{ {
/* add it to our list */ /* add it to our list */
list_count++; list_count++;

View File

@ -1,4 +1,8 @@
eet_deps = [crypto, jpeg, rg_etc, m] eet_deps = [crypto, jpeg, rg_etc]
if not sys_windows
eet_deps += m
endif
eet_pub_deps = [eina, emile, efl] eet_pub_deps = [eina, emile, efl]
eet_header_src = [ eet_header_src = [

View File

@ -11,9 +11,15 @@ efl_src = []
subdir('interfaces') subdir('interfaces')
package_header_subdirs += 'interfaces' package_header_subdirs += 'interfaces'
efl_lib_deps = [eina, eo]
if not sys_windows
efl_lib_deps += m
endif
efl_lib = library('efl', efl_lib = library('efl',
efl_src, pub_eo_file_target, efl_src, pub_eo_file_target,
dependencies: [eina, eo, m], dependencies: efl_lib_deps,
install: true, install: true,
version : meson.project_version() version : meson.project_version()
) )

View File

@ -6,7 +6,7 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <fcntl.h> #include <fcntl.h>
#include <unistd.h> #include <unistd.h>
#include <fnmatch.h> #include <Eina.h>
#include <Ecore.h> #include <Ecore.h>
#include <Ecore_File.h> #include <Ecore_File.h>
@ -1243,7 +1243,7 @@ efreet_mime_glob_match(const char *str, const char *glob)
if (str[0] == 0) return 1; if (str[0] == 0) return 1;
return 0; return 0;
} }
if (!fnmatch(glob, str, 0)) return 1; if (!eina_fnmatch(glob, str, 0)) return 1;
return 0; return 0;
} }
@ -1269,7 +1269,7 @@ efreet_mime_glob_case_match(char *str, const char *glob)
tglob = alloca(strlen(glob) + 1); tglob = alloca(strlen(glob) + 1);
for (tp = tglob, p = glob; *p; p++, tp++) *tp = tolower(*p); for (tp = tglob, p = glob; *p; p++, tp++) *tp = tolower(*p);
*tp = 0; *tp = 0;
if (!fnmatch(str, tglob, 0)) return 1; if (!eina_fnmatch(str, tglob, 0)) return 1;
return 0; return 0;
} }

View File

@ -4,7 +4,7 @@
/* TODO: add no_display check, as we might want only displayable items */ /* TODO: add no_display check, as we might want only displayable items */
#include <fnmatch.h> #include <Eina.h>
#include <ctype.h> #include <ctype.h>
#include <Ecore_File.h> #include <Ecore_File.h>
@ -450,7 +450,7 @@ efreet_util_glob_match(const char *str, const char *glob)
return 0; return 0;
} }
if (!strcmp(glob, "*")) return 1; if (!strcmp(glob, "*")) return 1;
if (!fnmatch(glob, str, 0)) return 1; if (!eina_fnmatch(glob, str, 0)) return 1;
return 0; return 0;
} }

View File

@ -81,6 +81,7 @@ install_headers(efreet_header_src,
install_dir : dir_package_include, install_dir : dir_package_include,
) )
if sys_windows == false
pkgconfig.generate(efreet_mime_lib, pkgconfig.generate(efreet_mime_lib,
name : 'efreet-mime', name : 'efreet-mime',
subdirs : package_version_name, subdirs : package_version_name,
@ -94,3 +95,4 @@ pkgconfig.generate(efreet_trash_lib,
version : version_major + '.' + version_minor + '.' + version_micro, version : version_major + '.' + version_minor + '.' + version_micro,
libraries : [tmp_deps] + tmp_pub_deps, libraries : [tmp_deps] + tmp_pub_deps,
) )
endif

View File

@ -277,9 +277,8 @@ extern "C" {
#include <eina_promise.h> #include <eina_promise.h>
#include <eina_vpath.h> #include <eina_vpath.h>
#include <eina_abstract_content.h> #include <eina_abstract_content.h>
#include <eina_fnmatch.h>
#undef EAPI
#define EAPI
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -25,12 +25,12 @@
#include "eina_unicode.h" #include "eina_unicode.h"
#include "eina_safety_checks.h" #include "eina_safety_checks.h"
EAPI Eina_Unicode eina_unicode_utf8_get_next(const char *buf, int *iindex) EINA_API Eina_Unicode eina_unicode_utf8_get_next(const char *buf, int *iindex)
{ {
return eina_unicode_utf8_next_get(buf, iindex); return eina_unicode_utf8_next_get(buf, iindex);
} }
EAPI unsigned int EINA_API unsigned int
eina_mempool_alignof(unsigned int size) eina_mempool_alignof(unsigned int size)
{ {
unsigned int align; unsigned int align;

View File

@ -12,7 +12,7 @@ struct _Eina_Content
const char *file; const char *file;
EINA_REFCOUNT; EINA_REFCOUNT;
}; };
EAPI const Eina_Value_Type *EINA_VALUE_TYPE_CONTENT; EINA_API const Eina_Value_Type *EINA_VALUE_TYPE_CONTENT;
static int _eina_abstract_content_log_domain = -1; static int _eina_abstract_content_log_domain = -1;
@ -39,7 +39,7 @@ _eina_content_ref(Eina_Content *content)
EINA_REFCOUNT_REF(content); EINA_REFCOUNT_REF(content);
} }
EAPI Eina_Bool EINA_API Eina_Bool
eina_content_converter_conversion_register(const char *from, const char *to, Eina_Content_Conversion_Callback conversion) eina_content_converter_conversion_register(const char *from, const char *to, Eina_Content_Conversion_Callback conversion)
{ {
Eina_Content_Conversion_Node *node = calloc(1, sizeof(Eina_Content_Conversion_Node)); Eina_Content_Conversion_Node *node = calloc(1, sizeof(Eina_Content_Conversion_Node));
@ -93,7 +93,7 @@ end:
return result; return result;
} }
EAPI Eina_Bool EINA_API Eina_Bool
eina_content_converter_convert_can(const char *from, const char *to) eina_content_converter_convert_can(const char *from, const char *to)
{ {
return !!_conversion_callback_fetch(from, to); return !!_conversion_callback_fetch(from, to);
@ -107,7 +107,7 @@ _process_cb(const void *container EINA_UNUSED, void *data, void *fdata EINA_UNUS
return n->to; return n->to;
} }
EAPI Eina_Iterator* EINA_API Eina_Iterator*
eina_content_converter_possible_conversions(const char *from) eina_content_converter_possible_conversions(const char *from)
{ {
Eina_List *possibilities = _conversion_callback_fetch_possible(from); Eina_List *possibilities = _conversion_callback_fetch_possible(from);
@ -115,7 +115,7 @@ eina_content_converter_possible_conversions(const char *from)
return eina_iterator_processed_new(eina_list_iterator_new(possibilities) , EINA_PROCESS_CB(_process_cb), NULL, possibilities); return eina_iterator_processed_new(eina_list_iterator_new(possibilities) , EINA_PROCESS_CB(_process_cb), NULL, possibilities);
} }
EAPI Eina_Content* EINA_API Eina_Content*
eina_content_new(Eina_Slice data, const char *type) eina_content_new(Eina_Slice data, const char *type)
{ {
Eina_Content *content; Eina_Content *content;
@ -149,7 +149,7 @@ err:
return NULL; return NULL;
} }
EAPI void EINA_API void
eina_content_free(Eina_Content *content) eina_content_free(Eina_Content *content)
{ {
EINA_REFCOUNT_UNREF(content) EINA_REFCOUNT_UNREF(content)
@ -161,7 +161,7 @@ eina_content_free(Eina_Content *content)
} }
} }
EAPI const char* EINA_API const char*
eina_content_as_file(Eina_Content *content) eina_content_as_file(Eina_Content *content)
{ {
if (!content->file) if (!content->file)
@ -189,19 +189,19 @@ eina_content_as_file(Eina_Content *content)
return content->file; return content->file;
} }
EAPI const char* EINA_API const char*
eina_content_type_get(Eina_Content *content) eina_content_type_get(Eina_Content *content)
{ {
return content->type; return content->type;
} }
EAPI Eina_Slice EINA_API Eina_Slice
eina_content_data_get(Eina_Content *content) eina_content_data_get(Eina_Content *content)
{ {
return eina_rw_slice_slice_get(content->data); return eina_rw_slice_slice_get(content->data);
} }
EAPI Eina_Content* EINA_API Eina_Content*
eina_content_convert(Eina_Content *content, const char *new_type) eina_content_convert(Eina_Content *content, const char *new_type)
{ {
Eina_Content_Conversion_Callback callback = _conversion_callback_fetch(content->type, new_type); Eina_Content_Conversion_Callback callback = _conversion_callback_fetch(content->type, new_type);
@ -370,7 +370,7 @@ _eina_value_type_content_pget(const Eina_Value_Type *type EINA_UNUSED, const voi
return EINA_TRUE; return EINA_TRUE;
} }
EAPI const Eina_Value_Type _EINA_VALUE_TYPE_CONTENT ={ EINA_API const Eina_Value_Type _EINA_VALUE_TYPE_CONTENT ={
EINA_VALUE_TYPE_VERSION, EINA_VALUE_TYPE_VERSION,
sizeof(Eina_Content*), sizeof(Eina_Content*),
"Eina_Abstract_Content", "Eina_Abstract_Content",

View File

@ -33,7 +33,7 @@ typedef Eina_Content* (*Eina_Content_Conversion_Callback)(Eina_Content *from, co
* @return The path to the file. Do not free this. * @return The path to the file. Do not free this.
* *
*/ */
EAPI const char* eina_content_as_file(Eina_Content *content); EINA_API const char* eina_content_as_file(Eina_Content *content);
/** /**
* Convert the content of the object to another type. * Convert the content of the object to another type.
@ -45,7 +45,7 @@ EAPI const char* eina_content_as_file(Eina_Content *content);
* *
* @return A new content object. The caller of this function is owning this. * @return A new content object. The caller of this function is owning this.
*/ */
EAPI Eina_Content* eina_content_convert(Eina_Content *content, const char *new_type); EINA_API Eina_Content* eina_content_convert(Eina_Content *content, const char *new_type);
/** /**
* Get the type of the passed content. * Get the type of the passed content.
@ -54,7 +54,7 @@ EAPI Eina_Content* eina_content_convert(Eina_Content *content, const char *new_t
* *
* @return The type of this content. Do no free this. * @return The type of this content. Do no free this.
*/ */
EAPI const char* eina_content_type_get(Eina_Content *content); EINA_API const char* eina_content_type_get(Eina_Content *content);
/** /**
* Get the Eina_Slice of the passed content. * Get the Eina_Slice of the passed content.
@ -63,7 +63,7 @@ EAPI const char* eina_content_type_get(Eina_Content *content);
* *
* @return An Eina_Slice containing the data. Do not free. * @return An Eina_Slice containing the data. Do not free.
*/ */
EAPI Eina_Slice eina_content_data_get(Eina_Content *content); EINA_API Eina_Slice eina_content_data_get(Eina_Content *content);
/** /**
* Create a new content object, with the provided data and type. * Create a new content object, with the provided data and type.
@ -73,14 +73,14 @@ EAPI Eina_Slice eina_content_data_get(Eina_Content *content);
* *
* @return The new content object. The caller owns this object. * @return The new content object. The caller owns this object.
*/ */
EAPI Eina_Content* eina_content_new(Eina_Slice data, const char *type); EINA_API Eina_Content* eina_content_new(Eina_Slice data, const char *type);
/** /**
* Free the content object. * Free the content object.
* *
* @param[in] content The content to free. * @param[in] content The content to free.
*/ */
EAPI void eina_content_free(Eina_Content *content); EINA_API void eina_content_free(Eina_Content *content);
/** /**
* Register a new conversion callback. * Register a new conversion callback.
@ -90,7 +90,7 @@ EAPI void eina_content_free(Eina_Content *content);
* *
* @return True if the callback was successfully registered. * @return True if the callback was successfully registered.
*/ */
EAPI Eina_Bool eina_content_converter_conversion_register(const char *from, const char *to, Eina_Content_Conversion_Callback convertion); EINA_API Eina_Bool eina_content_converter_conversion_register(const char *from, const char *to, Eina_Content_Conversion_Callback convertion);
/** /**
* Check if a specific conversion can be performed. * Check if a specific conversion can be performed.
@ -102,7 +102,7 @@ EAPI Eina_Bool eina_content_converter_conversion_register(const char *from, cons
* *
* @return True if the conversion can be performed. * @return True if the conversion can be performed.
*/ */
EAPI Eina_Bool eina_content_converter_convert_can(const char *from, const char *to); EINA_API Eina_Bool eina_content_converter_convert_can(const char *from, const char *to);
/** /**
* Returns an iterator containing all the target types that the provided source type can be converted to. * Returns an iterator containing all the target types that the provided source type can be converted to.
@ -111,9 +111,9 @@ EAPI Eina_Bool eina_content_converter_convert_can(const char *from, const char *
* *
* @return An Iterator containing MIME type strings. Free this via eina_iterator_free. * @return An Iterator containing MIME type strings. Free this via eina_iterator_free.
*/ */
EAPI Eina_Iterator* eina_content_converter_possible_conversions(const char *from); EINA_API Eina_Iterator* eina_content_converter_possible_conversions(const char *from);
EAPI extern const Eina_Value_Type *EINA_VALUE_TYPE_CONTENT; EINA_API extern const Eina_Value_Type *EINA_VALUE_TYPE_CONTENT;
/** /**
* Convert the Eina_Content object to an Eina_Value. * Convert the Eina_Content object to an Eina_Value.
@ -122,7 +122,7 @@ EAPI extern const Eina_Value_Type *EINA_VALUE_TYPE_CONTENT;
* *
* @return An newly-allocated Eina_Value. Caller owns it. * @return An newly-allocated Eina_Value. Caller owns it.
*/ */
EAPI Eina_Value* eina_value_content_new(Eina_Content *content); EINA_API Eina_Value* eina_value_content_new(Eina_Content *content);
/** /**
* Creates an Eina_Value from an Eina_Content. * Creates an Eina_Value from an Eina_Content.
@ -131,7 +131,7 @@ EAPI Eina_Value* eina_value_content_new(Eina_Content *content);
* *
* @return An Eina_Value with type EINA_VALUE_TYPE_CONTENT. * @return An Eina_Value with type EINA_VALUE_TYPE_CONTENT.
*/ */
EAPI Eina_Value eina_value_content_init(Eina_Content *content); EINA_API Eina_Value eina_value_content_init(Eina_Content *content);
/** /**
* Gets the content from the Eina_Value. * Gets the content from the Eina_Value.
@ -142,7 +142,7 @@ EAPI Eina_Value eina_value_content_init(Eina_Content *content);
* *
* @return A newly-allocated Eina_Content. Caller owns it. * @return A newly-allocated Eina_Content. Caller owns it.
*/ */
EAPI Eina_Content* eina_value_to_content(const Eina_Value *value); EINA_API Eina_Content* eina_value_to_content(const Eina_Value *value);
static inline Eina_Iterator* static inline Eina_Iterator*

View File

@ -92,7 +92,7 @@ eina_accessor_shutdown(void)
*============================================================================*/ *============================================================================*/
EAPI void EINA_API void
eina_accessor_free(Eina_Accessor *accessor) eina_accessor_free(Eina_Accessor *accessor)
{ {
if (!accessor) if (!accessor)
@ -103,7 +103,7 @@ eina_accessor_free(Eina_Accessor *accessor)
accessor->free(accessor); accessor->free(accessor);
} }
EAPI void * EINA_API void *
eina_accessor_container_get(Eina_Accessor *accessor) eina_accessor_container_get(Eina_Accessor *accessor)
{ {
EINA_MAGIC_CHECK_ACCESSOR(accessor); EINA_MAGIC_CHECK_ACCESSOR(accessor);
@ -112,7 +112,7 @@ eina_accessor_container_get(Eina_Accessor *accessor)
return accessor->get_container(accessor); return accessor->get_container(accessor);
} }
EAPI Eina_Bool EINA_API Eina_Bool
eina_accessor_data_get(Eina_Accessor *accessor, eina_accessor_data_get(Eina_Accessor *accessor,
unsigned int position, unsigned int position,
void **data) void **data)
@ -124,7 +124,7 @@ eina_accessor_data_get(Eina_Accessor *accessor,
return accessor->get_at(accessor, position, data); return accessor->get_at(accessor, position, data);
} }
EAPI void EINA_API void
eina_accessor_over(Eina_Accessor *accessor, eina_accessor_over(Eina_Accessor *accessor,
Eina_Each_Cb cb, Eina_Each_Cb cb,
unsigned int start, unsigned int start,
@ -156,7 +156,7 @@ eina_accessor_over(Eina_Accessor *accessor,
(void) eina_accessor_unlock(accessor); (void) eina_accessor_unlock(accessor);
} }
EAPI Eina_Bool EINA_API Eina_Bool
eina_accessor_lock(Eina_Accessor *accessor) eina_accessor_lock(Eina_Accessor *accessor)
{ {
EINA_MAGIC_CHECK_ACCESSOR(accessor); EINA_MAGIC_CHECK_ACCESSOR(accessor);
@ -167,7 +167,7 @@ eina_accessor_lock(Eina_Accessor *accessor)
return EINA_TRUE; return EINA_TRUE;
} }
EAPI Eina_Accessor* EINA_API Eina_Accessor*
eina_accessor_clone(Eina_Accessor *accessor) eina_accessor_clone(Eina_Accessor *accessor)
{ {
EINA_MAGIC_CHECK_ACCESSOR(accessor); EINA_MAGIC_CHECK_ACCESSOR(accessor);
@ -179,7 +179,7 @@ eina_accessor_clone(Eina_Accessor *accessor)
return NULL; return NULL;
} }
EAPI Eina_Bool EINA_API Eina_Bool
eina_accessor_unlock(Eina_Accessor *accessor) eina_accessor_unlock(Eina_Accessor *accessor)
{ {
EINA_MAGIC_CHECK_ACCESSOR(accessor); EINA_MAGIC_CHECK_ACCESSOR(accessor);
@ -235,7 +235,7 @@ eina_carray_length_accessor_free(Eina_Accessor_CArray_Length *accessor)
free(accessor); free(accessor);
} }
EAPI Eina_Accessor * EINA_API Eina_Accessor *
eina_carray_length_accessor_new(void** array, unsigned int step, unsigned int length) eina_carray_length_accessor_new(void** array, unsigned int step, unsigned int length)
{ {
Eina_Accessor_CArray_Length *accessor; Eina_Accessor_CArray_Length *accessor;
@ -258,7 +258,7 @@ eina_carray_length_accessor_new(void** array, unsigned int step, unsigned int le
return &accessor->accessor; return &accessor->accessor;
} }
EAPI Eina_Accessor * EINA_API Eina_Accessor *
eina_carray_length_ptr_accessor_new(void** array, unsigned int step, unsigned int length) eina_carray_length_ptr_accessor_new(void** array, unsigned int step, unsigned int length)
{ {
Eina_Accessor_CArray_Length *accessor; Eina_Accessor_CArray_Length *accessor;

View File

@ -205,7 +205,7 @@ struct _Eina_Accessor
* @param[in] accessor The accessor to free * @param[in] accessor The accessor to free
* *
*/ */
EAPI void eina_accessor_free(Eina_Accessor *accessor); EINA_API void eina_accessor_free(Eina_Accessor *accessor);
/** /**
* @brief Gets the data of an accessor at the given position. * @brief Gets the data of an accessor at the given position.
@ -219,7 +219,7 @@ EAPI void eina_accessor_free(Eina_Accessor *accessor);
* @return #EINA_TRUE on success, otherwise #EINA_FALSE * @return #EINA_TRUE on success, otherwise #EINA_FALSE
* *
*/ */
EAPI Eina_Bool eina_accessor_data_get(Eina_Accessor *accessor, EINA_API Eina_Bool eina_accessor_data_get(Eina_Accessor *accessor,
unsigned int position, unsigned int position,
void **data) EINA_ARG_NONNULL(1); void **data) EINA_ARG_NONNULL(1);
@ -231,7 +231,7 @@ EAPI Eina_Bool eina_accessor_data_get(Eina_Accessor *accessor,
* @return The container that created the accessor * @return The container that created the accessor
* *
*/ */
EAPI void *eina_accessor_container_get(Eina_Accessor *accessor) EINA_ARG_NONNULL(1) EINA_PURE; EINA_API void *eina_accessor_container_get(Eina_Accessor *accessor) EINA_ARG_NONNULL(1) EINA_PURE;
/** /**
* @brief Iterates over the container and executes a callback on the chosen elements. * @brief Iterates over the container and executes a callback on the chosen elements.
@ -249,7 +249,7 @@ EAPI void *eina_accessor_container_get(Eina_Accessor *accessor) EINA_ARG_NONNULL
* @param[in] fdata The data passed to the callback * @param[in] fdata The data passed to the callback
* *
*/ */
EAPI void eina_accessor_over(Eina_Accessor *accessor, EINA_API void eina_accessor_over(Eina_Accessor *accessor,
Eina_Each_Cb cb, Eina_Each_Cb cb,
unsigned int start, unsigned int start,
unsigned int end, unsigned int end,
@ -269,7 +269,7 @@ EAPI void eina_accessor_over(Eina_Accessor *accessor,
* *
* @warning None of the existing eina data structures are lockable. * @warning None of the existing eina data structures are lockable.
*/ */
EAPI Eina_Bool eina_accessor_lock(Eina_Accessor *accessor) EINA_ARG_NONNULL(1); EINA_API Eina_Bool eina_accessor_lock(Eina_Accessor *accessor) EINA_ARG_NONNULL(1);
/** /**
* @brief Clones the container of the accessor. * @brief Clones the container of the accessor.
@ -278,7 +278,7 @@ EAPI Eina_Bool eina_accessor_lock(Eina_Accessor *accessor) EINA_ARG_NONNULL(1);
* @return Another accessor * @return Another accessor
* @since 1.10 * @since 1.10
*/ */
EAPI Eina_Accessor* eina_accessor_clone(Eina_Accessor *accessor) EINA_ARG_NONNULL(1); EINA_API Eina_Accessor* eina_accessor_clone(Eina_Accessor *accessor) EINA_ARG_NONNULL(1);
/** /**
* @brief Unlocks the container of the accessor. * @brief Unlocks the container of the accessor.
@ -293,7 +293,7 @@ EAPI Eina_Accessor* eina_accessor_clone(Eina_Accessor *accessor) EINA_ARG_NONNUL
* *
* @warning None of the existing eina data structures are lockable. * @warning None of the existing eina data structures are lockable.
*/ */
EAPI Eina_Bool eina_accessor_unlock(Eina_Accessor *accessor) EINA_ARG_NONNULL(1); EINA_API Eina_Bool eina_accessor_unlock(Eina_Accessor *accessor) EINA_ARG_NONNULL(1);
/** /**
* @def EINA_ACCESSOR_FOREACH * @def EINA_ACCESSOR_FOREACH
@ -363,7 +363,7 @@ EAPI Eina_Bool eina_accessor_unlock(Eina_Accessor *accessor) EINA_ARG_NONNULL(1)
* *
* @since 1.23 * @since 1.23
*/ */
EAPI Eina_Accessor* eina_carray_length_accessor_new(void** array, unsigned int step, unsigned int length); EINA_API Eina_Accessor* eina_carray_length_accessor_new(void** array, unsigned int step, unsigned int length);
/** /**
@ -383,7 +383,7 @@ EAPI Eina_Accessor* eina_carray_length_accessor_new(void** array, unsigned int s
* @since 1.24 * @since 1.24
*/ */
EAPI Eina_Accessor* eina_carray_length_ptr_accessor_new(void** array, unsigned int step, unsigned int length); EINA_API Eina_Accessor* eina_carray_length_ptr_accessor_new(void** array, unsigned int step, unsigned int length);
/** /**
* @def EINA_C_ARRAY_ACCESSOR_NEW * @def EINA_C_ARRAY_ACCESSOR_NEW
* @brief Creates an Eina_Accessor that wraps a plain fixed size C array * @brief Creates an Eina_Accessor that wraps a plain fixed size C array

31
src/lib/eina/eina_api.h Normal file
View File

@ -0,0 +1,31 @@
#ifndef EINA_PREAMBLE_H
# define EINA_PREAMBLE_H
#ifdef EINA_API
# undef EINA_API
#endif
#ifdef _MSC_VER
# ifndef EINA_DLL
# define EINA_API
# elif defined(EINA_BUILD)
# define EINA_API __declspec(dllexport)
# else
# define EINA_API __declspec(dllimport)
# endif
# define EINA_API_WEAK
#else
# ifdef __GNUC__
# if __GNUC__ >= 4
# define EINA_API __attribute__ ((visibility("default")))
# define EINA_API_WEAK __attribute__ ((weak))
# else
# define EINA_API
# define EINA_API_WEAK
# endif
# else
# define EINA_API
# endif
#endif
#endif

View File

@ -191,7 +191,7 @@ eina_array_accessor_clone(const Eina_Accessor_Array *it)
} }
/* used from eina_inline_array.x, thus a needed symbol */ /* used from eina_inline_array.x, thus a needed symbol */
EAPI Eina_Bool EINA_API Eina_Bool
eina_array_grow(Eina_Array *array) eina_array_grow(Eina_Array *array)
{ {
void **tmp; void **tmp;
@ -272,7 +272,7 @@ eina_array_shutdown(void)
* API * * API *
*============================================================================*/ *============================================================================*/
EAPI Eina_Array * EINA_API Eina_Array *
eina_array_new(unsigned int step) eina_array_new(unsigned int step)
{ {
Eina_Array *array; Eina_Array *array;
@ -291,7 +291,7 @@ eina_array_new(unsigned int step)
return array; return array;
} }
EAPI void EINA_API void
eina_array_free(Eina_Array *array) eina_array_free(Eina_Array *array)
{ {
if (!array) return; if (!array) return;
@ -301,7 +301,7 @@ eina_array_free(Eina_Array *array)
MAGIC_FREE(array); MAGIC_FREE(array);
} }
EAPI void EINA_API void
eina_array_step_set(Eina_Array *array, eina_array_step_set(Eina_Array *array,
unsigned int sizeof_eina_array, unsigned int sizeof_eina_array,
unsigned int step) unsigned int step)
@ -326,7 +326,7 @@ eina_array_step_set(Eina_Array *array,
EINA_MAGIC_SET(array, EINA_MAGIC_ARRAY); EINA_MAGIC_SET(array, EINA_MAGIC_ARRAY);
} }
EAPI void EINA_API void
eina_array_flush(Eina_Array *array) eina_array_flush(Eina_Array *array)
{ {
EINA_SAFETY_ON_NULL_RETURN(array); EINA_SAFETY_ON_NULL_RETURN(array);
@ -342,7 +342,7 @@ eina_array_flush(Eina_Array *array)
array->data = NULL; array->data = NULL;
} }
EAPI Eina_Bool EINA_API Eina_Bool
eina_array_remove(Eina_Array *array, Eina_Bool (*keep)(void *data, eina_array_remove(Eina_Array *array, Eina_Bool (*keep)(void *data,
void *gdata), void *gdata),
void *gdata) void *gdata)
@ -390,7 +390,7 @@ eina_array_remove(Eina_Array *array, Eina_Bool (*keep)(void *data,
return EINA_TRUE; return EINA_TRUE;
} }
EAPI Eina_Iterator * EINA_API Eina_Iterator *
eina_array_iterator_new(const Eina_Array *array) eina_array_iterator_new(const Eina_Array *array)
{ {
Eina_Iterator_Array *it; Eina_Iterator_Array *it;
@ -415,7 +415,7 @@ eina_array_iterator_new(const Eina_Array *array)
return &it->iterator; return &it->iterator;
} }
EAPI Eina_Accessor * EINA_API Eina_Accessor *
eina_array_accessor_new(const Eina_Array *array) eina_array_accessor_new(const Eina_Array *array)
{ {
Eina_Accessor_Array *ac; Eina_Accessor_Array *ac;

View File

@ -251,7 +251,7 @@ struct _Eina_Array
* This function return a valid array on success, or @c NULL if memory * This function return a valid array on success, or @c NULL if memory
* allocation fails. * allocation fails.
*/ */
EAPI Eina_Array *eina_array_new(unsigned int step) EINA_WARN_UNUSED_RESULT EINA_MALLOC EINA_WARN_UNUSED_RESULT; EINA_API Eina_Array *eina_array_new(unsigned int step) EINA_WARN_UNUSED_RESULT EINA_MALLOC EINA_WARN_UNUSED_RESULT;
/** /**
* @brief Frees an array. * @brief Frees an array.
@ -263,7 +263,7 @@ EAPI Eina_Array *eina_array_new(unsigned int step) EINA_WARN_UNUSED_RESULT EINA_
* does not free the memory allocated for the elements of @p array. To * does not free the memory allocated for the elements of @p array. To
* free them, walk the array with #EINA_ARRAY_ITER_NEXT. * free them, walk the array with #EINA_ARRAY_ITER_NEXT.
*/ */
EAPI void eina_array_free(Eina_Array *array); EINA_API void eina_array_free(Eina_Array *array);
/** /**
* @brief Sets the step of an array. * @brief Sets the step of an array.
@ -278,7 +278,7 @@ EAPI void eina_array_free(Eina_Array *array);
* *
* @warning This function can @b only be called on uninitialized arrays. * @warning This function can @b only be called on uninitialized arrays.
*/ */
EAPI void eina_array_step_set(Eina_Array *array, EINA_API void eina_array_step_set(Eina_Array *array,
unsigned int sizeof_eina_array, unsigned int sizeof_eina_array,
unsigned int step) EINA_ARG_NONNULL(1); unsigned int step) EINA_ARG_NONNULL(1);
/** /**
@ -303,7 +303,7 @@ static inline void eina_array_clean(Eina_Array *array) EINA_ARG_NONNULL(1);
* there is no check of @p array. If it is @c NULL or invalid, the * there is no check of @p array. If it is @c NULL or invalid, the
* program may crash. * program may crash.
*/ */
EAPI void eina_array_flush(Eina_Array *array) EINA_ARG_NONNULL(1); EINA_API void eina_array_flush(Eina_Array *array) EINA_ARG_NONNULL(1);
/** /**
* @brief Rebuilds an array by specifying the data to keep. * @brief Rebuilds an array by specifying the data to keep.
@ -321,7 +321,7 @@ EAPI void eina_array_flush(Eina_Array *array) EINA_ARG_NONNULL(1);
* If it wasn't able to remove items due to an allocation failure, it will * If it wasn't able to remove items due to an allocation failure, it will
* return #EINA_FALSE. * return #EINA_FALSE.
*/ */
EAPI Eina_Bool eina_array_remove(Eina_Array * array, EINA_API Eina_Bool eina_array_remove(Eina_Array * array,
Eina_Bool (*keep)(void *data, void *gdata), Eina_Bool (*keep)(void *data, void *gdata),
void *gdata) EINA_ARG_NONNULL(1, 2); void *gdata) EINA_ARG_NONNULL(1, 2);
@ -441,7 +441,7 @@ static inline Eina_Bool eina_array_find(const Eina_Array *array,
* *
* @see Eina_Iterator_Group * @see Eina_Iterator_Group
*/ */
EAPI Eina_Iterator *eina_array_iterator_new(const Eina_Array *array) EINA_MALLOC EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT; EINA_API Eina_Iterator *eina_array_iterator_new(const Eina_Array *array) EINA_MALLOC EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT;
/** /**
* @brief Gets a new accessor associated with an array. * @brief Gets a new accessor associated with an array.
@ -456,7 +456,7 @@ EAPI Eina_Iterator *eina_array_iterator_new(const Eina_Array *array) EINA
* *
* @see Eina_Accessor_Group * @see Eina_Accessor_Group
*/ */
EAPI Eina_Accessor *eina_array_accessor_new(const Eina_Array *array) EINA_MALLOC EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT; EINA_API Eina_Accessor *eina_array_accessor_new(const Eina_Array *array) EINA_MALLOC EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT;
/** /**
* @brief Iterates over an array using a callback function. * @brief Iterates over an array using a callback function.

View File

@ -134,7 +134,7 @@ eina_benchmark_shutdown(void)
* API * * API *
*============================================================================*/ *============================================================================*/
EAPI Eina_Benchmark * EINA_API Eina_Benchmark *
eina_benchmark_new(const char *name, const char *run) eina_benchmark_new(const char *name, const char *run)
{ {
Eina_Benchmark *new; Eina_Benchmark *new;
@ -148,7 +148,7 @@ eina_benchmark_new(const char *name, const char *run)
return new; return new;
} }
EAPI void EINA_API void
eina_benchmark_free(Eina_Benchmark *bench) eina_benchmark_free(Eina_Benchmark *bench)
{ {
Eina_Array *names; Eina_Array *names;
@ -179,7 +179,7 @@ eina_benchmark_free(Eina_Benchmark *bench)
free(bench); free(bench);
} }
EAPI Eina_Bool EINA_API Eina_Bool
eina_benchmark_register(Eina_Benchmark *bench, eina_benchmark_register(Eina_Benchmark *bench,
const char *name, const char *name,
Eina_Benchmark_Specimens bench_cb, Eina_Benchmark_Specimens bench_cb,
@ -209,7 +209,7 @@ eina_benchmark_register(Eina_Benchmark *bench,
return EINA_TRUE; return EINA_TRUE;
} }
EAPI Eina_Array * EINA_API Eina_Array *
eina_benchmark_run(Eina_Benchmark *bench) eina_benchmark_run(Eina_Benchmark *bench)
{ {
FILE *main_script; FILE *main_script;

View File

@ -367,7 +367,7 @@ typedef void (*Eina_Benchmark_Specimens)(int request);
* When the new module is not needed anymore, use * When the new module is not needed anymore, use
* eina_benchmark_free() to free the allocated memory. * eina_benchmark_free() to free the allocated memory.
*/ */
EAPI Eina_Benchmark *eina_benchmark_new(const char *name, EINA_API Eina_Benchmark *eina_benchmark_new(const char *name,
const char *run); const char *run);
/** /**
@ -379,7 +379,7 @@ EAPI Eina_Benchmark *eina_benchmark_new(const char *name,
* registered and frees @p bench. If @p bench is @c NULL, this * registered and frees @p bench. If @p bench is @c NULL, this
* function returns immediately. * function returns immediately.
*/ */
EAPI void eina_benchmark_free(Eina_Benchmark *bench); EINA_API void eina_benchmark_free(Eina_Benchmark *bench);
/** /**
* @brief Adds a test to a benchmark. * @brief Adds a test to a benchmark.
@ -401,7 +401,7 @@ EAPI void eina_benchmark_free(Eina_Benchmark *bench);
* If @p bench is @c NULL or @p count_step is 0, this function returns * If @p bench is @c NULL or @p count_step is 0, this function returns
* immediately and does not add any tests to the benchmark. * immediately and does not add any tests to the benchmark.
*/ */
EAPI Eina_Bool eina_benchmark_register(Eina_Benchmark *bench, EINA_API Eina_Bool eina_benchmark_register(Eina_Benchmark *bench,
const char *name, const char *name,
Eina_Benchmark_Specimens bench_cb, Eina_Benchmark_Specimens bench_cb,
int count_start, int count_start,
@ -430,7 +430,7 @@ EAPI Eina_Bool eina_benchmark_register(Eina_Benchmark *bench,
* the gnuplot file. The number of times each test is executed is * the gnuplot file. The number of times each test is executed is
* controlled by the parameters passed to eina_benchmark_register(). * controlled by the parameters passed to eina_benchmark_register().
*/ */
EAPI Eina_Array *eina_benchmark_run(Eina_Benchmark *bench); EINA_API Eina_Array *eina_benchmark_run(Eina_Benchmark *bench);
/** /**
* @} * @}

View File

@ -106,7 +106,7 @@ _eina_bezier_length_helper(const Eina_Bezier *b)
return len; return len;
} }
EAPI void EINA_API void
eina_bezier_values_set(Eina_Bezier *b, eina_bezier_values_set(Eina_Bezier *b,
double start_x, double start_y, double start_x, double start_y,
double ctrl_start_x, double ctrl_start_y, double ctrl_start_x, double ctrl_start_y,
@ -123,7 +123,7 @@ eina_bezier_values_set(Eina_Bezier *b,
b->end.y = end_y; b->end.y = end_y;
} }
EAPI void EINA_API void
eina_bezier_values_get(const Eina_Bezier *b, eina_bezier_values_get(const Eina_Bezier *b,
double *start_x, double *start_y, double *start_x, double *start_y,
double *ctrl_start_x, double *ctrl_start_y, double *ctrl_start_x, double *ctrl_start_y,
@ -141,7 +141,7 @@ eina_bezier_values_get(const Eina_Bezier *b,
} }
EAPI void EINA_API void
eina_bezier_point_at(const Eina_Bezier *bz, double t, double *px, double *py) eina_bezier_point_at(const Eina_Bezier *bz, double t, double *px, double *py)
{ {
double m_t = 1.0 - t; double m_t = 1.0 - t;
@ -169,7 +169,7 @@ eina_bezier_point_at(const Eina_Bezier *bz, double t, double *px, double *py)
} }
} }
EAPI double EINA_API double
eina_bezier_angle_at(const Eina_Bezier *b, double t) eina_bezier_angle_at(const Eina_Bezier *b, double t)
{ {
double x, y; double x, y;
@ -183,7 +183,7 @@ eina_bezier_angle_at(const Eina_Bezier *b, double t)
return theta_normalized; return theta_normalized;
} }
EAPI double EINA_API double
eina_bezier_length_get(const Eina_Bezier *b) eina_bezier_length_get(const Eina_Bezier *b)
{ {
return _eina_bezier_length_helper(b); return _eina_bezier_length_helper(b);
@ -218,7 +218,7 @@ _eina_bezier_split_left(Eina_Bezier *b, double t, Eina_Bezier *left)
left->end.y = b->start.y = left->ctrl_end.y + t * (b->ctrl_start.y - left->ctrl_end.y); left->end.y = b->start.y = left->ctrl_end.y + t * (b->ctrl_start.y - left->ctrl_end.y);
} }
EAPI double EINA_API double
eina_bezier_t_at(const Eina_Bezier *b, double l) eina_bezier_t_at(const Eina_Bezier *b, double l)
{ {
double len = eina_bezier_length_get(b); double len = eina_bezier_length_get(b);
@ -256,7 +256,7 @@ eina_bezier_t_at(const Eina_Bezier *b, double l)
return t; return t;
} }
EAPI void EINA_API void
eina_bezier_split_at_length(const Eina_Bezier *b, double len, eina_bezier_split_at_length(const Eina_Bezier *b, double len,
Eina_Bezier *left, Eina_Bezier *right) Eina_Bezier *left, Eina_Bezier *right)
{ {
@ -270,7 +270,7 @@ eina_bezier_split_at_length(const Eina_Bezier *b, double len,
_eina_bezier_split_left(right, t, left); _eina_bezier_split_left(right, t, left);
} }
EAPI void EINA_API void
eina_bezier_bounds_get(const Eina_Bezier *b, double *x, double *y, double *w, double *h) eina_bezier_bounds_get(const Eina_Bezier *b, double *x, double *y, double *w, double *h)
{ {
double xmin = b->start.x; double xmin = b->start.x;
@ -310,7 +310,7 @@ eina_bezier_bounds_get(const Eina_Bezier *b, double *x, double *y, double *w, do
if (h) *h = ymax - ymin; if (h) *h = ymax - ymin;
} }
EAPI void EINA_API void
eina_bezier_on_interval(Eina_Bezier *b, double t0, double t1, Eina_Bezier *result) eina_bezier_on_interval(Eina_Bezier *b, double t0, double t1, Eina_Bezier *result)
{ {
Eina_Bezier bezier; Eina_Bezier bezier;

View File

@ -64,7 +64,7 @@ struct _Eina_Bezier
* @p b. No check is done on @p b. * @p b. No check is done on @p b.
* @since 1.16 * @since 1.16
*/ */
EAPI void eina_bezier_values_set(Eina_Bezier *b, double start_x, double start_y, double ctrl_start_x, double ctrl_start_y, double ctrl_end_x, double ctrl_end_y, double end_x, double end_y) EINA_ARG_NONNULL(1); EINA_API void eina_bezier_values_set(Eina_Bezier *b, double start_x, double start_y, double ctrl_start_x, double ctrl_start_y, double ctrl_end_x, double ctrl_end_y, double end_x, double end_y) EINA_ARG_NONNULL(1);
/** /**
* @brief Gets the values of the points of the given floating * @brief Gets the values of the points of the given floating
@ -83,7 +83,7 @@ EAPI void eina_bezier_values_set(Eina_Bezier *b, double start_x, double start_y,
* @p b. No check is done on @p b. * @p b. No check is done on @p b.
* @since 1.16 * @since 1.16
*/ */
EAPI void eina_bezier_values_get(const Eina_Bezier *b, double *start_x, double *start_y, double *ctrl_start_x, double *ctrl_start_y, double *ctrl_end_x, double *ctrl_end_y, double *end_x, double *end_y) EINA_ARG_NONNULL(1); EINA_API void eina_bezier_values_get(const Eina_Bezier *b, double *start_x, double *start_y, double *ctrl_start_x, double *ctrl_start_y, double *ctrl_end_x, double *ctrl_end_y, double *end_x, double *end_y) EINA_ARG_NONNULL(1);
/** /**
* @brief Calculates the approximate length of the given floating point * @brief Calculates the approximate length of the given floating point
@ -99,7 +99,7 @@ EAPI void eina_bezier_values_get(const Eina_Bezier *b, double *start_x, double *
* No check is done on @p b. * No check is done on @p b.
* @since 1.16 * @since 1.16
*/ */
EAPI double eina_bezier_length_get(const Eina_Bezier *b) EINA_ARG_NONNULL(1); EINA_API double eina_bezier_length_get(const Eina_Bezier *b) EINA_ARG_NONNULL(1);
/** /**
* @brief Returns the relative position on a bezier at a given length. * @brief Returns the relative position on a bezier at a given length.
@ -116,7 +116,7 @@ EAPI double eina_bezier_length_get(const Eina_Bezier *b) EINA_ARG_NONNULL(1);
* *
* @since 1.16 * @since 1.16
*/ */
EAPI double eina_bezier_t_at(const Eina_Bezier *b, double len) EINA_ARG_NONNULL(1); EINA_API double eina_bezier_t_at(const Eina_Bezier *b, double len) EINA_ARG_NONNULL(1);
/** /**
* @brief Gets the point on the bezier curve at position t. * @brief Gets the point on the bezier curve at position t.
@ -129,7 +129,7 @@ EAPI double eina_bezier_t_at(const Eina_Bezier *b, double len) EINA_ARG_NONNULL(
* No check is done on @p b. * No check is done on @p b.
* @since 1.16 * @since 1.16
*/ */
EAPI void eina_bezier_point_at(const Eina_Bezier *b, double t, double *px, double *py) EINA_ARG_NONNULL(1); EINA_API void eina_bezier_point_at(const Eina_Bezier *b, double t, double *px, double *py) EINA_ARG_NONNULL(1);
/** /**
* @brief Determines the slope of the bezier at a given position. * @brief Determines the slope of the bezier at a given position.
@ -140,7 +140,7 @@ EAPI void eina_bezier_point_at(const Eina_Bezier *b, double t, double *px, doubl
* No check is done on @p b. * No check is done on @p b.
* @since 1.16 * @since 1.16
*/ */
EAPI double eina_bezier_angle_at(const Eina_Bezier *b, double t) EINA_ARG_NONNULL(1); EINA_API double eina_bezier_angle_at(const Eina_Bezier *b, double t) EINA_ARG_NONNULL(1);
/** /**
* @brief Splits the bezier at a given length. * @brief Splits the bezier at a given length.
@ -153,7 +153,7 @@ EAPI double eina_bezier_angle_at(const Eina_Bezier *b, double t) EINA_ARG_NONNUL
* No check is done on @p b. * No check is done on @p b.
* @since 1.16 * @since 1.16
*/ */
EAPI void eina_bezier_split_at_length(const Eina_Bezier *b, double len, Eina_Bezier *left, Eina_Bezier *right) EINA_ARG_NONNULL(1); EINA_API void eina_bezier_split_at_length(const Eina_Bezier *b, double len, Eina_Bezier *left, Eina_Bezier *right) EINA_ARG_NONNULL(1);
/** /**
* @brief Calculates the bounding box for the bezier. * @brief Calculates the bounding box for the bezier.
@ -167,7 +167,7 @@ EAPI void eina_bezier_split_at_length(const Eina_Bezier *b, double len, Eina_Bez
* No check is done on @p b. * No check is done on @p b.
* @since 1.17 * @since 1.17
*/ */
EAPI void eina_bezier_bounds_get(const Eina_Bezier *b, double *x, double *y, double *w, double *h) EINA_ARG_NONNULL(1); EINA_API void eina_bezier_bounds_get(const Eina_Bezier *b, double *x, double *y, double *w, double *h) EINA_ARG_NONNULL(1);
/** /**
* @brief Finds the bezier between the given interval. * @brief Finds the bezier between the given interval.
@ -180,6 +180,6 @@ EAPI void eina_bezier_bounds_get(const Eina_Bezier *b, double *x, double *y, dou
* No check is done on @p b. * No check is done on @p b.
* @since 1.17 * @since 1.17
*/ */
EAPI void eina_bezier_on_interval(Eina_Bezier *b, double t0, double t1, Eina_Bezier *result); EINA_API void eina_bezier_on_interval(Eina_Bezier *b, double t0, double t1, Eina_Bezier *result);
#endif // EINA_BEZIER_H #endif // EINA_BEZIER_H

View File

@ -53,7 +53,7 @@ static const char __BINBUF_MAGIC_STR[] = "Eina Binbuf";
#include "eina_binbuf_template_c.x" #include "eina_binbuf_template_c.x"
EAPI Eina_Binbuf * EINA_API Eina_Binbuf *
eina_binbuf_manage_new(const unsigned char *str, size_t length, Eina_Bool ro) eina_binbuf_manage_new(const unsigned char *str, size_t length, Eina_Bool ro)
{ {
Eina_Binbuf *buf; Eina_Binbuf *buf;

View File

@ -47,7 +47,7 @@ typedef struct _Eina_Strbuf Eina_Binbuf;
* @see eina_binbuf_append() * @see eina_binbuf_append()
* @see eina_binbuf_string_get() * @see eina_binbuf_string_get()
*/ */
EAPI Eina_Binbuf *eina_binbuf_new(void) EINA_MALLOC EINA_WARN_UNUSED_RESULT; EINA_API Eina_Binbuf *eina_binbuf_new(void) EINA_MALLOC EINA_WARN_UNUSED_RESULT;
/** /**
* @brief Creates a new string buffer using the passed string. * @brief Creates a new string buffer using the passed string.
@ -73,7 +73,7 @@ EAPI Eina_Binbuf *eina_binbuf_new(void) EINA_MALLOC EINA_WARN_UNUSED_RESULT;
* *
* @since 1.14.0 * @since 1.14.0
*/ */
EAPI Eina_Binbuf *eina_binbuf_manage_new(const unsigned char *str, size_t length, Eina_Bool ro) EINA_MALLOC EINA_WARN_UNUSED_RESULT; EINA_API Eina_Binbuf *eina_binbuf_manage_new(const unsigned char *str, size_t length, Eina_Bool ro) EINA_MALLOC EINA_WARN_UNUSED_RESULT;
/** /**
* @brief Creates a new string buffer using the passed string. * @brief Creates a new string buffer using the passed string.
@ -89,7 +89,7 @@ EAPI Eina_Binbuf *eina_binbuf_manage_new(const unsigned char *str, size_t length
* *
* @since 1.2.0 * @since 1.2.0
*/ */
EAPI Eina_Binbuf *eina_binbuf_manage_new_length(unsigned char *str, size_t length) EINA_MALLOC EINA_WARN_UNUSED_RESULT EINA_DEPRECATED; EINA_API Eina_Binbuf *eina_binbuf_manage_new_length(unsigned char *str, size_t length) EINA_MALLOC EINA_WARN_UNUSED_RESULT EINA_DEPRECATED;
/** /**
* @brief Creates a new string buffer using the passed string. * @brief Creates a new string buffer using the passed string.
@ -110,7 +110,7 @@ EAPI Eina_Binbuf *eina_binbuf_manage_new_length(unsigned char *str, size_t lengt
* *
* @since 1.9.0 * @since 1.9.0
*/ */
EAPI Eina_Binbuf *eina_binbuf_manage_read_only_new_length(const unsigned char *str, size_t length) EINA_MALLOC EINA_WARN_UNUSED_RESULT EINA_DEPRECATED; EINA_API Eina_Binbuf *eina_binbuf_manage_read_only_new_length(const unsigned char *str, size_t length) EINA_MALLOC EINA_WARN_UNUSED_RESULT EINA_DEPRECATED;
/** /**
* @brief Frees a string buffer. * @brief Frees a string buffer.
@ -120,7 +120,7 @@ EAPI Eina_Binbuf *eina_binbuf_manage_read_only_new_length(const unsigned char *s
* This function frees the memory of @p buf. @p buf must have been * This function frees the memory of @p buf. @p buf must have been
* created by eina_binbuf_new(). * created by eina_binbuf_new().
*/ */
EAPI void eina_binbuf_free(Eina_Binbuf *buf) EINA_ARG_NONNULL(1); EINA_API void eina_binbuf_free(Eina_Binbuf *buf) EINA_ARG_NONNULL(1);
/** /**
* @brief Resets a string buffer. * @brief Resets a string buffer.
@ -130,7 +130,7 @@ EAPI void eina_binbuf_free(Eina_Binbuf *buf) EINA_ARG_NONNULL(1);
* This function resets @p buf: the buffer len is set to 0, and the * This function resets @p buf: the buffer len is set to 0, and the
* string is set to '\\0'. No memory is freed. * string is set to '\\0'. No memory is freed.
*/ */
EAPI void eina_binbuf_reset(Eina_Binbuf *buf) EINA_ARG_NONNULL(1); EINA_API void eina_binbuf_reset(Eina_Binbuf *buf) EINA_ARG_NONNULL(1);
/** /**
* @brief Expands a buffer, making room for at least @p minimum_unused_space. * @brief Expands a buffer, making room for at least @p minimum_unused_space.
@ -160,7 +160,7 @@ EAPI void eina_binbuf_reset(Eina_Binbuf *buf) EINA_ARG_NONNULL(1);
* *
* @since 1.19 * @since 1.19
*/ */
EAPI Eina_Rw_Slice eina_binbuf_expand(Eina_Binbuf *buf, size_t minimum_unused_space) EINA_ARG_NONNULL(1); EINA_API Eina_Rw_Slice eina_binbuf_expand(Eina_Binbuf *buf, size_t minimum_unused_space) EINA_ARG_NONNULL(1);
/** /**
* @brief Marks more bytes as used. * @brief Marks more bytes as used.
@ -180,7 +180,7 @@ EAPI Eina_Rw_Slice eina_binbuf_expand(Eina_Binbuf *buf, size_t minimum_unused_sp
* *
* @since 1.19 * @since 1.19
*/ */
EAPI Eina_Bool eina_binbuf_use(Eina_Binbuf *buf, size_t extra_bytes) EINA_ARG_NONNULL(1); EINA_API Eina_Bool eina_binbuf_use(Eina_Binbuf *buf, size_t extra_bytes) EINA_ARG_NONNULL(1);
/** /**
* @brief Appends a string of exact length to a buffer, reallocating as * @brief Appends a string of exact length to a buffer, reallocating as
@ -200,7 +200,7 @@ EAPI Eina_Bool eina_binbuf_use(Eina_Binbuf *buf, size_t extra_bytes) EINA_ARG_NO
* @see eina_binbuf_append() * @see eina_binbuf_append()
* @see eina_binbuf_append_n() * @see eina_binbuf_append_n()
*/ */
EAPI Eina_Bool eina_binbuf_append_length(Eina_Binbuf *buf, const unsigned char *str, size_t length) EINA_ARG_NONNULL(1, 2); EINA_API Eina_Bool eina_binbuf_append_length(Eina_Binbuf *buf, const unsigned char *str, size_t length) EINA_ARG_NONNULL(1, 2);
/** /**
* @brief Appends a slice to a buffer, reallocating as necessary. * @brief Appends a slice to a buffer, reallocating as necessary.
@ -213,7 +213,7 @@ EAPI Eina_Bool eina_binbuf_append_length(Eina_Binbuf *buf, const unsigned char *
* *
* @since 1.19 * @since 1.19
*/ */
EAPI Eina_Bool eina_binbuf_append_slice(Eina_Binbuf *buf, const Eina_Slice slice) EINA_ARG_NONNULL(1); EINA_API Eina_Bool eina_binbuf_append_slice(Eina_Binbuf *buf, const Eina_Slice slice) EINA_ARG_NONNULL(1);
/** /**
* @brief Appends an Eina_Binbuf to a buffer, reallocating as necessary. * @brief Appends an Eina_Binbuf to a buffer, reallocating as necessary.
@ -232,7 +232,7 @@ EAPI Eina_Bool eina_binbuf_append_slice(Eina_Binbuf *buf, const Eina_Slice slice
* *
* @since 1.9.0 * @since 1.9.0
*/ */
EAPI Eina_Bool eina_binbuf_append_buffer(Eina_Binbuf *buf, const Eina_Binbuf *data) EINA_ARG_NONNULL(1, 2); EINA_API Eina_Bool eina_binbuf_append_buffer(Eina_Binbuf *buf, const Eina_Binbuf *data) EINA_ARG_NONNULL(1, 2);
/** /**
* @brief Appends a character to a string buffer, reallocating as * @brief Appends a character to a string buffer, reallocating as
@ -244,7 +244,7 @@ EAPI Eina_Bool eina_binbuf_append_buffer(Eina_Binbuf *buf, const Eina_Binbuf *da
* *
* This function appends @p c to @p buf. * This function appends @p c to @p buf.
*/ */
EAPI Eina_Bool eina_binbuf_append_char(Eina_Binbuf *buf, unsigned char c) EINA_ARG_NONNULL(1); EINA_API Eina_Bool eina_binbuf_append_char(Eina_Binbuf *buf, unsigned char c) EINA_ARG_NONNULL(1);
/** /**
* @brief Inserts a string of exact length into a buffer, reallocating as necessary. * @brief Inserts a string of exact length into a buffer, reallocating as necessary.
@ -264,7 +264,7 @@ EAPI Eina_Bool eina_binbuf_append_char(Eina_Binbuf *buf, unsigned char c) EINA_A
* @see eina_binbuf_insert() * @see eina_binbuf_insert()
* @see eina_binbuf_insert_n() * @see eina_binbuf_insert_n()
*/ */
EAPI Eina_Bool eina_binbuf_insert_length(Eina_Binbuf *buf, const unsigned char *str, size_t length, size_t pos) EINA_ARG_NONNULL(1, 2); EINA_API Eina_Bool eina_binbuf_insert_length(Eina_Binbuf *buf, const unsigned char *str, size_t length, size_t pos) EINA_ARG_NONNULL(1, 2);
/** /**
* @brief Inserts a slice into a buffer, reallocating as necessary. * @brief Inserts a slice into a buffer, reallocating as necessary.
@ -278,7 +278,7 @@ EAPI Eina_Bool eina_binbuf_insert_length(Eina_Binbuf *buf, const unsigned char *
* *
* @since 1.19.0 * @since 1.19.0
*/ */
EAPI Eina_Bool eina_binbuf_insert_slice(Eina_Binbuf *buf, const Eina_Slice slice, size_t pos) EINA_ARG_NONNULL(1); EINA_API Eina_Bool eina_binbuf_insert_slice(Eina_Binbuf *buf, const Eina_Slice slice, size_t pos) EINA_ARG_NONNULL(1);
/** /**
* @brief Inserts a character into a string buffer, reallocating as * @brief Inserts a character into a string buffer, reallocating as
@ -291,7 +291,7 @@ EAPI Eina_Bool eina_binbuf_insert_slice(Eina_Binbuf *buf, const Eina_Slice slice
* *
* This function inserts @p c to @p buf at position @p pos. * This function inserts @p c to @p buf at position @p pos.
*/ */
EAPI Eina_Bool eina_binbuf_insert_char(Eina_Binbuf *buf, unsigned char c, size_t pos) EINA_ARG_NONNULL(1); EINA_API Eina_Bool eina_binbuf_insert_char(Eina_Binbuf *buf, unsigned char c, size_t pos) EINA_ARG_NONNULL(1);
/** /**
* @brief Removes a slice of the given string buffer. * @brief Removes a slice of the given string buffer.
@ -307,7 +307,7 @@ EAPI Eina_Bool eina_binbuf_insert_char(Eina_Binbuf *buf, unsigned char c, size_t
* (inclusive) and ending at @p end (non-inclusive). Both values are * (inclusive) and ending at @p end (non-inclusive). Both values are
* in bytes. * in bytes.
*/ */
EAPI Eina_Bool eina_binbuf_remove(Eina_Binbuf *buf, size_t start, size_t end) EINA_ARG_NONNULL(1); EINA_API Eina_Bool eina_binbuf_remove(Eina_Binbuf *buf, size_t start, size_t end) EINA_ARG_NONNULL(1);
/** /**
* @brief Retrieves a pointer to the contents of a string buffer. * @brief Retrieves a pointer to the contents of a string buffer.
@ -322,7 +322,7 @@ EAPI Eina_Bool eina_binbuf_remove(Eina_Binbuf *buf, size_t start, size_t end) EI
* *
* @see eina_binbuf_string_steal() * @see eina_binbuf_string_steal()
*/ */
EAPI const unsigned char *eina_binbuf_string_get(const Eina_Binbuf *buf) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT; EINA_API const unsigned char *eina_binbuf_string_get(const Eina_Binbuf *buf) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT;
/** /**
* @brief Steals the contents of a string buffer. * @brief Steals the contents of a string buffer.
@ -337,7 +337,7 @@ EAPI const unsigned char *eina_binbuf_string_get(const Eina_Binbuf *buf) EINA_AR
* *
* @see eina_binbuf_string_get() * @see eina_binbuf_string_get()
*/ */
EAPI unsigned char *eina_binbuf_string_steal(Eina_Binbuf *buf) EINA_MALLOC EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1); EINA_API unsigned char *eina_binbuf_string_steal(Eina_Binbuf *buf) EINA_MALLOC EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1);
/** /**
* @brief Frees the contents of a string buffer but not the buffer. * @brief Frees the contents of a string buffer but not the buffer.
@ -347,7 +347,7 @@ EAPI unsigned char *eina_binbuf_string_steal(Eina_Binbuf *buf) EINA_MALLOC EINA_
* This function frees the string contained in @p buf without freeing * This function frees the string contained in @p buf without freeing
* @p buf. * @p buf.
*/ */
EAPI void eina_binbuf_string_free(Eina_Binbuf *buf) EINA_ARG_NONNULL(1); EINA_API void eina_binbuf_string_free(Eina_Binbuf *buf) EINA_ARG_NONNULL(1);
/** /**
* @brief Retrieves the length of the string buffer's content. * @brief Retrieves the length of the string buffer's content.
@ -357,7 +357,7 @@ EAPI void eina_binbuf_string_free(Eina_Binbuf *buf) EINA_ARG_NONNULL(1);
* *
* This function returns the length of @p buf. * This function returns the length of @p buf.
*/ */
EAPI size_t eina_binbuf_length_get(const Eina_Binbuf *buf) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT; EINA_API size_t eina_binbuf_length_get(const Eina_Binbuf *buf) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT;
/** /**
* @brief Gets a read-only slice of the buffer contents. * @brief Gets a read-only slice of the buffer contents.
@ -368,7 +368,7 @@ EAPI size_t eina_binbuf_length_get(const Eina_Binbuf *buf) EINA_ARG_NONNULL(1) E
* *
* @since 1.19 * @since 1.19
*/ */
EAPI Eina_Slice eina_binbuf_slice_get(const Eina_Binbuf *buf) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1); EINA_API Eina_Slice eina_binbuf_slice_get(const Eina_Binbuf *buf) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1);
/** /**
* @brief Gets a read-write slice of the buffer contents. * @brief Gets a read-write slice of the buffer contents.
@ -382,7 +382,7 @@ EAPI Eina_Slice eina_binbuf_slice_get(const Eina_Binbuf *buf) EINA_WARN_UNUSED_R
* *
* @since 1.19 * @since 1.19
*/ */
EAPI Eina_Rw_Slice eina_binbuf_rw_slice_get(const Eina_Binbuf *buf) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1); EINA_API Eina_Rw_Slice eina_binbuf_rw_slice_get(const Eina_Binbuf *buf) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1);
/** /**
* @brief Frees the buffer, returning its old contents. * @brief Frees the buffer, returning its old contents.
@ -393,7 +393,7 @@ EAPI Eina_Rw_Slice eina_binbuf_rw_slice_get(const Eina_Binbuf *buf) EINA_WARN_UN
* *
* @since 1.19 * @since 1.19
*/ */
EAPI unsigned char* eina_binbuf_release(Eina_Binbuf *buf) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1); EINA_API unsigned char* eina_binbuf_release(Eina_Binbuf *buf) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1);
/** /**
* @} * @}

View File

@ -57,7 +57,7 @@ _FUNC_EXPAND(shutdown)(void)
* API * * API *
*============================================================================*/ *============================================================================*/
EAPI _STRBUF_STRUCT_NAME * EINA_API _STRBUF_STRUCT_NAME *
_FUNC_EXPAND(new)(void) _FUNC_EXPAND(new)(void)
{ {
_STRBUF_STRUCT_NAME *buf = eina_strbuf_common_new(_STRBUF_CSIZE); _STRBUF_STRUCT_NAME *buf = eina_strbuf_common_new(_STRBUF_CSIZE);
@ -65,7 +65,7 @@ _FUNC_EXPAND(new)(void)
return buf; return buf;
} }
EAPI _STRBUF_STRUCT_NAME * EINA_API _STRBUF_STRUCT_NAME *
_FUNC_EXPAND(manage_new_length)(_STRBUF_DATA_TYPE *str, size_t length) _FUNC_EXPAND(manage_new_length)(_STRBUF_DATA_TYPE *str, size_t length)
{ {
_STRBUF_STRUCT_NAME *buf = _STRBUF_STRUCT_NAME *buf =
@ -74,7 +74,7 @@ _FUNC_EXPAND(manage_new_length)(_STRBUF_DATA_TYPE *str, size_t length)
return buf; return buf;
} }
EAPI _STRBUF_STRUCT_NAME * EINA_API _STRBUF_STRUCT_NAME *
_FUNC_EXPAND(manage_read_only_new_length)(const _STRBUF_DATA_TYPE *str, size_t length) _FUNC_EXPAND(manage_read_only_new_length)(const _STRBUF_DATA_TYPE *str, size_t length)
{ {
_STRBUF_STRUCT_NAME *buf = _STRBUF_STRUCT_NAME *buf =
@ -83,7 +83,7 @@ _FUNC_EXPAND(manage_read_only_new_length)(const _STRBUF_DATA_TYPE *str, size_t l
return buf; return buf;
} }
EAPI void EINA_API void
_FUNC_EXPAND(free)(_STRBUF_STRUCT_NAME *buf) _FUNC_EXPAND(free)(_STRBUF_STRUCT_NAME *buf)
{ {
if (!buf) return ; if (!buf) return ;
@ -93,14 +93,14 @@ _FUNC_EXPAND(free)(_STRBUF_STRUCT_NAME *buf)
eina_strbuf_common_free(buf); eina_strbuf_common_free(buf);
} }
EAPI void EINA_API void
_FUNC_EXPAND(reset)(_STRBUF_STRUCT_NAME *buf) _FUNC_EXPAND(reset)(_STRBUF_STRUCT_NAME *buf)
{ {
EINA_MAGIC_CHECK_STRBUF(buf); EINA_MAGIC_CHECK_STRBUF(buf);
eina_strbuf_common_reset(_STRBUF_CSIZE, buf); eina_strbuf_common_reset(_STRBUF_CSIZE, buf);
} }
EAPI Eina_Rw_Slice EINA_API Eina_Rw_Slice
_FUNC_EXPAND(expand)(_STRBUF_STRUCT_NAME *buf, size_t minimum_unused_space) _FUNC_EXPAND(expand)(_STRBUF_STRUCT_NAME *buf, size_t minimum_unused_space)
{ {
Eina_Rw_Slice ret = {.len = 0, .mem = NULL}; Eina_Rw_Slice ret = {.len = 0, .mem = NULL};
@ -108,28 +108,28 @@ _FUNC_EXPAND(expand)(_STRBUF_STRUCT_NAME *buf, size_t minimum_unused_space)
return eina_strbuf_common_expand(_STRBUF_CSIZE, buf, minimum_unused_space); return eina_strbuf_common_expand(_STRBUF_CSIZE, buf, minimum_unused_space);
} }
EAPI Eina_Bool EINA_API Eina_Bool
_FUNC_EXPAND(use)(_STRBUF_STRUCT_NAME *buf, size_t extra_bytes) _FUNC_EXPAND(use)(_STRBUF_STRUCT_NAME *buf, size_t extra_bytes)
{ {
EINA_MAGIC_CHECK_STRBUF(buf, EINA_FALSE); EINA_MAGIC_CHECK_STRBUF(buf, EINA_FALSE);
return eina_strbuf_common_use(buf, extra_bytes); return eina_strbuf_common_use(buf, extra_bytes);
} }
EAPI Eina_Bool EINA_API Eina_Bool
_FUNC_EXPAND(append_length)(_STRBUF_STRUCT_NAME *buf, const _STRBUF_DATA_TYPE *str, size_t length) _FUNC_EXPAND(append_length)(_STRBUF_STRUCT_NAME *buf, const _STRBUF_DATA_TYPE *str, size_t length)
{ {
EINA_MAGIC_CHECK_STRBUF(buf, EINA_FALSE); EINA_MAGIC_CHECK_STRBUF(buf, EINA_FALSE);
return eina_strbuf_common_append_length(_STRBUF_CSIZE, buf, (const void *) str, length); return eina_strbuf_common_append_length(_STRBUF_CSIZE, buf, (const void *) str, length);
} }
EAPI Eina_Bool EINA_API Eina_Bool
_FUNC_EXPAND(append_slice)(_STRBUF_STRUCT_NAME *buf, const Eina_Slice slice) _FUNC_EXPAND(append_slice)(_STRBUF_STRUCT_NAME *buf, const Eina_Slice slice)
{ {
EINA_MAGIC_CHECK_STRBUF(buf, EINA_FALSE); EINA_MAGIC_CHECK_STRBUF(buf, EINA_FALSE);
return eina_strbuf_common_append_length(_STRBUF_CSIZE, buf, slice.mem, slice.len); return eina_strbuf_common_append_length(_STRBUF_CSIZE, buf, slice.mem, slice.len);
} }
EAPI Eina_Bool EINA_API Eina_Bool
_FUNC_EXPAND(append_buffer)(_STRBUF_STRUCT_NAME *buf, const _STRBUF_STRUCT_NAME *data) _FUNC_EXPAND(append_buffer)(_STRBUF_STRUCT_NAME *buf, const _STRBUF_STRUCT_NAME *data)
{ {
EINA_MAGIC_CHECK_STRBUF(buf, EINA_FALSE); EINA_MAGIC_CHECK_STRBUF(buf, EINA_FALSE);
@ -138,70 +138,70 @@ _FUNC_EXPAND(append_buffer)(_STRBUF_STRUCT_NAME *buf, const _STRBUF_STRUCT_NAME
return eina_strbuf_common_append_length(_STRBUF_CSIZE, buf, (_STRBUF_DATA_TYPE *) eina_strbuf_common_string_get(data), eina_strbuf_common_length_get(data)); return eina_strbuf_common_append_length(_STRBUF_CSIZE, buf, (_STRBUF_DATA_TYPE *) eina_strbuf_common_string_get(data), eina_strbuf_common_length_get(data));
} }
EAPI Eina_Bool EINA_API Eina_Bool
_FUNC_EXPAND(insert_length)(_STRBUF_STRUCT_NAME *buf, const _STRBUF_DATA_TYPE *str, size_t length, size_t pos) _FUNC_EXPAND(insert_length)(_STRBUF_STRUCT_NAME *buf, const _STRBUF_DATA_TYPE *str, size_t length, size_t pos)
{ {
EINA_MAGIC_CHECK_STRBUF(buf, EINA_FALSE); EINA_MAGIC_CHECK_STRBUF(buf, EINA_FALSE);
return eina_strbuf_common_insert_length(_STRBUF_CSIZE, buf, (const void *) str, length, pos); return eina_strbuf_common_insert_length(_STRBUF_CSIZE, buf, (const void *) str, length, pos);
} }
EAPI Eina_Bool EINA_API Eina_Bool
_FUNC_EXPAND(insert_slice)(_STRBUF_STRUCT_NAME *buf, const Eina_Slice slice, size_t pos) _FUNC_EXPAND(insert_slice)(_STRBUF_STRUCT_NAME *buf, const Eina_Slice slice, size_t pos)
{ {
EINA_MAGIC_CHECK_STRBUF(buf, EINA_FALSE); EINA_MAGIC_CHECK_STRBUF(buf, EINA_FALSE);
return eina_strbuf_common_insert_length(_STRBUF_CSIZE, buf, slice.mem, slice.len, pos); return eina_strbuf_common_insert_length(_STRBUF_CSIZE, buf, slice.mem, slice.len, pos);
} }
EAPI Eina_Bool EINA_API Eina_Bool
_FUNC_EXPAND(append_char)(_STRBUF_STRUCT_NAME *buf, _STRBUF_DATA_TYPE c) _FUNC_EXPAND(append_char)(_STRBUF_STRUCT_NAME *buf, _STRBUF_DATA_TYPE c)
{ {
EINA_MAGIC_CHECK_STRBUF(buf, EINA_FALSE); EINA_MAGIC_CHECK_STRBUF(buf, EINA_FALSE);
return eina_strbuf_common_append_char(_STRBUF_CSIZE, buf, (const void *) &c); return eina_strbuf_common_append_char(_STRBUF_CSIZE, buf, (const void *) &c);
} }
EAPI Eina_Bool EINA_API Eina_Bool
_FUNC_EXPAND(insert_char)(_STRBUF_STRUCT_NAME *buf, _STRBUF_DATA_TYPE c, size_t pos) _FUNC_EXPAND(insert_char)(_STRBUF_STRUCT_NAME *buf, _STRBUF_DATA_TYPE c, size_t pos)
{ {
EINA_MAGIC_CHECK_STRBUF(buf, EINA_FALSE); EINA_MAGIC_CHECK_STRBUF(buf, EINA_FALSE);
return eina_strbuf_common_insert_char(_STRBUF_CSIZE, buf, (const void *) &c, pos); return eina_strbuf_common_insert_char(_STRBUF_CSIZE, buf, (const void *) &c, pos);
} }
EAPI Eina_Bool EINA_API Eina_Bool
_FUNC_EXPAND(remove)(_STRBUF_STRUCT_NAME *buf, size_t start, size_t end) _FUNC_EXPAND(remove)(_STRBUF_STRUCT_NAME *buf, size_t start, size_t end)
{ {
EINA_MAGIC_CHECK_STRBUF(buf, EINA_FALSE); EINA_MAGIC_CHECK_STRBUF(buf, EINA_FALSE);
return eina_strbuf_common_remove(_STRBUF_CSIZE, buf, start, end); return eina_strbuf_common_remove(_STRBUF_CSIZE, buf, start, end);
} }
EAPI const _STRBUF_DATA_TYPE * EINA_API const _STRBUF_DATA_TYPE *
_FUNC_EXPAND(string_get)(const _STRBUF_STRUCT_NAME *buf) _FUNC_EXPAND(string_get)(const _STRBUF_STRUCT_NAME *buf)
{ {
EINA_MAGIC_CHECK_STRBUF(buf, NULL); EINA_MAGIC_CHECK_STRBUF(buf, NULL);
return (const _STRBUF_DATA_TYPE *) eina_strbuf_common_string_get(buf); return (const _STRBUF_DATA_TYPE *) eina_strbuf_common_string_get(buf);
} }
EAPI _STRBUF_DATA_TYPE * EINA_API _STRBUF_DATA_TYPE *
_FUNC_EXPAND(string_steal)(_STRBUF_STRUCT_NAME *buf) _FUNC_EXPAND(string_steal)(_STRBUF_STRUCT_NAME *buf)
{ {
EINA_MAGIC_CHECK_STRBUF(buf, NULL); EINA_MAGIC_CHECK_STRBUF(buf, NULL);
return (_STRBUF_DATA_TYPE *) eina_strbuf_common_string_steal(_STRBUF_CSIZE, buf); return (_STRBUF_DATA_TYPE *) eina_strbuf_common_string_steal(_STRBUF_CSIZE, buf);
} }
EAPI void EINA_API void
_FUNC_EXPAND(string_free)(_STRBUF_STRUCT_NAME *buf) _FUNC_EXPAND(string_free)(_STRBUF_STRUCT_NAME *buf)
{ {
EINA_MAGIC_CHECK_STRBUF(buf); EINA_MAGIC_CHECK_STRBUF(buf);
eina_strbuf_common_string_free(_STRBUF_CSIZE, buf); eina_strbuf_common_string_free(_STRBUF_CSIZE, buf);
} }
EAPI size_t EINA_API size_t
_FUNC_EXPAND(length_get)(const _STRBUF_STRUCT_NAME *buf) _FUNC_EXPAND(length_get)(const _STRBUF_STRUCT_NAME *buf)
{ {
EINA_MAGIC_CHECK_STRBUF(buf, 0); EINA_MAGIC_CHECK_STRBUF(buf, 0);
return eina_strbuf_common_length_get(buf); return eina_strbuf_common_length_get(buf);
} }
EAPI Eina_Slice EINA_API Eina_Slice
_FUNC_EXPAND(slice_get)(const _STRBUF_STRUCT_NAME *buf) _FUNC_EXPAND(slice_get)(const _STRBUF_STRUCT_NAME *buf)
{ {
Eina_Slice ret = {.len = 0, .mem = NULL}; Eina_Slice ret = {.len = 0, .mem = NULL};
@ -209,7 +209,7 @@ _FUNC_EXPAND(slice_get)(const _STRBUF_STRUCT_NAME *buf)
return eina_strbuf_common_slice_get(buf); return eina_strbuf_common_slice_get(buf);
} }
EAPI Eina_Rw_Slice EINA_API Eina_Rw_Slice
_FUNC_EXPAND(rw_slice_get)(const _STRBUF_STRUCT_NAME *buf) _FUNC_EXPAND(rw_slice_get)(const _STRBUF_STRUCT_NAME *buf)
{ {
Eina_Rw_Slice ret = {.len = 0, .mem = NULL}; Eina_Rw_Slice ret = {.len = 0, .mem = NULL};
@ -217,7 +217,7 @@ _FUNC_EXPAND(rw_slice_get)(const _STRBUF_STRUCT_NAME *buf)
return eina_strbuf_common_rw_slice_get(buf); return eina_strbuf_common_rw_slice_get(buf);
} }
EAPI _STRBUF_DATA_TYPE* EINA_API _STRBUF_DATA_TYPE*
_FUNC_EXPAND(release)(_STRBUF_STRUCT_NAME *buf) _FUNC_EXPAND(release)(_STRBUF_STRUCT_NAME *buf)
{ {
_STRBUF_DATA_TYPE *result; _STRBUF_DATA_TYPE *result;

View File

@ -83,7 +83,7 @@ static const char EINA_MAGIC_BINSHARE_NODE_STR[] = "Eina Binshare Node";
* *
* @see eina_init() * @see eina_init()
*/ */
EAPI Eina_Bool EINA_API Eina_Bool
eina_binshare_init(void) eina_binshare_init(void)
{ {
Eina_Bool ret; Eina_Bool ret;
@ -124,7 +124,7 @@ eina_binshare_init(void)
* *
* @see eina_shutdown() * @see eina_shutdown()
*/ */
EAPI Eina_Bool EINA_API Eina_Bool
eina_binshare_shutdown(void) eina_binshare_shutdown(void)
{ {
Eina_Bool ret; Eina_Bool ret;
@ -144,7 +144,7 @@ eina_binshare_shutdown(void)
* API * * API *
*============================================================================*/ *============================================================================*/
EAPI void EINA_API void
eina_binshare_del(const void *obj) eina_binshare_del(const void *obj)
{ {
if (!obj) if (!obj)
@ -154,7 +154,7 @@ eina_binshare_del(const void *obj)
CRI("EEEK trying to del non-shared binshare %p", obj); CRI("EEEK trying to del non-shared binshare %p", obj);
} }
EAPI const void * EINA_API const void *
eina_binshare_add_length(const void *obj, unsigned int olen) eina_binshare_add_length(const void *obj, unsigned int olen)
{ {
return eina_share_common_add_length(binshare_share, return eina_share_common_add_length(binshare_share,
@ -163,19 +163,19 @@ eina_binshare_add_length(const void *obj, unsigned int olen)
0); 0);
} }
EAPI const void * EINA_API const void *
eina_binshare_ref(const void *obj) eina_binshare_ref(const void *obj)
{ {
return eina_share_common_ref(binshare_share, obj); return eina_share_common_ref(binshare_share, obj);
} }
EAPI int EINA_API int
eina_binshare_length(const void *obj) eina_binshare_length(const void *obj)
{ {
return eina_share_common_length(binshare_share, obj); return eina_share_common_length(binshare_share, obj);
} }
EAPI void EINA_API void
eina_binshare_dump(void) eina_binshare_dump(void)
{ {
eina_share_common_dump(binshare_share, NULL, 0); eina_share_common_dump(binshare_share, NULL, 0);

View File

@ -93,7 +93,7 @@
* *
* @see eina_binshare_add() * @see eina_binshare_add()
*/ */
EAPI const void *eina_binshare_add_length(const void *obj, EINA_API const void *eina_binshare_add_length(const void *obj,
unsigned int olen) EINA_WARN_UNUSED_RESULT; unsigned int olen) EINA_WARN_UNUSED_RESULT;
/** /**
@ -110,7 +110,7 @@ EAPI const void *eina_binshare_add_length(const void *obj,
* *
* @note There is no unref since this is the work of eina_binshare_del(). * @note There is no unref since this is the work of eina_binshare_del().
*/ */
EAPI const void *eina_binshare_ref(const void *obj); EINA_API const void *eina_binshare_ref(const void *obj);
/** /**
* @brief Notes that the given object has lost an instance. * @brief Notes that the given object has lost an instance.
@ -125,7 +125,7 @@ EAPI const void *eina_binshare_ref(const void *obj);
* @warning If the given pointer is not shared, bad things happen, mostly a * @warning If the given pointer is not shared, bad things happen, mostly a
* segmentation fault. * segmentation fault.
*/ */
EAPI void eina_binshare_del(const void *obj); EINA_API void eina_binshare_del(const void *obj);
/** /**
* @brief Notes that the given object @b must be shared. * @brief Notes that the given object @b must be shared.
@ -138,7 +138,7 @@ EAPI void eina_binshare_del(const void *obj);
* @warning If the given pointer is not shared, bad things happen, mostly a * @warning If the given pointer is not shared, bad things happen, mostly a
* segmentation fault. If in doubt, try strlen(). * segmentation fault. If in doubt, try strlen().
*/ */
EAPI int eina_binshare_length(const void *obj) EINA_WARN_UNUSED_RESULT EINA_PURE; EINA_API int eina_binshare_length(const void *obj) EINA_WARN_UNUSED_RESULT EINA_PURE;
/** /**
* @brief Dumps the contents of share_common. * @brief Dumps the contents of share_common.
@ -146,7 +146,7 @@ EAPI int eina_binshare_length(const void *obj) EINA_WARN_UNUSED_RESULT E
* @details This function dumps all the objects from share_common to stdout with a * @details This function dumps all the objects from share_common to stdout with a
* DDD: prefix per line and a memory usage summary. * DDD: prefix per line and a memory usage summary.
*/ */
EAPI void eina_binshare_dump(void); EINA_API void eina_binshare_dump(void);
/** /**
* @brief Retrieves an instance of a blob for use in a program. * @brief Retrieves an instance of a blob for use in a program.

View File

@ -90,9 +90,9 @@ static inline void reverse(char s[], int length)
* @cond LOCAL * @cond LOCAL
*/ */
EAPI Eina_Error EINA_ERROR_CONVERT_P_NOT_FOUND = 0; EINA_API Eina_Error EINA_ERROR_CONVERT_P_NOT_FOUND = 0;
EAPI Eina_Error EINA_ERROR_CONVERT_0X_NOT_FOUND = 0; EINA_API Eina_Error EINA_ERROR_CONVERT_0X_NOT_FOUND = 0;
EAPI Eina_Error EINA_ERROR_CONVERT_OUTRUN_STRING_LENGTH = 0; EINA_API Eina_Error EINA_ERROR_CONVERT_OUTRUN_STRING_LENGTH = 0;
/** /**
* @endcond * @endcond
@ -149,7 +149,7 @@ eina_convert_shutdown(void)
* Come from the second edition of The C Programming Language ("K&R2") on page 64 * Come from the second edition of The C Programming Language ("K&R2") on page 64
*/ */
EAPI int EINA_API int
eina_convert_itoa(int n, char *s) eina_convert_itoa(int n, char *s)
{ {
int i = 0; int i = 0;
@ -174,7 +174,7 @@ eina_convert_itoa(int n, char *s)
return i + r; return i + r;
} }
EAPI int EINA_API int
eina_convert_xtoa(unsigned int n, char *s) eina_convert_xtoa(unsigned int n, char *s)
{ {
int i; int i;
@ -193,7 +193,7 @@ eina_convert_xtoa(unsigned int n, char *s)
return i; return i;
} }
EAPI Eina_Bool EINA_API Eina_Bool
eina_convert_atod(const char *src, int length, long long *m, long *e) eina_convert_atod(const char *src, int length, long long *m, long *e)
{ {
const char *str = src; const char *str = src;
@ -285,7 +285,7 @@ on_length_error:
return EINA_FALSE; return EINA_FALSE;
} }
EAPI int EINA_API int
eina_convert_dtoa(double d, char *des) eina_convert_dtoa(double d, char *des)
{ {
int length = 0; int length = 0;
@ -349,7 +349,7 @@ eina_convert_dtoa(double d, char *des)
return length + eina_convert_itoa(p, des); return length + eina_convert_itoa(p, des);
} }
EAPI int EINA_API int
eina_convert_fptoa(Eina_F32p32 fp, char *des) eina_convert_fptoa(Eina_F32p32 fp, char *des)
{ {
int length = 0; int length = 0;
@ -433,7 +433,7 @@ eina_convert_fptoa(Eina_F32p32 fp, char *des)
return length + eina_convert_itoa(p, des); return length + eina_convert_itoa(p, des);
} }
EAPI Eina_Bool EINA_API Eina_Bool
eina_convert_atofp(const char *src, int length, Eina_F32p32 *fp) eina_convert_atofp(const char *src, int length, Eina_F32p32 *fp)
{ {
long long m; long long m;
@ -467,7 +467,7 @@ eina_convert_atofp(const char *src, int length, Eina_F32p32 *fp)
* No hexadecimal form supported * No hexadecimal form supported
* no sequence supported after NAN * no sequence supported after NAN
*/ */
EAPI double EINA_API double
eina_convert_strtod_c(const char *nptr, char **endptr) eina_convert_strtod_c(const char *nptr, char **endptr)
{ {
const char *iter; const char *iter;

View File

@ -158,9 +158,9 @@
* @{ * @{
*/ */
EAPI extern Eina_Error EINA_ERROR_CONVERT_P_NOT_FOUND; /**< Not used, perhaps a placeholder? Defined as 0 in eina_convert.c*/ EINA_API extern Eina_Error EINA_ERROR_CONVERT_P_NOT_FOUND; /**< Not used, perhaps a placeholder? Defined as 0 in eina_convert.c*/
EAPI extern Eina_Error EINA_ERROR_CONVERT_0X_NOT_FOUND; /**< Not used, perhaps a placeholder? Defined as 0 in eina_convert.c*/ EINA_API extern Eina_Error EINA_ERROR_CONVERT_0X_NOT_FOUND; /**< Not used, perhaps a placeholder? Defined as 0 in eina_convert.c*/
EAPI extern Eina_Error EINA_ERROR_CONVERT_OUTRUN_STRING_LENGTH; /**< Not used, perhaps a placeholder? Defined as 0 in eina_convert.c*/ EINA_API extern Eina_Error EINA_ERROR_CONVERT_OUTRUN_STRING_LENGTH; /**< Not used, perhaps a placeholder? Defined as 0 in eina_convert.c*/
/** /**
* @brief Converts an integer number to a string in decimal base. * @brief Converts an integer number to a string in decimal base.
@ -177,7 +177,7 @@ EAPI extern Eina_Error EINA_ERROR_CONVERT_OUTRUN_STRING_LENGTH; /**< Not used, p
* The returned value is the length of the string, including the null * The returned value is the length of the string, including the null
* terminated character. * terminated character.
*/ */
EAPI int eina_convert_itoa(int n, char *s) EINA_ARG_NONNULL(2); EINA_API int eina_convert_itoa(int n, char *s) EINA_ARG_NONNULL(2);
/** /**
* @brief Converts an integer number to a string in hexadecimal base. * @brief Converts an integer number to a string in hexadecimal base.
@ -195,7 +195,7 @@ EAPI int eina_convert_itoa(int n, char *s) EINA_ARG_NONNULL(2);
* The returned value is the length of the string, including the nul * The returned value is the length of the string, including the nul
* terminated character. * terminated character.
*/ */
EAPI int eina_convert_xtoa(unsigned int n, char *s) EINA_ARG_NONNULL(2); EINA_API int eina_convert_xtoa(unsigned int n, char *s) EINA_ARG_NONNULL(2);
/** /**
@ -220,7 +220,7 @@ EAPI int eina_convert_xtoa(unsigned int n, char *s) EINA_ARG_NONNULL(2);
* The returned value is the length of the string, including the null * The returned value is the length of the string, including the null
* character. * character.
*/ */
EAPI int eina_convert_dtoa(double d, char *des) EINA_ARG_NONNULL(2); EINA_API int eina_convert_dtoa(double d, char *des) EINA_ARG_NONNULL(2);
/** /**
* @brief Converts a string to a double. * @brief Converts a string to a double.
@ -257,7 +257,7 @@ EAPI int eina_convert_dtoa(double d, char *des) EINA_ARG_NONNULL(2);
* If the string is invalid #EINA_FALSE is returned, otherwise #EINA_TRUE is * If the string is invalid #EINA_FALSE is returned, otherwise #EINA_TRUE is
* returned. * returned.
*/ */
EAPI Eina_Bool eina_convert_atod(const char *src, EINA_API Eina_Bool eina_convert_atod(const char *src,
int length, int length,
long long *m, long long *m,
long *e) EINA_ARG_NONNULL(1, 3, 4); long *e) EINA_ARG_NONNULL(1, 3, 4);
@ -289,7 +289,7 @@ EAPI Eina_Bool eina_convert_atod(const char *src,
* implements the frexp() function for fixed point numbers and does * implements the frexp() function for fixed point numbers and does
* some optimization. * some optimization.
*/ */
EAPI int eina_convert_fptoa(Eina_F32p32 fp, EINA_API int eina_convert_fptoa(Eina_F32p32 fp,
char *des) EINA_ARG_NONNULL(2); char *des) EINA_ARG_NONNULL(2);
/** /**
@ -329,7 +329,7 @@ EAPI int eina_convert_fptoa(Eina_F32p32 fp,
* @note The code uses eina_convert_atod() and do the correct bit * @note The code uses eina_convert_atod() and do the correct bit
* shift to compute the fixed point number. * shift to compute the fixed point number.
*/ */
EAPI Eina_Bool eina_convert_atofp(const char *src, EINA_API Eina_Bool eina_convert_atofp(const char *src,
int length, int length,
Eina_F32p32 *fp) EINA_ARG_NONNULL(1, 3); Eina_F32p32 *fp) EINA_ARG_NONNULL(1, 3);
@ -347,7 +347,7 @@ EAPI Eina_Bool eina_convert_atofp(const char *src,
* without locale-dependency, this function can replace strtod. * without locale-dependency, this function can replace strtod.
* For more information, please refer documents of strtod, strtod_l. * For more information, please refer documents of strtod, strtod_l.
*/ */
EAPI double eina_convert_strtod_c(const char *nptr, char **endptr); EINA_API double eina_convert_strtod_c(const char *nptr, char **endptr);
/** /**
* @} * @}

View File

@ -113,7 +113,7 @@ _eina_counter_asiprintf(char *base, int *position, const char *format, ...)
* API * * API *
*============================================================================*/ *============================================================================*/
EAPI Eina_Counter * EINA_API Eina_Counter *
eina_counter_new(const char *name) eina_counter_new(const char *name)
{ {
Eina_Counter *counter; Eina_Counter *counter;
@ -131,7 +131,7 @@ eina_counter_new(const char *name)
return counter; return counter;
} }
EAPI void EINA_API void
eina_counter_free(Eina_Counter *counter) eina_counter_free(Eina_Counter *counter)
{ {
EINA_SAFETY_ON_NULL_RETURN(counter); EINA_SAFETY_ON_NULL_RETURN(counter);
@ -147,7 +147,7 @@ eina_counter_free(Eina_Counter *counter)
free(counter); free(counter);
} }
EAPI void EINA_API void
eina_counter_start(Eina_Counter *counter) eina_counter_start(Eina_Counter *counter)
{ {
Eina_Clock *clk; Eina_Clock *clk;
@ -165,7 +165,7 @@ eina_counter_start(Eina_Counter *counter)
clk->start = tp; clk->start = tp;
} }
EAPI void EINA_API void
eina_counter_stop(Eina_Counter *counter, int specimen) eina_counter_stop(Eina_Counter *counter, int specimen)
{ {
Eina_Clock *clk; Eina_Clock *clk;
@ -185,7 +185,7 @@ eina_counter_stop(Eina_Counter *counter, int specimen)
clk->valid = EINA_TRUE; clk->valid = EINA_TRUE;
} }
EAPI char * EINA_API char *
eina_counter_dump(Eina_Counter *counter) eina_counter_dump(Eina_Counter *counter)
{ {
Eina_Clock *clk; Eina_Clock *clk;

View File

@ -124,7 +124,7 @@ typedef struct _Eina_Counter Eina_Counter;
* @note When the new counter is not needed anymore, use eina_counter_free() to * @note When the new counter is not needed anymore, use eina_counter_free() to
* free the allocated memory. * free the allocated memory.
*/ */
EAPI Eina_Counter *eina_counter_new(const char *name) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1); EINA_API Eina_Counter *eina_counter_new(const char *name) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1);
/** /**
* @brief Deletes a counter. * @brief Deletes a counter.
@ -135,7 +135,7 @@ EAPI Eina_Counter *eina_counter_new(const char *name) EINA_WARN_UNUSED_RESULT EI
* @param[in] counter The counter to delete * @param[in] counter The counter to delete
* *
*/ */
EAPI void eina_counter_free(Eina_Counter *counter) EINA_ARG_NONNULL(1); EINA_API void eina_counter_free(Eina_Counter *counter) EINA_ARG_NONNULL(1);
/** /**
* @brief Starts the time count. * @brief Starts the time count.
@ -152,7 +152,7 @@ EAPI void eina_counter_free(Eina_Counter *counter) EINA_ARG_NONNULL(1);
* @note To stop the timing, eina_counter_stop() must be called with the * @note To stop the timing, eina_counter_stop() must be called with the
* same counter. * same counter.
*/ */
EAPI void eina_counter_start(Eina_Counter *counter) EINA_ARG_NONNULL(1); EINA_API void eina_counter_start(Eina_Counter *counter) EINA_ARG_NONNULL(1);
/** /**
* @brief Stops the time count. * @brief Stops the time count.
@ -165,7 +165,7 @@ EAPI void eina_counter_start(Eina_Counter *counter) EINA_ARG_NONNULL(1)
* @param[in] specimen The number of the test * @param[in] specimen The number of the test
* *
*/ */
EAPI void eina_counter_stop(Eina_Counter *counter, EINA_API void eina_counter_stop(Eina_Counter *counter,
int specimen) EINA_ARG_NONNULL(1); int specimen) EINA_ARG_NONNULL(1);
/** /**
@ -185,7 +185,7 @@ EAPI void eina_counter_stop(Eina_Counter *counter,
* *
* @note The unit of time is nanoseconds. * @note The unit of time is nanoseconds.
*/ */
EAPI char *eina_counter_dump(Eina_Counter *counter) EINA_ARG_NONNULL(1); EINA_API char *eina_counter_dump(Eina_Counter *counter) EINA_ARG_NONNULL(1);
/** /**
* @} * @}

View File

@ -326,7 +326,7 @@ eina_cow_shutdown(void)
return EINA_TRUE; return EINA_TRUE;
} }
EAPI Eina_Cow * EINA_API Eina_Cow *
eina_cow_add(const char *name, unsigned int struct_size, unsigned int step, const void *default_value, Eina_Bool gc) eina_cow_add(const char *name, unsigned int struct_size, unsigned int step, const void *default_value, Eina_Bool gc)
{ {
const char *choice, *tmp; const char *choice, *tmp;
@ -390,7 +390,7 @@ eina_cow_add(const char *name, unsigned int struct_size, unsigned int step, cons
return NULL; return NULL;
} }
EAPI void EINA_API void
eina_cow_del(Eina_Cow *cow) eina_cow_del(Eina_Cow *cow)
{ {
if (!cow) return; if (!cow) return;
@ -405,7 +405,7 @@ eina_cow_del(Eina_Cow *cow)
free(cow); free(cow);
} }
EAPI const Eina_Cow_Data * EINA_API const Eina_Cow_Data *
eina_cow_alloc(Eina_Cow *cow) eina_cow_alloc(Eina_Cow *cow)
{ {
#ifdef EINA_COW_MAGIC_ON #ifdef EINA_COW_MAGIC_ON
@ -415,7 +415,7 @@ eina_cow_alloc(Eina_Cow *cow)
return cow->default_value; return cow->default_value;
} }
EAPI void EINA_API void
eina_cow_free(Eina_Cow *cow, const Eina_Cow_Data **data) eina_cow_free(Eina_Cow *cow, const Eina_Cow_Data **data)
{ {
Eina_Cow_Ptr *ref; Eina_Cow_Ptr *ref;
@ -451,7 +451,7 @@ eina_cow_free(Eina_Cow *cow, const Eina_Cow_Data **data)
eina_mempool_free(cow->pool, (void*) ref); eina_mempool_free(cow->pool, (void*) ref);
} }
EAPI void * EINA_API void *
eina_cow_write(Eina_Cow *cow, eina_cow_write(Eina_Cow *cow,
const Eina_Cow_Data * const *data) const Eina_Cow_Data * const *data)
{ {
@ -535,7 +535,7 @@ eina_cow_write(Eina_Cow *cow,
return (void *) *data; return (void *) *data;
} }
EAPI void EINA_API void
eina_cow_done(Eina_Cow *cow, eina_cow_done(Eina_Cow *cow,
const Eina_Cow_Data * const * dst, const Eina_Cow_Data * const * dst,
const void *data, const void *data,
@ -569,7 +569,7 @@ eina_cow_done(Eina_Cow *cow,
_eina_cow_togc_add(cow, ref, (const Eina_Cow_Data **) dst); _eina_cow_togc_add(cow, ref, (const Eina_Cow_Data **) dst);
} }
EAPI void EINA_API void
eina_cow_memcpy(Eina_Cow *cow, eina_cow_memcpy(Eina_Cow *cow,
const Eina_Cow_Data * const *dst, const Eina_Cow_Data * const *dst,
const Eina_Cow_Data *src) const Eina_Cow_Data *src)
@ -603,7 +603,7 @@ eina_cow_memcpy(Eina_Cow *cow,
*((const void**)dst) = src; *((const void**)dst) = src;
} }
EAPI Eina_Bool EINA_API Eina_Bool
eina_cow_gc(Eina_Cow *cow) eina_cow_gc(Eina_Cow *cow)
{ {
Eina_Cow_GC *gc; Eina_Cow_GC *gc;

View File

@ -61,14 +61,14 @@ typedef void Eina_Cow_Data;
* @param[in] gc Is it possible to run garbage collection on this pool. * @param[in] gc Is it possible to run garbage collection on this pool.
* @return A valid new Eina_Cow, or @c NULL on error. * @return A valid new Eina_Cow, or @c NULL on error.
*/ */
EAPI Eina_Cow *eina_cow_add(const char *name, unsigned int struct_size, unsigned int step, const void *default_value, Eina_Bool gc) EINA_WARN_UNUSED_RESULT; EINA_API Eina_Cow *eina_cow_add(const char *name, unsigned int struct_size, unsigned int step, const void *default_value, Eina_Bool gc) EINA_WARN_UNUSED_RESULT;
/** /**
* @brief Destroys an Eina_Cow pool and all the allocated memory. * @brief Destroys an Eina_Cow pool and all the allocated memory.
* *
* @param[in] cow The pool to destroy * @param[in] cow The pool to destroy
*/ */
EAPI void eina_cow_del(Eina_Cow *cow); EINA_API void eina_cow_del(Eina_Cow *cow);
/** /**
* @brief Returns an initialized pointer from the pool. * @brief Returns an initialized pointer from the pool.
@ -76,7 +76,7 @@ EAPI void eina_cow_del(Eina_Cow *cow);
* @param[in] cow The pool to take things from. * @param[in] cow The pool to take things from.
* @return A pointer to the new pool instance * @return A pointer to the new pool instance
*/ */
EAPI const Eina_Cow_Data *eina_cow_alloc(Eina_Cow *cow) EINA_WARN_UNUSED_RESULT; EINA_API const Eina_Cow_Data *eina_cow_alloc(Eina_Cow *cow) EINA_WARN_UNUSED_RESULT;
/** /**
* @brief Frees a pointer from the pool. * @brief Frees a pointer from the pool.
@ -87,7 +87,7 @@ EAPI const Eina_Cow_Data *eina_cow_alloc(Eina_Cow *cow) EINA_WARN_UNUSED_RESULT;
* @note To simplify the caller code *data will point to the default * @note To simplify the caller code *data will point to the default
* read only state after the call to this function. * read only state after the call to this function.
*/ */
EAPI void eina_cow_free(Eina_Cow *cow, const Eina_Cow_Data **data); EINA_API void eina_cow_free(Eina_Cow *cow, const Eina_Cow_Data **data);
/** /**
* @brief Gets a writeable pointer from a const pointer. * @brief Gets a writeable pointer from a const pointer.
@ -97,7 +97,7 @@ EAPI void eina_cow_free(Eina_Cow *cow, const Eina_Cow_Data **data);
* *
* @note This function is not thread safe. * @note This function is not thread safe.
*/ */
EAPI void *eina_cow_write(Eina_Cow *cow, EINA_API void *eina_cow_write(Eina_Cow *cow,
const Eina_Cow_Data * const *src) EINA_WARN_UNUSED_RESULT; const Eina_Cow_Data * const *src) EINA_WARN_UNUSED_RESULT;
/** /**
@ -110,7 +110,7 @@ EAPI void *eina_cow_write(Eina_Cow *cow,
* *
* @note This function is not thread safe. * @note This function is not thread safe.
*/ */
EAPI void eina_cow_done(Eina_Cow *cow, EINA_API void eina_cow_done(Eina_Cow *cow,
const Eina_Cow_Data * const *dst, const Eina_Cow_Data * const *dst,
const void *data, const void *data,
Eina_Bool needed_gc); Eina_Bool needed_gc);
@ -121,7 +121,7 @@ EAPI void eina_cow_done(Eina_Cow *cow,
* @param[in] dst The destination to update. * @param[in] dst The destination to update.
* @param[in] src The source of information to copy. * @param[in] src The source of information to copy.
*/ */
EAPI void eina_cow_memcpy(Eina_Cow *cow, EINA_API void eina_cow_memcpy(Eina_Cow *cow,
const Eina_Cow_Data * const *dst, const Eina_Cow_Data * const *dst,
const Eina_Cow_Data *src); const Eina_Cow_Data *src);
@ -135,7 +135,7 @@ EAPI void eina_cow_memcpy(Eina_Cow *cow,
* It does run a hash function on all possible common structures trying to * It does run a hash function on all possible common structures trying to
* find the one that matches and merge them into one pointer. * find the one that matches and merge them into one pointer.
*/ */
EAPI Eina_Bool eina_cow_gc(Eina_Cow *cow); EINA_API Eina_Bool eina_cow_gc(Eina_Cow *cow);
/** /**
* @def EINA_COW_WRITE_BEGIN * @def EINA_COW_WRITE_BEGIN

View File

@ -22,20 +22,21 @@
#ifdef EFL_HAVE_THREADS #ifdef EFL_HAVE_THREADS
# ifdef _WIN32 # ifdef _WIN32
# define WIN32_LEAN_AND_MEAN # include <evil_windows.h>
# include <windows.h>
# elif defined (__sun) || defined(__GNU__) || defined(__CYGWIN__) # elif defined (__sun) || defined(__GNU__) || defined(__CYGWIN__)
# include <unistd.h> # include <unistd.h>
# include <pthread.h>
# elif defined (__FreeBSD__) || defined (__OpenBSD__) || \ # elif defined (__FreeBSD__) || defined (__OpenBSD__) || \
defined (__NetBSD__) || defined (__DragonFly__) || defined (__MacOSX__) || \ defined (__NetBSD__) || defined (__DragonFly__) || defined (__MacOSX__) || \
(defined (__MACH__) && defined (__APPLE__)) (defined (__MACH__) && defined (__APPLE__))
# include <unistd.h> # include <unistd.h>
# include <sys/param.h> # include <sys/param.h>
# include <sys/sysctl.h> # include <sys/sysctl.h>
# include <pthread.h>
# elif defined (__linux__) || defined(__GLIBC__) # elif defined (__linux__) || defined(__GLIBC__)
# include <sched.h> # include <sched.h>
# include <pthread.h>
# endif # endif
# include <pthread.h>
# define TH_MAX 32 # define TH_MAX 32
#endif #endif
@ -165,7 +166,7 @@ _ppc_cpu_features(Eina_Cpu_Features *features)
/* FIXME the features checks should be called when this function is called? /* FIXME the features checks should be called when this function is called?
* or make it static by doing eina_cpu_init() and return a local var * or make it static by doing eina_cpu_init() and return a local var
*/ */
EAPI Eina_Cpu_Features eina_cpu_features = 0; EINA_API Eina_Cpu_Features eina_cpu_features = 0;
Eina_Bool Eina_Bool
eina_cpu_init(void) eina_cpu_init(void)
@ -192,7 +193,7 @@ eina_cpu_shutdown(void)
* *
* @return * @return
*/ */
EAPI Eina_Cpu_Features eina_cpu_features_get(void) EINA_API Eina_Cpu_Features eina_cpu_features_get(void)
{ {
return eina_cpu_features; return eina_cpu_features;
} }
@ -302,13 +303,13 @@ _eina_page_size(void)
} }
} }
EAPI int eina_cpu_page_size(void) EINA_API int eina_cpu_page_size(void)
{ {
if (_page_size == 0) _eina_page_size(); if (_page_size == 0) _eina_page_size();
return _page_size; return _page_size;
} }
EAPI int eina_cpu_count(void) EINA_API int eina_cpu_count(void)
{ {
return _cpu_count; return _cpu_count;
} }

View File

@ -64,14 +64,14 @@ typedef enum _Eina_Cpu_Features
* *
* @return the current cpu features * @return the current cpu features
*/ */
EAPI extern Eina_Cpu_Features eina_cpu_features; EINA_API extern Eina_Cpu_Features eina_cpu_features;
/** /**
* @brief Cpu features accessor. * @brief Cpu features accessor.
* *
* @return the current cpu features * @return the current cpu features
*/ */
EAPI Eina_Cpu_Features eina_cpu_features_get(void); EINA_API Eina_Cpu_Features eina_cpu_features_get(void);
/** /**
* @brief Gets the current number of processors. * @brief Gets the current number of processors.
@ -79,7 +79,7 @@ EAPI Eina_Cpu_Features eina_cpu_features_get(void);
* @return The number of processors that are online, that * @return The number of processors that are online, that
* is available when the function is called. * is available when the function is called.
*/ */
EAPI int eina_cpu_count(void); EINA_API int eina_cpu_count(void);
/** /**
* @brief Gets the current virtual page size. * @brief Gets the current virtual page size.
@ -88,7 +88,7 @@ EAPI int eina_cpu_count(void);
* allocation performed by the operating system on behalf of the program, and * allocation performed by the operating system on behalf of the program, and
* for transfers between the main memory and any other auxiliary store. * for transfers between the main memory and any other auxiliary store.
*/ */
EAPI int eina_cpu_page_size(void); EINA_API int eina_cpu_page_size(void);
/** /**
* @brief Reverses the byte order of a 16-bit (destination) register. * @brief Reverses the byte order of a 16-bit (destination) register.

View File

@ -287,7 +287,7 @@ static const unsigned int table[8][256] =
} }
}; };
EAPI unsigned int EINA_API unsigned int
_eina_crc(const char *data, int len, unsigned int seed, Eina_Bool start_stream) _eina_crc(const char *data, int len, unsigned int seed, Eina_Bool start_stream)
{ {
unsigned int crc; unsigned int crc;

View File

@ -35,7 +35,6 @@
#include <sys/time.h> #include <sys/time.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <pthread.h>
#include <signal.h> #include <signal.h>
#include <time.h> #include <time.h>
#include <sys/types.h> #include <sys/types.h>
@ -55,8 +54,8 @@
#include <fcntl.h> #include <fcntl.h>
#ifdef _WIN32 #ifdef _WIN32
# include <evil_windows.h> /* fcntl */
# include <ws2tcpip.h> # include <ws2tcpip.h>
# include <evil_private.h> /* fcntl */
#endif #endif
#include "eina_alloca.h" #include "eina_alloca.h"
@ -72,7 +71,7 @@
#include "eina_debug_private.h" #include "eina_debug_private.h"
#include "eina_vpath.h" #include "eina_vpath.h"
#include "eina_internal.h" #include "eina_internal.h"
#include "eina_thread.h"
#ifdef EINA_HAVE_PTHREAD_SETNAME #ifdef EINA_HAVE_PTHREAD_SETNAME
# ifndef __linux__ # ifndef __linux__
# include <pthread_np.h> # include <pthread_np.h>
@ -137,12 +136,10 @@ struct _Eina_Debug_Session
Eina_Bool deleted : 1; /* set if session is dead */ Eina_Bool deleted : 1; /* set if session is dead */
}; };
#ifndef _WIN32
static void _opcodes_register_all(Eina_Debug_Session *session); static void _opcodes_register_all(Eina_Debug_Session *session);
#endif
static void _thread_start(Eina_Debug_Session *session); static void _thread_start(Eina_Debug_Session *session);
EAPI int EINA_API int
eina_debug_session_send(Eina_Debug_Session *session, int dest, int op, void *data, int size) eina_debug_session_send(Eina_Debug_Session *session, int dest, int op, void *data, int size)
{ {
Eina_Debug_Packet_Header hdr; Eina_Debug_Packet_Header hdr;
@ -177,7 +174,6 @@ err:
#endif #endif
} }
#ifndef _WIN32
static void static void
_daemon_greet(Eina_Debug_Session *session) _daemon_greet(Eina_Debug_Session *session)
{ {
@ -191,6 +187,7 @@ _daemon_greet(Eina_Debug_Session *session)
#endif #endif
int size = 8 + (app_name ? strlen(app_name) : 0) + 1; int size = 8 + (app_name ? strlen(app_name) : 0) + 1;
unsigned char *buf = alloca(size); unsigned char *buf = alloca(size);
int version = SWAP_32(1); // version of protocol we speak int version = SWAP_32(1); // version of protocol we speak
int pid = getpid(); int pid = getpid();
pid = SWAP_32(pid); pid = SWAP_32(pid);
@ -260,15 +257,14 @@ end:
if (rret <= 0 && packet_buf) free(packet_buf); if (rret <= 0 && packet_buf) free(packet_buf);
return rret; return rret;
} }
#endif
EAPI void EINA_API void
eina_debug_disable() eina_debug_disable()
{ {
_debug_disabled = EINA_TRUE; _debug_disabled = EINA_TRUE;
} }
EAPI void EINA_API void
eina_debug_session_terminate(Eina_Debug_Session *session) eina_debug_session_terminate(Eina_Debug_Session *session)
{ {
/* Close fd here so the thread terminates its own session by itself */ /* Close fd here so the thread terminates its own session by itself */
@ -287,7 +283,7 @@ eina_debug_session_terminate(Eina_Debug_Session *session)
} }
} }
EAPI void EINA_API void
eina_debug_session_dispatch_override(Eina_Debug_Session *session, Eina_Debug_Dispatch_Cb disp_cb) eina_debug_session_dispatch_override(Eina_Debug_Session *session, Eina_Debug_Dispatch_Cb disp_cb)
{ {
if (!session) return; if (!session) return;
@ -295,14 +291,13 @@ eina_debug_session_dispatch_override(Eina_Debug_Session *session, Eina_Debug_Dis
session->dispatch_cb = disp_cb; session->dispatch_cb = disp_cb;
} }
EAPI Eina_Debug_Dispatch_Cb EINA_API Eina_Debug_Dispatch_Cb
eina_debug_session_dispatch_get(Eina_Debug_Session *session) eina_debug_session_dispatch_get(Eina_Debug_Session *session)
{ {
if (session) return session->dispatch_cb; if (session) return session->dispatch_cb;
else return NULL; else return NULL;
} }
#ifndef _WIN32
static void static void
_static_opcode_register(Eina_Debug_Session *session, _static_opcode_register(Eina_Debug_Session *session,
int op_id, Eina_Debug_Cb cb) int op_id, Eina_Debug_Cb cb)
@ -360,7 +355,6 @@ _callbacks_register_cb(Eina_Debug_Session *session, int src_id EINA_UNUSED, void
return EINA_FALSE; return EINA_FALSE;
} }
#endif
static void static void
_opcodes_registration_send(Eina_Debug_Session *session, _opcodes_registration_send(Eina_Debug_Session *session,
@ -405,7 +399,6 @@ _opcodes_registration_send(Eina_Debug_Session *session,
free(buf); free(buf);
} }
#ifndef _WIN32
static void static void
_opcodes_register_all(Eina_Debug_Session *session) _opcodes_register_all(Eina_Debug_Session *session)
{ {
@ -446,7 +439,6 @@ _opcodes_unregister_all(Eina_Debug_Session *session)
#define LENGTH_OF_SOCKADDR_UN(s) \ #define LENGTH_OF_SOCKADDR_UN(s) \
(strlen((s)->sun_path) + (size_t)(((struct sockaddr_un *)NULL)->sun_path)) (strlen((s)->sun_path) + (size_t)(((struct sockaddr_un *)NULL)->sun_path))
#endif
static Eina_Debug_Session * static Eina_Debug_Session *
_session_create(int fd) _session_create(int fd)
@ -462,7 +454,7 @@ _session_create(int fd)
return session; return session;
} }
EAPI Eina_Debug_Session * EINA_API Eina_Debug_Session *
eina_debug_remote_connect(int port) eina_debug_remote_connect(int port)
{ {
int fd; int fd;
@ -492,7 +484,7 @@ err:
return NULL; return NULL;
} }
EAPI Eina_Debug_Session * EINA_API Eina_Debug_Session *
eina_debug_local_connect(Eina_Bool is_master) eina_debug_local_connect(Eina_Bool is_master)
{ {
#ifndef _WIN32 #ifndef _WIN32
@ -545,7 +537,6 @@ err:
// way. this is an alternative to using external debuggers so we can get // way. this is an alternative to using external debuggers so we can get
// users or developers to get useful information about an app at all times // users or developers to get useful information about an app at all times
#ifndef _WIN32
static void * static void *
_monitor(void *_data) _monitor(void *_data)
{ {
@ -555,15 +546,10 @@ _monitor(void *_data)
_opcodes_register_all(session); _opcodes_register_all(session);
// set a name for this thread for system debugging // set a name for this thread for system debugging
#ifdef EINA_HAVE_PTHREAD_SETNAME #if defined(EINA_HAVE_PTHREAD_SETNAME) || defined(EINA_HAVE_WIN32_THREAD_SETNAME)
# ifndef __linux__ eina_thread_name_set(eina_thread_self(), "Edbg-mon");
pthread_set_name_np
# else
pthread_setname_np
# endif
(pthread_self(), "Edbg-mon");
#endif #endif
// sit forever processing commands or timeouts in the debug monitor // sit forever processing commands or timeouts in the debug monitor
// thread - this is separate to the rest of the app so it shouldn't // thread - this is separate to the rest of the app so it shouldn't
// impact the application specifically // impact the application specifically
@ -597,43 +583,20 @@ _monitor(void *_data)
} }
return NULL; return NULL;
} }
#endif
// start up the debug monitor if we haven't already // start up the debug monitor if we haven't already
static void static void
_thread_start(Eina_Debug_Session *session) _thread_start(Eina_Debug_Session *session)
{ {
#ifndef _WIN32 Eina_Thread monitor_thread;
pthread_t monitor_thread;
int err;
sigset_t oldset, newset;
sigemptyset(&newset); Eina_Bool err = eina_thread_create(&monitor_thread,EINA_THREAD_BACKGROUND,-1,(Eina_Thread_Cb)_monitor,session);
sigaddset(&newset, SIGPIPE);
sigaddset(&newset, SIGALRM);
sigaddset(&newset, SIGCHLD);
sigaddset(&newset, SIGUSR1);
sigaddset(&newset, SIGUSR2);
sigaddset(&newset, SIGHUP);
sigaddset(&newset, SIGQUIT);
sigaddset(&newset, SIGINT);
sigaddset(&newset, SIGTERM);
#ifdef SIGPWR
sigaddset(&newset, SIGPWR);
#endif
pthread_sigmask(SIG_BLOCK, &newset, &oldset);
err = pthread_create(&monitor_thread, NULL, _monitor, session); if (!err)
pthread_sigmask(SIG_SETMASK, &oldset, NULL);
if (err != 0)
{ {
e_debug("EINA DEBUG ERROR: Can't create monitor debug thread!"); e_debug("EINA DEBUG ERROR: Can't create monitor debug thread!");
abort(); abort();
} }
#else
(void)session;
#endif
} }
/* /*
@ -641,7 +604,7 @@ _thread_start(Eina_Debug_Session *session)
* - Pointer to ops: returned in the response to determine which opcodes have been added * - Pointer to ops: returned in the response to determine which opcodes have been added
* - List of opcode names separated by \0 * - List of opcode names separated by \0
*/ */
EAPI void EINA_API void
eina_debug_opcodes_register(Eina_Debug_Session *session, const Eina_Debug_Opcode ops[], eina_debug_opcodes_register(Eina_Debug_Session *session, const Eina_Debug_Opcode ops[],
Eina_Debug_Opcode_Status_Cb status_cb, void *data) Eina_Debug_Opcode_Status_Cb status_cb, void *data)
{ {
@ -663,7 +626,7 @@ eina_debug_opcodes_register(Eina_Debug_Session *session, const Eina_Debug_Opcode
_opcodes_registration_send(session, info); _opcodes_registration_send(session, info);
} }
EAPI Eina_Bool EINA_API Eina_Bool
eina_debug_dispatch(Eina_Debug_Session *session, void *buffer) eina_debug_dispatch(Eina_Debug_Session *session, void *buffer)
{ {
Eina_Debug_Packet_Header *hdr = buffer; Eina_Debug_Packet_Header *hdr = buffer;
@ -688,13 +651,13 @@ eina_debug_dispatch(Eina_Debug_Session *session, void *buffer)
return EINA_TRUE; return EINA_TRUE;
} }
EAPI void EINA_API void
eina_debug_session_data_set(Eina_Debug_Session *session, void *data) eina_debug_session_data_set(Eina_Debug_Session *session, void *data)
{ {
if (session) session->data = data; if (session) session->data = data;
} }
EAPI void * EINA_API void *
eina_debug_session_data_get(Eina_Debug_Session *session) eina_debug_session_data_get(Eina_Debug_Session *session)
{ {
if (session) return session->data; if (session) return session->data;
@ -704,14 +667,15 @@ eina_debug_session_data_get(Eina_Debug_Session *session)
Eina_Bool Eina_Bool
eina_debug_init(void) eina_debug_init(void)
{ {
pthread_t self;
Eina_Thread self;
eina_threads_init(); eina_threads_init();
// For Windows support GetModuleFileName can be used // For Windows support GetModuleFileName can be used
// set up thread things // set up thread things
eina_spinlock_new(&_eina_debug_lock); eina_spinlock_new(&_eina_debug_lock);
eina_spinlock_new(&_eina_debug_thread_lock); eina_spinlock_new(&_eina_debug_thread_lock);
self = pthread_self(); self = eina_thread_self();
_eina_debug_thread_mainloop_set(&self); _eina_debug_thread_mainloop_set(&self);
_eina_debug_thread_add(&self); _eina_debug_thread_add(&self);
_eina_debug_cpu_init(); _eina_debug_cpu_init();
@ -735,7 +699,7 @@ Eina_Bool
eina_debug_shutdown(void) eina_debug_shutdown(void)
{ {
Eina_Debug_Session *session; Eina_Debug_Session *session;
pthread_t self = pthread_self(); Eina_Thread self = eina_thread_self();
EINA_LIST_FREE(sessions, session) EINA_LIST_FREE(sessions, session)
eina_debug_session_terminate(session); eina_debug_session_terminate(session);
@ -750,7 +714,7 @@ eina_debug_shutdown(void)
return EINA_TRUE; return EINA_TRUE;
} }
EAPI void EINA_API void
eina_debug_fork_reset(void) eina_debug_fork_reset(void)
{ {
extern Eina_Bool fork_resetting; extern Eina_Bool fork_resetting;

View File

@ -162,7 +162,7 @@ typedef struct
* of them. * of them.
* Need to be invoked before eina_init. Otherwise it won't have any effect. * Need to be invoked before eina_init. Otherwise it won't have any effect.
*/ */
EAPI void eina_debug_disable(void); EINA_API void eina_debug_disable(void);
/** /**
* @brief Connect to the local daemon * @brief Connect to the local daemon
@ -171,7 +171,7 @@ EAPI void eina_debug_disable(void);
* *
* @return The session on success or NULL otherwise. * @return The session on success or NULL otherwise.
*/ */
EAPI Eina_Debug_Session *eina_debug_local_connect(Eina_Bool is_master); EINA_API Eina_Debug_Session *eina_debug_local_connect(Eina_Bool is_master);
/** /**
* @brief Connect to remote daemon * @brief Connect to remote daemon
@ -182,14 +182,14 @@ EAPI Eina_Debug_Session *eina_debug_local_connect(Eina_Bool is_master);
* *
* @return The session on success or NULL otherwise. * @return The session on success or NULL otherwise.
*/ */
EAPI Eina_Debug_Session *eina_debug_remote_connect(int port); EINA_API Eina_Debug_Session *eina_debug_remote_connect(int port);
/** /**
* @brief Terminate the session * @brief Terminate the session
* *
* @param[in,out] session the session to terminate * @param[in,out] session the session to terminate
*/ */
EAPI void eina_debug_session_terminate(Eina_Debug_Session *session); EINA_API void eina_debug_session_terminate(Eina_Debug_Session *session);
/** /**
* @brief Override the dispatcher of a specific session * @brief Override the dispatcher of a specific session
@ -201,7 +201,7 @@ EAPI void eina_debug_session_terminate(Eina_Debug_Session *session);
* @param[in,out] session the session * @param[in,out] session the session
* @param[in] disp_cb the new dispatcher for the given session * @param[in] disp_cb the new dispatcher for the given session
*/ */
EAPI void eina_debug_session_dispatch_override(Eina_Debug_Session *session, Eina_Debug_Dispatch_Cb disp_cb); EINA_API void eina_debug_session_dispatch_override(Eina_Debug_Session *session, Eina_Debug_Dispatch_Cb disp_cb);
/** /**
* @brief Get the dispatcher of a specific session * @brief Get the dispatcher of a specific session
@ -210,7 +210,7 @@ EAPI void eina_debug_session_dispatch_override(Eina_Debug_Session *session, Eina
* *
* @return The session dispatcher. * @return The session dispatcher.
*/ */
EAPI Eina_Debug_Dispatch_Cb eina_debug_session_dispatch_get(Eina_Debug_Session *session); EINA_API Eina_Debug_Dispatch_Cb eina_debug_session_dispatch_get(Eina_Debug_Session *session);
/** /**
* @brief Dispatch a given packet according to its header. * @brief Dispatch a given packet according to its header.
@ -224,7 +224,7 @@ EAPI Eina_Debug_Dispatch_Cb eina_debug_session_dispatch_get(Eina_Debug_Session *
* *
* @return True on success, false if the connection seems compromised. * @return True on success, false if the connection seems compromised.
*/ */
EAPI Eina_Bool eina_debug_dispatch(Eina_Debug_Session *session, void *buffer); EINA_API Eina_Bool eina_debug_dispatch(Eina_Debug_Session *session, void *buffer);
/** /**
* @brief Set data to a session * @brief Set data to a session
@ -232,7 +232,7 @@ EAPI Eina_Bool eina_debug_dispatch(Eina_Debug_Session *session, void *buffer);
* @param[in,out] session the session * @param[in,out] session the session
* @param[in] data the data to set * @param[in] data the data to set
*/ */
EAPI void eina_debug_session_data_set(Eina_Debug_Session *session, void *data); EINA_API void eina_debug_session_data_set(Eina_Debug_Session *session, void *data);
/** /**
* @brief Get the data attached to a session * @brief Get the data attached to a session
@ -241,7 +241,7 @@ EAPI void eina_debug_session_data_set(Eina_Debug_Session *session, void *data);
* *
* @return The data of the session. * @return The data of the session.
*/ */
EAPI void *eina_debug_session_data_get(Eina_Debug_Session *session); EINA_API void *eina_debug_session_data_get(Eina_Debug_Session *session);
/** /**
* @brief Register opcodes to a session * @brief Register opcodes to a session
@ -257,7 +257,7 @@ EAPI void *eina_debug_session_data_get(Eina_Debug_Session *session);
* @param[in] status_cb a function to call when the opcodes are received * @param[in] status_cb a function to call when the opcodes are received
* @param[in] status_data the data to give to status_cb * @param[in] status_data the data to give to status_cb
*/ */
EAPI void eina_debug_opcodes_register(Eina_Debug_Session *session, EINA_API void eina_debug_opcodes_register(Eina_Debug_Session *session,
const Eina_Debug_Opcode ops[], const Eina_Debug_Opcode ops[],
Eina_Debug_Opcode_Status_Cb status_cb, void *status_data); Eina_Debug_Opcode_Status_Cb status_cb, void *status_data);
@ -274,7 +274,7 @@ EAPI void eina_debug_opcodes_register(Eina_Debug_Session *session,
* *
* @return The number of sent bytes. * @return The number of sent bytes.
*/ */
EAPI int eina_debug_session_send(Eina_Debug_Session *session, int dest_id, int op, void *data, int size); EINA_API int eina_debug_session_send(Eina_Debug_Session *session, int dest_id, int op, void *data, int size);
/** /**
* @brief Add a timer * @brief Add a timer
@ -285,7 +285,7 @@ EAPI int eina_debug_session_send(Eina_Debug_Session *session, int dest_id, int o
* *
* @return The timer handle, NULL on error. * @return The timer handle, NULL on error.
*/ */
EAPI Eina_Debug_Timer *eina_debug_timer_add(unsigned int timeout_ms, Eina_Debug_Timer_Cb cb, void *data); EINA_API Eina_Debug_Timer *eina_debug_timer_add(unsigned int timeout_ms, Eina_Debug_Timer_Cb cb, void *data);
/** /**
* @brief Delete a timer * @brief Delete a timer
@ -295,7 +295,7 @@ EAPI Eina_Debug_Timer *eina_debug_timer_add(unsigned int timeout_ms, Eina_Debug_
* If the timer reaches the end and has not be renewed, trying to delete it will lead to a crash, as * If the timer reaches the end and has not be renewed, trying to delete it will lead to a crash, as
* it has already been deleted internally. * it has already been deleted internally.
*/ */
EAPI void eina_debug_timer_del(Eina_Debug_Timer *timer); EINA_API void eina_debug_timer_del(Eina_Debug_Timer *timer);
/** /**
* @brief Reset the eina debug system after forking * @brief Reset the eina debug system after forking
@ -303,7 +303,7 @@ EAPI void eina_debug_timer_del(Eina_Debug_Timer *timer);
* Call this any time the application forks * Call this any time the application forks
* @since 1.21 * @since 1.21
* */ * */
EAPI void eina_debug_fork_reset(void); EINA_API void eina_debug_fork_reset(void);
/** /**
* @} * @}
*/ */

View File

@ -49,7 +49,7 @@
// broken on OSX in that a HUP signal will maybe cause a crash... but compiling // broken on OSX in that a HUP signal will maybe cause a crash... but compiling
// with -pg would have guaranteed always caused a crash before anyway. // with -pg would have guaranteed always caused a crash before anyway.
// given OSX only supports "old-style" signals like: // given OSX only supports "old-style" signals like:
// //
// #define SIGHUP 1 /* hangup */ // #define SIGHUP 1 /* hangup */
// #define SIGINT 2 /* interrupt */ // #define SIGINT 2 /* interrupt */
// #define SIGQUIT 3 /* quit */ // #define SIGQUIT 3 /* quit */
@ -90,7 +90,7 @@
// #endif // #endif
// #define SIGUSR1 30 /* user defined signal 1 */ // #define SIGUSR1 30 /* user defined signal 1 */
// #define SIGUSR2 31 /* user defined signal 2 */ // #define SIGUSR2 31 /* user defined signal 2 */
// //
// (excerpt from OSX's signal.h - found at: // (excerpt from OSX's signal.h - found at:
// http://github.com/st3fan/osx-10.9/blob/master/xnu-2422.1.72/bsd/sys/signal.h // http://github.com/st3fan/osx-10.9/blob/master/xnu-2422.1.72/bsd/sys/signal.h
// pasting here due to how difficult it was to find a signal list for OSX) // pasting here due to how difficult it was to find a signal list for OSX)
@ -184,6 +184,10 @@ get_time(void)
struct timespec t; struct timespec t;
clock_gettime(CLOCK_MONOTONIC, &t); clock_gettime(CLOCK_MONOTONIC, &t);
return (double)t.tv_sec + (((double)t.tv_nsec) / 1000000000.0); return (double)t.tv_sec + (((double)t.tv_nsec) / 1000000000.0);
#elif defined (_MSC_VER)
struct timespec t;
timespec_get (&t, TIME_UTC);
return (double)t.tv_sec + (((double)t.tv_nsec) / 1000000000.0);
#else #else
struct timeval timev; struct timeval timev;
gettimeofday(&timev, NULL); gettimeofday(&timev, NULL);
@ -197,7 +201,7 @@ _signal_handler(int sig EINA_UNUSED,
siginfo_t *si EINA_UNUSED, void *foo EINA_UNUSED) siginfo_t *si EINA_UNUSED, void *foo EINA_UNUSED)
{ {
int i, slot = 0; int i, slot = 0;
pthread_t self = pthread_self(); Eina_Thread self = eina_thread_self();
#if defined(HAVE_CLOCK_GETTIME) && defined(HAVE_SCHED_GETCPU) && defined(__clockid_t_defined) #if defined(HAVE_CLOCK_GETTIME) && defined(HAVE_SCHED_GETCPU) && defined(__clockid_t_defined)
clockid_t cid; clockid_t cid;
#endif #endif
@ -235,7 +239,9 @@ found:
_bt_cpu[slot] = sched_getcpu(); _bt_cpu[slot] = sched_getcpu();
# ifdef HAVE_PTHREAD_GETCPUCLOCKID # ifdef HAVE_PTHREAD_GETCPUCLOCKID
/* Try pthread_getcpuclockid() first */ /* Try pthread_getcpuclockid() first */
pthread_getcpuclockid(self, &cid); #ifndef _WIN32
pthread_getcpuclockid(self, &cid);
#endif
# elif defined(_POSIX_THREAD_CPUTIME) # elif defined(_POSIX_THREAD_CPUTIME)
/* Fallback to POSIX clock id. */ /* Fallback to POSIX clock id. */
cid = CLOCK_THREAD_CPUTIME_ID; cid = CLOCK_THREAD_CPUTIME_ID;
@ -292,7 +298,7 @@ _signal_shutdown(void)
} }
static void static void
_collect_bt(pthread_t pth) _collect_bt(Eina_Thread pth)
{ {
// this async signals the thread to switch to the deebug signal handler // this async signals the thread to switch to the deebug signal handler
// and collect a backtrace and other info from inside the thread // and collect a backtrace and other info from inside the thread

View File

@ -81,7 +81,7 @@ _sysmon(void *data EINA_UNUSED, Eina_Thread thr EINA_UNUSED)
{ {
// get the correct clock id to use for the target thread // get the correct clock id to use for the target thread
pthread_getcpuclockid pthread_getcpuclockid
(_eina_debug_thread_active[i].thread, &cid); (_eina_debug_thread_active[i].thread, &cid);
// get the clock cpu time accumulation for that threas // get the clock cpu time accumulation for that threas
clock_gettime(cid, &t); clock_gettime(cid, &t);
_eina_debug_thread_active[i].clok = t; _eina_debug_thread_active[i].clok = t;

View File

@ -16,9 +16,9 @@
* if not, see <http://www.gnu.org/licenses/>. * if not, see <http://www.gnu.org/licenses/>.
*/ */
# ifndef _GNU_SOURCE #ifndef _GNU_SOURCE
# define _GNU_SOURCE 1 # define _GNU_SOURCE 1
# endif #endif
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include <config.h> # include <config.h>
@ -35,11 +35,11 @@
#include <sys/time.h> #include <sys/time.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <pthread.h>
#include <signal.h> #include <signal.h>
#include <time.h> #include <time.h>
#include <fcntl.h> #include <fcntl.h>
#include "eina_thread.h"
#include "eina_debug.h" #include "eina_debug.h"
#include "eina_debug_private.h" #include "eina_debug_private.h"
@ -56,7 +56,7 @@ struct _Eina_Debug_Timer
static Eina_List *_timers = NULL; static Eina_List *_timers = NULL;
static Eina_Bool _thread_runs = EINA_FALSE; static Eina_Bool _thread_runs = EINA_FALSE;
static pthread_t _thread; static Eina_Thread _thread;
static int pipeToThread[2]; static int pipeToThread[2];
@ -85,7 +85,7 @@ static void *
_monitor(void *_data EINA_UNUSED) _monitor(void *_data EINA_UNUSED)
{ {
#ifdef HAVE_SYS_EPOLL_H #ifdef HAVE_SYS_EPOLL_H
#define MAX_EVENTS 4 # define MAX_EVENTS 4
struct epoll_event event; struct epoll_event event;
struct epoll_event events[MAX_EVENTS]; struct epoll_event events[MAX_EVENTS];
int epfd = epoll_create(MAX_EVENTS), ret; int epfd = epoll_create(MAX_EVENTS), ret;
@ -94,18 +94,16 @@ _monitor(void *_data EINA_UNUSED)
event.events = EPOLLIN; event.events = EPOLLIN;
ret = epoll_ctl(epfd, EPOLL_CTL_ADD, event.data.fd, &event); ret = epoll_ctl(epfd, EPOLL_CTL_ADD, event.data.fd, &event);
if (ret) perror("epoll_ctl/add"); if (ret) perror("epoll_ctl/add");
#ifdef EINA_HAVE_PTHREAD_SETNAME # ifdef EINA_HAVE_PTHREAD_SETNAME || EINA_HAVE_WIN32_THREAD_SETNAME
# ifndef __linux__ eina_thread_name_set(eina_thread_self(), "Edbg-tim");
pthread_set_name_np
# else
pthread_setname_np
# endif # endif
(pthread_self(), "Edbg-tim");
#endif
while (1) while (1)
{ {
int timeout = -1; //in milliseconds int timeout = -1; //in milliseconds
# ifndef _WIN32
pthread_testcancel(); pthread_testcancel();
# endif
eina_spinlock_take(&_lock); eina_spinlock_take(&_lock);
if (_timers) if (_timers)
{ {
@ -113,11 +111,11 @@ _monitor(void *_data EINA_UNUSED)
timeout = t->timeout; timeout = t->timeout;
} }
eina_spinlock_release(&_lock); eina_spinlock_release(&_lock);
ret = epoll_wait(epfd, events, MAX_EVENTS, timeout); ret = epoll_wait(epfd, events, MAX_EVENTS, timeout);
# ifndef _WIN32
pthread_testcancel(); pthread_testcancel();
# endif
/* Some timer has been add/removed or we need to exit */ /* Some timer has been add/removed or we need to exit */
if (ret) if (ret)
{ {
char c; char c;
@ -148,7 +146,7 @@ _monitor(void *_data EINA_UNUSED)
return NULL; return NULL;
} }
EAPI Eina_Debug_Timer * EINA_API Eina_Debug_Timer *
eina_debug_timer_add(unsigned int timeout_ms, Eina_Debug_Timer_Cb cb, void *data) eina_debug_timer_add(unsigned int timeout_ms, Eina_Debug_Timer_Cb cb, void *data)
{ {
if (!cb || !timeout_ms) return NULL; if (!cb || !timeout_ms) return NULL;
@ -160,9 +158,8 @@ eina_debug_timer_add(unsigned int timeout_ms, Eina_Debug_Timer_Cb cb, void *data
_timer_append(t); _timer_append(t);
if (!_thread_runs) if (!_thread_runs)
{ {
#ifndef _WIN32 #ifndef _WIN32
sigset_t oldset, newset; sigset_t oldset, newset;
sigemptyset(&newset); sigemptyset(&newset);
sigaddset(&newset, SIGPIPE); sigaddset(&newset, SIGPIPE);
sigaddset(&newset, SIGALRM); sigaddset(&newset, SIGALRM);
@ -173,27 +170,27 @@ eina_debug_timer_add(unsigned int timeout_ms, Eina_Debug_Timer_Cb cb, void *data
sigaddset(&newset, SIGQUIT); sigaddset(&newset, SIGQUIT);
sigaddset(&newset, SIGINT); sigaddset(&newset, SIGINT);
sigaddset(&newset, SIGTERM); sigaddset(&newset, SIGTERM);
# ifdef SIGPWR # ifdef SIGPWR
sigaddset(&newset, SIGPWR); sigaddset(&newset, SIGPWR);
# endif # endif
pthread_sigmask(SIG_BLOCK, &newset, &oldset); pthread_sigmask(SIG_BLOCK, &newset, &oldset);
#endif #endif
int err = pthread_create(&_thread, NULL, _monitor, NULL); int err = eina_thread_create(&_thread, EINA_THREAD_BACKGROUND, NULL,(Eina_Thread_Cb)_monitor, NULL);
#ifndef _WIN32 #ifndef _WIN32
pthread_sigmask(SIG_SETMASK, &oldset, NULL); pthread_sigmask(SIG_SETMASK, &oldset, NULL);
#endif #endif
if (err != 0) if (!err)
{ {
e_debug("EINA DEBUG ERROR: Can't create debug timer thread!"); e_debug("EINA DEBUG ERROR: Can't create debug timer thread!");
abort(); abort();
} }
_thread_runs = EINA_TRUE; _thread_runs = EINA_TRUE;
} }
eina_spinlock_release(&_lock); eina_spinlock_release(&_lock);
return t; return t;
} }
EAPI void EINA_API void
eina_debug_timer_del(Eina_Debug_Timer *t) eina_debug_timer_del(Eina_Debug_Timer *t)
{ {
eina_spinlock_take(&_lock); eina_spinlock_take(&_lock);
@ -211,8 +208,7 @@ _eina_debug_timer_init(void)
{ {
eina_spinlock_new(&_lock); eina_spinlock_new(&_lock);
#ifndef _WIN32 #ifndef _WIN32
if (pipe(pipeToThread) == -1) if (pipe(pipeToThread) == -1) return EINA_FALSE;
return EINA_FALSE;
#endif #endif
return EINA_TRUE; return EINA_TRUE;
} }
@ -224,15 +220,13 @@ _eina_debug_timer_shutdown(void)
eina_spinlock_take(&_lock); eina_spinlock_take(&_lock);
EINA_LIST_FREE(_timers, t) EINA_LIST_FREE(_timers, t)
free(t); free(t);
close(pipeToThread[0]); close(pipeToThread[0]);
close(pipeToThread[1]); close(pipeToThread[1]);
if (_thread_runs) if (_thread_runs) eina_thread_cancel(_thread);
pthread_cancel(_thread);
_thread_runs = 0; _thread_runs = 0;
eina_spinlock_release(&_lock); eina_spinlock_release(&_lock);
eina_spinlock_free(&_lock); eina_spinlock_free(&_lock);
return EINA_TRUE; return EINA_TRUE;
} }

View File

@ -132,7 +132,7 @@ static inline int strerror_r(int errnum, char *buf, size_t buflen)
* @cond LOCAL * @cond LOCAL
*/ */
EAPI Eina_Error EINA_ERROR_OUT_OF_MEMORY = ENOMEM; EINA_API Eina_Error EINA_ERROR_OUT_OF_MEMORY = ENOMEM;
/** /**
* @endcond * @endcond
@ -219,7 +219,7 @@ eina_error_shutdown(void)
* API * * API *
*============================================================================*/ *============================================================================*/
EAPI Eina_Error EINA_API Eina_Error
eina_error_msg_register(const char *msg) eina_error_msg_register(const char *msg)
{ {
Eina_Error_Message *eem; Eina_Error_Message *eem;
@ -241,7 +241,7 @@ eina_error_msg_register(const char *msg)
return EINA_ERROR_FROM_INDEX(_eina_errors_count); /* identifier = index + 1 (== _count). */ return EINA_ERROR_FROM_INDEX(_eina_errors_count); /* identifier = index + 1 (== _count). */
} }
EAPI Eina_Error EINA_API Eina_Error
eina_error_msg_static_register(const char *msg) eina_error_msg_static_register(const char *msg)
{ {
Eina_Error_Message *eem; Eina_Error_Message *eem;
@ -257,7 +257,7 @@ eina_error_msg_static_register(const char *msg)
return EINA_ERROR_FROM_INDEX(_eina_errors_count); /* identifier = index + 1 (== _count). */ return EINA_ERROR_FROM_INDEX(_eina_errors_count); /* identifier = index + 1 (== _count). */
} }
EAPI Eina_Bool EINA_API Eina_Bool
eina_error_msg_modify(Eina_Error error, const char *msg) eina_error_msg_modify(Eina_Error error, const char *msg)
{ {
EINA_SAFETY_ON_NULL_RETURN_VAL(msg, EINA_FALSE); EINA_SAFETY_ON_NULL_RETURN_VAL(msg, EINA_FALSE);
@ -285,7 +285,7 @@ eina_error_msg_modify(Eina_Error error, const char *msg)
return EINA_TRUE; return EINA_TRUE;
} }
EAPI const char * EINA_API const char *
eina_error_msg_get(Eina_Error error) eina_error_msg_get(Eina_Error error)
{ {
if (!EINA_ERROR_REGISTERED_CHECK(error)) if (!EINA_ERROR_REGISTERED_CHECK(error))
@ -379,7 +379,7 @@ eina_error_msg_get(Eina_Error error)
return _eina_errors[error - 1].string; return _eina_errors[error - 1].string;
} }
EAPI Eina_Error EINA_API Eina_Error
eina_error_get(void) eina_error_get(void)
{ {
if (eina_main_loop_is()) if (eina_main_loop_is())
@ -388,7 +388,7 @@ eina_error_get(void)
return (Eina_Error)(uintptr_t) eina_tls_get(_eina_last_key); return (Eina_Error)(uintptr_t) eina_tls_get(_eina_last_key);
} }
EAPI void EINA_API void
eina_error_set(Eina_Error err) eina_error_set(Eina_Error err)
{ {
if (eina_main_loop_is()) if (eina_main_loop_is())
@ -397,7 +397,7 @@ eina_error_set(Eina_Error err)
eina_tls_set(_eina_last_key, (void*)(uintptr_t) err); eina_tls_set(_eina_last_key, (void*)(uintptr_t) err);
} }
EAPI Eina_Error EINA_API Eina_Error
eina_error_find(const char *msg) eina_error_find(const char *msg)
{ {
size_t i; size_t i;

View File

@ -112,7 +112,7 @@ typedef Eina_Bool Eina_Success_Flag;
* *
* @deprecated since 1.19, same as @c ENOMEM from @c errno.h * @deprecated since 1.19, same as @c ENOMEM from @c errno.h
*/ */
EAPI extern Eina_Error EINA_ERROR_OUT_OF_MEMORY EINA_DEPRECATED; /* use ENOMEM */ EINA_API extern Eina_Error EINA_ERROR_OUT_OF_MEMORY EINA_DEPRECATED; /* use ENOMEM */
/** /**
* @brief Registers a new error type. * @brief Registers a new error type.
@ -130,7 +130,7 @@ EAPI extern Eina_Error EINA_ERROR_OUT_OF_MEMORY EINA_DEPRECATED; /* use ENOMEM *
* *
* @see eina_error_msg_static_register() * @see eina_error_msg_static_register()
*/ */
EAPI Eina_Error eina_error_msg_register(const char *msg) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT; EINA_API Eina_Error eina_error_msg_register(const char *msg) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT;
/** /**
* @brief Registers a new error type, statically allocated message. * @brief Registers a new error type, statically allocated message.
@ -149,7 +149,7 @@ EAPI Eina_Error eina_error_msg_register(const char *msg) EINA_ARG_NONNULL(1) EI
* *
* @see eina_error_msg_register() * @see eina_error_msg_register()
*/ */
EAPI Eina_Error eina_error_msg_static_register(const char *msg) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT; EINA_API Eina_Error eina_error_msg_static_register(const char *msg) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT;
/** /**
* @brief Changes the message of an already registered message. * @brief Changes the message of an already registered message.
@ -170,7 +170,7 @@ EAPI Eina_Error eina_error_msg_static_register(const char *msg) EINA_ARG_NONNUL
* *
* @see eina_error_msg_register() * @see eina_error_msg_register()
*/ */
EAPI Eina_Bool eina_error_msg_modify(Eina_Error error, EINA_API Eina_Bool eina_error_msg_modify(Eina_Error error,
const char *msg) EINA_ARG_NONNULL(2); const char *msg) EINA_ARG_NONNULL(2);
/** /**
@ -182,7 +182,7 @@ EAPI Eina_Bool eina_error_msg_modify(Eina_Error error,
* *
* @note This function is thread safe @since 1.10, but slower to use. * @note This function is thread safe @since 1.10, but slower to use.
*/ */
EAPI Eina_Error eina_error_get(void); EINA_API Eina_Error eina_error_get(void);
/** /**
* @brief Sets the last error. * @brief Sets the last error.
@ -196,7 +196,7 @@ EAPI Eina_Error eina_error_get(void);
* *
* @note This function is thread safe @since 1.10, but slower to use. * @note This function is thread safe @since 1.10, but slower to use.
*/ */
EAPI void eina_error_set(Eina_Error err); EINA_API void eina_error_set(Eina_Error err);
/** /**
* @brief Returns the description of the given error number. * @brief Returns the description of the given error number.
@ -207,7 +207,7 @@ EAPI void eina_error_set(Eina_Error err);
* @return The description of the error * @return The description of the error
* *
*/ */
EAPI const char *eina_error_msg_get(Eina_Error error) EINA_PURE; EINA_API const char *eina_error_msg_get(Eina_Error error) EINA_PURE;
/** /**
* @brief Finds the #Eina_Error corresponding to a message string. * @brief Finds the #Eina_Error corresponding to a message string.
@ -222,7 +222,7 @@ EAPI const char *eina_error_msg_get(Eina_Error error) EINA_PURE;
* eina_error_msg_static_register() or modified with * eina_error_msg_static_register() or modified with
* eina_error_msg_modify(). * eina_error_msg_modify().
*/ */
EAPI Eina_Error eina_error_find(const char *msg) EINA_ARG_NONNULL(1) EINA_PURE; EINA_API Eina_Error eina_error_find(const char *msg) EINA_ARG_NONNULL(1) EINA_PURE;
/** /**
* @} * @}

View File

@ -150,7 +150,7 @@ push_buf(Eina_Evlog_Buf *b, unsigned int size)
return ptr; return ptr;
} }
EAPI void EINA_API void
eina_evlog(const char *event, void *obj, double srctime, const char *detail) eina_evlog(const char *event, void *obj, double srctime, const char *detail)
{ {
Eina_Evlog_Item *item; Eina_Evlog_Item *item;
@ -176,7 +176,7 @@ eina_evlog(const char *event, void *obj, double srctime, const char *detail)
item = (Eina_Evlog_Item *)strings; item = (Eina_Evlog_Item *)strings;
item->tim = SWAP_DBL(now); item->tim = SWAP_DBL(now);
item->srctim = SWAP_DBL(srctime); item->srctim = SWAP_DBL(srctime);
item->thread = SWAP_64((unsigned long long)(uintptr_t)pthread_self()); item->thread = SWAP_64((unsigned long long)(uintptr_t)eina_thread_self());
item->obj = SWAP_64((unsigned long long)(uintptr_t)obj); item->obj = SWAP_64((unsigned long long)(uintptr_t)obj);
item->event_offset = SWAP_16(sizeof(Eina_Evlog_Item)); item->event_offset = SWAP_16(sizeof(Eina_Evlog_Item));
item->detail_offset = SWAP_16(detail_offset); item->detail_offset = SWAP_16(detail_offset);
@ -186,7 +186,7 @@ eina_evlog(const char *event, void *obj, double srctime, const char *detail)
eina_spinlock_release(&_evlog_lock); eina_spinlock_release(&_evlog_lock);
} }
EAPI Eina_Evlog_Buf * EINA_API Eina_Evlog_Buf *
eina_evlog_steal(void) eina_evlog_steal(void)
{ {
Eina_Evlog_Buf *stolen = NULL; Eina_Evlog_Buf *stolen = NULL;
@ -210,7 +210,7 @@ eina_evlog_steal(void)
return stolen; return stolen;
} }
EAPI void EINA_API void
eina_evlog_start(void) eina_evlog_start(void)
{ {
eina_spinlock_take(&_evlog_lock); eina_spinlock_take(&_evlog_lock);
@ -224,7 +224,7 @@ eina_evlog_start(void)
eina_spinlock_release(&_evlog_lock); eina_spinlock_release(&_evlog_lock);
} }
EAPI void EINA_API void
eina_evlog_stop(void) eina_evlog_stop(void)
{ {
eina_spinlock_take(&_evlog_lock); eina_spinlock_take(&_evlog_lock);

View File

@ -113,7 +113,7 @@ struct _Eina_Evlog_Buf
* *
* @since 1.15 * @since 1.15
*/ */
EAPI void EINA_API void
eina_evlog(const char *event, void *obj, double srctime, const char *detail); eina_evlog(const char *event, void *obj, double srctime, const char *detail);
/** /**
@ -126,7 +126,7 @@ eina_evlog(const char *event, void *obj, double srctime, const char *detail);
* *
* @since 1.15 * @since 1.15
*/ */
EAPI Eina_Evlog_Buf * EINA_API Eina_Evlog_Buf *
eina_evlog_steal(void); eina_evlog_steal(void);
/** /**
@ -134,7 +134,7 @@ eina_evlog_steal(void);
* *
* @since 1.15 * @since 1.15
*/ */
EAPI void EINA_API void
eina_evlog_start(void); eina_evlog_start(void);
/** /**
@ -145,7 +145,7 @@ eina_evlog_start(void);
* *
* @since 1.15 * @since 1.15
*/ */
EAPI void EINA_API void
eina_evlog_stop(void); eina_evlog_stop(void);
/** /**

View File

@ -554,7 +554,7 @@ eina_file_cleanup(Eina_Tmpstr *path)
EAPI Eina_Bool EINA_API Eina_Bool
eina_file_dir_list(const char *dir, eina_file_dir_list(const char *dir,
Eina_Bool recursive, Eina_Bool recursive,
Eina_File_Dir_List_Cb cb, Eina_File_Dir_List_Cb cb,
@ -586,7 +586,7 @@ eina_file_dir_list(const char *dir,
return EINA_TRUE; return EINA_TRUE;
} }
EAPI Eina_Array * EINA_API Eina_Array *
eina_file_split(char *path) eina_file_split(char *path)
{ {
Eina_Array *ea; Eina_Array *ea;
@ -619,7 +619,7 @@ eina_file_split(char *path)
return ea; return ea;
} }
EAPI Eina_Iterator * EINA_API Eina_Iterator *
eina_file_ls(const char *dir) eina_file_ls(const char *dir)
{ {
#ifdef HAVE_DIRENT_H #ifdef HAVE_DIRENT_H
@ -667,7 +667,7 @@ eina_file_ls(const char *dir)
#endif #endif
} }
EAPI Eina_Iterator * EINA_API Eina_Iterator *
eina_file_direct_ls(const char *dir) eina_file_direct_ls(const char *dir)
{ {
#ifdef HAVE_DIRENT_H #ifdef HAVE_DIRENT_H
@ -727,7 +727,7 @@ eina_file_direct_ls(const char *dir)
#endif #endif
} }
EAPI Eina_Iterator * EINA_API Eina_Iterator *
eina_file_stat_ls(const char *dir) eina_file_stat_ls(const char *dir)
{ {
#ifdef HAVE_DIRENT_H #ifdef HAVE_DIRENT_H
@ -787,7 +787,7 @@ eina_file_stat_ls(const char *dir)
#endif #endif
} }
EAPI Eina_File * EINA_API Eina_File *
eina_file_open(const char *path, Eina_Bool shared) eina_file_open(const char *path, Eina_Bool shared)
{ {
Eina_File *file; Eina_File *file;
@ -896,7 +896,7 @@ eina_file_open(const char *path, Eina_Bool shared)
return NULL; return NULL;
} }
EAPI Eina_Bool EINA_API Eina_Bool
eina_file_refresh(Eina_File *file) eina_file_refresh(Eina_File *file)
{ {
struct stat file_stat; struct stat file_stat;
@ -929,7 +929,7 @@ eina_file_refresh(Eina_File *file)
return r; return r;
} }
EAPI Eina_Bool EINA_API Eina_Bool
eina_file_unlink(const char *pathname) eina_file_unlink(const char *pathname)
{ {
if ( unlink(pathname) < 0) if ( unlink(pathname) < 0)
@ -939,7 +939,7 @@ eina_file_unlink(const char *pathname)
return EINA_TRUE; return EINA_TRUE;
} }
EAPI void * EINA_API void *
eina_file_map_all(Eina_File *file, Eina_File_Populate rule) eina_file_map_all(Eina_File *file, Eina_File_Populate rule)
{ {
int flags = MAP_SHARED; int flags = MAP_SHARED;
@ -990,7 +990,7 @@ eina_file_map_all(Eina_File *file, Eina_File_Populate rule)
return ret; return ret;
} }
EAPI void * EINA_API void *
eina_file_map_new(Eina_File *file, Eina_File_Populate rule, eina_file_map_new(Eina_File *file, Eina_File_Populate rule,
unsigned long int offset, unsigned long int length) unsigned long int offset, unsigned long int length)
{ {
@ -1069,7 +1069,7 @@ eina_file_map_new(Eina_File *file, Eina_File_Populate rule,
return NULL; return NULL;
} }
EAPI void EINA_API void
eina_file_map_free(Eina_File *file, void *map) eina_file_map_free(Eina_File *file, void *map)
{ {
EINA_SAFETY_ON_NULL_RETURN(file); EINA_SAFETY_ON_NULL_RETURN(file);
@ -1100,7 +1100,7 @@ eina_file_map_free(Eina_File *file, void *map)
eina_lock_release(&file->lock); eina_lock_release(&file->lock);
} }
EAPI void EINA_API void
eina_file_map_populate(Eina_File *file, Eina_File_Populate rule, const void *map, eina_file_map_populate(Eina_File *file, Eina_File_Populate rule, const void *map,
unsigned long int offset, unsigned long int length) unsigned long int offset, unsigned long int length)
{ {
@ -1115,7 +1115,7 @@ eina_file_map_populate(Eina_File *file, Eina_File_Populate rule, const void *map
eina_lock_release(&file->lock); eina_lock_release(&file->lock);
} }
EAPI Eina_Bool EINA_API Eina_Bool
eina_file_map_faulted(Eina_File *file, void *map) eina_file_map_faulted(Eina_File *file, void *map)
{ {
Eina_Bool r = EINA_FALSE; Eina_Bool r = EINA_FALSE;
@ -1157,7 +1157,7 @@ eina_file_map_faulted(Eina_File *file, void *map)
return r; return r;
} }
EAPI Eina_Iterator * EINA_API Eina_Iterator *
eina_file_xattr_get(Eina_File *file) eina_file_xattr_get(Eina_File *file)
{ {
EINA_SAFETY_ON_NULL_RETURN_VAL(file, NULL); EINA_SAFETY_ON_NULL_RETURN_VAL(file, NULL);
@ -1167,7 +1167,7 @@ eina_file_xattr_get(Eina_File *file)
return eina_xattr_fd_ls(file->fd); return eina_xattr_fd_ls(file->fd);
} }
EAPI Eina_Iterator * EINA_API Eina_Iterator *
eina_file_xattr_value_get(Eina_File *file) eina_file_xattr_value_get(Eina_File *file)
{ {
EINA_SAFETY_ON_NULL_RETURN_VAL(file, NULL); EINA_SAFETY_ON_NULL_RETURN_VAL(file, NULL);
@ -1177,7 +1177,7 @@ eina_file_xattr_value_get(Eina_File *file)
return eina_xattr_value_fd_ls(file->fd); return eina_xattr_value_fd_ls(file->fd);
} }
EAPI int EINA_API int
eina_file_statat(void *container, Eina_File_Direct_Info *info, Eina_Stat *st) eina_file_statat(void *container, Eina_File_Direct_Info *info, Eina_Stat *st)
{ {
struct stat buf; struct stat buf;
@ -1252,7 +1252,7 @@ eina_file_statat(void *container, Eina_File_Direct_Info *info, Eina_Stat *st)
return 0; return 0;
} }
EAPI void EINA_API void
eina_file_close_from(int fd, int *except_fd) eina_file_close_from(int fd, int *except_fd)
{ {
#if defined(_WIN32) #if defined(_WIN32)

View File

@ -264,7 +264,7 @@ struct _Eina_File_Line
* @param[in] data The data to pass to the callback * @param[in] data The data to pass to the callback
* @return #EINA_TRUE on success, otherwise #EINA_FALSE * @return #EINA_TRUE on success, otherwise #EINA_FALSE
*/ */
EAPI Eina_Bool eina_file_dir_list(const char *dir, EINA_API Eina_Bool eina_file_dir_list(const char *dir,
Eina_Bool recursive, Eina_Bool recursive,
Eina_File_Dir_List_Cb cb, Eina_File_Dir_List_Cb cb,
void *data) EINA_ARG_NONNULL(1, 3); void *data) EINA_ARG_NONNULL(1, 3);
@ -280,7 +280,7 @@ EAPI Eina_Bool eina_file_dir_list(const char *dir,
* @return An array of the parts of the path to split * @return An array of the parts of the path to split
* *
*/ */
EAPI Eina_Array *eina_file_split(char *path) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_MALLOC; EINA_API Eina_Array *eina_file_split(char *path) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_MALLOC;
/** /**
* @brief Gets an iterator to list the content of a directory. * @brief Gets an iterator to list the content of a directory.
@ -300,7 +300,7 @@ EAPI Eina_Array *eina_file_split(char *path) EINA_WARN_UNUSED_RESULT EINA_ARG
* *
* @see eina_file_direct_ls() * @see eina_file_direct_ls()
*/ */
EAPI Eina_Iterator *eina_file_ls(const char *dir) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_MALLOC; EINA_API Eina_Iterator *eina_file_ls(const char *dir) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_MALLOC;
/** /**
* @brief Gets an iterator to list the content of a directory, with direct * @brief Gets an iterator to list the content of a directory, with direct
@ -327,7 +327,7 @@ EAPI Eina_Iterator *eina_file_ls(const char *dir) EINA_WARN_UNUSED_RESULT EINA_A
* *
* @see eina_file_direct_ls() * @see eina_file_direct_ls()
*/ */
EAPI Eina_Iterator *eina_file_stat_ls(const char *dir) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_MALLOC; EINA_API Eina_Iterator *eina_file_stat_ls(const char *dir) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_MALLOC;
/** /**
* @brief Uses information provided by #Eina_Iterator of eina_file_stat_ls() or eina_file_direct_ls() * @brief Uses information provided by #Eina_Iterator of eina_file_stat_ls() or eina_file_direct_ls()
@ -345,7 +345,7 @@ EAPI Eina_Iterator *eina_file_stat_ls(const char *dir) EINA_WARN_UNUSED_RESULT E
* *
* @since 1.2 * @since 1.2
*/ */
EAPI int eina_file_statat(void *container, Eina_File_Direct_Info *info, Eina_Stat *buf) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1, 2, 3); EINA_API int eina_file_statat(void *container, Eina_File_Direct_Info *info, Eina_Stat *buf) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1, 2, 3);
/** /**
* @brief Close all file descriptors that are open at or above the given fd * @brief Close all file descriptors that are open at or above the given fd
@ -362,7 +362,7 @@ EAPI int eina_file_statat(void *container, Eina_File_Direct_Info *info, Eina_Sta
* *
* @since 1.24 * @since 1.24
*/ */
EAPI void eina_file_close_from(int fd, int *except_fd); EINA_API void eina_file_close_from(int fd, int *except_fd);
/** /**
* @brief Generates and creates a uniquely named temporary file from a template name. * @brief Generates and creates a uniquely named temporary file from a template name.
@ -393,7 +393,7 @@ EAPI void eina_file_close_from(int fd, int *except_fd);
* @see eina_file_mkdtemp() * @see eina_file_mkdtemp()
* @since 1.8 * @since 1.8
*/ */
EAPI int eina_file_mkstemp(const char *templatename, Eina_Tmpstr **path) EINA_ARG_NONNULL(1); EINA_API int eina_file_mkstemp(const char *templatename, Eina_Tmpstr **path) EINA_ARG_NONNULL(1);
/** /**
* @brief Generates and creates a uniquely named temporary directory from a template name. * @brief Generates and creates a uniquely named temporary directory from a template name.
@ -417,7 +417,7 @@ EAPI int eina_file_mkstemp(const char *templatename, Eina_Tmpstr **path) EINA_AR
* @see eina_file_mkstemp() * @see eina_file_mkstemp()
* @since 1.8 * @since 1.8
*/ */
EAPI Eina_Bool eina_file_mkdtemp(const char *templatename, Eina_Tmpstr **path) EINA_ARG_NONNULL(1,2); EINA_API Eina_Bool eina_file_mkdtemp(const char *templatename, Eina_Tmpstr **path) EINA_ARG_NONNULL(1,2);
/** /**
* @brief Gets an iterator to list the content of a directory, with direct * @brief Gets an iterator to list the content of a directory, with direct
@ -446,7 +446,7 @@ EAPI Eina_Bool eina_file_mkdtemp(const char *templatename, Eina_Tmpstr **path) E
* *
* @see eina_file_ls() * @see eina_file_ls()
*/ */
EAPI Eina_Iterator *eina_file_direct_ls(const char *dir) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_MALLOC; EINA_API Eina_Iterator *eina_file_direct_ls(const char *dir) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_MALLOC;
/** /**
* @brief Sanitizes the file path. * @brief Sanitizes the file path.
@ -460,7 +460,7 @@ EAPI Eina_Iterator *eina_file_direct_ls(const char *dir) EINA_WARN_UNUSED_RESULT
* *
* @since 1.1 * @since 1.1
*/ */
EAPI char *eina_file_path_sanitize(const char *path); EINA_API char *eina_file_path_sanitize(const char *path);
/** /**
* @typedef Eina_File_Copy_Progress * @typedef Eina_File_Copy_Progress
@ -497,7 +497,7 @@ typedef enum {
* *
* @note During the progress it may call back @p cb with the progress summary. * @note During the progress it may call back @p cb with the progress summary.
*/ */
EAPI Eina_Bool eina_file_copy(const char *src, const char *dst, Eina_File_Copy_Flags flags, Eina_File_Copy_Progress cb, const void *cb_data) EINA_ARG_NONNULL(1, 2); EINA_API Eina_Bool eina_file_copy(const char *src, const char *dst, Eina_File_Copy_Flags flags, Eina_File_Copy_Progress cb, const void *cb_data) EINA_ARG_NONNULL(1, 2);
/** /**
* @brief Gets a read-only handler to a file. * @brief Gets a read-only handler to a file.
@ -512,7 +512,7 @@ EAPI Eina_Bool eina_file_copy(const char *src, const char *dst, Eina_File_Copy_F
* *
* @since 1.1 * @since 1.1
*/ */
EAPI Eina_File *eina_file_open(const char *name, Eina_Bool shared) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_MALLOC; EINA_API Eina_File *eina_file_open(const char *name, Eina_Bool shared) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_MALLOC;
/** /**
* @brief Creates a virtual file from a memory pointer. * @brief Creates a virtual file from a memory pointer.
@ -525,7 +525,7 @@ EAPI Eina_File *eina_file_open(const char *name, Eina_Bool shared) EINA_WARN_UNU
* *
* @since 1.8 * @since 1.8
*/ */
EAPI Eina_File * EINA_API Eina_File *
eina_file_virtualize(const char *virtual_name, const void *data, unsigned long long length, Eina_Bool copy) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1); eina_file_virtualize(const char *virtual_name, const void *data, unsigned long long length, Eina_Bool copy) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1);
/** /**
@ -536,7 +536,7 @@ eina_file_virtualize(const char *virtual_name, const void *data, unsigned long l
* *
* @since 1.8 * @since 1.8
*/ */
EAPI Eina_Bool EINA_API Eina_Bool
eina_file_virtual(Eina_File *file) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1); eina_file_virtual(Eina_File *file) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1);
/** /**
@ -549,7 +549,7 @@ eina_file_virtual(Eina_File *file) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1);
* *
* @since 1.8 * @since 1.8
*/ */
EAPI Eina_Bool eina_file_refresh(Eina_File *file); EINA_API Eina_Bool eina_file_refresh(Eina_File *file);
/** /**
* @brief Duplicates a read-only handler of a previously open file. * @brief Duplicates a read-only handler of a previously open file.
@ -561,7 +561,7 @@ EAPI Eina_Bool eina_file_refresh(Eina_File *file);
* *
* @since 1.8 * @since 1.8
*/ */
EAPI Eina_File * eina_file_dup(const Eina_File *file); EINA_API Eina_File * eina_file_dup(const Eina_File *file);
/** /**
* @brief Unrefs the file handler. * @brief Unrefs the file handler.
@ -571,7 +571,7 @@ EAPI Eina_File * eina_file_dup(const Eina_File *file);
* *
* @since 1.1 * @since 1.1
*/ */
EAPI void eina_file_close(Eina_File *file); EINA_API void eina_file_close(Eina_File *file);
/** /**
* @brief Gets the file size at open time. * @brief Gets the file size at open time.
@ -581,7 +581,7 @@ EAPI void eina_file_close(Eina_File *file);
* *
* @since 1.1 * @since 1.1
*/ */
EAPI size_t eina_file_size_get(const Eina_File *file); EINA_API size_t eina_file_size_get(const Eina_File *file);
/** /**
* @brief Gets the last modification time of an open file. * @brief Gets the last modification time of an open file.
@ -591,7 +591,7 @@ EAPI size_t eina_file_size_get(const Eina_File *file);
* *
* @since 1.1 * @since 1.1
*/ */
EAPI time_t eina_file_mtime_get(const Eina_File *file); EINA_API time_t eina_file_mtime_get(const Eina_File *file);
/** /**
* @brief Gets the filename of an open file. * @brief Gets the filename of an open file.
@ -601,7 +601,7 @@ EAPI time_t eina_file_mtime_get(const Eina_File *file);
* *
* @since 1.1 * @since 1.1
*/ */
EAPI const char *eina_file_filename_get(const Eina_File *file); EINA_API const char *eina_file_filename_get(const Eina_File *file);
/** /**
* @brief Gets the extended attribute of an open file. * @brief Gets the extended attribute of an open file.
@ -614,7 +614,7 @@ EAPI const char *eina_file_filename_get(const Eina_File *file);
* *
* @since 1.2 * @since 1.2
*/ */
EAPI Eina_Iterator *eina_file_xattr_get(Eina_File *file); EINA_API Eina_Iterator *eina_file_xattr_get(Eina_File *file);
/** /**
* @brief Gets the extended attribute of an open file. * @brief Gets the extended attribute of an open file.
@ -628,7 +628,7 @@ EAPI Eina_Iterator *eina_file_xattr_get(Eina_File *file);
* *
* @since 1.2 * @since 1.2
*/ */
EAPI Eina_Iterator *eina_file_xattr_value_get(Eina_File *file); EINA_API Eina_Iterator *eina_file_xattr_value_get(Eina_File *file);
/** /**
* @brief Maps all the files to a buffer. * @brief Maps all the files to a buffer.
@ -640,7 +640,7 @@ EAPI Eina_Iterator *eina_file_xattr_value_get(Eina_File *file);
* *
* @since 1.1 * @since 1.1
*/ */
EAPI void *eina_file_map_all(Eina_File *file, Eina_File_Populate rule); EINA_API void *eina_file_map_all(Eina_File *file, Eina_File_Populate rule);
/** /**
* @brief Maps a part of the file. * @brief Maps a part of the file.
@ -656,7 +656,7 @@ EAPI void *eina_file_map_all(Eina_File *file, Eina_File_Populate rule);
* *
* @since 1.1 * @since 1.1
*/ */
EAPI void *eina_file_map_new(Eina_File *file, Eina_File_Populate rule, EINA_API void *eina_file_map_new(Eina_File *file, Eina_File_Populate rule,
unsigned long int offset, unsigned long int length); unsigned long int offset, unsigned long int length);
/** /**
@ -667,7 +667,7 @@ EAPI void *eina_file_map_new(Eina_File *file, Eina_File_Populate rule,
* *
* @since 1.1 * @since 1.1
*/ */
EAPI void eina_file_map_free(Eina_File *file, void *map); EINA_API void eina_file_map_free(Eina_File *file, void *map);
/** /**
* @brief Asks the OS to populate or otherwise pages of memory in file mapping. * @brief Asks the OS to populate or otherwise pages of memory in file mapping.
@ -683,7 +683,7 @@ EAPI void eina_file_map_free(Eina_File *file, void *map);
* *
* @since 1.8 * @since 1.8
*/ */
EAPI void EINA_API void
eina_file_map_populate(Eina_File *file, Eina_File_Populate rule, const void *map, eina_file_map_populate(Eina_File *file, Eina_File_Populate rule, const void *map,
unsigned long int offset, unsigned long int length); unsigned long int offset, unsigned long int length);
@ -698,7 +698,7 @@ eina_file_map_populate(Eina_File *file, Eina_File_Populate rule, const void *map
* *
* @since 1.3 * @since 1.3
*/ */
EAPI Eina_Iterator *eina_file_map_lines(Eina_File *file); EINA_API Eina_Iterator *eina_file_map_lines(Eina_File *file);
/** /**
* @brief Tells whether there has been an IO error during the life of a mmaped file. * @brief Tells whether there has been an IO error during the life of a mmaped file.
@ -709,7 +709,7 @@ EAPI Eina_Iterator *eina_file_map_lines(Eina_File *file);
* *
* @since 1.2 * @since 1.2
*/ */
EAPI Eina_Bool eina_file_map_faulted(Eina_File *file, void *map); EINA_API Eina_Bool eina_file_map_faulted(Eina_File *file, void *map);
/** /**
* @brief Joins two paths of known length. * @brief Joins two paths of known length.
@ -768,7 +768,7 @@ static inline size_t eina_file_path_join(char *dst,
* *
* @since 1.19 * @since 1.19
*/ */
EAPI Eina_Bool eina_file_unlink(const char *pathname); EINA_API Eina_Bool eina_file_unlink(const char *pathname);
/** /**
* @brief Make sure a file descriptor will be closed on exec. * @brief Make sure a file descriptor will be closed on exec.
@ -781,7 +781,7 @@ EAPI Eina_Bool eina_file_unlink(const char *pathname);
* *
* @since 1.20 * @since 1.20
*/ */
EAPI Eina_Bool eina_file_close_on_exec(int fd, Eina_Bool on); EINA_API Eina_Bool eina_file_close_on_exec(int fd, Eina_Bool on);
#include "eina_inline_file.x" #include "eina_inline_file.x"
@ -796,26 +796,26 @@ typedef unsigned int Eina_Statgen;
* @brief Force the stat generation counter to tick over so any following i/o does real i/o and stat calls * @brief Force the stat generation counter to tick over so any following i/o does real i/o and stat calls
* @since 1.23 * @since 1.23
*/ */
EAPI void eina_file_statgen_next(void); EINA_API void eina_file_statgen_next(void);
/** /**
* @brief Get the current stat generation counter value * @brief Get the current stat generation counter value
* @return 0 if you should always do stat calls and compare, or some other value that changes like a generation counter * @return 0 if you should always do stat calls and compare, or some other value that changes like a generation counter
* @since 1.23 * @since 1.23
*/ */
EAPI Eina_Statgen eina_file_statgen_get(void); EINA_API Eina_Statgen eina_file_statgen_get(void);
/** /**
* @brief Enable stat generation count optimiziing to only stat/do file i/o between generation counts changing * @brief Enable stat generation count optimiziing to only stat/do file i/o between generation counts changing
* @since 1.23 * @since 1.23
*/ */
EAPI void eina_file_statgen_enable(void); EINA_API void eina_file_statgen_enable(void);
/** /**
* @brief Disable stat generation count optimiziing to only stat/do file i/o between generation counts changing * @brief Disable stat generation count optimiziing to only stat/do file i/o between generation counts changing
* @since 1.23 * @since 1.23
*/ */
EAPI void eina_file_statgen_disable(void); EINA_API void eina_file_statgen_disable(void);
/** /**
* @} * @}

View File

@ -73,7 +73,7 @@ Eina_Lock _eina_file_lock_cache;
static Eina_Spinlock _eina_statgen_lock; static Eina_Spinlock _eina_statgen_lock;
static Eina_Statgen _eina_statgen = 0; static Eina_Statgen _eina_statgen = 0;
EAPI void EINA_API void
eina_file_statgen_next(void) eina_file_statgen_next(void)
{ {
eina_spinlock_take(&_eina_statgen_lock); eina_spinlock_take(&_eina_statgen_lock);
@ -85,7 +85,7 @@ eina_file_statgen_next(void)
eina_spinlock_release(&_eina_statgen_lock); eina_spinlock_release(&_eina_statgen_lock);
} }
EAPI Eina_Statgen EINA_API Eina_Statgen
eina_file_statgen_get(void) eina_file_statgen_get(void)
{ {
Eina_Statgen s; Eina_Statgen s;
@ -95,7 +95,7 @@ eina_file_statgen_get(void)
return s; return s;
} }
EAPI void EINA_API void
eina_file_statgen_enable(void) eina_file_statgen_enable(void)
{ {
eina_spinlock_take(&_eina_statgen_lock); eina_spinlock_take(&_eina_statgen_lock);
@ -103,7 +103,7 @@ eina_file_statgen_enable(void)
eina_spinlock_release(&_eina_statgen_lock); eina_spinlock_release(&_eina_statgen_lock);
} }
EAPI void EINA_API void
eina_file_statgen_disable(void) eina_file_statgen_disable(void)
{ {
eina_spinlock_take(&_eina_statgen_lock); eina_spinlock_take(&_eina_statgen_lock);
@ -405,7 +405,7 @@ _eina_file_map_close(Eina_File_Map *map)
// Global API // Global API
EAPI char * EINA_API char *
eina_file_path_sanitize(const char *path) eina_file_path_sanitize(const char *path)
{ {
Eina_Tmpstr *result = NULL; Eina_Tmpstr *result = NULL;
@ -430,7 +430,7 @@ eina_file_path_sanitize(const char *path)
return r; return r;
} }
EAPI Eina_File * EINA_API Eina_File *
eina_file_virtualize(const char *virtual_name, const void *data, unsigned long long length, Eina_Bool copy) eina_file_virtualize(const char *virtual_name, const void *data, unsigned long long length, Eina_Bool copy)
{ {
Eina_File *file; Eina_File *file;
@ -494,7 +494,7 @@ eina_file_virtualize(const char *virtual_name, const void *data, unsigned long l
return file; return file;
} }
EAPI Eina_Bool EINA_API Eina_Bool
eina_file_virtual(Eina_File *file) eina_file_virtual(Eina_File *file)
{ {
if (!file) return EINA_FALSE; if (!file) return EINA_FALSE;
@ -502,7 +502,7 @@ eina_file_virtual(Eina_File *file)
return file->virtual; return file->virtual;
} }
EAPI Eina_File * EINA_API Eina_File *
eina_file_dup(const Eina_File *f) eina_file_dup(const Eina_File *f)
{ {
Eina_File *file = (Eina_File*) f; Eina_File *file = (Eina_File*) f;
@ -544,7 +544,7 @@ eina_file_clean_close(Eina_File *file)
free(file); free(file);
} }
EAPI void EINA_API void
eina_file_close(Eina_File *file) eina_file_close(Eina_File *file)
{ {
Eina_Bool leave = EINA_TRUE; Eina_Bool leave = EINA_TRUE;
@ -574,21 +574,21 @@ eina_file_close(Eina_File *file)
eina_lock_release(&_eina_file_lock_cache); eina_lock_release(&_eina_file_lock_cache);
} }
EAPI size_t EINA_API size_t
eina_file_size_get(const Eina_File *file) eina_file_size_get(const Eina_File *file)
{ {
EINA_FILE_MAGIC_CHECK(file, 0); EINA_FILE_MAGIC_CHECK(file, 0);
return file->length; return file->length;
} }
EAPI time_t EINA_API time_t
eina_file_mtime_get(const Eina_File *file) eina_file_mtime_get(const Eina_File *file)
{ {
EINA_FILE_MAGIC_CHECK(file, 0); EINA_FILE_MAGIC_CHECK(file, 0);
return file->mtime; return file->mtime;
} }
EAPI const char * EINA_API const char *
eina_file_filename_get(const Eina_File *file) eina_file_filename_get(const Eina_File *file)
{ {
EINA_FILE_MAGIC_CHECK(file, NULL); EINA_FILE_MAGIC_CHECK(file, NULL);
@ -695,7 +695,7 @@ _eina_file_map_lines_iterator_free(Eina_Lines_Iterator *it)
free(it); free(it);
} }
EAPI Eina_Iterator * EINA_API Eina_Iterator *
eina_file_map_lines(Eina_File *file) eina_file_map_lines(Eina_File *file)
{ {
Eina_Lines_Iterator *it; Eina_Lines_Iterator *it;
@ -952,7 +952,7 @@ _eina_file_copy_internal(int s, int d, off_t total, Eina_File_Copy_Progress cb,
return ret; return ret;
} }
EAPI Eina_Bool EINA_API Eina_Bool
eina_file_copy(const char *src, const char *dst, Eina_File_Copy_Flags flags, Eina_File_Copy_Progress cb, const void *cb_data) eina_file_copy(const char *src, const char *dst, Eina_File_Copy_Flags flags, Eina_File_Copy_Progress cb, const void *cb_data)
{ {
struct stat st; struct stat st;
@ -993,7 +993,7 @@ eina_file_copy(const char *src, const char *dst, Eina_File_Copy_Flags flags, Ein
return success; return success;
} }
EAPI int EINA_API int
eina_file_mkstemp(const char *templatename, Eina_Tmpstr **path) eina_file_mkstemp(const char *templatename, Eina_Tmpstr **path)
{ {
char buffer[PATH_MAX]; char buffer[PATH_MAX];
@ -1052,7 +1052,7 @@ eina_file_mkstemp(const char *templatename, Eina_Tmpstr **path)
return fd; return fd;
} }
EAPI Eina_Bool EINA_API Eina_Bool
eina_file_mkdtemp(const char *templatename, Eina_Tmpstr **path) eina_file_mkdtemp(const char *templatename, Eina_Tmpstr **path)
{ {
char buffer[PATH_MAX]; char buffer[PATH_MAX];
@ -1147,7 +1147,7 @@ eina_file_shutdown(void)
return EINA_TRUE; return EINA_TRUE;
} }
EAPI Eina_Bool EINA_API Eina_Bool
eina_file_close_on_exec(int fd, Eina_Bool on) eina_file_close_on_exec(int fd, Eina_Bool on)
{ {
#ifdef _WIN32 #ifdef _WIN32

View File

@ -450,7 +450,7 @@ eina_file_cleanup(Eina_Tmpstr *path)
* API * * API *
*============================================================================*/ *============================================================================*/
EAPI Eina_Bool EINA_API Eina_Bool
eina_file_dir_list(const char *dir, eina_file_dir_list(const char *dir,
Eina_Bool recursive, Eina_Bool recursive,
Eina_File_Dir_List_Cb cb, Eina_File_Dir_List_Cb cb,
@ -512,7 +512,7 @@ eina_file_dir_list(const char *dir,
return EINA_TRUE; return EINA_TRUE;
} }
EAPI Eina_Array * EINA_API Eina_Array *
eina_file_split(char *path) eina_file_split(char *path)
{ {
Eina_Array *ea; Eina_Array *ea;
@ -545,7 +545,7 @@ eina_file_split(char *path)
return ea; return ea;
} }
EAPI Eina_Iterator * EINA_API Eina_Iterator *
eina_file_ls(const char *dir) eina_file_ls(const char *dir)
{ {
Eina_File_Iterator *it; Eina_File_Iterator *it;
@ -590,7 +590,7 @@ eina_file_ls(const char *dir)
return NULL; return NULL;
} }
EAPI Eina_Iterator * EINA_API Eina_Iterator *
eina_file_direct_ls(const char *dir) eina_file_direct_ls(const char *dir)
{ {
Eina_File_Direct_Iterator *it; Eina_File_Direct_Iterator *it;
@ -641,13 +641,13 @@ eina_file_direct_ls(const char *dir)
return NULL; return NULL;
} }
EAPI Eina_Iterator * EINA_API Eina_Iterator *
eina_file_stat_ls(const char *dir) eina_file_stat_ls(const char *dir)
{ {
return eina_file_direct_ls(dir); return eina_file_direct_ls(dir);
} }
EAPI Eina_Bool EINA_API Eina_Bool
eina_file_refresh(Eina_File *file) eina_file_refresh(Eina_File *file)
{ {
WIN32_FILE_ATTRIBUTE_DATA fad; WIN32_FILE_ATTRIBUTE_DATA fad;
@ -679,7 +679,7 @@ eina_file_refresh(Eina_File *file)
return r; return r;
} }
EAPI Eina_File * EINA_API Eina_File *
eina_file_open(const char *path, Eina_Bool shared) eina_file_open(const char *path, Eina_Bool shared)
{ {
Eina_File *file; Eina_File *file;
@ -788,7 +788,7 @@ eina_file_open(const char *path, Eina_Bool shared)
return NULL; return NULL;
} }
EAPI Eina_Bool EINA_API Eina_Bool
eina_file_unlink(const char *pathname) eina_file_unlink(const char *pathname)
{ {
Eina_Stringshare *unlink_path = eina_file_sanitize(pathname); Eina_Stringshare *unlink_path = eina_file_sanitize(pathname);
@ -827,23 +827,23 @@ eina_file_unlink(const char *pathname)
} }
EAPI Eina_Iterator *eina_file_xattr_get(Eina_File *file EINA_UNUSED) EINA_API Eina_Iterator *eina_file_xattr_get(Eina_File *file EINA_UNUSED)
{ {
return NULL; return NULL;
} }
EAPI Eina_Iterator *eina_file_xattr_value_get(Eina_File *file EINA_UNUSED) EINA_API Eina_Iterator *eina_file_xattr_value_get(Eina_File *file EINA_UNUSED)
{ {
return NULL; return NULL;
} }
EAPI void EINA_API void
eina_file_map_populate(Eina_File *file EINA_UNUSED, Eina_File_Populate rule EINA_UNUSED, const void *map EINA_UNUSED, eina_file_map_populate(Eina_File *file EINA_UNUSED, Eina_File_Populate rule EINA_UNUSED, const void *map EINA_UNUSED,
unsigned long int offset EINA_UNUSED, unsigned long int length EINA_UNUSED) unsigned long int offset EINA_UNUSED, unsigned long int length EINA_UNUSED)
{ {
} }
EAPI void * EINA_API void *
eina_file_map_all(Eina_File *file, Eina_File_Populate rule EINA_UNUSED) eina_file_map_all(Eina_File *file, Eina_File_Populate rule EINA_UNUSED)
{ {
EINA_SAFETY_ON_NULL_RETURN_VAL(file, NULL); EINA_SAFETY_ON_NULL_RETURN_VAL(file, NULL);
@ -886,7 +886,7 @@ eina_file_map_all(Eina_File *file, Eina_File_Populate rule EINA_UNUSED)
return NULL; return NULL;
} }
EAPI void * EINA_API void *
eina_file_map_new(Eina_File *file, Eina_File_Populate rule, eina_file_map_new(Eina_File *file, Eina_File_Populate rule,
unsigned long int offset, unsigned long int length) unsigned long int offset, unsigned long int length)
{ {
@ -959,7 +959,7 @@ eina_file_map_new(Eina_File *file, Eina_File_Populate rule,
return map->map; return map->map;
} }
EAPI void EINA_API void
eina_file_map_free(Eina_File *file, void *map) eina_file_map_free(Eina_File *file, void *map)
{ {
EINA_SAFETY_ON_NULL_RETURN(file); EINA_SAFETY_ON_NULL_RETURN(file);
@ -990,7 +990,7 @@ eina_file_map_free(Eina_File *file, void *map)
eina_lock_release(&file->lock); eina_lock_release(&file->lock);
} }
EAPI Eina_Bool EINA_API Eina_Bool
eina_file_map_faulted(Eina_File *file, void *map EINA_UNUSED) eina_file_map_faulted(Eina_File *file, void *map EINA_UNUSED)
{ {
#warning "We need to handle access to corrupted memory mapped file." #warning "We need to handle access to corrupted memory mapped file."
@ -1028,7 +1028,7 @@ eina_file_map_faulted(Eina_File *file, void *map EINA_UNUSED)
return EINA_FALSE; return EINA_FALSE;
} }
EAPI int EINA_API int
eina_file_statat(void *container EINA_UNUSED, Eina_File_Direct_Info *info, Eina_Stat *st) eina_file_statat(void *container EINA_UNUSED, Eina_File_Direct_Info *info, Eina_Stat *st)
{ {
struct __stat64 buf; struct __stat64 buf;
@ -1036,7 +1036,7 @@ eina_file_statat(void *container EINA_UNUSED, Eina_File_Direct_Info *info, Eina_
EINA_SAFETY_ON_NULL_RETURN_VAL(info, -1); EINA_SAFETY_ON_NULL_RETURN_VAL(info, -1);
EINA_SAFETY_ON_NULL_RETURN_VAL(st, -1); EINA_SAFETY_ON_NULL_RETURN_VAL(st, -1);
if (stat64(info->path, &buf)) if (_stat64(info->path, &buf))
{ {
info->type = EINA_FILE_UNKNOWN; info->type = EINA_FILE_UNKNOWN;
return -1; return -1;
@ -1044,9 +1044,12 @@ eina_file_statat(void *container EINA_UNUSED, Eina_File_Direct_Info *info, Eina_
if (info->type == EINA_FILE_UNKNOWN) if (info->type == EINA_FILE_UNKNOWN)
{ {
if (S_ISREG(buf.st_mode)) #define EINA_S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
#define EINA_S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
if (EINA_S_ISREG(buf.st_mode))
info->type = EINA_FILE_REG; info->type = EINA_FILE_REG;
else if (S_ISDIR(buf.st_mode)) else if (EINA_S_ISDIR(buf.st_mode))
info->type = EINA_FILE_DIR; info->type = EINA_FILE_DIR;
else else
info->type = EINA_FILE_UNKNOWN; info->type = EINA_FILE_UNKNOWN;

249
src/lib/eina/eina_fnmatch.c Normal file
View File

@ -0,0 +1,249 @@
#include "eina_fnmatch.h"
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <pcreposix.h>
inline static int
_is_escapable(char c)
{
switch (c)
{
case '[': case '|': case '(': case ')': case '*': case '?':
case '!': case '^': case '$': case '.': case '+': case '\\':
return 1;
default:
return 0;
}
}
inline static char *
_wildcards_to_regex(const char *pattern, int flags)
{
// Counts how many additional chars needs to be allocated
int pattern_length = strlen(pattern);
int count = 2; // starts with '^' and ends with '$'
for (int j = 0; j < pattern_length; ++j)
{
if (pattern[j] == '\\')
{
if (flags & FNM_NOESCAPE) count++;
else count += 2;
}
else if ((pattern[j] == '*') || (pattern[j] == '?'))
{
if (flags & FNM_PATHNAME)
{
if (flags & FNM_PERIOD) // PATHNAME + PERIOD
{
if (pattern[j] == '*')
{
if (j == 0) count += 10;
else if (pattern[j - 1] == '/') count += 10;
else count += 5;
}
else if ((j == 0) || (pattern[j - 1] == '/')) count += 10;
else count += 4;
}
else if (pattern[j] == '*') count += 5; // PATHNAME
else count += 4;
}
else if (flags & FNM_PERIOD)
{
if (j == 0) // period at init
{
if (pattern[j] == '*') count += 5;
else count += 4;
}
// period at other places
else if (pattern[j] == '*') count += 2;
else count++;
}
else if (pattern[j] == '*') count += 2; // NORMAL
else count++;
}
else if (pattern[j] == '.') count += 4;
else count++; // OTHERS
}
int reg_length = pattern_length + count;
// Translates wildcards to regex
char *reg_pattern = (char *)malloc(reg_length * sizeof(char));
if (reg_pattern == NULL) exit(ENOMEM);
reg_pattern[0] = '^';
int i = 1;
for (int j = 0; j < pattern_length; ++j)
{
if (pattern[j] == '\\')
{
if (flags & FNM_NOESCAPE)
reg_pattern[i++] = '/';
else if (_is_escapable(pattern[j + 1]))
{
reg_pattern[i++] = '\\';
reg_pattern[i++] = pattern[++j];
}
else
{
reg_pattern[i++] = '\\';
reg_pattern[i++] = '/';
}
}
else if ((pattern[j] == '*') || (pattern[j] == '?'))
{
if (flags & FNM_PATHNAME)
{
if (flags & FNM_PERIOD) // PATHNAME + PERIOD
{
if (pattern[j] == '*')
{
if ( (j == 0) || (pattern[j - 1] == '/') )
{
strcpy_s(reg_pattern + i,
sizeof(reg_pattern + i),
"[^\\.][^/]*");
i += 10;
}
else
{
strcpy_s(reg_pattern + i,
sizeof(reg_pattern + i),
"[^/]*");
i += 5;
}
}
else if (j == 0)
{
strcpy_s(reg_pattern + i,
sizeof(reg_pattern + i),
"[^\\.][^/]?");
i += 10;
}
else if (pattern[j - 1] == '/')
{
strcpy_s(reg_pattern + i,
sizeof(reg_pattern + i),
"[^\\.][^/]?");
i += 10;
}
else
{
strcpy_s(reg_pattern + i,
sizeof(reg_pattern + i),
"[^/]");
i += 4;
}
}
else if (pattern[j] == '*') // PATHNAME
{
strcpy_s(reg_pattern + i,
sizeof(reg_pattern + i),
"[^/]*");
i += 5;
}
else
{
strcpy_s(reg_pattern + i,
sizeof(reg_pattern + i),
"[^/]");
i += 4;
}
}
else if (flags & FNM_PERIOD)
{
if (j == 0) // period at init
{
if (pattern[j] == '*')
{
strcpy_s(reg_pattern + i,
sizeof(reg_pattern + i),
"[\\.]*");
i += 5;
}
else
{
strcpy_s(reg_pattern + i,
sizeof(reg_pattern + i),
"[\\.]");
i += 4;
}
}
else if (pattern[j] == '*') // period at other places
{
strcpy_s(reg_pattern + i,
sizeof(reg_pattern + i),
".*");
i += 2;
}
else
reg_pattern[i++] = '.';
}
else if (pattern[j] == '*') // NORMAL
{
strcpy_s(reg_pattern + i,
sizeof(reg_pattern + i),
".*");
i += 2;
}
else
{
strcpy_s(reg_pattern + i,
sizeof(reg_pattern + i),
".");
i++;
}
}
else if (pattern[j] == '.')
{
strcpy_s(reg_pattern + i,
sizeof(reg_pattern + i),
"[\\.]");
i += 4;
}
else reg_pattern[i++] = pattern[j]; // OTHERS
}
strcpy_s(reg_pattern + i,
sizeof(reg_pattern + i),
"$\0");
return reg_pattern;
}
int
eina_fnmatch(const char *pattern, const char *string, int flags)
{
// Converts wildcard pattern to regex pattern
char *reg_pattern = _wildcards_to_regex(pattern, flags);
// Configures regex
int regex_flags = (REG_NOSUB) // Report only success/fail in regexec()
|| ((flags & FNM_CASEFOLD) ? REG_ICASE : 0);
// Compiles regex
regex_t regex;
if (regcomp(&regex, reg_pattern, regex_flags))
{
regfree(&regex);
return FNM_NOMATCH;
}
// Replaces '\\' with '/'
int string_length = strlen(string);
char *unix_path = (char *)malloc(string_length * sizeof(char));
if (unix_path == NULL) exit(ENOMEM);
unix_path[string_length] = '\0';
for (int i = 0; i < string_length; ++i)
unix_path[i] = (string[i] == '\\') ? '/' : string[i];
// Executes regex
int result = regexec(&regex, unix_path, 0, NULL, 0);
// Cleans-up and returns
free(unix_path);
free(reg_pattern);
regfree(&regex);
return result ? FNM_NOMATCH : 0;
}

View File

@ -0,0 +1,37 @@
#ifndef EINA_FNMATCH_H
#define EINA_FNMATCH_H
#ifdef __cplusplus
extern "C"
{
#endif
#ifdef _WIN32
/* Bits set in the FLAGS argument to `fnmatch'. */
#define FNM_PATHNAME (1 << 0) /* No wildcard can ever match `/'. */
#define FNM_NOESCAPE (1 << 1) /* Backslashes don't quote special chars. */
#define FNM_PERIOD (1 << 2) /* Leading `.' is matched only explicitly. */
#define FNM_FILE_NAME FNM_PATHNAME /* Preferred GNU name. */
#define FNM_LEADING_DIR (1 << 3) /* Ignore `/...' after a match. */
#define FNM_CASEFOLD (1 << 4) /* Compare without regard to case. */
/* Value returned by `fnmatch' if STRING does not match PATTERN. */
#define FNM_NOMATCH 1
int eina_fnmatch(const char *pattern, const char *string, int flags);
#else /* _WIN32 */
//#define eina_fnmatch(a,b,c) fnmatch(a,b,c)
#include <fnmatch.h>
#define eina_fnmatch fnmatch
#endif /* _WIN32 */
#ifdef __cplusplus
}
#endif
#endif /* EINA_FNMATCH_H */

View File

@ -423,7 +423,7 @@ static const Eina_F32p32 eina_trigo[MAX_PREC] =
0x0000000000653d02, 0x0000000000000000 0x0000000000653d02, 0x0000000000000000
}; };
EAPI Eina_F32p32 EINA_API Eina_F32p32
eina_f32p32_cos(Eina_F32p32 a) eina_f32p32_cos(Eina_F32p32 a)
{ {
Eina_F32p32 F32P32_2PI; Eina_F32p32 F32P32_2PI;
@ -471,7 +471,7 @@ eina_f32p32_cos(Eina_F32p32 a)
return result; return result;
} }
EAPI Eina_F32p32 EINA_API Eina_F32p32
eina_f32p32_sin(Eina_F32p32 a) eina_f32p32_sin(Eina_F32p32 a)
{ {
Eina_F32p32 F32P32_PI2; Eina_F32p32 F32P32_PI2;

View File

@ -194,7 +194,7 @@ static inline unsigned int eina_f32p32_fracc_get(Eina_F32p32 v);
* @param[in] a The angle in radians to calculate the cosine from. * @param[in] a The angle in radians to calculate the cosine from.
* @return The cosine of the angle @p a * @return The cosine of the angle @p a
*/ */
EAPI Eina_F32p32 eina_f32p32_cos(Eina_F32p32 a); EINA_API Eina_F32p32 eina_f32p32_cos(Eina_F32p32 a);
/** /**
* @brief Calculates the sine of a floating point number * @brief Calculates the sine of a floating point number
@ -202,7 +202,7 @@ EAPI Eina_F32p32 eina_f32p32_cos(Eina_F32p32 a);
* @param[in] a The angle in radians to calculate the sine from. * @param[in] a The angle in radians to calculate the sine from.
* @return The cosine of the angle @p a * @return The cosine of the angle @p a
*/ */
EAPI Eina_F32p32 eina_f32p32_sin(Eina_F32p32 a); EINA_API Eina_F32p32 eina_f32p32_sin(Eina_F32p32 a);
/** /**

View File

@ -431,7 +431,7 @@ _eina_freeq_new_postponed(void)
return fq; return fq;
} }
EAPI Eina_FreeQ * EINA_API Eina_FreeQ *
eina_freeq_new(Eina_FreeQ_Type type) eina_freeq_new(Eina_FreeQ_Type type)
{ {
switch (type) switch (type)
@ -445,7 +445,7 @@ eina_freeq_new(Eina_FreeQ_Type type)
} }
} }
EAPI void EINA_API void
eina_freeq_free(Eina_FreeQ *fq) eina_freeq_free(Eina_FreeQ *fq)
{ {
if (!fq) return; if (!fq) return;
@ -455,7 +455,7 @@ eina_freeq_free(Eina_FreeQ *fq)
free(fq); free(fq);
} }
EAPI Eina_FreeQ_Type EINA_API Eina_FreeQ_Type
eina_freeq_type_get(Eina_FreeQ *fq) eina_freeq_type_get(Eina_FreeQ *fq)
{ {
if (fq && fq->postponed) if (fq && fq->postponed)
@ -470,13 +470,13 @@ eina_freeq_main_set(Eina_FreeQ *fq)
_eina_freeq_main = fq; _eina_freeq_main = fq;
} }
EAPI Eina_FreeQ * EINA_API Eina_FreeQ *
eina_freeq_main_get(void) eina_freeq_main_get(void)
{ {
return _eina_freeq_main; return _eina_freeq_main;
} }
EAPI void EINA_API void
eina_freeq_count_max_set(Eina_FreeQ *fq, int count) eina_freeq_count_max_set(Eina_FreeQ *fq, int count)
{ {
if (!fq) return; if (!fq) return;
@ -489,7 +489,7 @@ eina_freeq_count_max_set(Eina_FreeQ *fq, int count)
UNLOCK_FQ(fq); UNLOCK_FQ(fq);
} }
EAPI int EINA_API int
eina_freeq_count_max_get(Eina_FreeQ *fq) eina_freeq_count_max_get(Eina_FreeQ *fq)
{ {
int count; int count;
@ -502,7 +502,7 @@ eina_freeq_count_max_get(Eina_FreeQ *fq)
return count; return count;
} }
EAPI void EINA_API void
eina_freeq_mem_max_set(Eina_FreeQ *fq, size_t mem) eina_freeq_mem_max_set(Eina_FreeQ *fq, size_t mem)
{ {
if (!fq) return; if (!fq) return;
@ -514,7 +514,7 @@ eina_freeq_mem_max_set(Eina_FreeQ *fq, size_t mem)
UNLOCK_FQ(fq); UNLOCK_FQ(fq);
} }
EAPI size_t EINA_API size_t
eina_freeq_mem_max_get(Eina_FreeQ *fq) eina_freeq_mem_max_get(Eina_FreeQ *fq)
{ {
size_t mem; size_t mem;
@ -527,7 +527,7 @@ eina_freeq_mem_max_get(Eina_FreeQ *fq)
return mem; return mem;
} }
EAPI void EINA_API void
eina_freeq_clear(Eina_FreeQ *fq) eina_freeq_clear(Eina_FreeQ *fq)
{ {
if (!fq) return; if (!fq) return;
@ -537,7 +537,7 @@ eina_freeq_clear(Eina_FreeQ *fq)
UNLOCK_FQ(fq); UNLOCK_FQ(fq);
} }
EAPI void EINA_API void
eina_freeq_reduce(Eina_FreeQ *fq, int count) eina_freeq_reduce(Eina_FreeQ *fq, int count)
{ {
if (!fq) return; if (!fq) return;
@ -551,7 +551,7 @@ eina_freeq_reduce(Eina_FreeQ *fq, int count)
UNLOCK_FQ(fq); UNLOCK_FQ(fq);
} }
EAPI Eina_Bool EINA_API Eina_Bool
eina_freeq_ptr_pending(Eina_FreeQ *fq) eina_freeq_ptr_pending(Eina_FreeQ *fq)
{ {
Eina_Bool pending; Eina_Bool pending;
@ -564,7 +564,7 @@ eina_freeq_ptr_pending(Eina_FreeQ *fq)
return pending; return pending;
} }
EAPI void EINA_API void
eina_freeq_ptr_add(Eina_FreeQ *fq, eina_freeq_ptr_add(Eina_FreeQ *fq,
void *ptr, void *ptr,
void (*free_func) (void *ptr), void (*free_func) (void *ptr),

View File

@ -126,7 +126,7 @@ typedef enum _Eina_FreeQ_Type
* @return A new free queue * @return A new free queue
* @since 1.19 * @since 1.19
*/ */
EAPI Eina_FreeQ * EINA_API Eina_FreeQ *
eina_freeq_new(Eina_FreeQ_Type type); eina_freeq_new(Eina_FreeQ_Type type);
/** /**
@ -136,7 +136,7 @@ eina_freeq_new(Eina_FreeQ_Type type);
* *
* @since 1.19 * @since 1.19
*/ */
EAPI void EINA_API void
eina_freeq_free(Eina_FreeQ *fq); eina_freeq_free(Eina_FreeQ *fq);
/** /**
@ -146,7 +146,7 @@ eina_freeq_free(Eina_FreeQ *fq);
* *
* @since 1.19 * @since 1.19
*/ */
EAPI Eina_FreeQ_Type EINA_API Eina_FreeQ_Type
eina_freeq_type_get(Eina_FreeQ *fq); eina_freeq_type_get(Eina_FreeQ *fq);
/** /**
@ -156,7 +156,7 @@ eina_freeq_type_get(Eina_FreeQ *fq);
* *
* @since 1.19 * @since 1.19
*/ */
EAPI Eina_FreeQ * EINA_API Eina_FreeQ *
eina_freeq_main_get(void); eina_freeq_main_get(void);
/** /**
@ -177,7 +177,7 @@ eina_freeq_main_get(void);
* *
* @since 1.19 * @since 1.19
*/ */
EAPI void EINA_API void
eina_freeq_count_max_set(Eina_FreeQ *fq, int count); eina_freeq_count_max_set(Eina_FreeQ *fq, int count);
/** /**
@ -188,7 +188,7 @@ eina_freeq_count_max_set(Eina_FreeQ *fq, int count);
* *
* @since 1.19 * @since 1.19
*/ */
EAPI int EINA_API int
eina_freeq_count_max_get(Eina_FreeQ *fq); eina_freeq_count_max_get(Eina_FreeQ *fq);
/** /**
@ -210,7 +210,7 @@ eina_freeq_count_max_get(Eina_FreeQ *fq);
* *
* @since 1.19 * @since 1.19
*/ */
EAPI void EINA_API void
eina_freeq_mem_max_set(Eina_FreeQ *fq, size_t mem); eina_freeq_mem_max_set(Eina_FreeQ *fq, size_t mem);
/** /**
@ -221,7 +221,7 @@ eina_freeq_mem_max_set(Eina_FreeQ *fq, size_t mem);
* *
* @since 1.19 * @since 1.19
*/ */
EAPI size_t EINA_API size_t
eina_freeq_mem_max_get(Eina_FreeQ *fq); eina_freeq_mem_max_get(Eina_FreeQ *fq);
/** /**
@ -235,7 +235,7 @@ eina_freeq_mem_max_get(Eina_FreeQ *fq);
* *
* @since 1.19 * @since 1.19
*/ */
EAPI void EINA_API void
eina_freeq_clear(Eina_FreeQ *fq); eina_freeq_clear(Eina_FreeQ *fq);
/** /**
@ -251,7 +251,7 @@ eina_freeq_clear(Eina_FreeQ *fq);
* *
* @since 1.19 * @since 1.19
*/ */
EAPI void EINA_API void
eina_freeq_reduce(Eina_FreeQ *fq, int count); eina_freeq_reduce(Eina_FreeQ *fq, int count);
/** /**
@ -262,7 +262,7 @@ eina_freeq_reduce(Eina_FreeQ *fq, int count);
* *
* @since 1.19 * @since 1.19
*/ */
EAPI Eina_Bool EINA_API Eina_Bool
eina_freeq_ptr_pending(Eina_FreeQ *fq); eina_freeq_ptr_pending(Eina_FreeQ *fq);
/** /**
@ -306,7 +306,7 @@ eina_freeq_ptr_pending(Eina_FreeQ *fq);
* *
* @since 1.19 * @since 1.19
*/ */
EAPI void EINA_API void
eina_freeq_ptr_add(Eina_FreeQ *fq, void *ptr, void (*free_func) (void *ptr), size_t size); eina_freeq_ptr_add(Eina_FreeQ *fq, void *ptr, void (*free_func) (void *ptr), size_t size);
/** /**

View File

@ -53,7 +53,7 @@ static const int _eina_hamster =
* API * * API *
*============================================================================*/ *============================================================================*/
EAPI int EINA_API int
eina_hamster_count(void) eina_hamster_count(void)
{ {
return _eina_hamster; return _eina_hamster;

View File

@ -40,7 +40,7 @@
* *
* This function returns how many hamsters you have. * This function returns how many hamsters you have.
*/ */
EAPI int eina_hamster_count(void); EINA_API int eina_hamster_count(void);
/** /**
* @} * @}

View File

@ -729,7 +729,7 @@ _eina_hash_iterator_free(Eina_Iterator_Hash *it)
* API * * API *
*============================================================================*/ *============================================================================*/
EAPI void EINA_API void
eina_hash_free_cb_set(Eina_Hash *hash, Eina_Free_Cb data_free_cb) eina_hash_free_cb_set(Eina_Hash *hash, Eina_Free_Cb data_free_cb)
{ {
EINA_MAGIC_CHECK_HASH(hash); EINA_MAGIC_CHECK_HASH(hash);
@ -738,7 +738,7 @@ eina_hash_free_cb_set(Eina_Hash *hash, Eina_Free_Cb data_free_cb)
hash->data_free_cb = data_free_cb; hash->data_free_cb = data_free_cb;
} }
EAPI Eina_Hash * EINA_API Eina_Hash *
eina_hash_new(Eina_Key_Length key_length_cb, eina_hash_new(Eina_Key_Length key_length_cb,
Eina_Key_Cmp key_cmp_cb, Eina_Key_Cmp key_cmp_cb,
Eina_Key_Hash key_hash_cb, Eina_Key_Hash key_hash_cb,
@ -776,7 +776,7 @@ on_error:
return NULL; return NULL;
} }
EAPI Eina_Hash * EINA_API Eina_Hash *
eina_hash_string_djb2_new(Eina_Free_Cb data_free_cb) eina_hash_string_djb2_new(Eina_Free_Cb data_free_cb)
{ {
return eina_hash_new(EINA_KEY_LENGTH(_eina_string_key_length), return eina_hash_new(EINA_KEY_LENGTH(_eina_string_key_length),
@ -786,7 +786,7 @@ eina_hash_string_djb2_new(Eina_Free_Cb data_free_cb)
EINA_HASH_BUCKET_SIZE); EINA_HASH_BUCKET_SIZE);
} }
EAPI Eina_Hash * EINA_API Eina_Hash *
eina_hash_string_superfast_new(Eina_Free_Cb data_free_cb) eina_hash_string_superfast_new(Eina_Free_Cb data_free_cb)
{ {
return eina_hash_new(EINA_KEY_LENGTH(_eina_string_key_length), return eina_hash_new(EINA_KEY_LENGTH(_eina_string_key_length),
@ -796,7 +796,7 @@ eina_hash_string_superfast_new(Eina_Free_Cb data_free_cb)
EINA_HASH_BUCKET_SIZE); EINA_HASH_BUCKET_SIZE);
} }
EAPI Eina_Hash * EINA_API Eina_Hash *
eina_hash_string_small_new(Eina_Free_Cb data_free_cb) eina_hash_string_small_new(Eina_Free_Cb data_free_cb)
{ {
return eina_hash_new(EINA_KEY_LENGTH(_eina_string_key_length), return eina_hash_new(EINA_KEY_LENGTH(_eina_string_key_length),
@ -806,7 +806,7 @@ eina_hash_string_small_new(Eina_Free_Cb data_free_cb)
EINA_HASH_SMALL_BUCKET_SIZE); EINA_HASH_SMALL_BUCKET_SIZE);
} }
EAPI Eina_Hash * EINA_API Eina_Hash *
eina_hash_int32_new(Eina_Free_Cb data_free_cb) eina_hash_int32_new(Eina_Free_Cb data_free_cb)
{ {
return eina_hash_new(EINA_KEY_LENGTH(_eina_int32_key_length), return eina_hash_new(EINA_KEY_LENGTH(_eina_int32_key_length),
@ -816,7 +816,7 @@ eina_hash_int32_new(Eina_Free_Cb data_free_cb)
EINA_HASH_BUCKET_SIZE); EINA_HASH_BUCKET_SIZE);
} }
EAPI Eina_Hash * EINA_API Eina_Hash *
eina_hash_int64_new(Eina_Free_Cb data_free_cb) eina_hash_int64_new(Eina_Free_Cb data_free_cb)
{ {
return eina_hash_new(EINA_KEY_LENGTH(_eina_int64_key_length), return eina_hash_new(EINA_KEY_LENGTH(_eina_int64_key_length),
@ -826,7 +826,7 @@ eina_hash_int64_new(Eina_Free_Cb data_free_cb)
EINA_HASH_BUCKET_SIZE); EINA_HASH_BUCKET_SIZE);
} }
EAPI Eina_Hash * EINA_API Eina_Hash *
eina_hash_pointer_new(Eina_Free_Cb data_free_cb) eina_hash_pointer_new(Eina_Free_Cb data_free_cb)
{ {
#ifdef EFL64 #ifdef EFL64
@ -844,7 +844,7 @@ eina_hash_pointer_new(Eina_Free_Cb data_free_cb)
#endif #endif
} }
EAPI Eina_Hash * EINA_API Eina_Hash *
eina_hash_stringshared_new(Eina_Free_Cb data_free_cb) eina_hash_stringshared_new(Eina_Free_Cb data_free_cb)
{ {
return eina_hash_new(NULL, return eina_hash_new(NULL,
@ -854,7 +854,7 @@ eina_hash_stringshared_new(Eina_Free_Cb data_free_cb)
EINA_HASH_BUCKET_SIZE); EINA_HASH_BUCKET_SIZE);
} }
EAPI int EINA_API int
eina_hash_population(const Eina_Hash *hash) eina_hash_population(const Eina_Hash *hash)
{ {
if (!hash) if (!hash)
@ -864,7 +864,7 @@ eina_hash_population(const Eina_Hash *hash)
return hash->population; return hash->population;
} }
EAPI void EINA_API void
eina_hash_free(Eina_Hash *hash) eina_hash_free(Eina_Hash *hash)
{ {
int i; int i;
@ -882,7 +882,7 @@ eina_hash_free(Eina_Hash *hash)
free(hash); free(hash);
} }
EAPI void EINA_API void
eina_hash_free_buckets(Eina_Hash *hash) eina_hash_free_buckets(Eina_Hash *hash)
{ {
int i; int i;
@ -902,7 +902,7 @@ eina_hash_free_buckets(Eina_Hash *hash)
} }
} }
EAPI Eina_Bool EINA_API Eina_Bool
eina_hash_add_by_hash(Eina_Hash *hash, eina_hash_add_by_hash(Eina_Hash *hash,
const void *key, const void *key,
int key_length, int key_length,
@ -917,7 +917,7 @@ eina_hash_add_by_hash(Eina_Hash *hash,
data); data);
} }
EAPI Eina_Bool EINA_API Eina_Bool
eina_hash_direct_add_by_hash(Eina_Hash *hash, eina_hash_direct_add_by_hash(Eina_Hash *hash,
const void *key, const void *key,
int key_length, int key_length,
@ -927,7 +927,7 @@ eina_hash_direct_add_by_hash(Eina_Hash *hash,
return eina_hash_add_alloc_by_hash(hash, key, key_length, 0, key_hash, data); return eina_hash_add_alloc_by_hash(hash, key, key_length, 0, key_hash, data);
} }
EAPI Eina_Bool EINA_API Eina_Bool
eina_hash_add(Eina_Hash *hash, const void *key, const void *data) eina_hash_add(Eina_Hash *hash, const void *key, const void *data)
{ {
int key_length; int key_length;
@ -944,7 +944,7 @@ eina_hash_add(Eina_Hash *hash, const void *key, const void *data)
return eina_hash_add_alloc_by_hash(hash, key, key_length, key_length, key_hash, data); return eina_hash_add_alloc_by_hash(hash, key, key_length, key_length, key_hash, data);
} }
EAPI Eina_Bool EINA_API Eina_Bool
eina_hash_direct_add(Eina_Hash *hash, const void *key, const void *data) eina_hash_direct_add(Eina_Hash *hash, const void *key, const void *data)
{ {
int key_length; int key_length;
@ -961,7 +961,7 @@ eina_hash_direct_add(Eina_Hash *hash, const void *key, const void *data)
return eina_hash_add_alloc_by_hash(hash, key, key_length, 0, key_hash, data); return eina_hash_add_alloc_by_hash(hash, key, key_length, 0, key_hash, data);
} }
EAPI Eina_Bool EINA_API Eina_Bool
eina_hash_del_by_key_hash(Eina_Hash *hash, eina_hash_del_by_key_hash(Eina_Hash *hash,
const void *key, const void *key,
int key_length, int key_length,
@ -973,7 +973,7 @@ eina_hash_del_by_key_hash(Eina_Hash *hash,
return _eina_hash_del_by_key_hash(hash, key, key_length, key_hash, NULL); return _eina_hash_del_by_key_hash(hash, key, key_length, key_hash, NULL);
} }
EAPI Eina_Bool EINA_API Eina_Bool
eina_hash_del_by_key(Eina_Hash *hash, const void *key) eina_hash_del_by_key(Eina_Hash *hash, const void *key)
{ {
EINA_SAFETY_ON_NULL_RETURN_VAL(hash, EINA_FALSE); EINA_SAFETY_ON_NULL_RETURN_VAL(hash, EINA_FALSE);
@ -982,7 +982,7 @@ eina_hash_del_by_key(Eina_Hash *hash, const void *key)
return _eina_hash_del_by_key(hash, key, NULL); return _eina_hash_del_by_key(hash, key, NULL);
} }
EAPI Eina_Bool EINA_API Eina_Bool
eina_hash_del_by_data(Eina_Hash *hash, const void *data) eina_hash_del_by_data(Eina_Hash *hash, const void *data)
{ {
Eina_Hash_Element *hash_element; Eina_Hash_Element *hash_element;
@ -1006,7 +1006,7 @@ error:
return EINA_FALSE; return EINA_FALSE;
} }
EAPI Eina_Bool EINA_API Eina_Bool
eina_hash_del_by_hash(Eina_Hash *hash, eina_hash_del_by_hash(Eina_Hash *hash,
const void *key, const void *key,
int key_length, int key_length,
@ -1026,7 +1026,7 @@ eina_hash_del_by_hash(Eina_Hash *hash,
return ret; return ret;
} }
EAPI Eina_Bool EINA_API Eina_Bool
eina_hash_del(Eina_Hash *hash, const void *key, const void *data) eina_hash_del(Eina_Hash *hash, const void *key, const void *data)
{ {
EINA_SAFETY_ON_NULL_RETURN_VAL(hash, EINA_FALSE); EINA_SAFETY_ON_NULL_RETURN_VAL(hash, EINA_FALSE);
@ -1038,7 +1038,7 @@ eina_hash_del(Eina_Hash *hash, const void *key, const void *data)
return _eina_hash_del_by_key(hash, key, data); return _eina_hash_del_by_key(hash, key, data);
} }
EAPI void * EINA_API void *
eina_hash_find_by_hash(const Eina_Hash *hash, eina_hash_find_by_hash(const Eina_Hash *hash,
const void *key, const void *key,
int key_length, int key_length,
@ -1065,7 +1065,7 @@ eina_hash_find_by_hash(const Eina_Hash *hash,
return NULL; return NULL;
} }
EAPI void * EINA_API void *
eina_hash_find(const Eina_Hash *hash, const void *key) eina_hash_find(const Eina_Hash *hash, const void *key)
{ {
int key_length; int key_length;
@ -1086,7 +1086,7 @@ eina_hash_find(const Eina_Hash *hash, const void *key)
return eina_hash_find_by_hash(hash, key, key_length, key_hash); return eina_hash_find_by_hash(hash, key, key_length, key_hash);
} }
EAPI void * EINA_API void *
eina_hash_modify_by_hash(Eina_Hash *hash, eina_hash_modify_by_hash(Eina_Hash *hash,
const void *key, const void *key,
int key_length, int key_length,
@ -1117,7 +1117,7 @@ eina_hash_modify_by_hash(Eina_Hash *hash,
return old_data; return old_data;
} }
EAPI void * EINA_API void *
eina_hash_set(Eina_Hash *hash, const void *key, const void *data) eina_hash_set(Eina_Hash *hash, const void *key, const void *data)
{ {
Eina_Hash_Tuple tuple; Eina_Hash_Tuple tuple;
@ -1170,7 +1170,7 @@ eina_hash_set(Eina_Hash *hash, const void *key, const void *data)
return NULL; return NULL;
} }
EAPI void * EINA_API void *
eina_hash_modify(Eina_Hash *hash, const void *key, const void *data) eina_hash_modify(Eina_Hash *hash, const void *key, const void *data)
{ {
int key_length; int key_length;
@ -1187,7 +1187,7 @@ eina_hash_modify(Eina_Hash *hash, const void *key, const void *data)
return eina_hash_modify_by_hash(hash, key, key_length, key_hash, data); return eina_hash_modify_by_hash(hash, key, key_length, key_hash, data);
} }
EAPI Eina_Bool EINA_API Eina_Bool
eina_hash_move(Eina_Hash *hash, const void *old_key, const void *new_key) eina_hash_move(Eina_Hash *hash, const void *old_key, const void *new_key)
{ {
Eina_Free_Cb hash_free_cb; Eina_Free_Cb hash_free_cb;
@ -1219,7 +1219,7 @@ error:
* Iterator * * Iterator *
*============================================================================*/ *============================================================================*/
EAPI void EINA_API void
eina_hash_foreach(const Eina_Hash *hash, eina_hash_foreach(const Eina_Hash *hash,
Eina_Hash_Foreach func, Eina_Hash_Foreach func,
const void *fdata) const void *fdata)
@ -1242,7 +1242,7 @@ eina_hash_foreach(const Eina_Hash *hash,
eina_iterator_free(it); eina_iterator_free(it);
} }
EAPI Eina_Iterator * EINA_API Eina_Iterator *
eina_hash_iterator_data_new(const Eina_Hash *hash) eina_hash_iterator_data_new(const Eina_Hash *hash)
{ {
Eina_Iterator_Hash *it; Eina_Iterator_Hash *it;
@ -1268,7 +1268,7 @@ eina_hash_iterator_data_new(const Eina_Hash *hash)
return &it->iterator; return &it->iterator;
} }
EAPI Eina_Iterator * EINA_API Eina_Iterator *
eina_hash_iterator_key_new(const Eina_Hash *hash) eina_hash_iterator_key_new(const Eina_Hash *hash)
{ {
Eina_Iterator_Hash *it; Eina_Iterator_Hash *it;
@ -1295,7 +1295,7 @@ eina_hash_iterator_key_new(const Eina_Hash *hash)
return &it->iterator; return &it->iterator;
} }
EAPI Eina_Iterator * EINA_API Eina_Iterator *
eina_hash_iterator_tuple_new(const Eina_Hash *hash) eina_hash_iterator_tuple_new(const Eina_Hash *hash)
{ {
Eina_Iterator_Hash *it; Eina_Iterator_Hash *it;
@ -1326,7 +1326,7 @@ eina_hash_iterator_tuple_new(const Eina_Hash *hash)
/* Paul Hsieh (http://www.azillionmonkeys.com/qed/hash.html) /* Paul Hsieh (http://www.azillionmonkeys.com/qed/hash.html)
used by WebCore (http://webkit.org/blog/8/hashtables-part-2/) */ used by WebCore (http://webkit.org/blog/8/hashtables-part-2/) */
EAPI int EINA_API int
eina_hash_superfast(const char *key, int len) eina_hash_superfast(const char *key, int len)
{ {
int hash = len, tmp; int hash = len, tmp;
@ -1378,7 +1378,7 @@ eina_hash_superfast(const char *key, int len)
return hash; return hash;
} }
EAPI void EINA_API void
eina_hash_list_append(Eina_Hash *hash, const void *key, const void *data) eina_hash_list_append(Eina_Hash *hash, const void *key, const void *data)
{ {
Eina_Hash_Tuple tuple; Eina_Hash_Tuple tuple;
@ -1411,7 +1411,7 @@ eina_hash_list_append(Eina_Hash *hash, const void *key, const void *data)
eina_list_append(NULL, data)); eina_list_append(NULL, data));
} }
EAPI void EINA_API void
eina_hash_list_direct_append(Eina_Hash *hash, const void *key, const void *data) eina_hash_list_direct_append(Eina_Hash *hash, const void *key, const void *data)
{ {
Eina_Hash_Tuple tuple; Eina_Hash_Tuple tuple;
@ -1444,7 +1444,7 @@ eina_hash_list_direct_append(Eina_Hash *hash, const void *key, const void *data)
eina_list_append(NULL, data)); eina_list_append(NULL, data));
} }
EAPI void EINA_API void
eina_hash_list_prepend(Eina_Hash *hash, const void *key, const void *data) eina_hash_list_prepend(Eina_Hash *hash, const void *key, const void *data)
{ {
Eina_Hash_Tuple tuple; Eina_Hash_Tuple tuple;
@ -1477,7 +1477,7 @@ eina_hash_list_prepend(Eina_Hash *hash, const void *key, const void *data)
eina_list_append(NULL, data)); eina_list_append(NULL, data));
} }
EAPI void EINA_API void
eina_hash_list_direct_prepend(Eina_Hash *hash, const void *key, const void *data) eina_hash_list_direct_prepend(Eina_Hash *hash, const void *key, const void *data)
{ {
Eina_Hash_Tuple tuple; Eina_Hash_Tuple tuple;
@ -1510,7 +1510,7 @@ eina_hash_list_direct_prepend(Eina_Hash *hash, const void *key, const void *data
eina_list_append(NULL, data)); eina_list_append(NULL, data));
} }
EAPI void EINA_API void
eina_hash_list_remove(Eina_Hash *hash, const void *key, const void *data) eina_hash_list_remove(Eina_Hash *hash, const void *key, const void *data)
{ {
Eina_Hash_Tuple tuple; Eina_Hash_Tuple tuple;

View File

@ -371,7 +371,7 @@ typedef Eina_Bool (*Eina_Hash_Foreach)(const Eina_Hash *hash, const void *key
* eina_hash_int64_new(), eina_hash_pointer_new() and * eina_hash_int64_new(), eina_hash_pointer_new() and
* eina_hash_stringshared_new(). * eina_hash_stringshared_new().
*/ */
EAPI Eina_Hash *eina_hash_new(Eina_Key_Length key_length_cb, EINA_API Eina_Hash *eina_hash_new(Eina_Key_Length key_length_cb,
Eina_Key_Cmp key_cmp_cb, Eina_Key_Cmp key_cmp_cb,
Eina_Key_Hash key_hash_cb, Eina_Key_Hash key_hash_cb,
Eina_Free_Cb data_free_cb, Eina_Free_Cb data_free_cb,
@ -391,7 +391,7 @@ EAPI Eina_Hash *eina_hash_new(Eina_Key_Length key_length_cb,
* @since 1.1 * @since 1.1
* @see eina_hash_new. * @see eina_hash_new.
*/ */
EAPI void eina_hash_free_cb_set(Eina_Hash *hash, Eina_Free_Cb data_free_cb) EINA_ARG_NONNULL(1); EINA_API void eina_hash_free_cb_set(Eina_Hash *hash, Eina_Free_Cb data_free_cb) EINA_ARG_NONNULL(1);
/** /**
* @brief Creates a new hash table using the djb2 algorithm. * @brief Creates a new hash table using the djb2 algorithm.
@ -406,7 +406,7 @@ EAPI void eina_hash_free_cb_set(Eina_Hash *hash, Eina_Free_Cb data_free_cb) EINA
* be looked up with pointers other than the original key pointer that * be looked up with pointers other than the original key pointer that
* was used to add values. * was used to add values.
*/ */
EAPI Eina_Hash *eina_hash_string_djb2_new(Eina_Free_Cb data_free_cb); EINA_API Eina_Hash *eina_hash_string_djb2_new(Eina_Free_Cb data_free_cb);
/** /**
* @brief Creates a new hash table for use with strings. * @brief Creates a new hash table for use with strings.
@ -425,7 +425,7 @@ EAPI Eina_Hash *eina_hash_string_djb2_new(Eina_Free_Cb data_free_cb);
* remotely request and push data in it. This hash is subject to denial * remotely request and push data in it. This hash is subject to denial
* of service. * of service.
*/ */
EAPI Eina_Hash *eina_hash_string_superfast_new(Eina_Free_Cb data_free_cb); EINA_API Eina_Hash *eina_hash_string_superfast_new(Eina_Free_Cb data_free_cb);
/** /**
* @brief Creates a new hash table for use with strings with small bucket size. * @brief Creates a new hash table for use with strings with small bucket size.
@ -442,7 +442,7 @@ EAPI Eina_Hash *eina_hash_string_superfast_new(Eina_Free_Cb data_free_cb);
* table. Values can then be looked up with pointers other than the * table. Values can then be looked up with pointers other than the
* original key pointer that was used to add values. * original key pointer that was used to add values.
*/ */
EAPI Eina_Hash *eina_hash_string_small_new(Eina_Free_Cb data_free_cb); EINA_API Eina_Hash *eina_hash_string_small_new(Eina_Free_Cb data_free_cb);
/** /**
* @brief Creates a new hash table for use with 32bit integers. * @brief Creates a new hash table for use with 32bit integers.
@ -460,7 +460,7 @@ EAPI Eina_Hash *eina_hash_string_small_new(Eina_Free_Cb data_free_cb);
* used to add values. This method is not suitable to match string keys as * used to add values. This method is not suitable to match string keys as
* it would only match the first character. * it would only match the first character.
*/ */
EAPI Eina_Hash *eina_hash_int32_new(Eina_Free_Cb data_free_cb); EINA_API Eina_Hash *eina_hash_int32_new(Eina_Free_Cb data_free_cb);
/** /**
* @brief Creates a new hash table for use with 64bit integers. * @brief Creates a new hash table for use with 64bit integers.
@ -477,7 +477,7 @@ EAPI Eina_Hash *eina_hash_int32_new(Eina_Free_Cb data_free_cb);
* used to add values. This method is not suitable to match string keys as * used to add values. This method is not suitable to match string keys as
* it would only match the first character. * it would only match the first character.
*/ */
EAPI Eina_Hash *eina_hash_int64_new(Eina_Free_Cb data_free_cb); EINA_API Eina_Hash *eina_hash_int64_new(Eina_Free_Cb data_free_cb);
/** /**
* @brief Creates a new hash table for use with pointers. * @brief Creates a new hash table for use with pointers.
@ -503,7 +503,7 @@ EAPI Eina_Hash *eina_hash_int64_new(Eina_Free_Cb data_free_cb);
* eina_hash_add(hash, &data, data); * eina_hash_add(hash, &data, data);
* @endcode * @endcode
*/ */
EAPI Eina_Hash *eina_hash_pointer_new(Eina_Free_Cb data_free_cb); EINA_API Eina_Hash *eina_hash_pointer_new(Eina_Free_Cb data_free_cb);
/** /**
* @brief Creates a new hash table optimized for stringshared values. * @brief Creates a new hash table optimized for stringshared values.
@ -528,7 +528,7 @@ EAPI Eina_Hash *eina_hash_pointer_new(Eina_Free_Cb data_free_cb);
* eina_hash_find(hash, "key"); * eina_hash_find(hash, "key");
* @endcode * @endcode
*/ */
EAPI Eina_Hash *eina_hash_stringshared_new(Eina_Free_Cb data_free_cb); EINA_API Eina_Hash *eina_hash_stringshared_new(Eina_Free_Cb data_free_cb);
/** /**
* @brief Adds an entry to the given hash table. * @brief Adds an entry to the given hash table.
@ -553,7 +553,7 @@ EAPI Eina_Hash *eina_hash_stringshared_new(Eina_Free_Cb data_free_cb);
* *
* Key strings are case sensitive. * Key strings are case sensitive.
*/ */
EAPI Eina_Bool eina_hash_add(Eina_Hash *hash, EINA_API Eina_Bool eina_hash_add(Eina_Hash *hash,
const void *key, const void *key,
const void *data) EINA_ARG_NONNULL(1, 2, 3); const void *data) EINA_ARG_NONNULL(1, 2, 3);
@ -582,7 +582,7 @@ EAPI Eina_Bool eina_hash_add(Eina_Hash *hash,
* @p key, so it must be a string constant or stored elsewhere (such as * @p key, so it must be a string constant or stored elsewhere (such as
* in the object being added). Key strings are case sensitive. * in the object being added). Key strings are case sensitive.
*/ */
EAPI Eina_Bool eina_hash_direct_add(Eina_Hash *hash, EINA_API Eina_Bool eina_hash_direct_add(Eina_Hash *hash,
const void *key, const void *key,
const void *data) EINA_ARG_NONNULL(1, 2, 3); const void *data) EINA_ARG_NONNULL(1, 2, 3);
@ -607,7 +607,7 @@ EAPI Eina_Bool eina_hash_direct_add(Eina_Hash *hash,
* eina_hash_del_by_key_hash(). If you don't have the key, use * eina_hash_del_by_key_hash(). If you don't have the key, use
* eina_hash_del_by_data() directly. * eina_hash_del_by_data() directly.
*/ */
EAPI Eina_Bool eina_hash_del(Eina_Hash *hash, EINA_API Eina_Bool eina_hash_del(Eina_Hash *hash,
const void *key, const void *key,
const void *data) EINA_ARG_NONNULL(1); const void *data) EINA_ARG_NONNULL(1);
@ -622,7 +622,7 @@ EAPI Eina_Bool eina_hash_del(Eina_Hash *hash,
* This function retrieves the entry associated with @p key in * This function retrieves the entry associated with @p key in
* @p hash. If @p hash is @c NULL, this function returns @c NULL. * @p hash. If @p hash is @c NULL, this function returns @c NULL.
*/ */
EAPI void *eina_hash_find(const Eina_Hash *hash, EINA_API void *eina_hash_find(const Eina_Hash *hash,
const void *key) EINA_ARG_NONNULL(2); const void *key) EINA_ARG_NONNULL(2);
/** /**
@ -637,7 +637,7 @@ EAPI void *eina_hash_find(const Eina_Hash *hash,
* This function modifies the data of @p key with @p data in @p * This function modifies the data of @p key with @p data in @p
* hash. If no entry is found, nothing is added to @p hash. * hash. If no entry is found, nothing is added to @p hash.
*/ */
EAPI void *eina_hash_modify(Eina_Hash *hash, EINA_API void *eina_hash_modify(Eina_Hash *hash,
const void *key, const void *key,
const void *data) EINA_ARG_NONNULL(1, 2, 3); const void *data) EINA_ARG_NONNULL(1, 2, 3);
@ -655,7 +655,7 @@ EAPI void *eina_hash_modify(Eina_Hash *hash,
* hash. If no entry is found, @p data is added to @p hash with the * hash. If no entry is found, @p data is added to @p hash with the
* key @p key. * key @p key.
*/ */
EAPI void *eina_hash_set(Eina_Hash *hash, EINA_API void *eina_hash_set(Eina_Hash *hash,
const void *key, const void *key,
const void *data) EINA_ARG_NONNULL(1, 2); const void *data) EINA_ARG_NONNULL(1, 2);
@ -672,7 +672,7 @@ EAPI void *eina_hash_set(Eina_Hash *hash,
* but does not call the Eina_Free_Cb associated with the hash table * but does not call the Eina_Free_Cb associated with the hash table
* when destroying the old key. * when destroying the old key.
*/ */
EAPI Eina_Bool eina_hash_move(Eina_Hash *hash, EINA_API Eina_Bool eina_hash_move(Eina_Hash *hash,
const void *old_key, const void *old_key,
const void *new_key) EINA_ARG_NONNULL(1, 2, 3); const void *new_key) EINA_ARG_NONNULL(1, 2, 3);
@ -699,7 +699,7 @@ EAPI Eina_Bool eina_hash_move(Eina_Hash *hash,
* hash = NULL; * hash = NULL;
* @endcode * @endcode
*/ */
EAPI void eina_hash_free(Eina_Hash *hash) EINA_ARG_NONNULL(1); EINA_API void eina_hash_free(Eina_Hash *hash) EINA_ARG_NONNULL(1);
/** /**
* @brief Frees the given hash table buckets resources. * @brief Frees the given hash table buckets resources.
@ -715,7 +715,7 @@ EAPI void eina_hash_free(Eina_Hash *hash) EINA_ARG_NONNULL(1);
* *
* If @p hash is @c NULL, the function returns immediately. * If @p hash is @c NULL, the function returns immediately.
*/ */
EAPI void eina_hash_free_buckets(Eina_Hash *hash) EINA_ARG_NONNULL(1); EINA_API void eina_hash_free_buckets(Eina_Hash *hash) EINA_ARG_NONNULL(1);
/** /**
* @brief Returns the number of entries in the given hash table. * @brief Returns the number of entries in the given hash table.
@ -724,7 +724,7 @@ EAPI void eina_hash_free_buckets(Eina_Hash *hash) EINA_ARG_NONNULL(1);
* @return The number of entries in the hash table, or @c 0 on error or * @return The number of entries in the hash table, or @c 0 on error or
* if @p hash is @c NULL. * if @p hash is @c NULL.
*/ */
EAPI int eina_hash_population(const Eina_Hash *hash) EINA_ARG_NONNULL(1); EINA_API int eina_hash_population(const Eina_Hash *hash) EINA_ARG_NONNULL(1);
/** /**
* @brief Adds an entry to the given hash table by its key hash. * @brief Adds an entry to the given hash table by its key hash.
@ -747,7 +747,7 @@ EAPI int eina_hash_population(const Eina_Hash *hash) EINA_ARG_NONNULL(1);
* *
* @see eina_hash_add() * @see eina_hash_add()
*/ */
EAPI Eina_Bool eina_hash_add_by_hash(Eina_Hash *hash, EINA_API Eina_Bool eina_hash_add_by_hash(Eina_Hash *hash,
const void *key, const void *key,
int key_length, int key_length,
int key_hash, int key_hash,
@ -778,7 +778,7 @@ EAPI Eina_Bool eina_hash_add_by_hash(Eina_Hash *hash,
* *
* @see eina_hash_direct_add() * @see eina_hash_direct_add()
*/ */
EAPI Eina_Bool eina_hash_direct_add_by_hash(Eina_Hash *hash, EINA_API Eina_Bool eina_hash_direct_add_by_hash(Eina_Hash *hash,
const void *key, const void *key,
int key_length, int key_length,
int key_hash, int key_hash,
@ -803,7 +803,7 @@ EAPI Eina_Bool eina_hash_direct_add_by_hash(Eina_Hash *hash,
* @note If you don't have the key_hash, use eina_hash_del_by_key() * @note If you don't have the key_hash, use eina_hash_del_by_key()
* instead. If you don't have the key, use eina_hash_del_by_data(). * instead. If you don't have the key, use eina_hash_del_by_data().
*/ */
EAPI Eina_Bool eina_hash_del_by_key_hash(Eina_Hash *hash, EINA_API Eina_Bool eina_hash_del_by_key_hash(Eina_Hash *hash,
const void *key, const void *key,
int key_length, int key_length,
int key_hash) EINA_ARG_NONNULL(1, 2); int key_hash) EINA_ARG_NONNULL(1, 2);
@ -828,7 +828,7 @@ EAPI Eina_Bool eina_hash_del_by_key_hash(Eina_Hash *hash,
* @note If you already have the key_hash, use eina_hash_del_by_key_hash(). * @note If you already have the key_hash, use eina_hash_del_by_key_hash().
* If you don't have the key, use eina_hash_del_by_data() instead. * If you don't have the key, use eina_hash_del_by_data() instead.
*/ */
EAPI Eina_Bool eina_hash_del_by_key(Eina_Hash *hash, EINA_API Eina_Bool eina_hash_del_by_key(Eina_Hash *hash,
const void *key) EINA_ARG_NONNULL(1, 2); const void *key) EINA_ARG_NONNULL(1, 2);
/** /**
@ -850,7 +850,7 @@ EAPI Eina_Bool eina_hash_del_by_key(Eina_Hash *hash,
* @note If you already have the key, use eina_hash_del_by_key() * @note If you already have the key, use eina_hash_del_by_key()
* or eina_hash_del_by_key_hash() instead. * or eina_hash_del_by_key_hash() instead.
*/ */
EAPI Eina_Bool eina_hash_del_by_data(Eina_Hash *hash, EINA_API Eina_Bool eina_hash_del_by_data(Eina_Hash *hash,
const void *data) EINA_ARG_NONNULL(1, 2); const void *data) EINA_ARG_NONNULL(1, 2);
/** /**
@ -880,7 +880,7 @@ EAPI Eina_Bool eina_hash_del_by_data(Eina_Hash *hash,
* @note If you already have the key, use eina_hash_del_by_key_hash(). * @note If you already have the key, use eina_hash_del_by_key_hash().
* If you don't have the key, use eina_hash_del_by_data() directly. * If you don't have the key, use eina_hash_del_by_data() directly.
*/ */
EAPI Eina_Bool eina_hash_del_by_hash(Eina_Hash *hash, EINA_API Eina_Bool eina_hash_del_by_hash(Eina_Hash *hash,
const void *key, const void *key,
int key_length, int key_length,
int key_hash, int key_hash,
@ -901,7 +901,7 @@ EAPI Eina_Bool eina_hash_del_by_hash(Eina_Hash *hash,
* @p key. It is ignored if @p key is @c NULL. Do not forget to count * @p key. It is ignored if @p key is @c NULL. Do not forget to count
* '\\0' for string when setting the value of @p key_length. * '\\0' for string when setting the value of @p key_length.
*/ */
EAPI void *eina_hash_find_by_hash(const Eina_Hash *hash, EINA_API void *eina_hash_find_by_hash(const Eina_Hash *hash,
const void *key, const void *key,
int key_length, int key_length,
int key_hash) EINA_ARG_NONNULL(1, 2); int key_hash) EINA_ARG_NONNULL(1, 2);
@ -921,7 +921,7 @@ EAPI void *eina_hash_find_by_hash(const Eina_Hash *hash,
* if not found. If an existing entry is not found, nothing is added to * if not found. If an existing entry is not found, nothing is added to
* the hash. * the hash.
*/ */
EAPI void *eina_hash_modify_by_hash(Eina_Hash *hash, EINA_API void *eina_hash_modify_by_hash(Eina_Hash *hash,
const void *key, const void *key,
int key_length, int key_length,
int key_hash, int key_hash,
@ -941,7 +941,7 @@ EAPI void *eina_hash_modify_by_hash(Eina_Hash *hash,
* @warning If the hash structure changes then the iterator becomes * @warning If the hash structure changes then the iterator becomes
* invalid; adding or removing items may lead to program crash. * invalid; adding or removing items may lead to program crash.
*/ */
EAPI Eina_Iterator *eina_hash_iterator_key_new(const Eina_Hash *hash) EINA_MALLOC EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT; EINA_API Eina_Iterator *eina_hash_iterator_key_new(const Eina_Hash *hash) EINA_MALLOC EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT;
/** /**
* @brief Returns a new iterator associated with a hash. * @brief Returns a new iterator associated with a hash.
@ -957,7 +957,7 @@ EAPI Eina_Iterator *eina_hash_iterator_key_new(const Eina_Hash *hash) EINA_MALLO
* @warning If the hash structure changes then the iterator becomes * @warning If the hash structure changes then the iterator becomes
* invalid; adding or removing items may lead to program crash. * invalid; adding or removing items may lead to program crash.
*/ */
EAPI Eina_Iterator *eina_hash_iterator_data_new(const Eina_Hash *hash) EINA_MALLOC EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT; EINA_API Eina_Iterator *eina_hash_iterator_data_new(const Eina_Hash *hash) EINA_MALLOC EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT;
/** /**
* @brief Returned a new iterator associated with hash keys and data. * @brief Returned a new iterator associated with hash keys and data.
@ -976,7 +976,7 @@ EAPI Eina_Iterator *eina_hash_iterator_data_new(const Eina_Hash *hash) EINA_MALL
* @warning If the hash structure changes then the iterator becomes * @warning If the hash structure changes then the iterator becomes
* invalid; adding or removing items may lead to program crash. * invalid; adding or removing items may lead to program crash.
*/ */
EAPI Eina_Iterator *eina_hash_iterator_tuple_new(const Eina_Hash *hash) EINA_MALLOC EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT; EINA_API Eina_Iterator *eina_hash_iterator_tuple_new(const Eina_Hash *hash) EINA_MALLOC EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT;
/** /**
* @brief Calls a function on every member stored in the hash table. * @brief Calls a function on every member stored in the hash table.
@ -1013,7 +1013,7 @@ EAPI Eina_Iterator *eina_hash_iterator_tuple_new(const Eina_Hash *hash) EINA_MAL
* } * }
* @endcode * @endcode
*/ */
EAPI void eina_hash_foreach(const Eina_Hash *hash, EINA_API void eina_hash_foreach(const Eina_Hash *hash,
Eina_Hash_Foreach func, Eina_Hash_Foreach func,
const void *fdata) EINA_ARG_NONNULL(1, 2); const void *fdata) EINA_ARG_NONNULL(1, 2);
@ -1031,7 +1031,7 @@ EAPI void eina_hash_foreach(const Eina_Hash *hash,
* *
* @since 1.10 * @since 1.10
*/ */
EAPI void eina_hash_list_append(Eina_Hash *hash, const void *key, const void *data) EINA_ARG_NONNULL(1, 2, 3); EINA_API void eina_hash_list_append(Eina_Hash *hash, const void *key, const void *data) EINA_ARG_NONNULL(1, 2, 3);
/** /**
* @brief Appends data to an #Eina_List inside a hash using eina_hash_direct_add(). * @brief Appends data to an #Eina_List inside a hash using eina_hash_direct_add().
@ -1046,7 +1046,7 @@ EAPI void eina_hash_list_append(Eina_Hash *hash, const void *key, const void *da
* *
* @since 1.23 * @since 1.23
*/ */
EAPI void eina_hash_list_direct_append(Eina_Hash *hash, const void *key, const void *data) EINA_ARG_NONNULL(1, 2, 3); EINA_API void eina_hash_list_direct_append(Eina_Hash *hash, const void *key, const void *data) EINA_ARG_NONNULL(1, 2, 3);
/** /**
* @brief Prepends data to an #Eina_List inside a hash. * @brief Prepends data to an #Eina_List inside a hash.
@ -1061,7 +1061,7 @@ EAPI void eina_hash_list_direct_append(Eina_Hash *hash, const void *key, const v
* *
* @since 1.10 * @since 1.10
*/ */
EAPI void eina_hash_list_prepend(Eina_Hash *hash, const void *key, const void *data) EINA_ARG_NONNULL(1, 2, 3); EINA_API void eina_hash_list_prepend(Eina_Hash *hash, const void *key, const void *data) EINA_ARG_NONNULL(1, 2, 3);
/** /**
* @brief Prepends data to an #Eina_List inside a hash using eina_hash_direct_add(). * @brief Prepends data to an #Eina_List inside a hash using eina_hash_direct_add().
@ -1076,7 +1076,7 @@ EAPI void eina_hash_list_prepend(Eina_Hash *hash, const void *key, const void *d
* *
* @since 1.23 * @since 1.23
*/ */
EAPI void eina_hash_list_direct_prepend(Eina_Hash *hash, const void *key, const void *data) EINA_ARG_NONNULL(1, 2, 3); EINA_API void eina_hash_list_direct_prepend(Eina_Hash *hash, const void *key, const void *data) EINA_ARG_NONNULL(1, 2, 3);
/** /**
* @brief Removes data from an #Eina_List inside a hash. * @brief Removes data from an #Eina_List inside a hash.
@ -1091,7 +1091,7 @@ EAPI void eina_hash_list_direct_prepend(Eina_Hash *hash, const void *key, const
* *
* @since 1.10 * @since 1.10
*/ */
EAPI void eina_hash_list_remove(Eina_Hash *hash, const void *key, const void *data) EINA_ARG_NONNULL(1, 2, 3); EINA_API void eina_hash_list_remove(Eina_Hash *hash, const void *key, const void *data) EINA_ARG_NONNULL(1, 2, 3);
/** /**
* @brief * @brief
@ -1101,7 +1101,7 @@ EAPI void eina_hash_list_remove(Eina_Hash *hash, const void *key, const void *da
* @param[in] len The length of the key. * @param[in] len The length of the key.
* @return The hash value. * @return The hash value.
*/ */
EAPI int eina_hash_superfast(const char *key, EINA_API int eina_hash_superfast(const char *key,
int len) EINA_ARG_NONNULL(1); int len) EINA_ARG_NONNULL(1);
/** /**

View File

@ -338,7 +338,7 @@ eina_inarray_shutdown(void)
/*============================================================================* /*============================================================================*
* API * * API *
*============================================================================*/ *============================================================================*/
EAPI Eina_Inarray * EINA_API Eina_Inarray *
eina_inarray_new(unsigned int member_size, unsigned int step) eina_inarray_new(unsigned int member_size, unsigned int step)
{ {
Eina_Inarray *ret; Eina_Inarray *ret;
@ -351,7 +351,7 @@ eina_inarray_new(unsigned int member_size, unsigned int step)
return ret; return ret;
} }
EAPI void EINA_API void
eina_inarray_free(Eina_Inarray *array) eina_inarray_free(Eina_Inarray *array)
{ {
if (!array) if (!array)
@ -362,7 +362,7 @@ eina_inarray_free(Eina_Inarray *array)
free(array); free(array);
} }
EAPI void EINA_API void
eina_inarray_step_set(Eina_Inarray *array, eina_inarray_step_set(Eina_Inarray *array,
unsigned int sizeof_eina_inarray, unsigned int sizeof_eina_inarray,
unsigned int member_size, unsigned int member_size,
@ -384,7 +384,7 @@ eina_inarray_step_set(Eina_Inarray *array,
_eina_inarray_setup(array, member_size, step); _eina_inarray_setup(array, member_size, step);
} }
EAPI void EINA_API void
eina_inarray_flush(Eina_Inarray *array) eina_inarray_flush(Eina_Inarray *array)
{ {
EINA_MAGIC_CHECK_INARRAY(array); EINA_MAGIC_CHECK_INARRAY(array);
@ -394,7 +394,7 @@ eina_inarray_flush(Eina_Inarray *array)
array->members = NULL; array->members = NULL;
} }
EAPI Eina_Bool EINA_API Eina_Bool
eina_inarray_resize(Eina_Inarray *array, unsigned int new_size) eina_inarray_resize(Eina_Inarray *array, unsigned int new_size)
{ {
Eina_Bool r; Eina_Bool r;
@ -407,7 +407,7 @@ eina_inarray_resize(Eina_Inarray *array, unsigned int new_size)
return EINA_TRUE; return EINA_TRUE;
} }
EAPI int EINA_API int
eina_inarray_push(Eina_Inarray *array, const void *data) eina_inarray_push(Eina_Inarray *array, const void *data)
{ {
void *p; void *p;
@ -425,7 +425,7 @@ eina_inarray_push(Eina_Inarray *array, const void *data)
return array->len - 1; return array->len - 1;
} }
EAPI void * EINA_API void *
eina_inarray_grow(Eina_Inarray *array, unsigned int size) eina_inarray_grow(Eina_Inarray *array, unsigned int size)
{ {
void *p; void *p;
@ -442,7 +442,7 @@ eina_inarray_grow(Eina_Inarray *array, unsigned int size)
return p; return p;
} }
EAPI int EINA_API int
eina_inarray_insert(Eina_Inarray *array, const void *data, Eina_Compare_Cb compare) eina_inarray_insert(Eina_Inarray *array, const void *data, Eina_Compare_Cb compare)
{ {
const unsigned char *itr, *itr_end; const unsigned char *itr, *itr_end;
@ -471,7 +471,7 @@ eina_inarray_insert(Eina_Inarray *array, const void *data, Eina_Compare_Cb compa
return eina_inarray_push(array, data); return eina_inarray_push(array, data);
} }
EAPI int EINA_API int
eina_inarray_insert_sorted(Eina_Inarray *array, const void *data, Eina_Compare_Cb compare) eina_inarray_insert_sorted(Eina_Inarray *array, const void *data, Eina_Compare_Cb compare)
{ {
unsigned int pos; unsigned int pos;
@ -490,7 +490,7 @@ eina_inarray_insert_sorted(Eina_Inarray *array, const void *data, Eina_Compare_C
return pos; return pos;
} }
EAPI int EINA_API int
eina_inarray_remove(Eina_Inarray *array, const void *data) eina_inarray_remove(Eina_Inarray *array, const void *data)
{ {
const unsigned char *itr, *itr_end; const unsigned char *itr, *itr_end;
@ -528,7 +528,7 @@ found:
return position; return position;
} }
EAPI void * EINA_API void *
eina_inarray_pop(Eina_Inarray *array) eina_inarray_pop(Eina_Inarray *array)
{ {
EINA_MAGIC_CHECK_INARRAY(array, NULL); EINA_MAGIC_CHECK_INARRAY(array, NULL);
@ -539,7 +539,7 @@ eina_inarray_pop(Eina_Inarray *array)
return _eina_inarray_get(array, array->len); return _eina_inarray_get(array, array->len);
} }
EAPI void * EINA_API void *
eina_inarray_nth(const Eina_Inarray *array, unsigned int position) eina_inarray_nth(const Eina_Inarray *array, unsigned int position)
{ {
EINA_MAGIC_CHECK_INARRAY(array, NULL); EINA_MAGIC_CHECK_INARRAY(array, NULL);
@ -547,7 +547,7 @@ eina_inarray_nth(const Eina_Inarray *array, unsigned int position)
return _eina_inarray_get(array, position); return _eina_inarray_get(array, position);
} }
EAPI Eina_Bool EINA_API Eina_Bool
eina_inarray_insert_at(Eina_Inarray *array, unsigned int position, const void *data) eina_inarray_insert_at(Eina_Inarray *array, unsigned int position, const void *data)
{ {
unsigned int sz; unsigned int sz;
@ -569,7 +569,7 @@ eina_inarray_insert_at(Eina_Inarray *array, unsigned int position, const void *d
return EINA_TRUE; return EINA_TRUE;
} }
EAPI void * EINA_API void *
eina_inarray_alloc_at(Eina_Inarray *array, unsigned int position, unsigned int member_count) eina_inarray_alloc_at(Eina_Inarray *array, unsigned int position, unsigned int member_count)
{ {
unsigned int sz; unsigned int sz;
@ -591,7 +591,7 @@ eina_inarray_alloc_at(Eina_Inarray *array, unsigned int position, unsigned int m
return p; return p;
} }
EAPI Eina_Bool EINA_API Eina_Bool
eina_inarray_replace_at(Eina_Inarray *array, unsigned int position, const void *data) eina_inarray_replace_at(Eina_Inarray *array, unsigned int position, const void *data)
{ {
unsigned char *p; unsigned char *p;
@ -605,7 +605,7 @@ eina_inarray_replace_at(Eina_Inarray *array, unsigned int position, const void *
return EINA_TRUE; return EINA_TRUE;
} }
EAPI Eina_Bool EINA_API Eina_Bool
eina_inarray_remove_at(Eina_Inarray *array, unsigned int position) eina_inarray_remove_at(Eina_Inarray *array, unsigned int position)
{ {
EINA_MAGIC_CHECK_INARRAY(array, EINA_FALSE); EINA_MAGIC_CHECK_INARRAY(array, EINA_FALSE);
@ -623,7 +623,7 @@ eina_inarray_remove_at(Eina_Inarray *array, unsigned int position)
return EINA_TRUE; return EINA_TRUE;
} }
EAPI void EINA_API void
eina_inarray_reverse(Eina_Inarray *array) eina_inarray_reverse(Eina_Inarray *array)
{ {
size_t sz; size_t sz;
@ -653,7 +653,7 @@ eina_inarray_reverse(Eina_Inarray *array)
} }
} }
EAPI void EINA_API void
eina_inarray_sort(Eina_Inarray *array, Eina_Compare_Cb compare) eina_inarray_sort(Eina_Inarray *array, Eina_Compare_Cb compare)
{ {
EINA_MAGIC_CHECK_INARRAY(array); EINA_MAGIC_CHECK_INARRAY(array);
@ -661,7 +661,7 @@ eina_inarray_sort(Eina_Inarray *array, Eina_Compare_Cb compare)
qsort(array->members, array->len, array->member_size, compare); qsort(array->members, array->len, array->member_size, compare);
} }
EAPI int EINA_API int
eina_inarray_search(const Eina_Inarray *array, const void *data, Eina_Compare_Cb compare) eina_inarray_search(const Eina_Inarray *array, const void *data, Eina_Compare_Cb compare)
{ {
EINA_MAGIC_CHECK_INARRAY(array, -1); EINA_MAGIC_CHECK_INARRAY(array, -1);
@ -670,7 +670,7 @@ eina_inarray_search(const Eina_Inarray *array, const void *data, Eina_Compare_Cb
return _eina_inarray_search(array, data, compare); return _eina_inarray_search(array, data, compare);
} }
EAPI int EINA_API int
eina_inarray_search_sorted(const Eina_Inarray *array, const void *data, Eina_Compare_Cb compare) eina_inarray_search_sorted(const Eina_Inarray *array, const void *data, Eina_Compare_Cb compare)
{ {
unsigned int pos; unsigned int pos;
@ -686,7 +686,7 @@ eina_inarray_search_sorted(const Eina_Inarray *array, const void *data, Eina_Com
return -1; return -1;
} }
EAPI Eina_Bool EINA_API Eina_Bool
eina_inarray_foreach(const Eina_Inarray *array, Eina_Each_Cb function, const void *user_data) eina_inarray_foreach(const Eina_Inarray *array, Eina_Each_Cb function, const void *user_data)
{ {
unsigned char *itr, *itr_end; unsigned char *itr, *itr_end;
@ -704,7 +704,7 @@ eina_inarray_foreach(const Eina_Inarray *array, Eina_Each_Cb function, const voi
return ret; return ret;
} }
EAPI int EINA_API int
eina_inarray_foreach_remove(Eina_Inarray *array, Eina_Each_Cb match, const void *user_data) eina_inarray_foreach_remove(Eina_Inarray *array, Eina_Each_Cb match, const void *user_data)
{ {
unsigned int i = 0, count = 0; unsigned int i = 0, count = 0;
@ -728,14 +728,14 @@ eina_inarray_foreach_remove(Eina_Inarray *array, Eina_Each_Cb match, const void
return count; return count;
} }
EAPI unsigned int EINA_API unsigned int
eina_inarray_count(const Eina_Inarray *array) eina_inarray_count(const Eina_Inarray *array)
{ {
EINA_MAGIC_CHECK_INARRAY(array, 0); EINA_MAGIC_CHECK_INARRAY(array, 0);
return array->len; return array->len;
} }
EAPI Eina_Iterator * EINA_API Eina_Iterator *
eina_inarray_iterator_new(const Eina_Inarray *array) eina_inarray_iterator_new(const Eina_Inarray *array)
{ {
Eina_Iterator_Inarray *it; Eina_Iterator_Inarray *it;
@ -759,7 +759,7 @@ eina_inarray_iterator_new(const Eina_Inarray *array)
return &it->iterator; return &it->iterator;
} }
EAPI Eina_Iterator * EINA_API Eina_Iterator *
eina_inarray_iterator_reversed_new(const Eina_Inarray *array) eina_inarray_iterator_reversed_new(const Eina_Inarray *array)
{ {
Eina_Iterator_Inarray *it; Eina_Iterator_Inarray *it;
@ -784,7 +784,7 @@ eina_inarray_iterator_reversed_new(const Eina_Inarray *array)
return &it->iterator; return &it->iterator;
} }
EAPI Eina_Accessor * EINA_API Eina_Accessor *
eina_inarray_accessor_new(const Eina_Inarray *array) eina_inarray_accessor_new(const Eina_Inarray *array)
{ {
Eina_Accessor_Inarray *ac; Eina_Accessor_Inarray *ac;

View File

@ -252,7 +252,7 @@ struct _Eina_Inarray
* *
* @since 1.2 * @since 1.2
*/ */
EAPI Eina_Inarray *eina_inarray_new(unsigned int member_size, EINA_API Eina_Inarray *eina_inarray_new(unsigned int member_size,
unsigned int step) EINA_MALLOC EINA_WARN_UNUSED_RESULT; unsigned int step) EINA_MALLOC EINA_WARN_UNUSED_RESULT;
/** /**
@ -264,7 +264,7 @@ EAPI Eina_Inarray *eina_inarray_new(unsigned int member_size,
* *
* @since 1.2 * @since 1.2
*/ */
EAPI void eina_inarray_free(Eina_Inarray *array) EINA_ARG_NONNULL(1); EINA_API void eina_inarray_free(Eina_Inarray *array) EINA_ARG_NONNULL(1);
/** /**
* @brief Initializes an inline array. * @brief Initializes an inline array.
@ -284,7 +284,7 @@ EAPI void eina_inarray_free(Eina_Inarray *array) EINA_ARG_NONNULL(1);
* *
* @since 1.2 * @since 1.2
*/ */
EAPI void eina_inarray_step_set(Eina_Inarray *array, EINA_API void eina_inarray_step_set(Eina_Inarray *array,
unsigned int sizeof_eina_inarray, unsigned int sizeof_eina_inarray,
unsigned int member_size, unsigned int member_size,
unsigned int step) EINA_ARG_NONNULL(1); unsigned int step) EINA_ARG_NONNULL(1);
@ -296,7 +296,7 @@ EAPI void eina_inarray_step_set(Eina_Inarray *array,
* *
* @since 1.2 * @since 1.2
*/ */
EAPI void eina_inarray_flush(Eina_Inarray *array) EINA_ARG_NONNULL(1); EINA_API void eina_inarray_flush(Eina_Inarray *array) EINA_ARG_NONNULL(1);
/** /**
* @brief Copies the data as the last member of the array. * @brief Copies the data as the last member of the array.
@ -312,7 +312,7 @@ EAPI void eina_inarray_flush(Eina_Inarray *array) EINA_ARG_NONNULL(1);
* *
* @since 1.2 * @since 1.2
*/ */
EAPI int eina_inarray_push(Eina_Inarray *array, EINA_API int eina_inarray_push(Eina_Inarray *array,
const void *data) EINA_ARG_NONNULL(1, 2); const void *data) EINA_ARG_NONNULL(1, 2);
/** /**
@ -326,7 +326,7 @@ EAPI int eina_inarray_push(Eina_Inarray *array,
* *
* @since 1.8 * @since 1.8
*/ */
EAPI void *eina_inarray_grow(Eina_Inarray *array, unsigned int size); EINA_API void *eina_inarray_grow(Eina_Inarray *array, unsigned int size);
/** /**
* @brief Copies the data to the array at a position found by the comparison function. * @brief Copies the data to the array at a position found by the comparison function.
@ -349,7 +349,7 @@ EAPI void *eina_inarray_grow(Eina_Inarray *array, unsigned int size);
* *
* @since 1.2 * @since 1.2
*/ */
EAPI int eina_inarray_insert(Eina_Inarray *array, EINA_API int eina_inarray_insert(Eina_Inarray *array,
const void *data, const void *data,
Eina_Compare_Cb compare) EINA_ARG_NONNULL(1, 2, 3); Eina_Compare_Cb compare) EINA_ARG_NONNULL(1, 2, 3);
@ -375,7 +375,7 @@ EAPI int eina_inarray_insert(Eina_Inarray *array,
* *
* @since 1.2 * @since 1.2
*/ */
EAPI int eina_inarray_insert_sorted(Eina_Inarray *array, EINA_API int eina_inarray_insert_sorted(Eina_Inarray *array,
const void *data, const void *data,
Eina_Compare_Cb compare) EINA_ARG_NONNULL(1, 2, 3); Eina_Compare_Cb compare) EINA_ARG_NONNULL(1, 2, 3);
@ -394,7 +394,7 @@ EAPI int eina_inarray_insert_sorted(Eina_Inarray *array,
* *
* @since 1.2 * @since 1.2
*/ */
EAPI int eina_inarray_remove(Eina_Inarray *array, EINA_API int eina_inarray_remove(Eina_Inarray *array,
const void *data) EINA_ARG_NONNULL(1, 2); const void *data) EINA_ARG_NONNULL(1, 2);
/** /**
@ -407,7 +407,7 @@ EAPI int eina_inarray_remove(Eina_Inarray *array,
* *
* @since 1.2 * @since 1.2
*/ */
EAPI void *eina_inarray_pop(Eina_Inarray *array) EINA_ARG_NONNULL(1); EINA_API void *eina_inarray_pop(Eina_Inarray *array) EINA_ARG_NONNULL(1);
/** /**
* @brief Gets the member at the given position. * @brief Gets the member at the given position.
@ -422,7 +422,7 @@ EAPI void *eina_inarray_pop(Eina_Inarray *array) EINA_ARG_NONNULL(1);
* *
* @since 1.2 * @since 1.2
*/ */
EAPI void *eina_inarray_nth(const Eina_Inarray *array, EINA_API void *eina_inarray_nth(const Eina_Inarray *array,
unsigned int position) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT; unsigned int position) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT;
/** /**
@ -447,7 +447,7 @@ EAPI void *eina_inarray_nth(const Eina_Inarray *array,
* *
* @since 1.2 * @since 1.2
*/ */
EAPI Eina_Bool eina_inarray_insert_at(Eina_Inarray *array, EINA_API Eina_Bool eina_inarray_insert_at(Eina_Inarray *array,
unsigned int position, unsigned int position,
const void *data) EINA_ARG_NONNULL(1, 3); const void *data) EINA_ARG_NONNULL(1, 3);
@ -477,7 +477,7 @@ EAPI Eina_Bool eina_inarray_insert_at(Eina_Inarray *array,
* *
* @since 1.2 * @since 1.2
*/ */
EAPI void *eina_inarray_alloc_at(Eina_Inarray *array, EINA_API void *eina_inarray_alloc_at(Eina_Inarray *array,
unsigned int position, unsigned int position,
unsigned int member_count) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT; unsigned int member_count) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT;
@ -497,7 +497,7 @@ EAPI void *eina_inarray_alloc_at(Eina_Inarray *array,
* *
* @since 1.2 * @since 1.2
*/ */
EAPI Eina_Bool eina_inarray_replace_at(Eina_Inarray *array, EINA_API Eina_Bool eina_inarray_replace_at(Eina_Inarray *array,
unsigned int position, unsigned int position,
const void *data) EINA_ARG_NONNULL(1, 3); const void *data) EINA_ARG_NONNULL(1, 3);
@ -516,7 +516,7 @@ EAPI Eina_Bool eina_inarray_replace_at(Eina_Inarray *array,
* *
* @since 1.2 * @since 1.2
*/ */
EAPI Eina_Bool eina_inarray_remove_at(Eina_Inarray *array, EINA_API Eina_Bool eina_inarray_remove_at(Eina_Inarray *array,
unsigned int position) EINA_ARG_NONNULL(1); unsigned int position) EINA_ARG_NONNULL(1);
/** /**
@ -531,7 +531,7 @@ EAPI Eina_Bool eina_inarray_remove_at(Eina_Inarray *array,
* *
* @since 1.2 * @since 1.2
*/ */
EAPI void eina_inarray_reverse(Eina_Inarray *array) EINA_ARG_NONNULL(1); EINA_API void eina_inarray_reverse(Eina_Inarray *array) EINA_ARG_NONNULL(1);
/** /**
* @brief Applies a quick sort to the array. * @brief Applies a quick sort to the array.
@ -547,7 +547,7 @@ EAPI void eina_inarray_reverse(Eina_Inarray *array) EINA_ARG_NONNULL(1);
* *
* @since 1.2 * @since 1.2
*/ */
EAPI void eina_inarray_sort(Eina_Inarray *array, EINA_API void eina_inarray_sort(Eina_Inarray *array,
Eina_Compare_Cb compare) EINA_ARG_NONNULL(1, 2); Eina_Compare_Cb compare) EINA_ARG_NONNULL(1, 2);
/** /**
@ -565,7 +565,7 @@ EAPI void eina_inarray_sort(Eina_Inarray *array,
* *
* @since 1.2 * @since 1.2
*/ */
EAPI int eina_inarray_search(const Eina_Inarray *array, EINA_API int eina_inarray_search(const Eina_Inarray *array,
const void *data, const void *data,
Eina_Compare_Cb compare) EINA_ARG_NONNULL(1, 2, 3); Eina_Compare_Cb compare) EINA_ARG_NONNULL(1, 2, 3);
@ -584,7 +584,7 @@ EAPI int eina_inarray_search(const Eina_Inarray *array,
* *
* @since 1.2 * @since 1.2
*/ */
EAPI int eina_inarray_search_sorted(const Eina_Inarray *array, EINA_API int eina_inarray_search_sorted(const Eina_Inarray *array,
const void *data, const void *data,
Eina_Compare_Cb compare) EINA_ARG_NONNULL(1, 2, 3); Eina_Compare_Cb compare) EINA_ARG_NONNULL(1, 2, 3);
@ -607,7 +607,7 @@ EAPI int eina_inarray_search_sorted(const Eina_Inarray *array,
* *
* @since 1.2 * @since 1.2
*/ */
EAPI Eina_Bool eina_inarray_foreach(const Eina_Inarray *array, EINA_API Eina_Bool eina_inarray_foreach(const Eina_Inarray *array,
Eina_Each_Cb function, Eina_Each_Cb function,
const void *user_data) EINA_ARG_NONNULL(1, 2); const void *user_data) EINA_ARG_NONNULL(1, 2);
@ -623,7 +623,7 @@ EAPI Eina_Bool eina_inarray_foreach(const Eina_Inarray *array,
* *
* @since 1.2 * @since 1.2
*/ */
EAPI int eina_inarray_foreach_remove(Eina_Inarray *array, EINA_API int eina_inarray_foreach_remove(Eina_Inarray *array,
Eina_Each_Cb match, Eina_Each_Cb match,
const void *user_data) EINA_ARG_NONNULL(1, 2); const void *user_data) EINA_ARG_NONNULL(1, 2);
@ -636,7 +636,7 @@ EAPI int eina_inarray_foreach_remove(Eina_Inarray *array,
* *
* @since 1.10 * @since 1.10
*/ */
EAPI Eina_Bool eina_inarray_resize(Eina_Inarray *array, unsigned int new_size); EINA_API Eina_Bool eina_inarray_resize(Eina_Inarray *array, unsigned int new_size);
/** /**
* @brief Counts the number of members in an array. * @brief Counts the number of members in an array.
@ -646,7 +646,7 @@ EAPI Eina_Bool eina_inarray_resize(Eina_Inarray *array, unsigned int new_size);
* *
* @since 1.2 * @since 1.2
*/ */
EAPI unsigned int eina_inarray_count(const Eina_Inarray *array) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT; EINA_API unsigned int eina_inarray_count(const Eina_Inarray *array) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT;
/** /**
* @brief Returns a new iterator associated to an array. * @brief Returns a new iterator associated to an array.
@ -665,7 +665,7 @@ EAPI unsigned int eina_inarray_count(const Eina_Inarray *array) EINA_ARG_NONNULL
* *
* @since 1.2 * @since 1.2
*/ */
EAPI Eina_Iterator *eina_inarray_iterator_new(const Eina_Inarray *array) EINA_MALLOC EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1); EINA_API Eina_Iterator *eina_inarray_iterator_new(const Eina_Inarray *array) EINA_MALLOC EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1);
/** /**
* @brief Returns a new reversed iterator associated to an array. * @brief Returns a new reversed iterator associated to an array.
@ -686,7 +686,7 @@ EAPI Eina_Iterator *eina_inarray_iterator_new(const Eina_Inarray *array) EINA_MA
* *
* @since 1.2 * @since 1.2
*/ */
EAPI Eina_Iterator *eina_inarray_iterator_reversed_new(const Eina_Inarray *array) EINA_MALLOC EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1); EINA_API Eina_Iterator *eina_inarray_iterator_reversed_new(const Eina_Inarray *array) EINA_MALLOC EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1);
/** /**
* @brief Returns a new accessor associated to an array. * @brief Returns a new accessor associated to an array.
@ -701,7 +701,7 @@ EAPI Eina_Iterator *eina_inarray_iterator_reversed_new(const Eina_Inarray *array
* *
* @since 1.2 * @since 1.2
*/ */
EAPI Eina_Accessor *eina_inarray_accessor_new(const Eina_Inarray *array) EINA_MALLOC EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1); EINA_API Eina_Accessor *eina_inarray_accessor_new(const Eina_Inarray *array) EINA_MALLOC EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1);
/** /**
* @def EINA_INARRAY_FOREACH * @def EINA_INARRAY_FOREACH

View File

@ -27,7 +27,7 @@
* @cond LOCAL * @cond LOCAL
*/ */
EAPI Eina_Bool eina_array_grow(Eina_Array *array); EINA_API Eina_Bool eina_array_grow(Eina_Array *array);
/** /**
* @endcond * @endcond

View File

@ -19,7 +19,7 @@
#ifndef EINA_INLINE_CRC_X_ #ifndef EINA_INLINE_CRC_X_
#define EINA_INLINE_CRC_X_ #define EINA_INLINE_CRC_X_
EAPI unsigned int _eina_crc(const char *data, int len, unsigned int seed, Eina_Bool start_stream); EINA_API unsigned int _eina_crc(const char *data, int len, unsigned int seed, Eina_Bool start_stream);
static inline unsigned int static inline unsigned int
eina_crc(const char *key, int len, unsigned int seed, Eina_Bool start_stream) eina_crc(const char *key, int len, unsigned int seed, Eina_Bool start_stream)

View File

@ -21,7 +21,7 @@
#include "eina_crc.h" #include "eina_crc.h"
EAPI extern unsigned int eina_seed; EINA_API extern unsigned int eina_seed;
/* /*
djb2 hash algorithm was first reported by dan bernstein, and was the old djb2 hash algorithm was first reported by dan bernstein, and was the old

View File

@ -1,26 +0,0 @@
typedef struct _Eina_Barrier Eina_Barrier;
/** @private */
struct _Eina_Barrier
{
int needed; /**< The number of waiting threads that will cause the barrier to signal and reset. */
int called; /**< The number of threads that are waiting on this barrier. */
Eina_Lock cond_lock; /**< The lock for the barrier */
Eina_Condition cond; /**< The condition variable for the barrier */
};
static inline Eina_Bool
eina_barrier_wait(Eina_Barrier *barrier)
{
eina_lock_take(&(barrier->cond_lock));
barrier->called++;
if (barrier->called == barrier->needed)
{
barrier->called = 0;
eina_condition_broadcast(&(barrier->cond));
}
else
eina_condition_wait(&(barrier->cond));
eina_lock_release(&(barrier->cond_lock));
return EINA_TRUE;
}

View File

@ -25,7 +25,26 @@
#endif #endif
#define _XOPEN_SOURCE 600 #define _XOPEN_SOURCE 600
#ifdef EINA_HAVE_POSIX_SPINLOCK #ifdef EINA_HAVE_OSX_SPINLOCK
/*
* macOS 10.12 introduced the os_unfair_lock API which
* deprecates OSSpinLock, while keeping compatible.
*
* The Spinlock API is not inlined because it would imply including
* stdbool.h, which is not wanted: it would introduce new macros,
* and break compilation of existing programs.
*/
# if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200
# include <os/lock.h>
# define SPINLOCK_GET(LCK) ((os_unfair_lock_t)(LCK))
# else
# include <libkern/OSAtomic.h>
# define SPINLOCK_GET(LCK) ((OSSpinLock *)(LCK))
# define os_unfair_lock_lock(LCK) OSSpinLockLock(LCK)
# define os_unfair_lock_unlock(LCK) OSSpinLockUnlock(LCK)
# define os_unfair_lock_trylock(LCK) OSSpinLockTry(LCK)
# endif
#elif defined(EINA_HAVE_PTHREAD_SPINLOCK)
# include <sched.h> # include <sched.h>
#endif #endif
@ -61,8 +80,8 @@ typedef void (*Eina_Lock_Bt_Func) ();
#include "eina_inlist.h" #include "eina_inlist.h"
#endif #endif
EAPI void _eina_lock_debug_abort(int err, const char *fn, const volatile void *ptr); EINA_API void _eina_lock_debug_abort(int err, const char *fn, const volatile void *ptr);
EAPI void _eina_lock_debug_deadlock(const char *fn, const volatile void *ptr); EINA_API void _eina_lock_debug_deadlock(const char *fn, const volatile void *ptr);
#define EINA_LOCK_ABORT_DEBUG(err, fn, ptr) \ #define EINA_LOCK_ABORT_DEBUG(err, fn, ptr) \
_eina_lock_debug_abort(err, #fn, ptr) _eina_lock_debug_abort(err, #fn, ptr)
@ -80,7 +99,7 @@ typedef struct _Eina_RWLock Eina_RWLock;
typedef struct _Eina_Condition Eina_Condition; typedef struct _Eina_Condition Eina_Condition;
typedef pthread_key_t Eina_TLS; typedef pthread_key_t Eina_TLS;
#if defined(EINA_HAVE_POSIX_SPINLOCK) #ifdef EINA_HAVE_PTHREAD_SPINLOCK
typedef pthread_spinlock_t Eina_Spinlock; typedef pthread_spinlock_t Eina_Spinlock;
#elif defined(EINA_HAVE_OSX_SPINLOCK) #elif defined(EINA_HAVE_OSX_SPINLOCK)
typedef uintptr_t Eina_Spinlock; typedef uintptr_t Eina_Spinlock;
@ -94,22 +113,20 @@ typedef semaphore_t Eina_Semaphore;
typedef sem_t Eina_Semaphore; typedef sem_t Eina_Semaphore;
#endif #endif
EAPI void eina_lock_debug(const Eina_Lock *mutex); EINA_API void eina_lock_debug(const Eina_Lock *mutex);
/** @privatesection @{ */ /** @privatesection @{ */
struct _Eina_Lock struct _Eina_Lock
{ {
#ifdef EINA_HAVE_DEBUG_THREADS
EINA_INLIST; /**< Keeps track of the threads waiting for the lock */
#endif
pthread_mutex_t mutex; /**< The mutex that handles the locking */ pthread_mutex_t mutex; /**< The mutex that handles the locking */
#ifdef EINA_HAVE_DEBUG_THREADS #ifdef EINA_HAVE_DEBUG_THREADS
EINA_INLIST; /**< Keeps track of the threads waiting for the lock */
pthread_t lock_thread_id; /**< The ID of the thread that currently has the lock */ pthread_t lock_thread_id; /**< The ID of the thread that currently has the lock */
Eina_Lock_Bt_Func lock_bt[EINA_LOCK_DEBUG_BT_NUM]; /**< The function that will produce a backtrace on the thread that has the lock */ Eina_Lock_Bt_Func lock_bt[EINA_LOCK_DEBUG_BT_NUM]; /**< The function that will produce a backtrace on the thread that has the lock */
int lock_bt_num; /**< Number of addresses in the backtrace */ int lock_bt_num; /**< Number of addresses in the backtrace */
Eina_Bool locked : 1; /**< Indicates locked or not locked */ Eina_Bool locked : 1; /**< Indicates locked or not locked */
Eina_Bool recursive : 1; /**< Indicates recursive lock */ Eina_Bool recursive : 1; /**< Indicates recursive lock */
#endif #endif /* EINA_HAVE_DEBUG_THREADS */
}; };
struct _Eina_Condition struct _Eina_Condition
@ -130,60 +147,55 @@ struct _Eina_RWLock
}; };
/** @} privatesection */ /** @} privatesection */
EAPI extern Eina_Bool _eina_threads_activated; EINA_API extern Eina_Bool _eina_threads_activated;
#ifdef EINA_HAVE_DEBUG_THREADS #ifdef EINA_HAVE_DEBUG_THREADS
EAPI extern int _eina_threads_debug; EINA_API extern int _eina_threads_debug;
EAPI extern pthread_t _eina_main_loop; EINA_API extern pthread_t _eina_main_loop;
EAPI extern pthread_mutex_t _eina_tracking_lock; EINA_API extern pthread_mutex_t _eina_tracking_lock;
EAPI extern Eina_Inlist *_eina_tracking; EINA_API extern Eina_Inlist *_eina_tracking;
#endif #endif
EAPI Eina_Bool _eina_lock_new(Eina_Lock *mutex, Eina_Bool recursive); EINA_API Eina_Bool _eina_lock_new(Eina_Lock *mutex, Eina_Bool recursive);
EAPI void _eina_lock_free(Eina_Lock *mutex); EINA_API void _eina_lock_free(Eina_Lock *mutex);
EAPI Eina_Bool _eina_condition_new(Eina_Condition *cond, Eina_Lock *mutex); EINA_API Eina_Bool _eina_condition_new(Eina_Condition *cond, Eina_Lock *mutex);
EAPI void _eina_condition_free(Eina_Condition *cond); EINA_API void _eina_condition_free(Eina_Condition *cond);
EAPI Eina_Bool _eina_rwlock_new(Eina_RWLock *mutex); EINA_API Eina_Bool _eina_rwlock_new(Eina_RWLock *mutex);
EAPI void _eina_rwlock_free(Eina_RWLock *mutex); EINA_API void _eina_rwlock_free(Eina_RWLock *mutex);
EAPI Eina_Bool _eina_spinlock_new(Eina_Spinlock *spinlock); EINA_API Eina_Bool _eina_spinlock_new(Eina_Spinlock *spinlock);
EAPI void _eina_spinlock_free(Eina_Spinlock *spinlock); EINA_API void _eina_spinlock_free(Eina_Spinlock *spinlock);
EAPI Eina_Bool _eina_semaphore_new(Eina_Semaphore *sem, int count_init); EINA_API Eina_Bool _eina_semaphore_new(Eina_Semaphore *sem, int count_init);
EAPI Eina_Bool _eina_semaphore_free(Eina_Semaphore *sem); EINA_API Eina_Bool _eina_semaphore_free(Eina_Semaphore *sem);
#ifdef EINA_HAVE_OSX_SPINLOCK #ifdef EINA_HAVE_OSX_SPINLOCK
EAPI Eina_Lock_Result _eina_spinlock_macos_take(Eina_Spinlock *spinlock); EINA_API Eina_Lock_Result _eina_spinlock_macos_take(Eina_Spinlock *spinlock);
EAPI Eina_Lock_Result _eina_spinlock_macos_take_try(Eina_Spinlock *spinlock); EINA_API Eina_Lock_Result _eina_spinlock_macos_take_try(Eina_Spinlock *spinlock);
EAPI Eina_Lock_Result _eina_spinlock_macos_release(Eina_Spinlock *spinlock); EINA_API Eina_Lock_Result _eina_spinlock_macos_release(Eina_Spinlock *spinlock);
#endif #endif
static inline Eina_Bool static inline Eina_Bool
eina_lock_new(Eina_Lock *mutex) _eina_lock_new(Eina_Lock *mutex, Eina_Bool recursive)
{ {
Eina_Bool ret = _eina_lock_new(mutex, EINA_FALSE); pthread_mutexattr_t attr;
#ifdef EINA_HAVE_DEBUG_THREADS Eina_Bool ok = EINA_FALSE;
mutex->recursive = EINA_FALSE;
mutex->lock_thread_id = 0;
mutex->lock_bt_num = 0;
mutex->locked = 0;
#endif
return ret;
}
static inline Eina_Bool if (pthread_mutexattr_init(&attr) != 0) return EINA_FALSE;
eina_lock_recursive_new(Eina_Lock *mutex) if (recursive)
{ {
Eina_Bool ret = _eina_lock_new(mutex, EINA_TRUE); if (pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE) != 0) goto fail_release;
}
#ifdef EINA_HAVE_DEBUG_THREADS #ifdef EINA_HAVE_DEBUG_THREADS
mutex->recursive = EINA_TRUE; else if (pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK) != 0) goto fail_release;
mutex->lock_thread_id = 0;
mutex->lock_bt_num = 0;
mutex->locked = 0;
#endif #endif
return ret; if (pthread_mutex_init(&(mutex->mutex), &attr) != 0) goto fail_release;
ok = EINA_TRUE;
fail_release:
pthread_mutexattr_destroy(&attr);
return ok;
} }
static inline void static inline void
eina_lock_free(Eina_Lock *mutex) _eina_lock_free(Eina_Lock *mutex)
{ {
#ifdef EINA_HAVE_DEBUG_THREADS #ifdef EINA_HAVE_DEBUG_THREADS
if (mutex->locked) if (mutex->locked)
@ -194,11 +206,15 @@ eina_lock_free(Eina_Lock *mutex)
pthread_mutex_unlock(&_eina_tracking_lock); pthread_mutex_unlock(&_eina_tracking_lock);
} }
#endif #endif
_eina_lock_free(mutex);
int ok;
ok = pthread_mutex_destroy(&(mutex->mutex));
if (ok != 0) EINA_LOCK_ABORT_DEBUG(ok, mutex_destroy, mutex);
} }
static inline Eina_Lock_Result static inline Eina_Lock_Result
eina_lock_take_try(Eina_Lock *mutex) _eina_lock_take_try(Eina_Lock *mutex)
{ {
Eina_Lock_Result ret = EINA_LOCK_FAIL; Eina_Lock_Result ret = EINA_LOCK_FAIL;
int ok; int ok;
@ -240,7 +256,7 @@ eina_lock_take_try(Eina_Lock *mutex)
} }
static inline Eina_Lock_Result static inline Eina_Lock_Result
eina_lock_take(Eina_Lock *mutex) _eina_lock_take(Eina_Lock *mutex)
{ {
Eina_Lock_Result ret = EINA_LOCK_FAIL; Eina_Lock_Result ret = EINA_LOCK_FAIL;
int ok; int ok;
@ -313,7 +329,7 @@ eina_lock_take(Eina_Lock *mutex)
} }
static inline Eina_Lock_Result static inline Eina_Lock_Result
eina_lock_release(Eina_Lock *mutex) _eina_lock_release(Eina_Lock *mutex)
{ {
Eina_Lock_Result ret = EINA_LOCK_FAIL; Eina_Lock_Result ret = EINA_LOCK_FAIL;
int ok; int ok;
@ -347,19 +363,59 @@ eina_lock_release(Eina_Lock *mutex)
} }
static inline Eina_Bool static inline Eina_Bool
eina_condition_new(Eina_Condition *cond, Eina_Lock *mutex) _eina_condition_new(Eina_Condition *cond, Eina_Lock *mutex)
{ {
return _eina_condition_new(cond, mutex); pthread_condattr_t attr;
int ok;
#ifdef EINA_HAVE_DEBUG_THREADS
assert(mutex != NULL);
#endif
cond->lock = mutex;
pthread_condattr_init(&attr);
/* OSX doesn't provide clockid_t or clock_gettime. */
#if defined(__clockid_t_defined)
cond->clkid = (clockid_t) 0;
/* We try here to chose the best clock for cond_timedwait */
# if defined(CLOCK_MONOTONIC_RAW)
if (!pthread_condattr_setclock(&attr, CLOCK_MONOTONIC_RAW))
cond->clkid = CLOCK_MONOTONIC_RAW;
# endif
# if defined(CLOCK_MONOTONIC)
if (!cond->clkid && !pthread_condattr_setclock(&attr, CLOCK_MONOTONIC))
cond->clkid = CLOCK_MONOTONIC;
# endif
# if defined(CLOCK_REALTIME)
if (!cond->clkid && !pthread_condattr_setclock(&attr, CLOCK_REALTIME))
cond->clkid = CLOCK_REALTIME;
# endif
#endif
ok = pthread_cond_init(&cond->condition, &attr);
if (ok != 0)
{
pthread_condattr_destroy(&attr);
#ifdef EINA_HAVE_DEBUG_THREADS
if (ok == EBUSY)
fprintf(stderr, "EINA ERROR: eina_condition_new on already initialized Eina_Condition\n");
#endif
return EINA_FALSE;
}
pthread_condattr_destroy(&attr);
return EINA_TRUE;
} }
static inline void static inline void
eina_condition_free(Eina_Condition *cond) _eina_condition_free(Eina_Condition *cond)
{ {
_eina_condition_free(cond); pthread_cond_destroy(&(cond->condition));
} }
static inline Eina_Bool static inline Eina_Bool
eina_condition_wait(Eina_Condition *cond) _eina_condition_wait(Eina_Condition *cond)
{ {
Eina_Bool r = EINA_FALSE; Eina_Bool r = EINA_FALSE;
int ok; int ok;
@ -390,7 +446,7 @@ eina_condition_wait(Eina_Condition *cond)
} }
static inline Eina_Bool static inline Eina_Bool
eina_condition_timedwait(Eina_Condition *cond, double t) _eina_condition_timedwait(Eina_Condition *cond, double t)
{ {
struct timespec ts; struct timespec ts;
time_t sec; time_t sec;
@ -456,7 +512,7 @@ eina_condition_timedwait(Eina_Condition *cond, double t)
} }
static inline Eina_Bool static inline Eina_Bool
eina_condition_broadcast(Eina_Condition *cond) _eina_condition_broadcast(Eina_Condition *cond)
{ {
int ok; int ok;
@ -472,7 +528,7 @@ eina_condition_broadcast(Eina_Condition *cond)
} }
static inline Eina_Bool static inline Eina_Bool
eina_condition_signal(Eina_Condition *cond) _eina_condition_signal(Eina_Condition *cond)
{ {
int ok; int ok;
@ -488,19 +544,25 @@ eina_condition_signal(Eina_Condition *cond)
} }
static inline Eina_Bool static inline Eina_Bool
eina_rwlock_new(Eina_RWLock *mutex) _eina_rwlock_new(Eina_RWLock *mutex)
{ {
return _eina_rwlock_new(mutex); int ok;
ok = pthread_rwlock_init(&(mutex->mutex), NULL);
if (ok == 0) return EINA_TRUE;
else if ((ok == EAGAIN) || (ok == ENOMEM)) return EINA_FALSE;
else EINA_LOCK_ABORT_DEBUG(ok, rwlock_init, mutex);
return EINA_FALSE;
} }
static inline void static inline void
eina_rwlock_free(Eina_RWLock *mutex) _eina_rwlock_free(Eina_RWLock *mutex)
{ {
_eina_rwlock_free(mutex); pthread_rwlock_destroy(&(mutex->mutex));
} }
static inline Eina_Lock_Result static inline Eina_Lock_Result
eina_rwlock_take_read(Eina_RWLock *mutex) _eina_rwlock_take_read(Eina_RWLock *mutex)
{ {
int ok; int ok;
@ -520,7 +582,7 @@ eina_rwlock_take_read(Eina_RWLock *mutex)
} }
static inline Eina_Lock_Result static inline Eina_Lock_Result
eina_rwlock_take_write(Eina_RWLock *mutex) _eina_rwlock_take_write(Eina_RWLock *mutex)
{ {
int ok; int ok;
@ -540,7 +602,7 @@ eina_rwlock_take_write(Eina_RWLock *mutex)
} }
static inline Eina_Lock_Result static inline Eina_Lock_Result
eina_rwlock_release(Eina_RWLock *mutex) _eina_rwlock_release(Eina_RWLock *mutex)
{ {
int ok; int ok;
@ -559,92 +621,169 @@ eina_rwlock_release(Eina_RWLock *mutex)
} }
static inline Eina_Bool static inline Eina_Bool
eina_tls_cb_new(Eina_TLS *key, Eina_TLS_Delete_Cb delete_cb) _eina_tls_cb_new(Eina_TLS *key, Eina_TLS_Delete_Cb delete_cb)
{ {
if (pthread_key_create(key, delete_cb) == 0) return EINA_TRUE; if (pthread_key_create(key, delete_cb) == 0) return EINA_TRUE;
return EINA_FALSE; return EINA_FALSE;
} }
static inline Eina_Bool
eina_tls_new(Eina_TLS *key)
{
return eina_tls_cb_new(key, NULL);
}
static inline void static inline void
eina_tls_free(Eina_TLS key) _eina_tls_free(Eina_TLS key)
{ {
pthread_key_delete(key); pthread_key_delete(key);
} }
static inline void * static inline void *
eina_tls_get(Eina_TLS key) _eina_tls_get(Eina_TLS key)
{ {
return pthread_getspecific(key); return pthread_getspecific(key);
} }
static inline Eina_Bool static inline Eina_Bool
eina_tls_set(Eina_TLS key, const void *data) _eina_tls_set(Eina_TLS key, const void *data)
{ {
if (pthread_setspecific(key, data) == 0) return EINA_TRUE; if (pthread_setspecific(key, data) == 0) return EINA_TRUE;
return EINA_FALSE; return EINA_FALSE;
} }
#ifdef EINA_HAVE_PTHREAD_BARRIER
typedef struct _Eina_Barrier Eina_Barrier; typedef struct _Eina_Barrier Eina_Barrier;
#ifdef EINA_HAVE_PTHREAD_BARRIER
struct _Eina_Barrier struct _Eina_Barrier
{ {
pthread_barrier_t barrier; pthread_barrier_t barrier;
}; };
#else
struct _Eina_Barrier
{
int needed; /**< The number of waiting threads that will cause the barrier to signal and reset. */
int called; /**< The number of threads that are waiting on this barrier. */
Eina_Lock cond_lock; /**< The lock for the barrier */
Eina_Condition cond; /**< The condition variable for the barrier */
};
#endif
static inline Eina_Bool static inline Eina_Bool
eina_barrier_wait(Eina_Barrier *barrier) _eina_barrier_new(Eina_Barrier *barrier, int needed)
{ {
#ifdef EINA_HAVE_PTHREAD_BARRIER
int ok = pthread_barrier_init(&(barrier->barrier), NULL, needed);
if (ok == 0) return EINA_TRUE;
else if ((ok == EAGAIN) || (ok == ENOMEM)) return EINA_FALSE;
else EINA_LOCK_ABORT_DEBUG(ok, barrier_init, barrier);
return EINA_FALSE;
#else
barrier->needed = needed;
barrier->called = 0;
if (eina_lock_new(&(barrier->cond_lock)))
{
if (eina_condition_new(&(barrier->cond), &(barrier->cond_lock)))
return EINA_TRUE;
}
return EINA_FALSE;
#endif
}
static inline void
_eina_barrier_free(Eina_Barrier *barrier)
{
#ifdef EINA_HAVE_PTHREAD_BARRIER
int ok = pthread_barrier_destroy(&(barrier->barrier));
if (ok != 0) EINA_LOCK_ABORT_DEBUG(ok, barrier_destroy, barrier);
#else
eina_condition_free(&(barrier->cond));
eina_lock_free(&(barrier->cond_lock));
barrier->needed = 0;
barrier->called = 0;
#endif
}
static inline Eina_Bool
_eina_barrier_wait(Eina_Barrier *barrier)
{
#ifdef EINA_HAVE_PTHREAD_BARRIER
int ok = pthread_barrier_wait(&(barrier->barrier)); int ok = pthread_barrier_wait(&(barrier->barrier));
if (ok == 0) return EINA_TRUE; if (ok == 0) return EINA_TRUE;
else if (ok == PTHREAD_BARRIER_SERIAL_THREAD) return EINA_TRUE; else if (ok == PTHREAD_BARRIER_SERIAL_THREAD) return EINA_TRUE;
else EINA_LOCK_ABORT_DEBUG(ok, barrier_wait, barrier); else EINA_LOCK_ABORT_DEBUG(ok, barrier_wait, barrier);
return EINA_TRUE; return EINA_TRUE;
}
#else #else
#include "eina_inline_lock_barrier.x" eina_lock_take(&(barrier->cond_lock));
barrier->called++;
if (barrier->called == barrier->needed)
{
barrier->called = 0;
eina_condition_broadcast(&(barrier->cond));
}
else
eina_condition_wait(&(barrier->cond));
eina_lock_release(&(barrier->cond_lock));
return EINA_TRUE;
#endif #endif
}
EAPI Eina_Bool _eina_barrier_new(Eina_Barrier *barrier, int needed); EINA_API Eina_Bool _eina_barrier_new(Eina_Barrier *barrier, int needed);
EAPI void _eina_barrier_free(Eina_Barrier *barrier); EINA_API void _eina_barrier_free(Eina_Barrier *barrier);
static inline Eina_Bool static inline Eina_Bool
eina_barrier_new(Eina_Barrier *barrier, int needed) _eina_spinlock_new(Eina_Spinlock *spinlock)
{ {
return _eina_barrier_new(barrier, needed); #if defined(EINA_HAVE_PTHREAD_SPINLOCK)
int ok = pthread_spin_init(spinlock, PTHREAD_PROCESS_PRIVATE);
if (ok == 0) return EINA_TRUE;
else if ((ok == EAGAIN) || (ok == ENOMEM)) return EINA_FALSE;
else EINA_LOCK_ABORT_DEBUG(ok, spin_init, spinlock);
return EINA_FALSE;
#elif defined(EINA_HAVE_OSX_SPINLOCK)
*spinlock = 0;
return EINA_TRUE;
#else
return eina_lock_new(spinlock);
#endif
} }
static inline void static inline void
eina_barrier_free(Eina_Barrier *barrier) _eina_spinlock_free(Eina_Spinlock *spinlock)
{ {
_eina_barrier_free(barrier); #if defined(EINA_HAVE_PTHREAD_SPINLOCK)
int ok = pthread_spin_destroy(spinlock);
if (ok != 0) EINA_LOCK_ABORT_DEBUG(ok, spin_destroy, spinlock);
#elif defined(EINA_HAVE_OSX_SPINLOCK)
/* Not applicable */
(void) spinlock;
#else
eina_lock_free(spinlock);
#endif
} }
#ifdef EINA_HAVE_OSX_SPINLOCK
static inline Eina_Bool static inline Eina_Lock_Result
eina_spinlock_new(Eina_Spinlock *spinlock) _eina_spinlock_macos_take(Eina_Spinlock *spinlock)
{ {
return _eina_spinlock_new(spinlock); os_unfair_lock_lock(SPINLOCK_GET(spinlock));
} return EINA_LOCK_SUCCEED;
static inline void
eina_spinlock_free(Eina_Spinlock *spinlock)
{
_eina_spinlock_free(spinlock);
} }
static inline Eina_Lock_Result static inline Eina_Lock_Result
eina_spinlock_take_try(Eina_Spinlock *spinlock) _eina_spinlock_macos_take_try(Eina_Spinlock *spinlock)
{ {
#if defined(EINA_HAVE_POSIX_SPINLOCK) return (os_unfair_lock_trylock(SPINLOCK_GET(spinlock)) == true)
? EINA_LOCK_SUCCEED
: EINA_LOCK_FAIL;
}
static inline Eina_Lock_Result
_eina_spinlock_macos_release(Eina_Spinlock *spinlock)
{
os_unfair_lock_unlock(SPINLOCK_GET(spinlock));
return EINA_LOCK_SUCCEED;
}
#endif /* EINA_HAVE_OSX_SPINLOCK */
static inline Eina_Lock_Result
_eina_spinlock_take_try(Eina_Spinlock *spinlock)
{
#if defined(EINA_HAVE_PTHREAD_SPINLOCK)
int t = pthread_spin_trylock(spinlock); int t = pthread_spin_trylock(spinlock);
if (t == 0) return EINA_LOCK_SUCCEED; if (t == 0) return EINA_LOCK_SUCCEED;
else if (t == EBUSY) return EINA_LOCK_FAIL; else if (t == EBUSY) return EINA_LOCK_FAIL;
@ -658,9 +797,9 @@ eina_spinlock_take_try(Eina_Spinlock *spinlock)
} }
static inline Eina_Lock_Result static inline Eina_Lock_Result
eina_spinlock_take(Eina_Spinlock *spinlock) _eina_spinlock_take(Eina_Spinlock *spinlock)
{ {
#if defined(EINA_HAVE_POSIX_SPINLOCK) #if defined(EINA_HAVE_PTHREAD_SPINLOCK)
int t; int t;
#ifdef EINA_HAVE_DEBUG_THREADS #ifdef EINA_HAVE_DEBUG_THREADS
@ -683,9 +822,9 @@ eina_spinlock_take(Eina_Spinlock *spinlock)
} }
static inline Eina_Lock_Result static inline Eina_Lock_Result
eina_spinlock_release(Eina_Spinlock *spinlock) _eina_spinlock_release(Eina_Spinlock *spinlock)
{ {
#if defined(EINA_HAVE_POSIX_SPINLOCK) #if defined(EINA_HAVE_PTHREAD_SPINLOCK)
int ok = pthread_spin_unlock(spinlock); int ok = pthread_spin_unlock(spinlock);
if (ok == 0) return EINA_LOCK_SUCCEED; if (ok == 0) return EINA_LOCK_SUCCEED;
else if (ok == EPERM) return EINA_LOCK_FAIL; else if (ok == EPERM) return EINA_LOCK_FAIL;
@ -699,19 +838,37 @@ eina_spinlock_release(Eina_Spinlock *spinlock)
} }
static inline Eina_Bool static inline Eina_Bool
eina_semaphore_new(Eina_Semaphore *sem, int count_init) _eina_semaphore_new(Eina_Semaphore *sem, int count_init)
{ {
return _eina_semaphore_new(sem, count_init); if (sem && (count_init >= 0))
{
#if defined(EINA_HAVE_OSX_SEMAPHORE)
kern_return_t kr = semaphore_create(mach_task_self(), sem, SYNC_POLICY_FIFO, count_init);
return (kr == KERN_SUCCESS) ? EINA_TRUE : EINA_FALSE;
#else
return (sem_init(sem, 0, count_init) == 0) ? EINA_TRUE : EINA_FALSE;
#endif
}
return EINA_FALSE;
} }
static inline Eina_Bool static inline Eina_Bool
eina_semaphore_free(Eina_Semaphore *sem) _eina_semaphore_free(Eina_Semaphore *sem)
{ {
return _eina_semaphore_free(sem); if (sem)
{
#if defined(EINA_HAVE_OSX_SEMAPHORE)
return (semaphore_destroy(mach_task_self(), *sem) == KERN_SUCCESS)
? EINA_TRUE : EINA_FALSE;
#else
return (sem_destroy(sem) == 0) ? EINA_TRUE : EINA_FALSE;
#endif
}
return EINA_FALSE;
} }
static inline Eina_Bool static inline Eina_Bool
eina_semaphore_lock(Eina_Semaphore *sem) _eina_semaphore_lock(Eina_Semaphore *sem)
{ {
if (sem) if (sem)
{ {
@ -735,7 +892,7 @@ err:
} }
static inline Eina_Bool static inline Eina_Bool
eina_semaphore_release(Eina_Semaphore *sem, int count_release EINA_UNUSED) _eina_semaphore_release(Eina_Semaphore *sem, int count_release EINA_UNUSED)
{ {
if (sem) if (sem)
#if defined(EINA_HAVE_OSX_SEMAPHORE) #if defined(EINA_HAVE_OSX_SEMAPHORE)

View File

@ -0,0 +1,747 @@
/* EINA - EFL data type library
* Copyright (C) 2020 Lucas Cavalcante de Sousa
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library;
* if not, see <http://www.gnu.org/licenses/>.
*/
#ifndef EINA_INLINE_LOCK_WIN32_X_
#define EINA_INLINE_LOCK_WIN32_X_
#ifndef WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN
#endif
#include <Windows.h>
#include <synchapi.h>
#undef WIN32_LEAN_AND_MEAN
#include "unimplemented.h"
#include <errno.h>
#include <sys/time.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <unistd.h>
#ifdef EINA_HAVE_DEBUG_THREADS
#include <assert.h>
#include <execinfo.h>
#define EINA_LOCK_DEBUG_BT_NUM 64
typedef void (*Eina_Lock_Bt_Func) ();
#include "eina_inlist.h"
#endif
EINA_API void _eina_lock_debug_abort(int err, const char *fn, const volatile void *ptr);
EINA_API void _eina_lock_debug_deadlock(const char *fn, const volatile void *ptr);
#define EINA_LOCK_ABORT_DEBUG(err, fn, ptr) \
_eina_lock_debug_abort(err, #fn, ptr)
#define EINA_LOCK_DEADLOCK_DEBUG(fn, ptr) \
_eina_lock_debug_deadlock(#fn, ptr)
/* For cond_timedwait */
#include <time.h>
#include <sys/time.h>
#include <eina_error.h>
typedef struct _Eina_Lock Eina_Lock;
typedef struct _Eina_RWLock Eina_RWLock;
typedef struct _Eina_Condition Eina_Condition;
typedef struct _Eina_Barrier Eina_Barrier;
typedef LPDWORD Eina_TLS;
typedef HANDLE Eina_Semaphore;
#ifdef EINA_HAVE_WIN32_SPINLOCK
typedef PCRITICAL_SECTION Eina_Spinlock;
#else
typedef Eina_Lock Eina_Spinlock;
#endif
EINA_API void eina_lock_debug(const Eina_Lock *mutex);
/** @privatesection @{ */
typedef HANDLE _Eina_Thread;
typedef PCRITICAL_SECTION _Eina_Mutex_t;
typedef CONDITION_VARIABLE _Eina_Condition_t;
typedef PSRWLOCK _Eina_RWLock_t;
struct _Eina_Lock
{
_Eina_Mutex_t mutex; /**< The mutex that handles the locking */
#ifdef EINA_HAVE_DEBUG_THREADS
EINA_INLIST; /**< Keeps track of the threads waiting for the lock */
_Eina_Thread lock_thread_id; /**< The ID of the thread that currently has the lock */
Eina_Lock_Bt_Func lock_bt[EINA_LOCK_DEBUG_BT_NUM]; /**< The function that will produce a backtrace on the thread that has the lock */
int lock_bt_num; /**< Number of addresses in the backtrace */
Eina_Bool locked : 1; /**< Indicates locked or not locked */
Eina_Bool recursive : 1; /**< Indicates recursive lock */
#endif /* EINA_HAVE_DEBUG_THREADS */
};
struct _Eina_Condition
{
Eina_Lock *lock; /**< The lock for this condition */
_Eina_Condition_t condition; /**< The condition variable */
#if defined(__clockid_t_defined)
clockid_t clkid; /**< The attached clock for timedwait */
#endif
};
enum _Eina_RWLock_Mode {
_Eina_RWLock_Mode_Shared,
_Eina_RWLock_Mode_Exclusive,
_Eina_RWLock_Mode_None
};
struct _Eina_RWLock
{
_Eina_RWLock_t mutex; /**< The mutex that handles the locking */
#ifdef EINA_HAVE_DEBUG_THREADS
_Eina_Thread lock_thread_wid; /**< The ID of the thread that currently has the lock */
#endif
enum _Eina_RWLock_Mode mode; /**< The mode the SRWLock is (Shared, Exclusive or None)*/
};
/** @} privatesection */
EINA_API extern Eina_Bool _eina_threads_activated;
#ifdef EINA_HAVE_DEBUG_THREADS
EINA_API extern int _eina_threads_debug;
EINA_API extern _Eina_Thread _eina_main_loop;
EINA_API extern Eina_Lock _eina_tracking_lock;
EINA_API extern Eina_Inlist *_eina_tracking;
#endif
EINA_API Eina_Bool eina_lock_new(Eina_Lock *mutex);
EINA_API void eina_lock_free(Eina_Lock *mutex);
EINA_API Eina_Lock_Result eina_lock_take(Eina_Lock *mutex);
EINA_API Eina_Lock_Result eina_lock_take_try(Eina_Lock *mutex);
EINA_API Eina_Lock_Result eina_lock_release(Eina_Lock *mutex);
EINA_API Eina_Bool eina_condition_new(Eina_Condition *cond, Eina_Lock *mutex);
EINA_API void eina_condition_free(Eina_Condition *cond);
EINA_API Eina_Bool eina_condition_wait(Eina_Condition *cond);
EINA_API Eina_Bool eina_condition_broadcast(Eina_Condition *cond);
static inline Eina_Bool
_eina_lock_new(Eina_Lock *mutex, Eina_Bool recursive)
{
InitializeCriticalSection((mutex->mutex));
DWORD ok = GetLastError();
if (ok == ERROR_SUCCESS) return EINA_TRUE;
return EINA_FALSE;
}
static inline void
_eina_lock_free(Eina_Lock *mutex)
{
#ifdef EINA_HAVE_DEBUG_THREADS
if (mutex->locked)
{
EnterCriticalSection(_eina_tracking_lock);
_eina_tracking = eina_inlist_remove(_eina_tracking,
EINA_INLIST_GET(mutex));
LeaveCriticalSection(_eina_tracking_lock);
}
#endif
DWORD ok;
DeleteCriticalSection((mutex->mutex));
ok = GetLastError();
if (ok != ERROR_SUCCESS) EINA_LOCK_ABORT_DEBUG((int)ok, mutex_destroy
, mutex);
}
static inline Eina_Lock_Result
_eina_lock_take_try(Eina_Lock *mutex)
{
Eina_Lock_Result ret = EINA_LOCK_FAIL;
#ifdef EINA_HAVE_ON_OFF_THREADS
if (!_eina_threads_activated) return EINA_LOCK_SUCCEED;
#endif
int ok = TryEnterCriticalSection((mutex->mutex));
DWORD err = GetLastError();
if (ok != 0) ret = EINA_LOCK_SUCCEED;
else if (err == ERROR_POSSIBLE_DEADLOCK)
{
eina_lock_debug(mutex);
ret = EINA_LOCK_DEADLOCK;
}
else if (err != ERROR_TIMEOUT) EINA_LOCK_ABORT_DEBUG((int)err, trylock, mutex);
#ifdef EINA_HAVE_DEBUG_THREADS
if (ret == EINA_LOCK_SUCCEED)
{
/* recursive locks can't make use of any of this */
if (mutex->recursive) return ret;
mutex->locked = 1;
mutex->lock_thread_id = GetCurrentThreadId();
/* backtrace() can somehow generate EINVAL even though this is not documented anywhere? */
int err = errno;
mutex->lock_bt_num = backtrace((void **)(mutex->lock_bt), EINA_LOCK_DEBUG_BT_NUM);
errno = err;
EnterCriticalSection(_eina_tracking_lock);
_eina_tracking = eina_inlist_append(_eina_tracking,
EINA_INLIST_GET(mutex));
LeaveCriticalSection(_eina_tracking_lock);
}
#endif
return ret;
}
static inline Eina_Lock_Result
_eina_lock_take(Eina_Lock *mutex)
{
Eina_Lock_Result ret = EINA_LOCK_FAIL;
DWORD ok;
#ifdef EINA_HAVE_ON_OFF_THREADS
if (!_eina_threads_activated) return EINA_LOCK_SUCCEED;
#endif
#ifdef EINA_HAVE_DEBUG_THREADS
if (eina_lock_take_try(mutex) == EINA_LOCK_SUCCEED) return EINA_LOCK_SUCCEED;
if (_eina_threads_debug >= 100)
{
struct timeval t0, t1;
int dt;
gettimeofday(&t0, NULL);
ok = EnterCriticalSection((mutex->mutex));
gettimeofday(&t1, NULL);
dt = (t1.tv_sec - t0.tv_sec) * 1000000;
if (t1.tv_usec > t0.tv_usec) dt += (t1.tv_usec - t0.tv_usec);
else dt -= t0.tv_usec - t1.tv_usec;
if (dt > _eina_threads_debug) abort();
}
else
{
#endif
EnterCriticalSection((mutex->mutex));
ok = GetLastError();
#ifdef EINA_HAVE_DEBUG_THREADS
}
#endif
if (ok == ERROR_SUCCESS) ret = EINA_LOCK_SUCCEED;
else if (ok == ERROR_POSSIBLE_DEADLOCK)
{
eina_lock_debug(mutex);
ret = EINA_LOCK_DEADLOCK;
#ifdef EINA_HAVE_DEBUG_THREADS
if (_eina_threads_debug) abort();
#endif
}
else if (ok != ERROR_TIMEOUT) EINA_LOCK_ABORT_DEBUG((int)ok, lock, mutex);
#ifdef EINA_HAVE_DEBUG_THREADS
/* recursive locks can't make use of any of this */
if (mutex->recursive) return ret;
mutex->locked = 1;
mutex->lock_thread_id = GetCurrentThreadId();
/* backtrace() can somehow generate EINVAL even though this is not documented anywhere? */
int err = errno;
mutex->lock_bt_num = backtrace((void **)(mutex->lock_bt), EINA_LOCK_DEBUG_BT_NUM);
errno = err;
EnterCriticalSection(_eina_tracking_lock);
_eina_tracking = eina_inlist_append(_eina_tracking,
EINA_INLIST_GET(mutex));
LeaveCriticalSection(_eina_tracking_lock);
#endif
return ret;
}
static inline Eina_Lock_Result
_eina_lock_release(Eina_Lock *mutex)
{
Eina_Lock_Result ret = EINA_LOCK_FAIL;
#ifdef EINA_HAVE_ON_OFF_THREADS
if (!_eina_threads_activated) return EINA_LOCK_SUCCEED;
#endif
#ifdef EINA_HAVE_DEBUG_THREADS
/* recursive locks can't make use of any of this */
if (!mutex->recursive)
{
mutex->locked = 0;
mutex->lock_thread_id = 0;
memset(mutex->lock_bt, 0, EINA_LOCK_DEBUG_BT_NUM * sizeof(Eina_Lock_Bt_Func));
mutex->lock_bt_num = 0;
EnterCriticalSection(_eina_tracking_lock);
_eina_tracking = eina_inlist_remove(_eina_tracking,
EINA_INLIST_GET(mutex));
LeaveCriticalSection(_eina_tracking_lock);
}
#endif
LeaveCriticalSection((mutex->mutex));
DWORD ok = GetLastError();
if (ok == ERROR_SUCCESS) ret = EINA_LOCK_SUCCEED;
else if (ok != ERROR_ACCESS_DENIED) ret = EINA_LOCK_FAIL;
else EINA_LOCK_ABORT_DEBUG((int)ok, unlock, mutex);
return ret;
}
UNIMPLEMENTED static inline Eina_Bool
_eina_condition_new(Eina_Condition *cond, Eina_Lock *mutex)
{
// TODO
#warning eina_condition_new is not implemented
return EINA_TRUE;
}
static inline void
_eina_condition_free(Eina_Condition *cond)
{
return;
}
static inline Eina_Bool
_eina_condition_wait(Eina_Condition *cond)
{
Eina_Bool r = EINA_FALSE;
#ifdef EINA_HAVE_DEBUG_THREADS
assert(_eina_threads_activated);
assert(cond->lock != NULL);
EnterCriticalSection(_eina_tracking_lock);
_eina_tracking = eina_inlist_remove(_eina_tracking,
EINA_INLIST_GET(cond->lock));
LeaveCriticalSection(_eina_tracking_lock);
#endif
int ok = SleepConditionVariableCS(&(cond->condition)
, (cond->lock->mutex), INFINITE);
DWORD err = GetLastError();
if (ok != 0) r = EINA_TRUE;
else if (err != ERROR_ACCESS_DENIED) r = EINA_FALSE;
else EINA_LOCK_ABORT_DEBUG((int)ok, cond_wait, cond);
#ifdef EINA_HAVE_DEBUG_THREADS
EnterCriticalSection(_eina_tracking_lock);
_eina_tracking = eina_inlist_append(_eina_tracking
, EINA_INLIST_GET(cond->lock));
LeaveCriticalSection(_eina_tracking_lock);
#endif
return r;
}
UNIMPLEMENTED static inline Eina_Bool
_eina_condition_timedwait(Eina_Condition *cond, double t)
{
//** TODO **//
#warning eina_condition_timedwait is not implemented
return EINA_TRUE;
}
static inline Eina_Bool
_eina_condition_broadcast(Eina_Condition *cond)
{
#ifdef EINA_HAVE_DEBUG_THREADS
assert(cond->lock != NULL);
#endif
WakeAllConditionVariable(&(cond->condition));
DWORD ok = GetLastError();
if (ok == ERROR_SUCCESS) return EINA_TRUE;
EINA_LOCK_ABORT_DEBUG((int)ok, cond_broadcast, cond);
return EINA_FALSE;
}
static inline Eina_Bool
_eina_condition_signal(Eina_Condition *cond)
{
#ifdef EINA_HAVE_DEBUG_THREADS
assert(cond->lock != NULL);
#endif
WakeConditionVariable(&(cond->condition));
DWORD ok = GetLastError();
if (ok == ERROR_SUCCESS) return EINA_TRUE;
EINA_LOCK_ABORT_DEBUG((int)ok, cond_signal, cond);
return EINA_FALSE;
}
static inline Eina_Bool
_eina_rwlock_new(Eina_RWLock *mutex)
{
InitializeSRWLock((mutex->mutex));
DWORD ok = GetLastError();
if (ok == ERROR_SUCCESS) return EINA_TRUE;
else if ((ok == ERROR_NOT_ENOUGH_MEMORY) || (ok == ERROR_ACCESS_DENIED)
|| (ok == ERROR_OUTOFMEMORY))
{
return EINA_FALSE;
}
else EINA_LOCK_ABORT_DEBUG(ok, rwlock_init, mutex);
return EINA_FALSE;
}
static inline void
_eina_rwlock_free(Eina_RWLock *mutex)
{
return;
}
static inline Eina_Lock_Result
_eina_rwlock_take_read(Eina_RWLock *mutex)
{
#ifdef EINA_HAVE_ON_OFF_THREADS
if (!_eina_threads_activated) return EINA_LOCK_SUCCEED;
#endif
AcquireSRWLockShared((mutex->mutex));
DWORD ok = GetLastError();
if (ok == ERROR_SUCCESS)
{
mutex->mode = _Eina_RWLock_Mode_Shared;
return EINA_LOCK_SUCCEED;
}
else if (ok == ERROR_NOT_ENOUGH_MEMORY || ok == ERROR_OUTOFMEMORY)
{
return EINA_LOCK_FAIL;
}
else if (ok == ERROR_POSSIBLE_DEADLOCK)
{
EINA_LOCK_DEADLOCK_DEBUG(rwlock_rdlock, mutex);
}
else EINA_LOCK_ABORT_DEBUG((int)ok, rwlock_rdlock, mutex);
return EINA_LOCK_FAIL;
}
static inline Eina_Lock_Result
_eina_rwlock_take_write(Eina_RWLock *mutex)
{
#ifdef EINA_HAVE_ON_OFF_THREADS
if (!_eina_threads_activated) return EINA_LOCK_SUCCEED;
#endif
AcquireSRWLockExclusive((mutex->mutex));
DWORD ok = GetLastError();
if (ok == ERROR_SUCCESS)
{
mutex->mode = _Eina_RWLock_Mode_Exclusive;
return EINA_LOCK_SUCCEED;
}
else if (ok == ERROR_NOT_ENOUGH_MEMORY || ok == ERROR_OUTOFMEMORY)
{
return EINA_LOCK_FAIL;
}
else if (ok == ERROR_POSSIBLE_DEADLOCK)
{
EINA_LOCK_DEADLOCK_DEBUG(rwlock_rdlock, mutex);
}
else EINA_LOCK_ABORT_DEBUG((int)ok, rwlock_rdlock, mutex);
return EINA_LOCK_FAIL;
}
static inline Eina_Lock_Result
_eina_rwlock_release(Eina_RWLock *mutex)
{
DWORD ok;
#ifdef EINA_HAVE_ON_OFF_THREADS
if (!_eina_threads_activated) return EINA_LOCK_SUCCEED;
#endif
if (mutex->mode == _Eina_RWLock_Mode_Exclusive)
{
mutex->mode = _Eina_RWLock_Mode_None;
ReleaseSRWLockExclusive((mutex->mutex));
ok = GetLastError();
if (ok == ERROR_SUCCESS) return EINA_LOCK_SUCCEED;
mutex->mode = _Eina_RWLock_Mode_Exclusive;
}
else if (mutex->mode == _Eina_RWLock_Mode_Shared)
{
mutex->mode = _Eina_RWLock_Mode_None;
ReleaseSRWLockShared((mutex->mutex));
ok = GetLastError();
if (ok == ERROR_SUCCESS) return EINA_LOCK_SUCCEED;
mutex->mode = _Eina_RWLock_Mode_Shared;
}
if (ok == ERROR_ACCESS_DENIED) return EINA_LOCK_FAIL;
EINA_LOCK_ABORT_DEBUG((int)ok, rwlock_unlock, mutex);
return EINA_LOCK_FAIL;
}
static inline Eina_Bool
_eina_tls_cb_new(Eina_TLS *key, Eina_TLS_Delete_Cb delete_cb)
{
* key = TlsAlloc();
DWORD ok = GetLastError();
if (key != TLS_OUT_OF_INDEXES || ok != ERROR_SUCCESS) return EINA_TRUE;
else return EINA_FALSE;
}
static inline void
_eina_tls_free(Eina_TLS key)
{
TlsFree(key);
}
static inline void *
_eina_tls_get(Eina_TLS key)
{
return TlsGetValue(key);
}
static inline Eina_Bool
_eina_tls_set(Eina_TLS key, const void *data)
{
int ok = TlsSetValue(key, (void *) data);
DWORD err = GetLastError();
if (ok != 0 && err == ERROR_SUCCESS) return EINA_TRUE;
else return EINA_TRUE;
}
#ifdef EINA_HAVE_WIN32_BARRIER
struct _Eina_Barrier
{
LPSYNCHRONIZATION_BARRIER barrier;
};
#else
struct _Eina_Barrier
{
int needed; /**< The number of waiting threads that will cause the barrier to signal and reset. */
int called; /**< The number of threads that are waiting on this barrier. */
Eina_Lock cond_lock; /**< The lock for the barrier */
Eina_Condition cond; /**< The condition variable for the barrier */
};
#endif
static inline Eina_Bool
_eina_barrier_new(Eina_Barrier *barrier, int needed)
{
#ifdef EINA_HAVE_WIN32_BARRIER
InitializeSynchronizationBarrier(&(barrier->barrier), (LONG) needed, 0);
DWORD ok = GetLastError();
if (ok == ERROR_SUCCESS) return EINA_TRUE;
else if ((ok == ERROR_NOT_ENOUGH_MEMORY) || (ok == ERROR_ACCESS_DENIED)
|| (ok == ERROR_OUTOFMEMORY))
{
return EINA_FALSE;
}
else EINA_LOCK_ABORT_DEBUG(ok, barrier_init, barrier);
return EINA_FALSE;
#else
barrier->needed = needed;
barrier->called = 0;
if (eina_lock_new(&(barrier->cond_lock)))
{
if (eina_condition_new(&(barrier->cond), &(barrier->cond_lock)))
return EINA_TRUE;
}
return EINA_FALSE;
#endif
}
static inline void
_eina_barrier_free(Eina_Barrier *barrier)
{
#ifdef EINA_HAVE_WIN32_BARRIER
DeleteSynchronizationBarrier(&(barrier->barrier));
DWORD ok = GetLastError();
if (ok != ERROR_SUCCESS) EINA_LOCK_ABORT_DEBUG(ok, barrier_destroy, barrier);
#else
eina_condition_free(&(barrier->cond));
eina_lock_free(&(barrier->cond_lock));
barrier->needed = 0;
barrier->called = 0;
#endif
}
static inline Eina_Bool
_eina_barrier_wait(Eina_Barrier *barrier)
{
#ifdef EINA_HAVE_WIN32_BARRIER
EnterSyncronizationBarrier(&(barrier->barrier)
, SYNCHRONIZATION_BARRIER_FLAGS_BLOCK_ONLY);
DWORD ok = GetLastError();
if (ok == ERROR_SUCCESS) return EINA_TRUE;
else EINA_LOCK_ABORT_DEBUG((int)ok, barrier_wait, barrier);
return EINA_TRUE;
#else
eina_lock_take(&(barrier->cond_lock));
barrier->called++;
if (barrier->called == barrier->needed)
{
barrier->called = 0;
eina_condition_broadcast(&(barrier->cond));
}
else eina_condition_wait(&(barrier->cond));
eina_lock_release(&(barrier->cond_lock));
return EINA_TRUE;
#endif
}
static inline Eina_Bool
_eina_spinlock_new(Eina_Spinlock *spinlock)
{
#ifdef EINA_HAVE_WIN32_SPINLOCK
int ok = InitializeCriticalSectionAndSpinCount(spinlock, INFINITE);
DWORD err = GetLastError();
if (ok != 0) return EINA_TRUE;
else if ((err == ERROR_NOT_ENOUGH_MEMORY) || (err == ERROR_ACCESS_DENIED)
|| (err == ERROR_OUTOFMEMORY))
{
return EINA_FALSE;
}
else EINA_LOCK_ABORT_DEBUG((int)err, spin_init, spinlock);
return EINA_FALSE;
#else
return eina_lock_new(spinlock);
#endif
}
static inline void
_eina_spinlock_free(Eina_Spinlock *spinlock)
{
#ifdef EINA_HAVE_WIN32_SPINLOCK
DeleteCriticalSection(spinlock);
DWORD ok = GetLastError();
if (ok != ERROR_SUCCESS) EINA_LOCK_ABORT_DEBUG(ok, spin_destroy, spinlock);
#else
eina_lock_free(spinlock);
#endif
}
static inline Eina_Lock_Result
_eina_spinlock_take_try(Eina_Spinlock *spinlock)
{
#ifdef EINA_HAVE_WIN32_SPINLOCK
int ok = TryEnterCriticalSection(spinlock);
DWORD err = GetLastError();
if (err == ERROR_SUCCESS) return EINA_LOCK_SUCCEED;
else if (ok == 0 || err == ERROR_TIMEOUT) EINA_LOCK_FAIL;
else EINA_LOCK_ABORT_DEBUG((int)err, trylock, mutex);
return EINA_LOCK_FAIL
#else
return eina_lock_take_try(spinlock);
#endif
}
static inline Eina_Lock_Result
_eina_spinlock_take(Eina_Spinlock *spinlock)
{
#ifdef EINA_HAVE_WIN32_SPINLOCK
# ifdef EINA_HAVE_DEBUG_THREADS
if (eina_spinlock_take_try(spinlock) == EINA_LOCK_SUCCEED)
return EINA_LOCK_SUCCEED;
# endif
for (;;)
{
int ok = EnterCriticalSection(spinlock);
if (ok != 0) break;
else {
DWORD err = GetLastError();
EINA_LOCK_ABORT_DEBUG((int)err, spin_lock, spinlock);
}
}
return EINA_LOCK_SUCCEED;
#else
return eina_lock_take(spinlock);
#endif
}
static inline Eina_Lock_Result
_eina_spinlock_release(Eina_Spinlock *spinlock)
{
#if defined(EINA_HAVE_WIN32_SPINLOCK)
LeaveCriticalSection(spinlock);
DWORD ok = GetLastError();
if (ok == ERROR_SUCCESS) return EINA_LOCK_SUCCEED;
else if (ok == ERROR_ACCESS_DENIED) return EINA_LOCK_FAIL;
else EINA_LOCK_ABORT_DEBUG((int)ok, spin_unlock, spinlock);
return EINA_LOCK_FAIL;
#else
return eina_lock_release(spinlock);
#endif
}
static inline Eina_Bool
_eina_semaphore_new(Eina_Semaphore *sem, int count_init)
{
if (sem && (count_init >= 0))
{
sem = CreateSemaphoreA(NULL, count_init, count_init, NULL);
DWORD ok = GetLastError();
if (ok == ERROR_SUCCESS) return EINA_TRUE;
}
return EINA_FALSE;
}
static inline Eina_Bool
_eina_semaphore_free(Eina_Semaphore *sem)
{
if (sem)
{
CloseHandle(sem);
DWORD ok = GetLastError();
if (ok == ERROR_SUCCESS) return EINA_TRUE;
}
return EINA_FALSE;
}
static inline Eina_Bool
_eina_semaphore_lock(Eina_Semaphore *sem)
{
if (sem)
{
for (;;)
{
WaitForSingleObject(sem, INFINITE);
DWORD ok = GetLastError();
if (ok == ERROR_SUCCESS)
return EINA_TRUE;
else if (ok == WAIT_OBJECT_0 || ok == WAIT_TIMEOUT)
continue;
else if (errno == ERROR_POSSIBLE_DEADLOCK)
{
EINA_LOCK_DEADLOCK_DEBUG(sem_wait, sem);
return EINA_FALSE;
}
}
}
return EINA_FALSE;
}
static inline Eina_Bool
_eina_semaphore_release(Eina_Semaphore *sem, int count_release EINA_UNUSED)
{
if (sem)
return (ReleaseSemaphore(sem, 1, NULL) != 0) ? EINA_TRUE : EINA_FALSE;
return EINA_FALSE;
}
#endif

View File

@ -24,7 +24,7 @@
#define __EINA_MODULE_UNIQUE_ID(id) _EINA_MODINFO_CONCAT(__EINA_MODULE_UNIQUE_ID_, id) #define __EINA_MODULE_UNIQUE_ID(id) _EINA_MODINFO_CONCAT(__EINA_MODULE_UNIQUE_ID_, id)
#define _EINA_MODINFO(name, info) \ #define _EINA_MODINFO(name, info) \
EAPI const char __EINA_MODULE_UNIQUE_ID(name)[] \ EINA_API const char __EINA_MODULE_UNIQUE_ID(name)[] \
__attribute__((__used__)) __attribute__((unused, aligned(1))) = info; __attribute__((__used__)) __attribute__((unused, aligned(1))) = info;
#define EINA_MODINFO(tag, info) _EINA_MODINFO(tag, info) #define EINA_MODINFO(tag, info) _EINA_MODINFO(tag, info)

View File

@ -39,7 +39,12 @@ _eina_time_get(Eina_Nano_Time *tp)
if (!clock_gettime(CLOCK_REALTIME, tp)) if (!clock_gettime(CLOCK_REALTIME, tp))
return 0; return 0;
# endif # endif
#ifdef _MSC_VER
if (timespec_get(tp , TIME_UTC))
return 0;
else
return -1;
#else
/* FIXME: Have a look if and how we can support CLOCK_MONOTONIC */ /* FIXME: Have a look if and how we can support CLOCK_MONOTONIC */
struct timeval tv; struct timeval tv;
@ -51,6 +56,7 @@ _eina_time_get(Eina_Nano_Time *tp)
tp->tv_nsec = tv.tv_usec * 1000L; tp->tv_nsec = tv.tv_usec * 1000L;
return 0; return 0;
#endif
} }
static inline long int static inline long int

View File

@ -119,8 +119,8 @@ struct _Eina_Memory_Table
Eina_Memory_Entry entries[EINA_MAX_ENTRY_ID]; Eina_Memory_Entry entries[EINA_MAX_ENTRY_ID];
}; };
EAPI extern Eina_Memory_Table **_eina_sp_ids_tables[EINA_MAX_MID_TABLE_ID]; EINA_API extern Eina_Memory_Table **_eina_sp_ids_tables[EINA_MAX_MID_TABLE_ID];
EAPI extern int _eina_sp_log_dom; EINA_API extern int _eina_sp_log_dom;
#ifdef _EINA_SP_ERR #ifdef _EINA_SP_ERR
#undef _EINA_SP_ERR #undef _EINA_SP_ERR

View File

@ -86,7 +86,7 @@ eina_rw_slice_copy(const Eina_Rw_Slice dst, const Eina_Slice src)
} }
static inline Eina_Slice static inline Eina_Slice
eina_slice_seek(const Eina_Slice slice, ssize_t offset, int whence) eina_slice_seek(const Eina_Slice slice, ptrdiff_t offset, int whence)
{ {
Eina_Slice ret; Eina_Slice ret;
@ -110,7 +110,7 @@ eina_slice_seek(const Eina_Slice slice, ssize_t offset, int whence)
} }
static inline Eina_Rw_Slice static inline Eina_Rw_Slice
eina_rw_slice_seek(const Eina_Rw_Slice rw_slice, ssize_t offset, int whence) eina_rw_slice_seek(const Eina_Rw_Slice rw_slice, ptrdiff_t offset, int whence)
{ {
Eina_Rw_Slice ret; Eina_Rw_Slice ret;

View File

@ -0,0 +1,202 @@
/* EINA - EFL data type library
* Copyright (C) 2020 Carlos Signor
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library;
* if not, see <http://www.gnu.org/licenses/>.
*/
#include "eina_thread_posix.h"
/**
* @def EINA_THREAD_CLEANUP_PUSH(cleanup, data)
*
* @brief Pushes a cleanup function to be executed when the thread is
* canceled.
*
* This macro will schedule a function cleanup(data) to be executed if
* the thread is canceled with eina_thread_cancel() and the thread
* was previously marked as cancellable with
* eina_thread_cancellable_set().
*
* It @b must be paired with EINA_THREAD_CLEANUP_POP() in the same
* code block as they will expand to do {} while ()!
*
* The cleanup function may also be executed if
* EINA_THREAD_CLEANUP_POP(EINA_TRUE) is used.
*
* @note If the block within EINA_THREAD_CLEANUP_PUSH() and
* EINA_THREAD_CLEANUP_POP() returns, the cleanup callback will
* @b not be executed! To avoid problems prefer to use
* eina_thread_cancellable_run()!
*
* @param[in] cleanup The function to execute on cancellation.
* @param[in] data The context to give to cleanup function.
*
* @see eina_thread_cancellable_run()
*
* @since 1.19
*/
#define EINA_THREAD_CLEANUP_PUSH(cleanup, data) \
pthread_cleanup_push(cleanup, data)
/**
* @def EINA_THREAD_CLEANUP_POP(exec_cleanup)
*
* @brief Pops a cleanup function to be executed when the thread is
* canceled.
*
* This macro will remove a previously pushed cleanup function, thus
* if the thread is canceled with eina_thread_cancel() and the thread
* was previously marked as cancellable with
* eina_thread_cancellable_set(), that cleanup won't be executed
* anymore.
*
* It @b must be paired with EINA_THREAD_CLEANUP_PUSH() in the same
* code block as they will expand to do {} while ()!
*
* @note If the block within EINA_THREAD_CLEANUP_PUSH() and
* EINA_THREAD_CLEANUP_POP() returns, the cleanup callback will
* @b not be executed even if exec_cleanup is EINA_TRUE! To
* avoid problems prefer to use eina_thread_cancellable_run()!
*
* @param[in] exec_cleanup if EINA_TRUE, the function registered with
* EINA_THREAD_CLEANUP_PUSH() will be executed.
*
* @see eina_thread_cancellable_run()
*
* @since 1.19
*/
#define EINA_THREAD_CLEANUP_POP(exec_cleanup) \
pthread_cleanup_pop(exec_cleanup)
static inline void *
_eina_thread_join(Eina_Thread t)
{
void *ret = NULL;
int err = pthread_join((pthread_t)t, &ret);
if (err == 0) return ret;
return NULL;
}
static inline Eina_Bool
_eina_thread_name_set(Eina_Thread thread, char *buf)
{
#ifndef __linux__
pthread_set_name_np((pthread_t)t, buf);
return EINA_TRUE;
#else
return pthread_setname_np((pthread_t)thread, buf);
#endif
}
static inline Eina_Bool
_eina_thread_create(Eina_Thread *t, int affinity, void *(*func)(void *data), void *data)
{
int err;
pthread_attr_t attr;
sigset_t oldset, newset;
pthread_attr_init(&attr);
if (affinity >= 0)
{
#ifdef EINA_HAVE_PTHREAD_AFFINITY
cpu_set_t cpu;
CPU_ZERO(&cpu);
CPU_SET(affinity, &cpu);
pthread_attr_setaffinity_np(&attr, sizeof(cpu), &cpu);
#endif
}
/* setup initial locks */
sigemptyset(&newset);
sigaddset(&newset, SIGPIPE);
sigaddset(&newset, SIGALRM);
sigaddset(&newset, SIGCHLD);
sigaddset(&newset, SIGUSR1);
sigaddset(&newset, SIGUSR2);
sigaddset(&newset, SIGHUP);
sigaddset(&newset, SIGQUIT);
sigaddset(&newset, SIGINT);
sigaddset(&newset, SIGTERM);
#ifdef SIGPWR
sigaddset(&newset, SIGPWR);
#endif
pthread_sigmask(SIG_BLOCK, &newset, &oldset);
err = pthread_create((pthread_t *)t, &attr, func, data);
pthread_sigmask(SIG_SETMASK, &oldset, NULL);
pthread_attr_destroy(&attr);
if (err == 0) return EINA_TRUE;
return EINA_FALSE;
}
static inline Eina_Bool
_eina_thread_equal(Eina_Thread t1, Eina_Thread t2)
{
return !!pthread_equal((pthread_t)t1, (pthread_t)t2);
}
static inline Eina_Bool
_eina_thread_cancel(Eina_Thread thread)
{
return pthread_cancel((pthread_t)thread);
}
static inline Eina_Thread
_eina_thread_self(void)
{
return (Eina_Thread)pthread_self();
}
static inline void
_eina_thread_setcanceltype(int type, int *oldtype)
{
pthread_setcanceltype(EINA_THREAD_CANCEL_DEFERRED, &oldtype);
}
static inline int
_eina_thread_setcancelstate(int type, int *oldtype)
{
return pthread_setcancelstate(type, &oldtype);
}
static inline Eina_Bool
_eina_thread_cancellable_set(Eina_Bool cancellable, Eina_Bool *was_cancellable)
{
int state = cancellable ? EINA_THREAD_CANCEL_ENABLE : EINA_THREAD_CANCEL_DISABLE;
int old = 0;
int r;
/* enforce deferred in case users changed to asynchronous themselves */
_eina_thread_setcanceltype(EINA_THREAD_CANCEL_DEFERRED, &old);
r = _eina_thread_setcancelstate(state, &old);
if (was_cancellable && r == 0)
*was_cancellable = (old == EINA_THREAD_CANCEL_ENABLE);
return r == 0;
}
static inline void
_eina_thread_cancel_checkpoint(){
pthread_testcancel();
}

View File

@ -0,0 +1,188 @@
/* EINA - EFL data type library
* Copyright (C) 2020 Carlos Ré Signor
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library;
* if not, see <http://www.gnu.org/licenses/>.
*/
#ifndef EINA_INLINE_THREAD_WIN32_H_
#define EINA_INLINE_THREAD_WIN32_H_
#include "eina_thread_win32.h"
#define EINA_THREAD_CLEANUP_PUSH(cleanup, data)
#define EINA_THREAD_CLEANUP_POP(exec_cleanup)
typedef struct _Eina_Win32_Thread_Func
{
void *data;
void *(*func)(void *data);
} Eina_Win32_Thread_Func;
typedef struct _Eina_Win32_Thread_Attr
{
LPSECURITY_ATTRIBUTES lpThreadAttributes;
SIZE_T dwStackSize;
DWORD dwCreationFlags;
} Eina_Win32_Thread_Attr;
static inline int *
_eina_thread_join(Eina_Thread t)
{
int ret = (int)WaitForSingleObject(t, INFINITE);
if (ret != 0) return ret;
return NULL;
}
DWORD WINAPI
_eina_thread_func(void *params)
{
return (DWORD)((Eina_Win32_Thread_Func *)params)->
func((void *)((Eina_Win32_Thread_Func *)params)->data);
}
static inline void
_eina_thread_set_priority(Eina_Thread_Priority prio, Eina_Thread *t)
{
int nPriority = THREAD_PRIORITY_NORMAL;
switch (prio)
{
case EINA_THREAD_URGENT:
nPriority = THREAD_PRIORITY_HIGHEST;
break;
case EINA_THREAD_BACKGROUND:
nPriority = THREAD_PRIORITY_BELOW_NORMAL;
break;
case EINA_THREAD_IDLE:
nPriority = THREAD_PRIORITY_IDLE;
break;
case EINA_THREAD_NORMAL:
default:
nPriority = THREAD_PRIORITY_NORMAL;
break;
}
SetThreadPriority((HANDLE)*t, nPriority);
}
static inline Eina_Bool
_eina_thread_create(Eina_Thread *t, int affinity, void *(*func)(void *data), void *data)
{
Eina_Bool ret;
Eina_Win32_Thread_Attr thread_attr;
SECURITY_ATTRIBUTES sec_attributes;
sec_attributes.nLength = sizeof(SECURITY_ATTRIBUTES);
sec_attributes.lpSecurityDescriptor = NULL;
sec_attributes.bInheritHandle = EINA_TRUE;
thread_attr.lpThreadAttributes = &sec_attributes;
thread_attr.dwStackSize = 2*1024*1024;
thread_attr.dwCreationFlags = 0;
LPDWORD threadID;
Eina_Win32_Thread_Func thread_func;
Eina_Thread_Call *c = (Eina_Thread_Call *)(data);
thread_func.func = func;
thread_func.data = data;
*t = CreateThread(thread_attr.lpThreadAttributes, thread_attr.dwStackSize, &_eina_thread_func, &thread_func, thread_attr.dwCreationFlags, threadID);
_eina_thread_set_priority(c->prio, t);
ret = (*t != NULL) ? EINA_TRUE : EINA_FALSE;
if (affinity >= 0 && ret)
{
#ifdef EINA_HAVE_WIN32_THREAD_AFFINITY
SetThreadAffinityMask(*t, (DWORD_PTR *)&affinity);
#endif
}
return ret;
}
static inline Eina_Bool
_eina_thread_equal(Eina_Thread t1, Eina_Thread t2)
{
DWORD t1_thread_id = GetThreadId(t1);
DWORD t2_thread_id = GetThreadId(t2);
return (t1_thread_id == t2_thread_id) ? EINA_TRUE : EINA_FALSE;
}
static inline Eina_Thread
_eina_thread_self(void)
{
return GetCurrentThread();
}
static inline Eina_Bool
_eina_thread_name_set(Eina_Thread thread, char *buf)
{
HRESULT res = SetThreadDescription((HANDLE)thread, (PCWSTR)buf);
return HRESULT_CODE(res);
}
static inline Eina_Bool
_eina_thread_cancel(Eina_Thread thread)
{
LPDWORD lpExitCode;
Eina_Bool success = GetExitCodeThread((HANDLE)thread, lpExitCode);
ExitThread(*lpExitCode);
return !success;
}
UNIMPLEMENTED static inline void
_eina_thread_setcanceltype(int type, int *oldtype)
{
#warning _eina_thread_setcanceltype is not implemented.
}
UNIMPLEMENTED static inline int
_eina_thread_setcancelstate(int type, int *oldtype)
{
#warning _eina_thread_setcancelstate is not implemented.
return 0;
}
UNIMPLEMENTED static inline void
_eina_thread_cancel_checkpoint(void)
{
#warning _eina_thread_cancel_checkpoint is not implemented.
}
static inline Eina_Bool
_eina_thread_cancellable_set(Eina_Bool cancellable, Eina_Bool *was_cancellable)
{
int state = cancellable ? EINA_THREAD_CANCEL_ENABLE :
EINA_THREAD_CANCEL_DISABLE;
if (!state)
{
*was_cancellable = EINA_TRUE;
return EINA_FALSE;
}
else
{
*was_cancellable = EINA_TRUE;
return EINA_TRUE;
}
}
#endif

View File

@ -19,7 +19,7 @@
#ifndef EINA_INLINE_UNICODE_ #ifndef EINA_INLINE_UNICODE_
# define EINA_INLINE_UNICODE_ # define EINA_INLINE_UNICODE_
EAPI Eina_Unicode _eina_unicode_utf8_next_get(int ind, EINA_API Eina_Unicode _eina_unicode_utf8_next_get(int ind,
unsigned char d, unsigned char d,
const char *buf, const char *buf,
int *iindex); int *iindex);

View File

@ -37,7 +37,7 @@
* @since 1.2 * @since 1.2
* @private * @private
*/ */
EAPI extern const Eina_Value_Type *_EINA_VALUE_TYPE_BASICS_START; EINA_API extern const Eina_Value_Type *_EINA_VALUE_TYPE_BASICS_START;
/** /**
* @var _EINA_VALUE_TYPE_BASICS_END * @var _EINA_VALUE_TYPE_BASICS_END
@ -45,7 +45,7 @@ EAPI extern const Eina_Value_Type *_EINA_VALUE_TYPE_BASICS_START;
* @since 1.2 * @since 1.2
* @private * @private
*/ */
EAPI extern const Eina_Value_Type *_EINA_VALUE_TYPE_BASICS_END; EINA_API extern const Eina_Value_Type *_EINA_VALUE_TYPE_BASICS_END;
#define EINA_VALUE_TYPE_DEFAULT(type) \ #define EINA_VALUE_TYPE_DEFAULT(type) \
((_EINA_VALUE_TYPE_BASICS_START <= type) && \ ((_EINA_VALUE_TYPE_BASICS_START <= type) && \
(type <= _EINA_VALUE_TYPE_BASICS_END)) (type <= _EINA_VALUE_TYPE_BASICS_END))
@ -94,13 +94,13 @@ eina_value_memory_get(const Eina_Value *value)
* @since 1.2 * @since 1.2
* @private * @private
*/ */
EAPI void *eina_value_inner_alloc(size_t size); EINA_API void *eina_value_inner_alloc(size_t size);
/** /**
* @brief Releases memory for internal value types. * @brief Releases memory for internal value types.
* @since 1.2 * @since 1.2
* @private * @private
*/ */
EAPI void eina_value_inner_free(size_t size, void *mem); EINA_API void eina_value_inner_free(size_t size, void *mem);
static inline Eina_Bool static inline Eina_Bool
eina_value_setup(Eina_Value *value, const Eina_Value_Type *type) eina_value_setup(Eina_Value *value, const Eina_Value_Type *type)
@ -1409,7 +1409,7 @@ eina_value_hash_pget(const Eina_Value *value, const char *key, void *ptr)
* @since 1.2 * @since 1.2
* @internal * @internal
*/ */
EAPI const Eina_Value_Struct_Member *eina_value_struct_member_find(const Eina_Value_Struct *st, const char *name) EINA_ARG_NONNULL(1, 2) EINA_WARN_UNUSED_RESULT; EINA_API const Eina_Value_Struct_Member *eina_value_struct_member_find(const Eina_Value_Struct *st, const char *name) EINA_ARG_NONNULL(1, 2) EINA_WARN_UNUSED_RESULT;
static inline Eina_Bool static inline Eina_Bool
eina_value_struct_setup(Eina_Value *value, const Eina_Value_Struct_Desc *sdesc) eina_value_struct_setup(Eina_Value *value, const Eina_Value_Struct_Desc *sdesc)

View File

@ -223,7 +223,7 @@ _eina_inlist_sorted_state_compact(Eina_Inlist_Sorted_State *state)
* API * * API *
*============================================================================*/ *============================================================================*/
EAPI Eina_Inlist * EINA_API Eina_Inlist *
eina_inlist_append(Eina_Inlist *list, Eina_Inlist *new_l) eina_inlist_append(Eina_Inlist *list, Eina_Inlist *new_l)
{ {
Eina_Inlist *l; Eina_Inlist *l;
@ -250,7 +250,7 @@ eina_inlist_append(Eina_Inlist *list, Eina_Inlist *new_l)
return list; return list;
} }
EAPI Eina_Inlist * EINA_API Eina_Inlist *
eina_inlist_prepend(Eina_Inlist *list, Eina_Inlist *new_l) eina_inlist_prepend(Eina_Inlist *list, Eina_Inlist *new_l)
{ {
EINA_SAFETY_ON_NULL_RETURN_VAL(new_l, list); EINA_SAFETY_ON_NULL_RETURN_VAL(new_l, list);
@ -270,7 +270,7 @@ eina_inlist_prepend(Eina_Inlist *list, Eina_Inlist *new_l)
return new_l; return new_l;
} }
EAPI Eina_Inlist * EINA_API Eina_Inlist *
eina_inlist_append_relative(Eina_Inlist *list, eina_inlist_append_relative(Eina_Inlist *list,
Eina_Inlist *new_l, Eina_Inlist *new_l,
Eina_Inlist *relative) Eina_Inlist *relative)
@ -298,7 +298,7 @@ eina_inlist_append_relative(Eina_Inlist *list,
return eina_inlist_append(list, new_l); return eina_inlist_append(list, new_l);
} }
EAPI Eina_Inlist * EINA_API Eina_Inlist *
eina_inlist_prepend_relative(Eina_Inlist *list, eina_inlist_prepend_relative(Eina_Inlist *list,
Eina_Inlist *new_l, Eina_Inlist *new_l,
Eina_Inlist *relative) Eina_Inlist *relative)
@ -331,7 +331,7 @@ eina_inlist_prepend_relative(Eina_Inlist *list,
return eina_inlist_prepend(list, new_l); return eina_inlist_prepend(list, new_l);
} }
EAPI Eina_Inlist * EINA_API Eina_Inlist *
eina_inlist_remove(Eina_Inlist *list, Eina_Inlist *item) eina_inlist_remove(Eina_Inlist *list, Eina_Inlist *item)
{ {
Eina_Inlist *return_l; Eina_Inlist *return_l;
@ -368,7 +368,7 @@ eina_inlist_remove(Eina_Inlist *list, Eina_Inlist *item)
return return_l; return return_l;
} }
EAPI Eina_Inlist * EINA_API Eina_Inlist *
eina_inlist_promote(Eina_Inlist *list, Eina_Inlist *item) eina_inlist_promote(Eina_Inlist *list, Eina_Inlist *item)
{ {
EINA_SAFETY_ON_NULL_RETURN_VAL(list, NULL); EINA_SAFETY_ON_NULL_RETURN_VAL(list, NULL);
@ -395,7 +395,7 @@ eina_inlist_promote(Eina_Inlist *list, Eina_Inlist *item)
return item; return item;
} }
EAPI Eina_Inlist * EINA_API Eina_Inlist *
eina_inlist_demote(Eina_Inlist *list, Eina_Inlist *item) eina_inlist_demote(Eina_Inlist *list, Eina_Inlist *item)
{ {
Eina_Inlist *l; Eina_Inlist *l;
@ -429,7 +429,7 @@ eina_inlist_demote(Eina_Inlist *list, Eina_Inlist *item)
return l; return l;
} }
EAPI Eina_Inlist * EINA_API Eina_Inlist *
eina_inlist_find(Eina_Inlist *list, Eina_Inlist *item) eina_inlist_find(Eina_Inlist *list, Eina_Inlist *item)
{ {
Eina_Inlist *l; Eina_Inlist *l;
@ -444,7 +444,7 @@ eina_inlist_find(Eina_Inlist *list, Eina_Inlist *item)
return NULL; return NULL;
} }
EAPI unsigned int EINA_API unsigned int
eina_inlist_count(const Eina_Inlist *list) eina_inlist_count(const Eina_Inlist *list)
{ {
const Eina_Inlist *l; const Eina_Inlist *l;
@ -456,7 +456,7 @@ eina_inlist_count(const Eina_Inlist *list)
return i; return i;
} }
EAPI int EINA_API int
eina_inlist_sorted_state_init(Eina_Inlist_Sorted_State *state, Eina_Inlist *list) eina_inlist_sorted_state_init(Eina_Inlist_Sorted_State *state, Eina_Inlist *list)
{ {
Eina_Inlist *ct = NULL; Eina_Inlist *ct = NULL;
@ -486,7 +486,7 @@ eina_inlist_sorted_state_init(Eina_Inlist_Sorted_State *state, Eina_Inlist *list
return count; return count;
} }
EAPI Eina_Inlist_Sorted_State * EINA_API Eina_Inlist_Sorted_State *
eina_inlist_sorted_state_new(void) eina_inlist_sorted_state_new(void)
{ {
Eina_Inlist_Sorted_State *r; Eina_Inlist_Sorted_State *r;
@ -499,7 +499,7 @@ eina_inlist_sorted_state_new(void)
return r; return r;
} }
EAPI void EINA_API void
eina_inlist_sorted_state_free(Eina_Inlist_Sorted_State *state) eina_inlist_sorted_state_free(Eina_Inlist_Sorted_State *state)
{ {
free(state); free(state);
@ -554,7 +554,7 @@ _eina_inlist_sorted_state_insert(Eina_Inlist_Sorted_State *state,
} }
} }
EAPI Eina_Inlist * EINA_API Eina_Inlist *
eina_inlist_sorted_insert(Eina_Inlist *list, eina_inlist_sorted_insert(Eina_Inlist *list,
Eina_Inlist *item, Eina_Inlist *item,
Eina_Compare_Cb func) Eina_Compare_Cb func)
@ -661,7 +661,7 @@ eina_inlist_sorted_insert(Eina_Inlist *list,
return eina_inlist_prepend_relative(list, item, ct); return eina_inlist_prepend_relative(list, item, ct);
} }
EAPI Eina_Inlist * EINA_API Eina_Inlist *
eina_inlist_sorted_state_insert(Eina_Inlist *list, eina_inlist_sorted_state_insert(Eina_Inlist *list,
Eina_Inlist *item, Eina_Inlist *item,
Eina_Compare_Cb func, Eina_Compare_Cb func,
@ -800,7 +800,7 @@ eina_inlist_sorted_state_insert(Eina_Inlist *list,
return ct; return ct;
} }
EAPI Eina_Inlist * EINA_API Eina_Inlist *
eina_inlist_sort(Eina_Inlist *head, Eina_Compare_Cb func) eina_inlist_sort(Eina_Inlist *head, Eina_Compare_Cb func)
{ {
unsigned int i = 0; unsigned int i = 0;
@ -848,7 +848,7 @@ eina_inlist_sort(Eina_Inlist *head, Eina_Compare_Cb func)
} }
EAPI Eina_Iterator * EINA_API Eina_Iterator *
eina_inlist_iterator_new(const Eina_Inlist *list) eina_inlist_iterator_new(const Eina_Inlist *list)
{ {
Eina_Iterator_Inlist *it; Eina_Iterator_Inlist *it;
@ -870,7 +870,7 @@ eina_inlist_iterator_new(const Eina_Inlist *list)
return &it->iterator; return &it->iterator;
} }
EAPI Eina_Accessor * EINA_API Eina_Accessor *
eina_inlist_accessor_new(const Eina_Inlist *list) eina_inlist_accessor_new(const Eina_Inlist *list)
{ {
Eina_Accessor_Inlist *ac; Eina_Accessor_Inlist *ac;

View File

@ -431,7 +431,7 @@ struct _Eina_Inlist
* *
* @return The new list head. Use it and not @a in_list anymore. * @return The new list head. Use it and not @a in_list anymore.
*/ */
EAPI Eina_Inlist *eina_inlist_append(Eina_Inlist *in_list, EINA_API Eina_Inlist *eina_inlist_append(Eina_Inlist *in_list,
Eina_Inlist *in_item) EINA_ARG_NONNULL(2) EINA_WARN_UNUSED_RESULT; Eina_Inlist *in_item) EINA_ARG_NONNULL(2) EINA_WARN_UNUSED_RESULT;
/** /**
@ -450,7 +450,7 @@ EAPI Eina_Inlist *eina_inlist_append(Eina_Inlist *in_list,
* *
* @return The new list head. Use it and not @a in_list anymore. * @return The new list head. Use it and not @a in_list anymore.
*/ */
EAPI Eina_Inlist *eina_inlist_prepend(Eina_Inlist *in_list, EINA_API Eina_Inlist *eina_inlist_prepend(Eina_Inlist *in_list,
Eina_Inlist *in_item) EINA_ARG_NONNULL(2) EINA_WARN_UNUSED_RESULT; Eina_Inlist *in_item) EINA_ARG_NONNULL(2) EINA_WARN_UNUSED_RESULT;
/** /**
@ -475,7 +475,7 @@ EAPI Eina_Inlist *eina_inlist_prepend(Eina_Inlist *in_list,
* *
* @return The new list head. Use it and not @a list anymore. * @return The new list head. Use it and not @a list anymore.
*/ */
EAPI Eina_Inlist *eina_inlist_append_relative(Eina_Inlist *in_list, EINA_API Eina_Inlist *eina_inlist_append_relative(Eina_Inlist *in_list,
Eina_Inlist *in_item, Eina_Inlist *in_item,
Eina_Inlist *in_relative) EINA_ARG_NONNULL(2) EINA_WARN_UNUSED_RESULT; Eina_Inlist *in_relative) EINA_ARG_NONNULL(2) EINA_WARN_UNUSED_RESULT;
@ -501,7 +501,7 @@ EAPI Eina_Inlist *eina_inlist_append_relative(Eina_Inlist *in_list,
* *
* @return The new list head. Use it and not @a in_list anymore. * @return The new list head. Use it and not @a in_list anymore.
*/ */
EAPI Eina_Inlist *eina_inlist_prepend_relative(Eina_Inlist *in_list, EINA_API Eina_Inlist *eina_inlist_prepend_relative(Eina_Inlist *in_list,
Eina_Inlist *in_item, Eina_Inlist *in_item,
Eina_Inlist *in_relative) EINA_ARG_NONNULL(2) EINA_WARN_UNUSED_RESULT; Eina_Inlist *in_relative) EINA_ARG_NONNULL(2) EINA_WARN_UNUSED_RESULT;
@ -522,7 +522,7 @@ EAPI Eina_Inlist *eina_inlist_prepend_relative(Eina_Inlist *in_list,
* *
* @return The new list head. Use it and not @a list anymore. * @return The new list head. Use it and not @a list anymore.
*/ */
EAPI Eina_Inlist *eina_inlist_remove(Eina_Inlist *in_list, EINA_API Eina_Inlist *eina_inlist_remove(Eina_Inlist *in_list,
Eina_Inlist *in_item) EINA_ARG_NONNULL(1, 2) EINA_WARN_UNUSED_RESULT; Eina_Inlist *in_item) EINA_ARG_NONNULL(1, 2) EINA_WARN_UNUSED_RESULT;
/** /**
@ -536,7 +536,7 @@ EAPI Eina_Inlist *eina_inlist_remove(Eina_Inlist *in_list,
* *
* @return @a in_item if found, @c NULL if not. * @return @a in_item if found, @c NULL if not.
*/ */
EAPI Eina_Inlist *eina_inlist_find(Eina_Inlist *in_list, EINA_API Eina_Inlist *eina_inlist_find(Eina_Inlist *in_list,
Eina_Inlist *in_item) EINA_ARG_NONNULL(2) EINA_WARN_UNUSED_RESULT; Eina_Inlist *in_item) EINA_ARG_NONNULL(2) EINA_WARN_UNUSED_RESULT;
/** /**
@ -554,7 +554,7 @@ EAPI Eina_Inlist *eina_inlist_find(Eina_Inlist *in_list,
* *
* @return The new list head. Use it and not @a list anymore. * @return The new list head. Use it and not @a list anymore.
*/ */
EAPI Eina_Inlist *eina_inlist_promote(Eina_Inlist *list, EINA_API Eina_Inlist *eina_inlist_promote(Eina_Inlist *list,
Eina_Inlist *item) EINA_ARG_NONNULL(1, 2) EINA_WARN_UNUSED_RESULT; Eina_Inlist *item) EINA_ARG_NONNULL(1, 2) EINA_WARN_UNUSED_RESULT;
/** /**
@ -572,7 +572,7 @@ EAPI Eina_Inlist *eina_inlist_promote(Eina_Inlist *list,
* *
* @return The new list head. Use it and not @a list anymore. * @return The new list head. Use it and not @a list anymore.
*/ */
EAPI Eina_Inlist *eina_inlist_demote(Eina_Inlist *list, EINA_API Eina_Inlist *eina_inlist_demote(Eina_Inlist *list,
Eina_Inlist *item) EINA_ARG_NONNULL(1, 2) EINA_WARN_UNUSED_RESULT; Eina_Inlist *item) EINA_ARG_NONNULL(1, 2) EINA_WARN_UNUSED_RESULT;
/** /**
@ -620,7 +620,7 @@ static inline Eina_Inlist *eina_inlist_last(const Eina_Inlist *list) EINA_PURE E
* on the number of elements on the list, so, it might become * on the number of elements on the list, so, it might become
* slow for big lists! * slow for big lists!
*/ */
EAPI unsigned int eina_inlist_count(const Eina_Inlist *list) EINA_WARN_UNUSED_RESULT; EINA_API unsigned int eina_inlist_count(const Eina_Inlist *list) EINA_WARN_UNUSED_RESULT;
/** /**
@ -642,7 +642,7 @@ EAPI unsigned int eina_inlist_count(const Eina_Inlist *list) EINA_WARN_UNUSED_
* invalid, and if you add or remove nodes iterator * invalid, and if you add or remove nodes iterator
* behavior is undefined, and your program may crash! * behavior is undefined, and your program may crash!
*/ */
EAPI Eina_Iterator *eina_inlist_iterator_new(const Eina_Inlist *in_list) EINA_MALLOC EINA_WARN_UNUSED_RESULT; EINA_API Eina_Iterator *eina_inlist_iterator_new(const Eina_Inlist *in_list) EINA_MALLOC EINA_WARN_UNUSED_RESULT;
/** /**
* @brief Returns a new accessor associated to a list. * @brief Returns a new accessor associated to a list.
@ -656,7 +656,7 @@ EAPI Eina_Iterator *eina_inlist_iterator_new(const Eina_Inlist *in_list) EINA_MA
* not be allocated, @c NULL is returned and Otherwise, a valid accessor is * not be allocated, @c NULL is returned and Otherwise, a valid accessor is
* returned. * returned.
*/ */
EAPI Eina_Accessor *eina_inlist_accessor_new(const Eina_Inlist *in_list) EINA_MALLOC EINA_WARN_UNUSED_RESULT; EINA_API Eina_Accessor *eina_inlist_accessor_new(const Eina_Inlist *in_list) EINA_MALLOC EINA_WARN_UNUSED_RESULT;
/** /**
* @brief Inserts a new node into a sorted list. * @brief Inserts a new node into a sorted list.
@ -680,7 +680,7 @@ EAPI Eina_Accessor *eina_inlist_accessor_new(const Eina_Inlist *in_list) EINA_MA
* *
* @since 1.1.0 * @since 1.1.0
*/ */
EAPI Eina_Inlist *eina_inlist_sorted_insert(Eina_Inlist *list, Eina_Inlist *item, Eina_Compare_Cb func) EINA_ARG_NONNULL(2, 3) EINA_WARN_UNUSED_RESULT; EINA_API Eina_Inlist *eina_inlist_sorted_insert(Eina_Inlist *list, Eina_Inlist *item, Eina_Compare_Cb func) EINA_ARG_NONNULL(2, 3) EINA_WARN_UNUSED_RESULT;
/** /**
* @brief Creates state with valid data in it. * @brief Creates state with valid data in it.
@ -691,7 +691,7 @@ EAPI Eina_Inlist *eina_inlist_sorted_insert(Eina_Inlist *list, Eina_Inlist *item
* *
* See eina_inlist_sorted_state_insert() for more information. * See eina_inlist_sorted_state_insert() for more information.
*/ */
EAPI Eina_Inlist_Sorted_State *eina_inlist_sorted_state_new(void); EINA_API Eina_Inlist_Sorted_State *eina_inlist_sorted_state_new(void);
/** /**
* @brief Forces an Eina_Inlist_Sorted_State to match the content of a list. * @brief Forces an Eina_Inlist_Sorted_State to match the content of a list.
@ -706,7 +706,7 @@ EAPI Eina_Inlist_Sorted_State *eina_inlist_sorted_state_new(void);
* useful if you didn't use eina_inlist_sorted_state_insert() at some point, but * useful if you didn't use eina_inlist_sorted_state_insert() at some point, but
* still think you have a sorted list. It will only correctly work on a sorted list. * still think you have a sorted list. It will only correctly work on a sorted list.
*/ */
EAPI int eina_inlist_sorted_state_init(Eina_Inlist_Sorted_State *state, Eina_Inlist *list); EINA_API int eina_inlist_sorted_state_init(Eina_Inlist_Sorted_State *state, Eina_Inlist *list);
/** /**
* @brief Frees an Eina_Inlist_Sorted_State. * @brief Frees an Eina_Inlist_Sorted_State.
@ -717,7 +717,7 @@ EAPI int eina_inlist_sorted_state_init(Eina_Inlist_Sorted_State *state, Eina_Inl
* *
* See eina_inlist_sorted_state_insert() for more information. * See eina_inlist_sorted_state_insert() for more information.
*/ */
EAPI void eina_inlist_sorted_state_free(Eina_Inlist_Sorted_State *state); EINA_API void eina_inlist_sorted_state_free(Eina_Inlist_Sorted_State *state);
/** /**
* @brief Inserts a new node into a sorted list. * @brief Inserts a new node into a sorted list.
@ -747,7 +747,7 @@ EAPI void eina_inlist_sorted_state_free(Eina_Inlist_Sorted_State *state);
* linear cost again. Consider worst case to be almost O(n) pointer * linear cost again. Consider worst case to be almost O(n) pointer
* dereference (list walk). * dereference (list walk).
*/ */
EAPI Eina_Inlist *eina_inlist_sorted_state_insert(Eina_Inlist *list, EINA_API Eina_Inlist *eina_inlist_sorted_state_insert(Eina_Inlist *list,
Eina_Inlist *item, Eina_Inlist *item,
Eina_Compare_Cb func, Eina_Compare_Cb func,
Eina_Inlist_Sorted_State *state); Eina_Inlist_Sorted_State *state);
@ -795,7 +795,7 @@ EAPI Eina_Inlist *eina_inlist_sorted_state_insert(Eina_Inlist *list,
* list = eina_inlist_sort(list, sort_cb); * list = eina_inlist_sort(list, sort_cb);
* @endcode * @endcode
*/ */
EAPI Eina_Inlist *eina_inlist_sort(Eina_Inlist *head, Eina_Compare_Cb func); EINA_API Eina_Inlist *eina_inlist_sort(Eina_Inlist *head, Eina_Compare_Cb func);
/* These two macros are helpers for the _FOREACH ones, don't use them */ /* These two macros are helpers for the _FOREACH ones, don't use them */
/** /**

View File

@ -8,39 +8,6 @@
* not stable API. * not stable API.
*/ */
#ifdef EAPI
# undef EAPI
#endif
#ifdef _WIN32
# ifdef EFL_BUILD
# ifdef DLL_EXPORT
# define EAPI __declspec(dllexport)
# else
# define EAPI
# endif
# else
# define EAPI __declspec(dllimport)
# endif
# define EAPI_WEAK
#else
# ifdef __GNUC__
# if __GNUC__ >= 4
# define EAPI __attribute__ ((visibility("default")))
# define EAPI_WEAK __attribute__ ((weak))
# else
# define EAPI
# define EAPI_WEAK
# endif
# else
/**
* @def EAPI
* @brief Used to export functions (by changing visibility).
*/
# define EAPI
# endif
#endif
#include "eina_prefix.h" #include "eina_prefix.h"
#include "eina_promise.h" #include "eina_promise.h"
@ -70,9 +37,9 @@ struct _Eina_Vpath_Interface_User
* *
* @internal * @internal
*/ */
EAPI void __eina_promise_cancel_all(void); EINA_API void __eina_promise_cancel_all(void);
EAPI void __eina_promise_cancel_data(void *data); EINA_API void __eina_promise_cancel_data(void *data);
/** /**
* Make the app specific paths accessible as virtual path * Make the app specific paths accessible as virtual path
@ -89,7 +56,7 @@ EAPI void __eina_promise_cancel_data(void *data);
* *
* If you do NOT call this api the virtual paths for app.* will be unset * If you do NOT call this api the virtual paths for app.* will be unset
*/ */
EAPI void eina_vpath_interface_app_set(const char *app_name, Eina_Prefix *p); EINA_API void eina_vpath_interface_app_set(const char *app_name, Eina_Prefix *p);
/** /**
* Create the desktop specific vpaths * Create the desktop specific vpaths
@ -98,11 +65,11 @@ EAPI void eina_vpath_interface_app_set(const char *app_name, Eina_Prefix *p);
* *
* If you do NOT call this api the virtual paths for usr.* will be unset. * If you do NOT call this api the virtual paths for usr.* will be unset.
*/ */
EAPI void eina_vpath_interface_user_set(Eina_Vpath_Interface_User *user); EINA_API void eina_vpath_interface_user_set(Eina_Vpath_Interface_User *user);
void eina_xdg_env_init(void); void eina_xdg_env_init(void);
#undef EAPI #undef EINA_API
#define EAPI #define EINA_API
#endif #endif

View File

@ -94,7 +94,7 @@ eina_iterator_shutdown(void)
* API * * API *
*============================================================================*/ *============================================================================*/
EAPI void EINA_API void
eina_iterator_free(Eina_Iterator *iterator) eina_iterator_free(Eina_Iterator *iterator)
{ {
if (!iterator) if (!iterator)
@ -105,7 +105,7 @@ eina_iterator_free(Eina_Iterator *iterator)
iterator->free(iterator); iterator->free(iterator);
} }
EAPI void * EINA_API void *
eina_iterator_container_get(Eina_Iterator *iterator) eina_iterator_container_get(Eina_Iterator *iterator)
{ {
EINA_MAGIC_CHECK_ITERATOR(iterator); EINA_MAGIC_CHECK_ITERATOR(iterator);
@ -114,7 +114,7 @@ eina_iterator_container_get(Eina_Iterator *iterator)
return iterator->get_container(iterator); return iterator->get_container(iterator);
} }
EAPI Eina_Bool EINA_API Eina_Bool
eina_iterator_next(Eina_Iterator *iterator, void **data) eina_iterator_next(Eina_Iterator *iterator, void **data)
{ {
if (!iterator) if (!iterator)
@ -126,7 +126,7 @@ eina_iterator_next(Eina_Iterator *iterator, void **data)
return iterator->next(iterator, data); return iterator->next(iterator, data);
} }
EAPI void EINA_API void
eina_iterator_foreach(Eina_Iterator *iterator, eina_iterator_foreach(Eina_Iterator *iterator,
Eina_Each_Cb cb, Eina_Each_Cb cb,
const void *fdata) const void *fdata)
@ -155,7 +155,7 @@ on_exit:
(void) eina_iterator_unlock(iterator); (void) eina_iterator_unlock(iterator);
} }
EAPI Eina_Bool EINA_API Eina_Bool
eina_iterator_lock(Eina_Iterator *iterator) eina_iterator_lock(Eina_Iterator *iterator)
{ {
EINA_MAGIC_CHECK_ITERATOR(iterator); EINA_MAGIC_CHECK_ITERATOR(iterator);
@ -166,7 +166,7 @@ eina_iterator_lock(Eina_Iterator *iterator)
return EINA_TRUE; return EINA_TRUE;
} }
EAPI Eina_Bool EINA_API Eina_Bool
eina_iterator_unlock(Eina_Iterator *iterator) eina_iterator_unlock(Eina_Iterator *iterator)
{ {
EINA_MAGIC_CHECK_ITERATOR(iterator); EINA_MAGIC_CHECK_ITERATOR(iterator);
@ -210,7 +210,7 @@ eina_carray_iterator_free(Eina_Iterator_CArray *it)
free(it); free(it);
} }
EAPI Eina_Iterator* EINA_API Eina_Iterator*
eina_carray_iterator_new(void** array) eina_carray_iterator_new(void** array)
{ {
Eina_Iterator_CArray *it; Eina_Iterator_CArray *it;
@ -268,7 +268,7 @@ eina_carray_length_iterator_free(Eina_Iterator_CArray_Length *it)
free(it); free(it);
} }
EAPI Eina_Iterator * EINA_API Eina_Iterator *
eina_carray_length_iterator_new(void** array, unsigned int step, unsigned int length) eina_carray_length_iterator_new(void** array, unsigned int step, unsigned int length)
{ {
Eina_Iterator_CArray_Length *it; Eina_Iterator_CArray_Length *it;
@ -336,7 +336,7 @@ eina_multi_iterator_free(Eina_Multi_Iterator *it)
free(it); free(it);
} }
EAPI Eina_Iterator * EINA_API Eina_Iterator *
eina_multi_iterator_internal_new(Eina_Iterator *itc, ...) eina_multi_iterator_internal_new(Eina_Iterator *itc, ...)
{ {
Eina_Multi_Iterator *it; Eina_Multi_Iterator *it;
@ -404,7 +404,7 @@ eina_iterator_filter_free(Eina_Iterator_Filter *it)
free(it); free(it);
} }
EAPI Eina_Iterator* EINA_API Eina_Iterator*
eina_iterator_filter_new(Eina_Iterator *iterator, Eina_Each_Cb filter, Eina_Free_Cb free_cb, void *data) eina_iterator_filter_new(Eina_Iterator *iterator, Eina_Each_Cb filter, Eina_Free_Cb free_cb, void *data)
{ {
Eina_Iterator_Filter *it; Eina_Iterator_Filter *it;
@ -465,7 +465,7 @@ eina_iterator_process_free(Eina_Iterator_Processor *it)
free(it); free(it);
} }
EAPI Eina_Iterator* EINA_API Eina_Iterator*
eina_iterator_processed_new(Eina_Iterator *iterator, Eina_Process_Cb process, Eina_Free_Cb free_cb, void *data) eina_iterator_processed_new(Eina_Iterator *iterator, Eina_Process_Cb process, Eina_Free_Cb free_cb, void *data)
{ {
Eina_Iterator_Processor *it; Eina_Iterator_Processor *it;

View File

@ -203,7 +203,7 @@ struct _Eina_Iterator
* *
* This function frees @p iterator if it is not @c NULL; * This function frees @p iterator if it is not @c NULL;
*/ */
EAPI void eina_iterator_free(Eina_Iterator *iterator); EINA_API void eina_iterator_free(Eina_Iterator *iterator);
/** /**
@ -215,7 +215,7 @@ EAPI void eina_iterator_free(Eina_Iterator *iterator);
* This function returns the container which created @p iterator. If * This function returns the container which created @p iterator. If
* @p iterator is @c NULL, this function returns @c NULL. * @p iterator is @c NULL, this function returns @c NULL.
*/ */
EAPI void *eina_iterator_container_get(Eina_Iterator *iterator) EINA_ARG_NONNULL(1) EINA_PURE; EINA_API void *eina_iterator_container_get(Eina_Iterator *iterator) EINA_ARG_NONNULL(1) EINA_PURE;
/** /**
* @brief Returns the value of the current element and go to the next one. * @brief Returns the value of the current element and go to the next one.
@ -229,7 +229,7 @@ EAPI void *eina_iterator_container_get(Eina_Iterator *iterator) EINA_ARG_NON
* iterator is @c NULL or if a problem occurred, #EINA_FALSE is * iterator is @c NULL or if a problem occurred, #EINA_FALSE is
* returned, otherwise #EINA_TRUE is returned. * returned, otherwise #EINA_TRUE is returned.
*/ */
EAPI Eina_Bool eina_iterator_next(Eina_Iterator *iterator, EINA_API Eina_Bool eina_iterator_next(Eina_Iterator *iterator,
void **data) EINA_ARG_NONNULL(2) EINA_WARN_UNUSED_RESULT; void **data) EINA_ARG_NONNULL(2) EINA_WARN_UNUSED_RESULT;
@ -247,7 +247,7 @@ EAPI Eina_Bool eina_iterator_next(Eina_Iterator *iterator,
* the iteration stops at that point, if @p cb returns #EINA_TRUE * the iteration stops at that point, if @p cb returns #EINA_TRUE
* the iteration continues. * the iteration continues.
*/ */
EAPI void eina_iterator_foreach(Eina_Iterator *iterator, EINA_API void eina_iterator_foreach(Eina_Iterator *iterator,
Eina_Each_Cb callback, Eina_Each_Cb callback,
const void *fdata) EINA_ARG_NONNULL(2); const void *fdata) EINA_ARG_NONNULL(2);
@ -266,7 +266,7 @@ EAPI void eina_iterator_foreach(Eina_Iterator *iterator,
* *
* @warning None of the existing eina data structures are lockable. * @warning None of the existing eina data structures are lockable.
*/ */
EAPI Eina_Bool eina_iterator_lock(Eina_Iterator *iterator) EINA_ARG_NONNULL(1); EINA_API Eina_Bool eina_iterator_lock(Eina_Iterator *iterator) EINA_ARG_NONNULL(1);
/** /**
* @brief Unlocks the container of the iterator. * @brief Unlocks the container of the iterator.
@ -282,7 +282,7 @@ EAPI Eina_Bool eina_iterator_lock(Eina_Iterator *iterator) EINA_ARG_NONNULL(1);
* *
* @warning None of the existing eina data structures are lockable. * @warning None of the existing eina data structures are lockable.
*/ */
EAPI Eina_Bool eina_iterator_unlock(Eina_Iterator *iterator) EINA_ARG_NONNULL(1); EINA_API Eina_Bool eina_iterator_unlock(Eina_Iterator *iterator) EINA_ARG_NONNULL(1);
/** /**
* @brief Creates an Eina_Iterator that iterates through a * @brief Creates an Eina_Iterator that iterates through a
@ -299,7 +299,7 @@ EAPI Eina_Bool eina_iterator_unlock(Eina_Iterator *iterator) EINA_ARG_NONNULL(1)
* *
* @since 1.18 * @since 1.18
*/ */
EAPI Eina_Iterator *eina_carray_iterator_new(void** array) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT; EINA_API Eina_Iterator *eina_carray_iterator_new(void** array) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT;
/** /**
* @brief Creates an Eina_Iterator that iterates through a * @brief Creates an Eina_Iterator that iterates through a
@ -315,7 +315,7 @@ EAPI Eina_Iterator *eina_carray_iterator_new(void** array) EINA_ARG_NONNULL(1) E
* *
* @since 1.22 * @since 1.22
*/ */
EAPI Eina_Iterator *eina_carray_length_iterator_new(void** array, unsigned int step, unsigned int length) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT; EINA_API Eina_Iterator *eina_carray_length_iterator_new(void** array, unsigned int step, unsigned int length) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT;
/** /**
* @def EINA_C_ARRAY_ITERATOR_NEW * @def EINA_C_ARRAY_ITERATOR_NEW
@ -347,7 +347,7 @@ EAPI Eina_Iterator *eina_carray_length_iterator_new(void** array, unsigned int s
* *
* @since 1.19 * @since 1.19
*/ */
EAPI Eina_Iterator* eina_iterator_filter_new(Eina_Iterator *original, Eina_Each_Cb filter, Eina_Free_Cb free_cb, void *data) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT; EINA_API Eina_Iterator* eina_iterator_filter_new(Eina_Iterator *original, Eina_Each_Cb filter, Eina_Free_Cb free_cb, void *data) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT;
/** /**
* @brief Creates an Eina_Iterator that iterates through a series * @brief Creates an Eina_Iterator that iterates through a series
@ -363,7 +363,7 @@ EAPI Eina_Iterator* eina_iterator_filter_new(Eina_Iterator *original, Eina_Each_
* *
* @since 1.22 * @since 1.22
*/ */
EAPI Eina_Iterator *eina_multi_iterator_internal_new(Eina_Iterator *it, ...) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT; EINA_API Eina_Iterator *eina_multi_iterator_internal_new(Eina_Iterator *it, ...) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT;
/** /**
@ -381,7 +381,7 @@ EAPI Eina_Iterator *eina_multi_iterator_internal_new(Eina_Iterator *it, ...) EIN
* *
* @since 1.24 * @since 1.24
*/ */
EAPI Eina_Iterator* eina_iterator_processed_new(Eina_Iterator *iterator, Eina_Process_Cb process, Eina_Free_Cb free_cb, void *fdata) EINA_WARN_UNUSED_RESULT; EINA_API Eina_Iterator* eina_iterator_processed_new(Eina_Iterator *iterator, Eina_Process_Cb process, Eina_Free_Cb free_cb, void *fdata) EINA_WARN_UNUSED_RESULT;
/** /**
* @def eina_multi_iterator_new * @def eina_multi_iterator_new

View File

@ -65,7 +65,7 @@ struct _Eina_Lalloc
* @{ * @{
*/ */
EAPI Eina_Lalloc *eina_lalloc_new(void *data, EINA_API Eina_Lalloc *eina_lalloc_new(void *data,
Eina_Lalloc_Alloc alloc_cb, Eina_Lalloc_Alloc alloc_cb,
Eina_Lalloc_Free free_cb, Eina_Lalloc_Free free_cb,
int num_init) int num_init)
@ -88,7 +88,7 @@ EAPI Eina_Lalloc *eina_lalloc_new(void *data,
return a; return a;
} }
EAPI void eina_lalloc_free(Eina_Lalloc *a) EINA_API void eina_lalloc_free(Eina_Lalloc *a)
{ {
EINA_SAFETY_ON_NULL_RETURN(a); EINA_SAFETY_ON_NULL_RETURN(a);
EINA_SAFETY_ON_NULL_RETURN(a->free_cb); EINA_SAFETY_ON_NULL_RETURN(a->free_cb);
@ -96,7 +96,7 @@ EAPI void eina_lalloc_free(Eina_Lalloc *a)
free(a); free(a);
} }
EAPI Eina_Bool eina_lalloc_element_add(Eina_Lalloc *a) EINA_API Eina_Bool eina_lalloc_element_add(Eina_Lalloc *a)
{ {
EINA_SAFETY_ON_NULL_RETURN_VAL(a, EINA_FALSE); EINA_SAFETY_ON_NULL_RETURN_VAL(a, EINA_FALSE);
EINA_SAFETY_ON_NULL_RETURN_VAL(a->alloc_cb, EINA_FALSE); EINA_SAFETY_ON_NULL_RETURN_VAL(a->alloc_cb, EINA_FALSE);
@ -117,7 +117,7 @@ EAPI Eina_Bool eina_lalloc_element_add(Eina_Lalloc *a)
return EINA_TRUE; return EINA_TRUE;
} }
EAPI Eina_Bool eina_lalloc_elements_add(Eina_Lalloc *a, int num) EINA_API Eina_Bool eina_lalloc_elements_add(Eina_Lalloc *a, int num)
{ {
int tmp; int tmp;

View File

@ -76,7 +76,7 @@ typedef struct _Eina_Lalloc Eina_Lalloc;
* @return A new lazy allocator. * @return A new lazy allocator.
* *
*/ */
EAPI Eina_Lalloc *eina_lalloc_new(void *data, EINA_API Eina_Lalloc *eina_lalloc_new(void *data,
Eina_Lalloc_Alloc alloc_cb, Eina_Lalloc_Alloc alloc_cb,
Eina_Lalloc_Free free_cb, Eina_Lalloc_Free free_cb,
int num_init) EINA_ARG_NONNULL(2, 3); int num_init) EINA_ARG_NONNULL(2, 3);
@ -87,7 +87,7 @@ EAPI Eina_Lalloc *eina_lalloc_new(void *data,
* @param[in,out] a The lazy allocator to free. * @param[in,out] a The lazy allocator to free.
* *
*/ */
EAPI void eina_lalloc_free(Eina_Lalloc *a) EINA_ARG_NONNULL(1); EINA_API void eina_lalloc_free(Eina_Lalloc *a) EINA_ARG_NONNULL(1);
/** /**
* @brief Adds several elements to a lazy allocator. * @brief Adds several elements to a lazy allocator.
@ -98,7 +98,7 @@ EAPI void eina_lalloc_free(Eina_Lalloc *a) EINA_ARG_NONNULL(1);
* @return #EINA_TRUE on success, else #EINA_FALSE. * @return #EINA_TRUE on success, else #EINA_FALSE.
* *
*/ */
EAPI Eina_Bool eina_lalloc_elements_add(Eina_Lalloc *a, EINA_API Eina_Bool eina_lalloc_elements_add(Eina_Lalloc *a,
int num) EINA_ARG_NONNULL(1); int num) EINA_ARG_NONNULL(1);
/** /**
@ -109,7 +109,7 @@ EAPI Eina_Bool eina_lalloc_elements_add(Eina_Lalloc *a,
* @return #EINA_TRUE on success, else #EINA_FALSE. * @return #EINA_TRUE on success, else #EINA_FALSE.
* *
*/ */
EAPI Eina_Bool eina_lalloc_element_add(Eina_Lalloc *a) EINA_ARG_NONNULL(1); EINA_API Eina_Bool eina_lalloc_element_add(Eina_Lalloc *a) EINA_ARG_NONNULL(1);
/** /**
* @} * @}

View File

@ -580,7 +580,7 @@ eina_list_shutdown(void)
* API * * API *
*============================================================================*/ *============================================================================*/
EAPI Eina_List * EINA_API Eina_List *
eina_list_append(Eina_List *list, const void *data) eina_list_append(Eina_List *list, const void *data)
{ {
Eina_List *l, *new_l; Eina_List *l, *new_l;
@ -614,7 +614,7 @@ on_error:
#endif #endif
} }
EAPI Eina_List * EINA_API Eina_List *
eina_list_prepend(Eina_List *list, const void *data) eina_list_prepend(Eina_List *list, const void *data)
{ {
Eina_List *new_l; Eina_List *new_l;
@ -645,7 +645,7 @@ on_error:
#endif #endif
} }
EAPI Eina_List * EINA_API Eina_List *
eina_list_append_relative(Eina_List *list, eina_list_append_relative(Eina_List *list,
const void *data, const void *data,
const void *relative) const void *relative)
@ -666,7 +666,7 @@ eina_list_append_relative(Eina_List *list,
return eina_list_append(list, data); return eina_list_append(list, data);
} }
EAPI Eina_List * EINA_API Eina_List *
eina_list_append_relative_list(Eina_List *list, eina_list_append_relative_list(Eina_List *list,
const void *data, const void *data,
Eina_List *relative) Eina_List *relative)
@ -700,7 +700,7 @@ eina_list_append_relative_list(Eina_List *list,
return list; return list;
} }
EAPI Eina_List * EINA_API Eina_List *
eina_list_prepend_relative(Eina_List *list, eina_list_prepend_relative(Eina_List *list,
const void *data, const void *data,
const void *relative) const void *relative)
@ -720,7 +720,7 @@ eina_list_prepend_relative(Eina_List *list,
return eina_list_prepend(list, data); return eina_list_prepend(list, data);
} }
EAPI Eina_List * EINA_API Eina_List *
eina_list_prepend_relative_list(Eina_List *list, eina_list_prepend_relative_list(Eina_List *list,
const void *data, const void *data,
Eina_List *relative) Eina_List *relative)
@ -753,7 +753,7 @@ eina_list_prepend_relative_list(Eina_List *list,
return new_l; return new_l;
} }
EAPI Eina_List * EINA_API Eina_List *
eina_list_sorted_insert(Eina_List *list, Eina_Compare_Cb func, const void *data) eina_list_sorted_insert(Eina_List *list, Eina_Compare_Cb func, const void *data)
{ {
Eina_List *lnear; Eina_List *lnear;
@ -769,7 +769,7 @@ eina_list_sorted_insert(Eina_List *list, Eina_Compare_Cb func, const void *data)
return eina_list_prepend_relative_list(list, data, lnear); return eina_list_prepend_relative_list(list, data, lnear);
} }
EAPI Eina_List * EINA_API Eina_List *
eina_list_remove(Eina_List *list, const void *data) eina_list_remove(Eina_List *list, const void *data)
{ {
Eina_List *l; Eina_List *l;
@ -782,7 +782,7 @@ eina_list_remove(Eina_List *list, const void *data)
return eina_list_remove_list(list, l); return eina_list_remove_list(list, l);
} }
EAPI Eina_List * EINA_API Eina_List *
eina_list_remove_list(Eina_List *list, Eina_List *remove_list) eina_list_remove_list(Eina_List *list, Eina_List *remove_list)
{ {
Eina_List *return_l; Eina_List *return_l;
@ -819,7 +819,7 @@ eina_list_remove_list(Eina_List *list, Eina_List *remove_list)
return return_l; return return_l;
} }
EAPI Eina_List * EINA_API Eina_List *
eina_list_free(Eina_List *list) eina_list_free(Eina_List *list)
{ {
Eina_List *l, *free_l; Eina_List *l, *free_l;
@ -841,7 +841,7 @@ eina_list_free(Eina_List *list)
return NULL; return NULL;
} }
EAPI Eina_List * EINA_API Eina_List *
eina_list_promote_list(Eina_List *list, Eina_List *move_list) eina_list_promote_list(Eina_List *list, Eina_List *move_list)
{ {
if (!list) if (!list)
@ -885,7 +885,7 @@ eina_list_promote_list(Eina_List *list, Eina_List *move_list)
return move_list; return move_list;
} }
EAPI Eina_List * EINA_API Eina_List *
eina_list_demote_list(Eina_List *list, Eina_List *move_list) eina_list_demote_list(Eina_List *list, Eina_List *move_list)
{ {
if (!list) if (!list)
@ -924,7 +924,7 @@ eina_list_demote_list(Eina_List *list, Eina_List *move_list)
return list; return list;
} }
EAPI void * EINA_API void *
eina_list_data_find(const Eina_List *list, const void *data) eina_list_data_find(const Eina_List *list, const void *data)
{ {
if (eina_list_data_find_list(list, data)) if (eina_list_data_find_list(list, data))
@ -933,7 +933,7 @@ eina_list_data_find(const Eina_List *list, const void *data)
return NULL; return NULL;
} }
EAPI Eina_Bool EINA_API Eina_Bool
eina_list_move(Eina_List **to, Eina_List **from, void *data) eina_list_move(Eina_List **to, Eina_List **from, void *data)
{ {
Eina_List *l; Eina_List *l;
@ -954,7 +954,7 @@ eina_list_move(Eina_List **to, Eina_List **from, void *data)
return EINA_TRUE; return EINA_TRUE;
} }
EAPI Eina_Bool EINA_API Eina_Bool
eina_list_move_list(Eina_List **to, Eina_List **from, Eina_List *data) eina_list_move_list(Eina_List **to, Eina_List **from, Eina_List *data)
{ {
EINA_SAFETY_ON_NULL_RETURN_VAL(to, EINA_FALSE); EINA_SAFETY_ON_NULL_RETURN_VAL(to, EINA_FALSE);
@ -971,7 +971,7 @@ eina_list_move_list(Eina_List **to, Eina_List **from, Eina_List *data)
return EINA_TRUE; return EINA_TRUE;
} }
EAPI Eina_List * EINA_API Eina_List *
eina_list_data_find_list(const Eina_List *list, const void *data) eina_list_data_find_list(const Eina_List *list, const void *data)
{ {
const Eina_List *l; const Eina_List *l;
@ -990,7 +990,7 @@ eina_list_data_find_list(const Eina_List *list, const void *data)
return NULL; return NULL;
} }
EAPI void * EINA_API void *
eina_list_nth(const Eina_List *list, unsigned int n) eina_list_nth(const Eina_List *list, unsigned int n)
{ {
Eina_List *l; Eina_List *l;
@ -1002,7 +1002,7 @@ eina_list_nth(const Eina_List *list, unsigned int n)
return l ? l->data : NULL; return l ? l->data : NULL;
} }
EAPI Eina_List * EINA_API Eina_List *
eina_list_nth_list(const Eina_List *list, unsigned int n) eina_list_nth_list(const Eina_List *list, unsigned int n)
{ {
const Eina_List *l; const Eina_List *l;
@ -1038,7 +1038,7 @@ eina_list_nth_list(const Eina_List *list, unsigned int n)
abort(); abort();
} }
EAPI Eina_List * EINA_API Eina_List *
eina_list_reverse(Eina_List *list) eina_list_reverse(Eina_List *list)
{ {
Eina_List *l1, *l2; Eina_List *l1, *l2;
@ -1068,7 +1068,7 @@ eina_list_reverse(Eina_List *list)
return list; return list;
} }
EAPI Eina_List * EINA_API Eina_List *
eina_list_reverse_clone(const Eina_List *list) eina_list_reverse_clone(const Eina_List *list)
{ {
const Eina_List *l; const Eina_List *l;
@ -1088,7 +1088,7 @@ eina_list_reverse_clone(const Eina_List *list)
return lclone; return lclone;
} }
EAPI Eina_List * EINA_API Eina_List *
eina_list_clone(const Eina_List *list) eina_list_clone(const Eina_List *list)
{ {
const Eina_List *l; const Eina_List *l;
@ -1108,7 +1108,7 @@ eina_list_clone(const Eina_List *list)
return lclone; return lclone;
} }
EAPI Eina_List * EINA_API Eina_List *
eina_list_sort(Eina_List *list, unsigned int limit, Eina_Compare_Cb func) eina_list_sort(Eina_List *list, unsigned int limit, Eina_Compare_Cb func)
{ {
unsigned int i = 0; unsigned int i = 0;
@ -1178,7 +1178,7 @@ eina_list_sort(Eina_List *list, unsigned int limit, Eina_Compare_Cb func)
return list; return list;
} }
EAPI Eina_List * EINA_API Eina_List *
eina_list_shuffle(Eina_List *list, Eina_Random_Cb func) eina_list_shuffle(Eina_List *list, Eina_Random_Cb func)
{ {
unsigned int n, i, j; unsigned int n, i, j;
@ -1261,7 +1261,7 @@ eina_list_shuffle(Eina_List *list, Eina_Random_Cb func)
return shuffled_list; return shuffled_list;
} }
EAPI Eina_List * EINA_API Eina_List *
eina_list_merge(Eina_List *left, Eina_List *right) eina_list_merge(Eina_List *left, Eina_List *right)
{ {
unsigned int n_left, n_right; unsigned int n_left, n_right;
@ -1312,7 +1312,7 @@ eina_list_merge(Eina_List *left, Eina_List *right)
} }
EAPI Eina_List * EINA_API Eina_List *
eina_list_split_list(Eina_List *list, Eina_List *relative, Eina_List **right) eina_list_split_list(Eina_List *list, Eina_List *relative, Eina_List **right)
{ {
Eina_List *next; Eina_List *next;
@ -1358,7 +1358,7 @@ eina_list_split_list(Eina_List *list, Eina_List *relative, Eina_List **right)
return list; return list;
} }
EAPI Eina_List * EINA_API Eina_List *
eina_list_sorted_merge(Eina_List *left, Eina_List *right, Eina_Compare_Cb func) eina_list_sorted_merge(Eina_List *left, Eina_List *right, Eina_Compare_Cb func)
{ {
Eina_List *ret; Eina_List *ret;
@ -1435,7 +1435,7 @@ eina_list_sorted_merge(Eina_List *left, Eina_List *right, Eina_Compare_Cb func)
return ret; return ret;
} }
EAPI Eina_List * EINA_API Eina_List *
eina_list_search_sorted_near_list(const Eina_List *list, eina_list_search_sorted_near_list(const Eina_List *list,
Eina_Compare_Cb func, Eina_Compare_Cb func,
const void *data, const void *data,
@ -1518,7 +1518,7 @@ end:
return (Eina_List *)ct; return (Eina_List *)ct;
} }
EAPI Eina_List * EINA_API Eina_List *
eina_list_search_sorted_list(const Eina_List *list, eina_list_search_sorted_list(const Eina_List *list,
Eina_Compare_Cb func, Eina_Compare_Cb func,
const void *data) const void *data)
@ -1537,7 +1537,7 @@ eina_list_search_sorted_list(const Eina_List *list,
} }
EAPI void * EINA_API void *
eina_list_search_sorted(const Eina_List *list, eina_list_search_sorted(const Eina_List *list,
Eina_Compare_Cb func, Eina_Compare_Cb func,
const void *data) const void *data)
@ -1545,7 +1545,7 @@ eina_list_search_sorted(const Eina_List *list,
return eina_list_data_get(eina_list_search_sorted_list(list, func, data)); return eina_list_data_get(eina_list_search_sorted_list(list, func, data));
} }
EAPI Eina_List * EINA_API Eina_List *
eina_list_search_unsorted_list(const Eina_List *list, eina_list_search_unsorted_list(const Eina_List *list,
Eina_Compare_Cb func, Eina_Compare_Cb func,
const void *data) const void *data)
@ -1561,7 +1561,7 @@ eina_list_search_unsorted_list(const Eina_List *list,
return NULL; return NULL;
} }
EAPI void * EINA_API void *
eina_list_search_unsorted(const Eina_List *list, eina_list_search_unsorted(const Eina_List *list,
Eina_Compare_Cb func, Eina_Compare_Cb func,
const void *data) const void *data)
@ -1570,7 +1570,7 @@ eina_list_search_unsorted(const Eina_List *list,
} }
EAPI Eina_Iterator * EINA_API Eina_Iterator *
eina_list_iterator_new(const Eina_List *list) eina_list_iterator_new(const Eina_List *list)
{ {
Eina_Iterator_List *it; Eina_Iterator_List *it;
@ -1593,7 +1593,7 @@ eina_list_iterator_new(const Eina_List *list)
return &it->iterator; return &it->iterator;
} }
EAPI Eina_Iterator * EINA_API Eina_Iterator *
eina_list_iterator_reversed_new(const Eina_List *list) eina_list_iterator_reversed_new(const Eina_List *list)
{ {
Eina_Iterator_List *it; Eina_Iterator_List *it;
@ -1616,7 +1616,7 @@ eina_list_iterator_reversed_new(const Eina_List *list)
return &it->iterator; return &it->iterator;
} }
EAPI Eina_Accessor * EINA_API Eina_Accessor *
eina_list_accessor_new(const Eina_List *list) eina_list_accessor_new(const Eina_List *list)
{ {
Eina_Accessor_List *ac; Eina_Accessor_List *ac;
@ -1643,7 +1643,7 @@ eina_list_accessor_new(const Eina_List *list)
return &ac->accessor; return &ac->accessor;
} }
EAPI int EINA_API int
eina_list_data_idx(const Eina_List *list, void *data) eina_list_data_idx(const Eina_List *list, void *data)
{ {
const Eina_List *l; const Eina_List *l;

Some files were not shown because too many files have changed in this diff Show More