From f507edf2917fd39ba7d66eea0ff9b16c8d5ffa56 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 22 Oct 2003 22:59:07 +0000 Subject: some const fixes git-svn-id: file:///home/lennart/svn/public/libnewmail/trunk@31 2d4e79f2-dfba-0310-a9f4-9628e67fcdf4 --- src/newmail.c | 6 +++--- src/newmail.h | 10 +++++----- src/nmail-async.c | 4 ++-- src/nmail.c | 2 +- src/util.c | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/newmail.c b/src/newmail.c index 7d513c9..f480500 100644 --- a/src/newmail.c +++ b/src/newmail.c @@ -44,7 +44,7 @@ void* (*nm_realloc)(void *,size_t) = realloc; void (*nm_free)(void *) = free; enum nm_error nm_errno = 0; -char *nm_explanation = 0; +const char *nm_explanation = 0; static void _ltdl_init(int b) { static int n = 0; @@ -61,7 +61,7 @@ static void _ltdl_init(int b) { } -int nm_list(nm_enum_cb_t cb, const void*user) { +int nm_list(nm_enum_cb_t cb, void*user) { static char p[PATH_MAX]; DIR *d; struct dirent *de; @@ -190,7 +190,7 @@ fail: } -int nm_query_submit(struct nm_spool *s, enum nm_query query, oop_source *oop, nm_query_cb_t cb, const void *user) { +int nm_query_submit(struct nm_spool *s, enum nm_query query, oop_source *oop, nm_query_cb_t cb, void *user) { if (!s || !cb || !oop) { nm_error(NM_ERROR_INVPAR, NULL); diff --git a/src/newmail.h b/src/newmail.h index 109a87d..dcc813d 100644 --- a/src/newmail.h +++ b/src/newmail.h @@ -134,14 +134,14 @@ struct nm_info { * @param spool A path to a configuration file * @param user The user pointer specified on nm_list() invocation */ -typedef void (*nm_enum_cb_t) (const char *spool, const void*user); +typedef void (*nm_enum_cb_t) (const char *spool, void*user); /** A prototype for callback functions for asynchronous mail spool queries. * @param s The mail spool belonging to this response * @param status A pointer to a structure describing the mail spool status or NULL, if an error occured. In this case, nm_errno is set. * @param user The user pointer specified on nm_query_submit() invocation */ -typedef void (*nm_query_cb_t) (struct nm_spool *s, struct nm_status *status, const void *user); +typedef void (*nm_query_cb_t) (struct nm_spool *s, struct nm_status *status, void *user); /** A pointer to a malloc() compatible function which is used by * libnewmail for allocating memory. Initially set to libc's malloc(). @@ -164,7 +164,7 @@ extern void (*nm_free)(void *); * last failure. This is only valid when NM_ERROR_EXPLANATION is set * in nm_errno. */ -extern char *nm_explanation; +extern const char *nm_explanation; /** A variable describing the last error occured. Only valid when the * last API function call returned a failure. @@ -209,7 +209,7 @@ int nm_query(struct nm_spool *s, enum nm_query query, struct nm_status *status); * @param user An arbitrary pointer to be passed to cb * @return zero on success, negative on failure. In the latter case nm_errno is set. */ -int nm_query_submit(struct nm_spool *s, enum nm_query query, oop_source *oop, nm_query_cb_t cb, const void *user); +int nm_query_submit(struct nm_spool *s, enum nm_query query, oop_source *oop, nm_query_cb_t cb, void *user); /** Show an X11 configuration dialog for the specified mail spool -- Currently an NOOP * This function will run an external configuration program for the specific mail spool eventually. @@ -234,7 +234,7 @@ int nm_info(struct nm_spool *s, struct nm_info *info); * is zero, no mail spool is configured, you probably should try a * nm_open(NULL) next. */ -int nm_list(nm_enum_cb_t cb, const void*user); +int nm_list(nm_enum_cb_t cb, void *user); /** Return a textual representation of the given error triplet. * @param n A libnewmail error condition (e.g. nm_errno) diff --git a/src/nmail-async.c b/src/nmail-async.c index 06f4d09..c32896d 100644 --- a/src/nmail-async.c +++ b/src/nmail-async.c @@ -58,7 +58,7 @@ void finish(void) { } /* A callback function which is called whenever a mail spool query finished */ -void cb_check(struct nm_spool *s, struct nm_status *status, const void *user) { +void cb_check(struct nm_spool *s, struct nm_status *status, void *user) { struct nm_info i; static char txt[256]; @@ -101,7 +101,7 @@ finish: } /* The callback function for iterating through the mail spools available */ -void cb_list(const char *spool, const void *user) { +void cb_list(const char *spool, void *user) { struct nm_spool* s = NULL; struct spool_ll* l = 0; diff --git a/src/nmail.c b/src/nmail.c index e9fbdb8..7b28aaa 100644 --- a/src/nmail.c +++ b/src/nmail.c @@ -35,7 +35,7 @@ char *b2s(int b) { } /* A callback function called once for each defined libnewmail mailbox */ -void cb(const char *spool, const void*user) { +void cb(const char *spool, void*user) { struct nm_spool* s = NULL; struct nm_info i; struct nm_status st; diff --git a/src/util.c b/src/util.c index f3eeae1..f8ff05e 100644 --- a/src/util.c +++ b/src/util.c @@ -95,7 +95,7 @@ char *nm_strdup(const char *s) { void nm_error(enum nm_error en, const char* exp) { nm_errno = en | (exp ? NM_ERROR_EXPLANATION : 0); if (nm_explanation) - nm_free(nm_explanation); + nm_free((void*) nm_explanation); nm_explanation = nm_strdup(exp); } -- cgit