index 0b4b2e7419312e10d68f9725d7db061dea9d0d14..879af9087db92d7346fee2109326df55eaf25dfc 100644 (file)
--- a/src/include/core/data.h
+++ b/src/include/core/data.h
/*
* SysDB - src/include/core/data.h
/*
* SysDB - src/include/core/data.h
- * Copyright (C) 2012 Sebastian 'tokkee' Harl <sh@tokkee.org>
+ * Copyright (C) 2012-2014 Sebastian 'tokkee' Harl <sh@tokkee.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
void
sdb_data_free_datum(sdb_data_t *datum);
void
sdb_data_free_datum(sdb_data_t *datum);
+/*
+ * sdb_data_cmp:
+ * Compare two data points. A NULL datum is considered less than any non-NULL
+ * datum. On data-type mismatch, the function always returns a negative value.
+ *
+ * Returns:
+ * - a value less than zero if d1 compares less than d2
+ * - zero if d1 compares equal to d2
+ * - a value greater than zero if d1 compares greater than d2
+ */
+int
+sdb_data_cmp(sdb_data_t *d1, sdb_data_t *d2);
+
/*
* sdb_data_strlen:
* Returns a (worst-case) estimate for the number of bytes required to format
/*
* sdb_data_strlen:
* Returns a (worst-case) estimate for the number of bytes required to format
* account.
*/
size_t
* account.
*/
size_t
-sdb_data_strlen(sdb_data_t *datum);
+sdb_data_strlen(const sdb_data_t *datum);
enum {
SDB_UNQUOTED = 0,
enum {
SDB_UNQUOTED = 0,
* - a negative value else
*/
int
* - a negative value else
*/
int
-sdb_data_format(sdb_data_t *datum, char *buf, size_t buflen, int quoted);
+sdb_data_format(const sdb_data_t *datum, char *buf, size_t buflen, int quoted);
#ifdef __cplusplus
} /* extern "C" */
#ifdef __cplusplus
} /* extern "C" */