Mercurial > dovecot > core-2.2
changeset 4816:8ac2a2d27364 HEAD
Cleanup: Don't put string literals into non-const pointers.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Sat, 18 Nov 2006 15:41:38 +0200 |
parents | fc29abb75b01 |
children | 38753229afaf |
files | src/auth/db-ldap.c src/auth/mech-plain.c src/imap/namespace.h src/lib-imap/imap-bodystructure.c src/lib-imap/imap-quote.c src/lib-imap/imap-quote.h src/lib-settings/settings.c src/plugins/quota/quota-private.h src/pop3/client.c |
diffstat | 9 files changed, 25 insertions(+), 25 deletions(-) [+] |
line wrap: on
line diff
--- a/src/auth/db-ldap.c Sat Nov 18 13:53:59 2006 +0200 +++ b/src/auth/db-ldap.c Sat Nov 18 15:41:38 2006 +0200 @@ -598,10 +598,8 @@ value = p_strdup(conn->pool, p + 1); } - if (skip_attr != NULL && strcmp(skip_attr, value) == 0) - name = ""; - - if (*name != '\0') { + if (*name != '\0' && + (skip_attr == NULL || strcmp(skip_attr, value) != 0)) { hash_insert(attr_map, name, value); (*attr_names_r)[j++] = name; }
--- a/src/auth/mech-plain.c Sat Nov 18 13:53:59 2006 +0200 +++ b/src/auth/mech-plain.c Sat Nov 18 15:41:38 2006 +0200 @@ -33,7 +33,7 @@ /* authorization ID \0 authentication ID \0 pass. we'll ignore authorization ID for now. */ authid = (const char *) data; - authenid = NULL; pass = ""; + authenid = NULL; pass = NULL; count = 0; for (i = 0; i < data_size; i++) { @@ -70,7 +70,8 @@ } /* make sure it's cleared */ - safe_memset(pass, 0, strlen(pass)); + if (pass != NULL) + safe_memset(pass, 0, strlen(pass)); } static struct auth_request *mech_plain_auth_new(void)
--- a/src/imap/namespace.h Sat Nov 18 13:53:59 2006 +0200 +++ b/src/imap/namespace.h Sat Nov 18 15:41:38 2006 +0200 @@ -13,7 +13,7 @@ enum namespace_type type; char sep, real_sep, sep_str[3]; - char *prefix; + const char *prefix; size_t prefix_len; int inbox, hidden, subscriptions;
--- a/src/lib-imap/imap-bodystructure.c Sat Nov 18 13:53:59 2006 +0200 +++ b/src/lib-imap/imap-bodystructure.c Sat Nov 18 15:41:38 2006 +0200 @@ -21,15 +21,15 @@ struct message_part_body_data { pool_t pool; string_t *str; /* temporary */ - char *content_type, *content_subtype; - char *content_type_params; - char *content_transfer_encoding; - char *content_id; - char *content_description; - char *content_disposition; - char *content_disposition_params; - char *content_md5; - char *content_language; + const char *content_type, *content_subtype; + const char *content_type_params; + const char *content_transfer_encoding; + const char *content_id; + const char *content_description; + const char *content_disposition; + const char *content_disposition_params; + const char *content_md5; + const char *content_language; struct message_part_envelope_data *envelope;
--- a/src/lib-imap/imap-quote.c Sat Nov 18 13:53:59 2006 +0200 +++ b/src/lib-imap/imap-quote.c Sat Nov 18 15:41:38 2006 +0200 @@ -86,7 +86,8 @@ str_append_c(str, '"'); } -char *imap_quote(pool_t pool, const unsigned char *value, size_t value_len) +const char *imap_quote(pool_t pool, const unsigned char *value, + size_t value_len) { string_t *str; char *ret;
--- a/src/lib-imap/imap-quote.h Sat Nov 18 13:53:59 2006 +0200 +++ b/src/lib-imap/imap-quote.h Sat Nov 18 15:41:38 2006 +0200 @@ -4,7 +4,8 @@ /* Return value suitable for sending to client, either as quoted-string or literal. Note that this also converts TABs into spaces, multiple spaces into single space and NULs to #128. */ -char *imap_quote(pool_t pool, const unsigned char *value, size_t value_len); +const char *imap_quote(pool_t pool, const unsigned char *value, + size_t value_len); /* Append to existing string. */ void imap_quote_append(string_t *str, const unsigned char *value,
--- a/src/lib-settings/settings.c Sat Nov 18 13:53:59 2006 +0200 +++ b/src/lib-settings/settings.c Sat Nov 18 15:41:38 2006 +0200 @@ -64,8 +64,8 @@ settings_section_callback_t *sect_callback, void *context) { struct istream *input; - const char *errormsg, *next_section; - char *line, *key, *name, *p, quote; + const char *errormsg, *next_section, *name; + char *line, *key, *p, quote; size_t len; int fd, linenum, skip, sections, root_section;
--- a/src/plugins/quota/quota-private.h Sat Nov 18 13:53:59 2006 +0200 +++ b/src/plugins/quota/quota-private.h Sat Nov 18 15:41:38 2006 +0200 @@ -51,7 +51,7 @@ pool_t pool; /* Unique quota root name. */ - char *name; + const char *name; /* pointer to the quota that owns this root */ struct quota *quota;
--- a/src/pop3/client.c Sat Nov 18 13:53:59 2006 +0200 +++ b/src/pop3/client.c Sat Nov 18 15:41:38 2006 +0200 @@ -362,13 +362,12 @@ while (!client->output->closed && (line = i_stream_next_line(client->input)) != NULL) { args = strchr(line, ' '); - if (args == NULL) - args = ""; - else + if (args != NULL) *args++ = '\0'; t_push(); - ret = client_command_execute(client, line, args); + ret = client_command_execute(client, line, + args != NULL ? args : ""); t_pop(); if (ret >= 0) { client->bad_counter = 0;