Commit message (Collapse) | Author | Age | Files | Lines | |
---|---|---|---|---|---|
* | utils: Check if the parameter passed to countof() is actually an array type | Martin Willi | 2014-08-25 | 1 | -1/+2 |
| | | | | This should avoid errors such as the one fixed with 118b2879. | ||||
* | utils: Add some initial build time assertion macros | Martin Willi | 2014-08-25 | 1 | -0/+14 |
| | | | | | These are useful to assert constants during build time. We evaluate the expression to 0 when valid, so we can safely use the evaluated value. | ||||
* | utils: Undefine mem{cpy,move,set} if set before defining them | Martin Willi | 2014-07-07 | 1 | -0/+9 |
| | | | | | Some platforms, such as OS X, use macros for these functions. Undefine them to avoid compiler warnings. | ||||
* | utils: Helper macros to define overloaded macros based on number of arguments | Tobias Brunner | 2014-06-30 | 1 | -0/+26 |
| | |||||
* | utils: Add wrappers for memcpy(3), memmove(3) and memset(3) | Tobias Brunner | 2014-06-24 | 1 | -1/+33 |
| | | | | | | | | These wrappers guarantee that calls to these functions are noops if the number of bytes is 0, as calling them with NULL pointers is undefined according to the C standard, even if the number of bytes is 0 (most implementations probably ignore the pointers anyway in this case, but lets make sure). | ||||
* | utils: Add a wait_sigint() function to wait for SIGINT or equivalent | Martin Willi | 2014-06-04 | 1 | -0/+5 |
| | |||||
* | utils: Provide a path_absolute() function to check path for non-relativeness | Martin Willi | 2014-06-04 | 1 | -0/+8 |
| | | | | The usually used trivial '/' check won't work on Windows platforms. | ||||
* | utils: Define a platform directory separator character used in paths | Martin Willi | 2014-06-04 | 1 | -0/+9 |
| | |||||
* | windows: Provide a sched_yield() implementation | Martin Willi | 2014-06-04 | 1 | -0/+1 |
| | |||||
* | windows: Add utils_init/deinit functions to initialize Winsock2 | Martin Willi | 2014-06-04 | 1 | -0/+10 |
| | |||||
* | windows: Add a common Windows header for platform specific wrappers | Martin Willi | 2014-06-03 | 1 | -2/+11 |
| | | | | | Include some more basic system headers in utils.h, so we can use that common header on the different platforms. | ||||
* | enum: Don't directly include enum.h | Martin Willi | 2014-05-16 | 1 | -3/+3 |
| | | | | | To allow enum.h to depend on utils.h definitions, avoid its direct inclusion. Instead include utils.h, which includes enum.h as well. | ||||
* | utils: Provide a CALLBACK macro, similar to METHOD, but for void* callbacks | Martin Willi | 2014-05-07 | 1 | -0/+13 |
| | | | | | | Using the same mechanism as the METHOD macro, the CALLBACK macro defines a hybrid function signature. It strictly uses a weak void* for the first function parameter, in contrast to the dynamic METHOD object "this" type. | ||||
* | utils: Enable __atomic* built-ins based on the GCC version | Tobias Brunner | 2014-05-04 | 1 | -0/+7 |
| | | | | | | | | | | | This solves a problem with GNAT when compiling charon-tkm as __atomic* built-ins are only provided in GCC 4.7 and newer. Currently GNAT 4.6 and GCC 4.7.2 is shipped with Debian wheezy (stable), as used in the testing environment. So while the configure script correctly detected the __atomic* built-ins, and defined HAVE_GCC_ATOMIC_OPERATIONS, this define turned out to be incorrect when charon-tkm was later built with GNAT. | ||||
* | utils: Use GCC's __atomic built-ins if available | Tobias Brunner | 2014-04-24 | 1 | -1/+20 |
| | | | | | | | | These are available since GCC 4.7 and will eventually replace the __sync operations. They support the memory model defined by C++11. For instance, by using __ATOMIC_RELAXED for some operations on the reference counters we can avoid memory barriers, which are required by __sync operations (whose memory model essentially is __ATOMIC_SEQ_CST). | ||||
* | utils: Add ref_cur() to retrieve the current value of a reference counter | Tobias Brunner | 2014-04-24 | 1 | -2/+11 |
| | | | | | | | | | | On many architectures it is safe to read the value directly (those using cache coherency protocols, and with atomic loads for 32-bit values) but it is not if that's not the case or if we ever decide to make refcount_t 64-bit (load not atomic on x86). So make sure the operation is actually atomic and that users do not have to care about the size of refcount_t. | ||||
* | utils: Add memrchr(3) replacement for platforms that don't support it | Tobias Brunner | 2014-02-26 | 1 | -0/+14 |
| | | | | For instance, on Mac OS X memrchr(3) is not provided by the C library. | ||||
* | utils: Add thread-safe variants of dirname(3) and basename(3) | Tobias Brunner | 2014-02-24 | 1 | -1/+27 |
| | |||||
* | utils: Move thread-safe strerror replacement to a separate file | Tobias Brunner | 2014-02-24 | 1 | -17/+1 |
| | | | | | For some utils _GNU_SOURCE might be needed but that conflicts with the signature of strerror_r(3). | ||||
* | Fixed some typos | Tobias Brunner | 2014-02-18 | 1 | -3/+3 |
| | |||||
* | utils: Add strreplace function | Tobias Brunner | 2014-01-23 | 1 | -1/+15 |
| | |||||
* | utils: Include stdio.h for fmemopen() replacement | Tobias Brunner | 2013-10-29 | 1 | -0/+1 |
| | | | | | This might now be required because Vstr is not necessarily required anymore, which means stdio.h might not be pulled in by prinf_hook.h. | ||||
* | utils: Fix check for fmemopen() fallback implementation | Martin Willi | 2013-10-24 | 1 | -1/+2 |
| | |||||
* | utils: Provide a fmemopen(3) fallback using BSD funopen() | Martin Willi | 2013-10-24 | 1 | -0/+15 |
| | |||||
* | utils: Add utility function to calculate padding length | Tobias Brunner | 2013-10-17 | 1 | -12/+16 |
| | |||||
* | utils: Add case-insensitive version of strpfx() | Tobias Brunner | 2013-08-24 | 1 | -0/+8 |
| | |||||
* | utils: add round_up/down() helper functions | Martin Willi | 2013-07-29 | 1 | -0/+23 |
| | |||||
* | utils: Add helper function to check a string for a given prefix | Tobias Brunner | 2013-07-08 | 1 | -0/+8 |
| | |||||
* | utils: Convert string helper macros to static inline functions | Tobias Brunner | 2013-07-08 | 1 | -6/+15 |
| | |||||
* | utils: Remove volatile qualifier from refcount_t typedef | Tobias Brunner | 2013-06-19 | 1 | -2/+1 |
| | | | | | It's not really required anymore (if it ever was) and may cause compiler warnings when using the non atomic versions of ref_get/ref_put. | ||||
* | utils: ref_get() returns the new value of the reference counter | Martin Willi | 2013-06-11 | 1 | -2/+3 |
| | | | | This allows us to use ref_get() for getting unique values. | ||||
* | Removed unused clalloc() function | Tobias Brunner | 2013-06-11 | 1 | -5/+0 |
| | |||||
* | timeval_add_ms() fixed | Tobias Brunner | 2013-06-11 | 1 | -1/+1 |
| | | | | 1000000us are exactly 1s so. | ||||
* | Allow memwipe() to be called with NULL argument | Tobias Brunner | 2013-05-27 | 1 | -0/+4 |
| | |||||
* | Add a utility function to resolve TTY color escape codes dynamically | Martin Willi | 2013-03-04 | 1 | -0/+40 |
| | |||||
* | Add a global return_success() method implementation | Martin Willi | 2013-02-14 | 1 | -0/+5 |
| | |||||
* | Moved utils.[ch] to utils folder | Tobias Brunner | 2012-10-24 | 1 | -0/+699 |