#include <stdlib.h>#include <stdint.h>#include <stdbool.h>#include <string.h>#include <unistd.h>#include <assert.h>#include <stdio.h>#include <time.h>#include <errno.h>#include <sys/time.h>#include "../mkavl.h"Go to the source code of this file.
| Defines | |
| #define | NELEMS(x) (sizeof(x) / sizeof(x[0])) | 
| #define | CT_ASSERT(e) extern char (*CT_ASSERT(void)) [sizeof(char[1 - 2*!(e)])] | 
| #define | EXAMPLES_RUNAWAY_SANITY 100000 | 
| Functions | |
| static void | assert_abort (bool condition) | 
| static double | timeval_to_seconds (struct timeval *tv) | 
| static size_t | my_strlcpy (char *dst, const char *src, size_t siz) | 
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version.
This program 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 General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
These are common functionalities shared by the examples.
Definition in file examples_common.h.
| #define CT_ASSERT | ( | e | ) | extern char (*CT_ASSERT(void)) [sizeof(char[1 - 2*!(e)])] | 
Compile time assert macro from: http://www.pixelbeat.org/programming/gcc/static_assert.html
Definition at line 51 of file examples_common.h.
| #define EXAMPLES_RUNAWAY_SANITY 100000 | 
Sanity check for infinite loops.
Definition at line 57 of file examples_common.h.
| #define NELEMS | ( | x | ) | (sizeof(x) / sizeof(x[0])) | 
Determine the number of elements in an array.
Definition at line 43 of file examples_common.h.
| static void assert_abort | ( | bool | condition | ) |  [inline, static] | 
Assert utility to crash (via abort()) if the condition is not met regardless of whether NDEBUG is defined.
| condition | The condition for which a crash will happen if false. | 
Definition at line 66 of file examples_common.h.
| static size_t my_strlcpy | ( | char * | dst, | 
| const char * | src, | ||
| size_t | siz | ||
| ) |  [inline, static] | 
Sigh, yes for reasons divorced from reality, you just have to keep implementing this. Copied from the BSD source. See Wikipedia for more documentation.
| dst | The destination string. | 
| src | The source string. | 
| siz | The size of the destination buffer. | 
Definition at line 101 of file examples_common.h.
| static double timeval_to_seconds | ( | struct timeval * | tv | ) |  [inline, static] | 
Utility to convert time objects to seconds.
| tv | The time object. | 
Definition at line 80 of file examples_common.h.
 1.7.4
 1.7.4