From: Sebastian Harl Date: Sun, 22 Jun 2014 15:28:04 +0000 (+0200) Subject: data: Pass 'const' data objects to strlen()/format(). X-Git-Tag: sysdb-0.2.0~42 X-Git-Url: https://git.tokkee.org/?p=sysdb.git;a=commitdiff_plain;h=31c79a0408f61f43310093e0e03681c7f5206483 data: Pass 'const' data objects to strlen()/format(). --- diff --git a/src/core/data.c b/src/core/data.c index 0e8cfcb..dc2d0ae 100644 --- a/src/core/data.c +++ b/src/core/data.c @@ -147,7 +147,7 @@ sdb_data_cmp(sdb_data_t *d1, sdb_data_t *d2) } /* sdb_data_cmp */ size_t -sdb_data_strlen(sdb_data_t *datum) +sdb_data_strlen(const sdb_data_t *datum) { if (! datum) return 0; @@ -175,7 +175,7 @@ sdb_data_strlen(sdb_data_t *datum) } /* sdb_data_strlen */ 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) { char tmp[sdb_data_strlen(datum) + 1]; char *data = NULL; diff --git a/src/include/core/data.h b/src/include/core/data.h index bd10266..879af90 100644 --- a/src/include/core/data.h +++ b/src/include/core/data.h @@ -120,7 +120,7 @@ sdb_data_cmp(sdb_data_t *d1, sdb_data_t *d2); * account. */ size_t -sdb_data_strlen(sdb_data_t *datum); +sdb_data_strlen(const sdb_data_t *datum); enum { SDB_UNQUOTED = 0, @@ -143,7 +143,7 @@ enum { * - 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" */