X-Git-Url: https://git.exim.org/exim.git/blobdiff_plain/94e1f16d6033683bdebaf5092f64c58bc044dd2d..42c7f0b4ea09d8971a19beeef743ec8981d4aacc:/src/src/lookups/ibase.c diff --git a/src/src/lookups/ibase.c b/src/src/lookups/ibase.c index 58bced201..eab3c6ad8 100644 --- a/src/src/lookups/ibase.c +++ b/src/src/lookups/ibase.c @@ -2,7 +2,7 @@ * Exim - an Internet mail transport agent * *************************************************/ -/* Copyright (c) University of Cambridge 1995 - 2015 */ +/* Copyright (c) University of Cambridge 1995 - 2018 */ /* See the file NOTICE for conditions of use and distribution. */ /* The code in this module was contributed by Ard Biesheuvel. */ @@ -51,7 +51,7 @@ static void ibase_tidy(void) while ((cn = ibase_connections) != NULL) { ibase_connections = cn->next; - DEBUG(D_lookup) debug_printf("close Interbase connection: %s\n", + DEBUG(D_lookup) debug_printf_indent("close Interbase connection: %s\n", cn->server); isc_commit_transaction(status, &cn->transh); isc_detach_database(status, &cn->dbh); @@ -112,12 +112,12 @@ perform_ibase_search(uschar * query, uschar * server, uschar ** resultptr, isc_stmt_handle stmth = NULL; XSQLDA *out_sqlda; XSQLVAR *var; +int i; char buffer[256]; ISC_STATUS status[20], *statusp = status; gstring * result; -int i; int yield = DEFER; ibase_connection *cn; uschar *server_copy = NULL; @@ -128,7 +128,7 @@ database, user, password. We can write to the string, since it is in a nextinlist temporary buffer. The copy of the string that is used for caching has the password removed. This copy is also used for debugging output. */ -for (i = 2; i > 0; i--) +for (int i = 2; i > 0; i--) { uschar *pp = Ustrrchr(server, '|'); @@ -170,10 +170,8 @@ if (cn) isc_detach_database(status, &cn->dbh); } else - { - DEBUG(D_lookup) debug_printf("Interbase using cached connection for %s\n", + DEBUG(D_lookup) debug_printf_indent("Interbase using cached connection for %s\n", server_copy); - } } else { @@ -189,7 +187,7 @@ else if (cn->dbh == NULL || cn->transh == NULL) { - char *dpb, *p; + char *dpb; short dpb_length; static char trans_options[] = { isc_tpb_version3, isc_tpb_read, isc_tpb_read_committed, @@ -201,16 +199,16 @@ if (cn->dbh == NULL || cn->transh == NULL) *dpb++ = isc_dpb_version1; *dpb++ = isc_dpb_user_name; *dpb++ = strlen(sdata[1]); - for (p = sdata[1]; *p;) + for (char * p = sdata[1]; *p;) *dpb++ = *p++; *dpb++ = isc_dpb_password; *dpb++ = strlen(sdata[2]); - for (p = sdata[2]; *p;) + for (char * p = sdata[2]; *p;) *dpb++ = *p++; dpb_length = dpb - buffer; DEBUG(D_lookup) - debug_printf("new Interbase connection: database=%s user=%s\n", + debug_printf_indent("new Interbase connection: database=%s user=%s\n", sdata[0], sdata[1]); /* Connect to the database */ @@ -373,7 +371,7 @@ while (isc_dsql_fetch(status, &stmth, out_sqlda->version, out_sqlda) != 100L) } else - for (i = 0; i < out_sqlda->sqld; i++) + for (int i = 0; i < out_sqlda->sqld; i++) { int len = fetch_field(buffer, sizeof(buffer), &out_sqlda->sqlvar[i]); @@ -388,10 +386,8 @@ while (isc_dsql_fetch(status, &stmth, out_sqlda->version, out_sqlda) != 100L) else if (buffer[0] == 0 || Ustrchr(buffer, ' ') != NULL) { - int j; - result = string_catn(result, US "\"", 1); - for (j = 0; j < len; j++) + for (int j = 0; j < len; j++) { if (buffer[j] == '\"' || buffer[j] == '\\') result = string_cat(result, US "\\", 1); @@ -434,7 +430,7 @@ if (result) } else { - DEBUG(D_lookup) debug_printf("%s\n", *errmsg); + DEBUG(D_lookup) debug_printf_indent("%s\n", *errmsg); return yield; /* FAIL or DEFER */ } } @@ -462,7 +458,7 @@ ibase_find(void *handle, uschar * filename, uschar * query, int length, /* Keep picky compilers happy */ do_cache = do_cache; - DEBUG(D_lookup) debug_printf("Interbase query: %s\n", query); + DEBUG(D_lookup) debug_printf_indent("Interbase query: %s\n", query); while ((server = string_nextinlist(&list, &sep, buffer,