#include "capi.h"
#include "error.h"
Go to the source code of this file.
|
#define | LIS_UNUSED(x) (void)(x) |
|
#define | LIS_COUNT_OF(x) (sizeof(x) / sizeof((x)[0])) |
|
#define | FREE(x) |
|
#define | MIN(x, y) ((x) < (y) ? (x) : (y)) |
|
#define | MAX(x, y) ((x) > (y) ? (x) : (y)) |
|
|
enum lis_error | lis_copy (const enum lis_value_type type, const union lis_value *original, union lis_value *copy) |
| Copy a value. You must free the copy once you're done with it. More...
|
|
void | lis_free (const enum lis_value_type type, union lis_value *value) |
| Free a copied value. More...
|
|
enum lis_error | lis_set_option (struct lis_item *item, const char *opt_name, const char *opt_value) |
| helper to set quickly an option More...
|
|
int | lis_compare (enum lis_value_type type, union lis_value val1, union lis_value val2) |
| compare values More...
|
|
union lis_value | lis_add (enum lis_value_type type, union lis_value a, union lis_value b) |
|
union lis_value | lis_sub (enum lis_value_type type, union lis_value a, union lis_value b) |
|
int | lis_getenv (const char *var, int default_val) |
| return the value of an environment variable. More...
|
|
const char * | lis_get_version (void) |
| return Libinsane version. More...
|
|
void | lis_hexdump (const char *prefix, const void *data, size_t nb_bytes) |
|
◆ FREE
Value: do { \
free(((void*)(x))); \
(x) = NULL; \
} while(0);
Definition at line 16 of file util.h.
◆ LIS_COUNT_OF
#define LIS_COUNT_OF |
( |
|
x | ) |
(sizeof(x) / sizeof((x)[0])) |
◆ LIS_UNUSED
#define LIS_UNUSED |
( |
|
x | ) |
(void)(x) |
◆ MAX
#define MAX |
( |
|
x, |
|
|
|
y |
|
) |
| ((x) > (y) ? (x) : (y)) |
◆ MIN
#define MIN |
( |
|
x, |
|
|
|
y |
|
) |
| ((x) < (y) ? (x) : (y)) |
◆ lis_add()
◆ lis_compare()
compare values
- Return values
-
1 | if values are identical |
0 | if values are different |
◆ lis_copy()
Copy a value. You must free the copy once you're done with it.
- Parameters
-
[in] | type | define the value type. |
[in] | original | value to copy. |
[out] | copy | duplicated value. |
◆ lis_free()
Free a copied value.
- Parameters
-
[in] | type | define a the value type. |
[in] | value | value to free. Do not use it after calling this function. |
◆ lis_get_version()
const char* lis_get_version |
( |
void |
| ) |
|
return Libinsane version.
- Returns
- never NULL
◆ lis_getenv()
int lis_getenv |
( |
const char * |
var, |
|
|
int |
default_val |
|
) |
| |
return the value of an environment variable.
- Parameters
-
[in] | var | env variable name |
[in] | default_val | default value if the variable is not set |
◆ lis_hexdump()
void lis_hexdump |
( |
const char * |
prefix, |
|
|
const void * |
data, |
|
|
size_t |
nb_bytes |
|
) |
| |
◆ lis_set_option()
enum lis_error lis_set_option |
( |
struct lis_item * |
item, |
|
|
const char * |
opt_name, |
|
|
const char * |
opt_value |
|
) |
| |
helper to set quickly an option
◆ lis_sub()