From 31c79a0408f61f43310093e0e03681c7f5206483 Mon Sep 17 00:00:00 2001 From: Sebastian Harl Date: Sun, 22 Jun 2014 17:28:04 +0200 Subject: [PATCH] data: Pass 'const' data objects to strlen()/format(). --- src/core/data.c | 4 ++-- src/include/core/data.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) 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" */ -- 2.30.2