summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Monnerat <pm@datasphere.ch>2013-10-28 12:00:22 +0100
committerPatrick Monnerat <pm@datasphere.ch>2013-10-28 12:00:22 +0100
commit5d415815df4b93d694a7134739725d6c41176b01 (patch)
tree9e820d75b0d2eb5c468b7fb5e1cd11c6e0ea5653
parentf68559c086b74e092f72b72641d3a1a043cfa636 (diff)
downloadgnurl-5d415815df4b93d694a7134739725d6c41176b01.tar.gz
gnurl-5d415815df4b93d694a7134739725d6c41176b01.tar.bz2
gnurl-5d415815df4b93d694a7134739725d6c41176b01.zip
OS400: coding style standards
-rw-r--r--lib/setup-os400.h8
-rw-r--r--packages/OS400/ccsidcurl.c28
-rw-r--r--packages/OS400/ccsidcurl.h4
-rw-r--r--packages/OS400/os400sys.c232
4 files changed, 138 insertions, 134 deletions
diff --git a/lib/setup-os400.h b/lib/setup-os400.h
index 37dc05b2b..0331464e4 100644
--- a/lib/setup-os400.h
+++ b/lib/setup-os400.h
@@ -33,7 +33,7 @@
typedef unsigned long u_int32_t;
-/* System API wrapper prototypes and definitions to support ASCII parameters. */
+/* System API wrapper prototypes & definitions to support ASCII parameters. */
#include <sys/socket.h>
#include <netdb.h>
@@ -42,7 +42,8 @@ typedef unsigned long u_int32_t;
#include <qsoasync.h>
#include <gssapi.h>
-extern int Curl_getaddrinfo_a(const char * nodename, const char * servname,
+extern int Curl_getaddrinfo_a(const char * nodename,
+ const char * servname,
const struct addrinfo * hints,
struct addrinfo * * res);
#define getaddrinfo Curl_getaddrinfo_a
@@ -66,7 +67,8 @@ extern int Curl_SSL_Init_a(SSLInit * init);
#define SSL_Init Curl_SSL_Init_a
-extern char * Curl_SSL_Strerror_a(int sslreturnvalue, SSLErrorMsg * serrmsgp);
+extern char * Curl_SSL_Strerror_a(int sslreturnvalue,
+ SSLErrorMsg * serrmsgp);
#define SSL_Strerror Curl_SSL_Strerror_a
diff --git a/packages/OS400/ccsidcurl.c b/packages/OS400/ccsidcurl.c
index 9049d9e49..e312c71ae 100644
--- a/packages/OS400/ccsidcurl.c
+++ b/packages/OS400/ccsidcurl.c
@@ -77,7 +77,8 @@ makeOS400IconvCode(char buf[ICONV_ID_SIZE], unsigned int ccsid)
static iconv_t
-iconv_open_CCSID(unsigned int ccsidout, unsigned int ccsidin, unsigned int cstr)
+iconv_open_CCSID(unsigned int ccsidout, unsigned int ccsidin,
+ unsigned int cstr)
{
char fromcode[ICONV_ID_SIZE];
@@ -218,7 +219,7 @@ slist_convert(int dccsid, struct curl_slist * from, int sccsid)
struct curl_slist * to = (struct curl_slist *) NULL;
char * cp;
- for (; from; from = from->next) {
+ for(; from; from = from->next) {
if(!(cp = dynconvert(dccsid, from->data, -1, sccsid))) {
curl_slist_free_all(to);
return (struct curl_slist *) NULL;
@@ -407,7 +408,7 @@ curl_version_info_ccsid(CURLversion stamp, unsigned int ccsid)
compiler seems to compare string values after substitution. */
#if CURLVERSION_NOW != CURLVERSION_FOURTH
-#error curl_version_info_data structure has changed: upgrade this procedure too.
+#error curl_version_info_data structure has changed: upgrade this procedure.
#endif
/* If caller has been compiled with a new version, error. */
@@ -426,7 +427,7 @@ curl_version_info_ccsid(CURLversion stamp, unsigned int ccsid)
nproto = 0;
if(p->protocols) {
- while (p->protocols[nproto])
+ while(p->protocols[nproto])
n += strlen(p->protocols[nproto++]);
n += nproto++;
@@ -478,7 +479,7 @@ curl_version_info_ccsid(CURLversion stamp, unsigned int ccsid)
cp += i;
n -= i;
- for (i = 0; id->protocols[i]; i++)
+ for(i = 0; id->protocols[i]; i++)
if(convert_version_info_string(((const char * *) id->protocols) + i,
&cp, &n, ccsid))
return (curl_version_info_data *) NULL;
@@ -593,7 +594,7 @@ curl_certinfo_free_all(struct curl_certinfo *info)
/* Free all memory used by certificate info. */
if(info) {
if(info->certinfo) {
- for (i = 0; i < info->num_of_certs; i++)
+ for(i = 0; i < info->num_of_certs; i++)
curl_slist_free_all(info->certinfo[i]);
free((char *) info->certinfo);
}
@@ -653,13 +654,14 @@ curl_easy_getinfo_ccsid(CURL * curl, CURLINFO info, ...)
if(!(cipt = (struct curl_certinfo *) malloc(sizeof *cipt)))
ret = CURLE_OUT_OF_MEMORY;
else {
- cipt->certinfo = (struct curl_slist * *) calloc(cipf->num_of_certs +
- 1, sizeof(struct curl_slist *));
+ cipt->certinfo = (struct curl_slist * *)
+ calloc(cipf->num_of_certs +
+ 1, sizeof(struct curl_slist *));
if(!cipt->certinfo)
ret = CURLE_OUT_OF_MEMORY;
else {
cipt->num_of_certs = cipf->num_of_certs;
- for (i = 0; i < cipf->num_of_certs; i++)
+ for(i = 0; i < cipf->num_of_certs; i++)
if(cipf->certinfo[i])
if(!(cipt->certinfo[i] = slist_convert(ccsid,
cipf->certinfo[i],
@@ -715,7 +717,7 @@ static void
Curl_formadd_release_local(struct curl_forms * forms, int nargs, int skip)
{
- while (nargs--)
+ while(nargs--)
if(nargs != skip)
if(Curl_is_formadd_string(forms[nargs].option))
if(forms[nargs].value)
@@ -755,7 +757,7 @@ Curl_formadd_convert(struct curl_forms * forms,
return -1;
}
- cp2 = realloc(cp, l); /* Shorten buffer to the string size. */
+ cp2 = realloc(cp, l); /* Shorten buffer to the string size. */
if(cp2)
cp = cp2;
@@ -763,7 +765,7 @@ Curl_formadd_convert(struct curl_forms * forms,
forms[formx].value = cp;
if(lengthx >= 0)
- forms[lengthx].value = (char *) l; /* Update to length after conversion. */
+ forms[lengthx].value = (char *) l; /* Update length after conversion. */
return l;
}
@@ -826,7 +828,7 @@ curl_formadd_ccsid(struct curl_httppost * * httppost,
forms = (struct curl_forms *) NULL;
va_start(arg, last_post);
- for (;;) {
+ for(;;) {
/* Make sure there is still room for an item in local array. */
if(nargs >= lformlen) {
diff --git a/packages/OS400/ccsidcurl.h b/packages/OS400/ccsidcurl.h
index eaa591f72..3d1fe7949 100644
--- a/packages/OS400/ccsidcurl.h
+++ b/packages/OS400/ccsidcurl.h
@@ -38,13 +38,13 @@ CURL_EXTERN char * curl_easy_unescape_ccsid(CURL * handle, const char * string,
int length, int * outlength,
unsigned int sccsid,
unsigned int dccsid);
-CURL_EXTERN struct curl_slist * curl_slist_append_ccsid(struct curl_slist * lst,
+CURL_EXTERN struct curl_slist * curl_slist_append_ccsid(struct curl_slist * l,
const char * data,
unsigned int ccsid);
CURL_EXTERN time_t curl_getdate_ccsid(const char * p, const time_t * unused,
unsigned int ccsid);
CURL_EXTERN curl_version_info_data * curl_version_info_ccsid(CURLversion stamp,
- unsigned int csid);
+ unsigned int cid);
CURL_EXTERN const char * curl_easy_strerror_ccsid(CURLcode error,
unsigned int ccsid);
CURL_EXTERN const char * curl_share_strerror_ccsid(CURLSHcode error,
diff --git a/packages/OS400/os400sys.c b/packages/OS400/os400sys.c
index 90160878d..fd3cf6e0f 100644
--- a/packages/OS400/os400sys.c
+++ b/packages/OS400/os400sys.c
@@ -101,11 +101,11 @@ thdbufdestroy(void * private)
localkey_t i;
buffer_t * p;
- if (private) {
+ if(private) {
p = (buffer_t *) private;
- for (i = (localkey_t) 0; i < LK_LAST; i++) {
- if (p->buf)
+ for(i = (localkey_t) 0; i < LK_LAST; i++) {
+ if(p->buf)
free(p->buf);
p++;
@@ -120,13 +120,13 @@ static void
terminate(void)
{
- if (Curl_thread_buffer == buffer_threaded) {
+ if(Curl_thread_buffer == buffer_threaded) {
locbufs = pthread_getspecific(thdkey);
pthread_setspecific(thdkey, (void *) NULL);
pthread_key_delete(thdkey);
}
- if (Curl_thread_buffer != buffer_undef) {
+ if(Curl_thread_buffer != buffer_undef) {
thdbufdestroy((void *) locbufs);
locbufs = (buffer_t *) NULL;
}
@@ -144,31 +144,31 @@ get_buffer(buffer_t * buf, long size)
/* If `size' >= 0, make sure buffer at `buf' is at least `size'-byte long.
Return the buffer address. */
- if (size < 0)
+ if(size < 0)
return buf->buf;
- if (!buf->buf) {
- if ((buf->buf = malloc(size)))
+ if(!buf->buf) {
+ if((buf->buf = malloc(size)))
buf->size = size;
return buf->buf;
}
- if ((unsigned long) size <= buf->size) {
+ if((unsigned long) size <= buf->size) {
/* Shorten the buffer only if it frees a significant byte count. This
avoids some realloc() overhead. */
- if (buf->size - size < MIN_BYTE_GAIN)
+ if(buf->size - size < MIN_BYTE_GAIN)
return buf->buf;
}
/* Resize the buffer. */
- if ((cp = realloc(buf->buf, size))) {
+ if((cp = realloc(buf->buf, size))) {
buf->buf = cp;
buf->size = size;
}
- else if (size <= buf->size)
+ else if(size <= buf->size)
cp = buf->buf;
return cp;
@@ -195,16 +195,16 @@ buffer_threaded(localkey_t key, long size)
bufs = (buffer_t *) pthread_getspecific(thdkey);
- if (!bufs) {
- if (size < 0)
+ if(!bufs) {
+ if(size < 0)
return (char *) NULL; /* No buffer yet. */
/* Allocate buffer descriptors for the current thread. */
- if (!(bufs = calloc((size_t) LK_LAST, sizeof *bufs)))
+ if(!(bufs = calloc((size_t) LK_LAST, sizeof *bufs)))
return (char *) NULL;
- if (pthread_setspecific(thdkey, (void *) bufs)) {
+ if(pthread_setspecific(thdkey, (void *) bufs)) {
free(bufs);
return (char *) NULL;
}
@@ -226,11 +226,10 @@ buffer_undef(localkey_t key, long size)
/* Determine if we can use pthread-specific data. */
- if (Curl_thread_buffer == buffer_undef) { /* If unchanged during lock. */
- if (!pthread_key_create(&thdkey, thdbufdestroy))
+ if(Curl_thread_buffer == buffer_undef) { /* If unchanged during lock. */
+ if(!pthread_key_create(&thdkey, thdbufdestroy))
Curl_thread_buffer = buffer_threaded;
- else if (!(locbufs = calloc((size_t) LK_LAST,
- sizeof *locbufs))) {
+ else if(!(locbufs = calloc((size_t) LK_LAST, sizeof *locbufs))) {
pthread_mutex_unlock(&mutex);
return (char *) NULL;
}
@@ -282,13 +281,13 @@ Curl_getnameinfo_a(const struct sockaddr * sa, curl_socklen_t salen,
enodename = (char *) NULL;
eservname = (char *) NULL;
- if (nodename && nodenamelen)
- if (!(enodename = malloc(nodenamelen)))
+ if(nodename && nodenamelen)
+ if(!(enodename = malloc(nodenamelen)))
return EAI_MEMORY;
- if (servname && servnamelen)
- if (!(eservname = malloc(servnamelen))) {
- if (enodename)
+ if(servname && servnamelen)
+ if(!(eservname = malloc(servnamelen))) {
+ if(enodename)
free(enodename);
return EAI_MEMORY;
@@ -297,24 +296,24 @@ Curl_getnameinfo_a(const struct sockaddr * sa, curl_socklen_t salen,
status = getnameinfo(sa, salen, enodename, nodenamelen,
eservname, servnamelen, flags);
- if (!status) {
- if (enodename) {
+ if(!status) {
+ if(enodename) {
i = QadrtConvertE2A(nodename, enodename,
nodenamelen - 1, strlen(enodename));
nodename[i] = '\0';
}
- if (eservname) {
+ if(eservname) {
i = QadrtConvertE2A(servname, eservname,
servnamelen - 1, strlen(eservname));
servname[i] = '\0';
}
}
- if (enodename)
+ if(enodename)
free(enodename);
- if (eservname)
+ if(eservname)
free(eservname);
return status;
@@ -335,21 +334,21 @@ Curl_getaddrinfo_a(const char * nodename, const char * servname,
enodename = (char *) NULL;
eservname = (char *) NULL;
- if (nodename) {
+ if(nodename) {
i = strlen(nodename);
- if (!(enodename = malloc(i + 1)))
+ if(!(enodename = malloc(i + 1)))
return EAI_MEMORY;
i = QadrtConvertA2E(enodename, nodename, i, i);
enodename[i] = '\0';
}
- if (servname) {
+ if(servname) {
i = strlen(servname);
- if (!(eservname = malloc(i + 1))) {
- if (enodename)
+ if(!(eservname = malloc(i + 1))) {
+ if(enodename)
free(enodename);
return EAI_MEMORY;
@@ -361,10 +360,10 @@ Curl_getaddrinfo_a(const char * nodename, const char * servname,
status = getaddrinfo(enodename, eservname, hints, res);
- if (enodename)
+ if(enodename)
free(enodename);
- if (eservname)
+ if(eservname)
free(eservname);
return status;
@@ -383,13 +382,13 @@ Curl_SSL_Init_Application_a(SSLInitApp * init_app)
unsigned int i;
SSLInitApp ia;
- if (!init_app || !init_app->applicationID || !init_app->applicationIDLen)
+ if(!init_app || !init_app->applicationID || !init_app->applicationIDLen)
return SSL_Init_Application(init_app);
memcpy((char *) &ia, (char *) init_app, sizeof ia);
i = ia.applicationIDLen;
- if (!(ia.applicationID = malloc(i + 1))) {
+ if(!(ia.applicationID = malloc(i + 1))) {
errno = ENOMEM;
return SSL_ERROR_IO;
}
@@ -412,15 +411,15 @@ Curl_SSL_Init_a(SSLInit * init)
unsigned int i;
SSLInit ia;
- if (!init || (!init->keyringFileName && !init->keyringPassword))
+ if(!init || (!init->keyringFileName && !init->keyringPassword))
return SSL_Init(init);
memcpy((char *) &ia, (char *) init, sizeof ia);
- if (ia.keyringFileName) {
+ if(ia.keyringFileName) {
i = strlen(ia.keyringFileName);
- if (!(ia.keyringFileName = malloc(i + 1))) {
+ if(!(ia.keyringFileName = malloc(i + 1))) {
errno = ENOMEM;
return SSL_ERROR_IO;
}
@@ -429,11 +428,11 @@ Curl_SSL_Init_a(SSLInit * init)
ia.keyringFileName[i] = '\0';
}
- if (ia.keyringPassword) {
+ if(ia.keyringPassword) {
i = strlen(ia.keyringPassword);
- if (!(ia.keyringPassword = malloc(i + 1))) {
- if (ia.keyringFileName)
+ if(!(ia.keyringPassword = malloc(i + 1))) {
+ if(ia.keyringFileName)
free(ia.keyringFileName);
errno = ENOMEM;
@@ -446,10 +445,10 @@ Curl_SSL_Init_a(SSLInit * init)
rc = SSL_Init(&ia);
- if (ia.keyringFileName)
+ if(ia.keyringFileName)
free(ia.keyringFileName);
- if (ia.keyringPassword)
+ if(ia.keyringPassword)
free(ia.keyringPassword);
return rc;
@@ -545,7 +544,7 @@ gsk_free_handle(struct Curl_gsk_descriptor * p)
{
struct gskstrlist * q;
- while ((q = p->strlist)) {
+ while((q = p->strlist)) {
p->strlist = q;
free((void *) q->asciistr);
free(q);
@@ -566,7 +565,7 @@ Curl_gsk_environment_close(gsk_handle * my_env_handle)
if(!*my_env_handle)
return GSK_INVALID_HANDLE;
p = (struct Curl_gsk_descriptor *) *my_env_handle;
- if ((rc = gsk_environment_close(&p->h)) == GSK_OK) {
+ if((rc = gsk_environment_close(&p->h)) == GSK_OK) {
gsk_free_handle(p);
*my_env_handle = (gsk_handle) NULL;
}
@@ -586,7 +585,7 @@ Curl_gsk_secure_soc_close(gsk_handle * my_session_handle)
if(!*my_session_handle)
return GSK_INVALID_HANDLE;
p = (struct Curl_gsk_descriptor *) *my_session_handle;
- if ((rc = gsk_secure_soc_close(&p->h)) == GSK_OK) {
+ if((rc = gsk_secure_soc_close(&p->h)) == GSK_OK) {
gsk_free_handle(p);
*my_session_handle = (gsk_handle) NULL;
}
@@ -638,7 +637,7 @@ Curl_gsk_attribute_set_buffer_a(gsk_handle my_gsk_handle, GSK_BUF_ID bufID,
p = (struct Curl_gsk_descriptor *) my_gsk_handle;
if(!bufSize)
bufSize = strlen(buffer);
- if (!(ebcdicbuf = malloc(bufSize + 1)))
+ if(!(ebcdicbuf = malloc(bufSize + 1)))
return GSK_INSUFFICIENT_STORAGE;
QadrtConvertA2E(ebcdicbuf, buffer, bufSize, bufSize);
ebcdicbuf[bufSize] = '\0';
@@ -700,7 +699,7 @@ cachestring(struct Curl_gsk_descriptor * p,
char * asciibuf;
struct gskstrlist * sp;
- for (sp = p->strlist; sp; sp = sp->next)
+ for(sp = p->strlist; sp; sp = sp->next)
if(sp->ebcdicstr == ebcdicbuf)
break;
if(!sp) {
@@ -737,7 +736,7 @@ Curl_gsk_attribute_get_buffer_a(gsk_handle my_gsk_handle, GSK_BUF_ID bufID,
if(!buffer || !bufSize)
return GSK_OS400_ERROR_INVALID_POINTER;
p = (struct Curl_gsk_descriptor *) my_gsk_handle;
- if ((rc = gsk_attribute_get_buffer(p->h, bufID, &mybuf, &mylen)) != GSK_OK)
+ if((rc = gsk_attribute_get_buffer(p->h, bufID, &mybuf, &mylen)) != GSK_OK)
return rc;
if((rc = cachestring(p, mybuf, mylen, buffer)) == GSK_OK)
*bufSize = mylen;
@@ -873,11 +872,11 @@ Curl_gss_convert_in_place(OM_uint32 * minor_status, gss_buffer_t buf)
i = buf->length;
- if (i) {
- if (!(t = malloc(i))) {
+ if(i) {
+ if(!(t = malloc(i))) {
gss_release_buffer(minor_status, buf);
- if (minor_status)
+ if(minor_status)
*minor_status = ENOMEM;
return -1;
@@ -901,14 +900,14 @@ Curl_gss_import_name_a(OM_uint32 * minor_status, gss_buffer_t in_name,
unsigned int i;
gss_buffer_desc in;
- if (!in_name || !in_name->value || !in_name->length)
+ if(!in_name || !in_name->value || !in_name->length)
return gss_import_name(minor_status, in_name, in_name_type, out_name);
memcpy((char *) &in, (char *) in_name, sizeof in);
i = in.length;
- if (!(in.value = malloc(i + 1))) {
- if (minor_status)
+ if(!(in.value = malloc(i + 1))) {
+ if(minor_status)
*minor_status = ENOMEM;
return GSS_S_FAILURE;
@@ -933,15 +932,15 @@ Curl_gss_display_status_a(OM_uint32 * minor_status, OM_uint32 status_value,
rc = gss_display_status(minor_status, status_value, status_type,
mech_type, message_context, status_string);
- if (rc != GSS_S_COMPLETE || !status_string ||
- !status_string->length || !status_string->value)
+ if(rc != GSS_S_COMPLETE || !status_string ||
+ !status_string->length || !status_string->value)
return rc;
/* No way to allocate a buffer here, because it will be released by
gss_release_buffer(). The solution is to overwrite the EBCDIC buffer
with ASCII to return it. */
- if (Curl_gss_convert_in_place(minor_status, status_string))
+ if(Curl_gss_convert_in_place(minor_status, status_string))
return GSS_S_FAILURE;
return rc;
@@ -949,7 +948,8 @@ Curl_gss_display_status_a(OM_uint32 * minor_status, OM_uint32 status_value,
OM_uint32
-Curl_gss_init_sec_context_a(OM_uint32 * minor_status, gss_cred_id_t cred_handle,
+Curl_gss_init_sec_context_a(OM_uint32 * minor_status,
+ gss_cred_id_t cred_handle,
gss_ctx_id_t * context_handle,
gss_name_t target_name, gss_OID mech_type,
gss_flags_t req_flags, OM_uint32 time_req,
@@ -967,12 +967,12 @@ Curl_gss_init_sec_context_a(OM_uint32 * minor_status, gss_cred_id_t cred_handle,
in.value = NULL;
- if ((inp = input_token))
- if (inp->length && inp->value) {
+ if((inp = input_token))
+ if(inp->length && inp->value) {
i = inp->length;
- if (!(in.value = malloc(i + 1))) {
- if (minor_status)
+ if(!(in.value = malloc(i + 1))) {
+ if(minor_status)
*minor_status = ENOMEM;
return GSS_S_FAILURE;
@@ -989,10 +989,10 @@ Curl_gss_init_sec_context_a(OM_uint32 * minor_status, gss_cred_id_t cred_handle,
input_chan_bindings, inp, actual_mech_type,
output_token, ret_flags, time_rec);
- if (in.value)
+ if(in.value)
free(in.value);
- if (rc != GSS_S_COMPLETE || !output_token ||
+ if(rc != GSS_S_COMPLETE || !output_token ||
!output_token->length || !output_token->value)
return rc;
@@ -1000,7 +1000,7 @@ Curl_gss_init_sec_context_a(OM_uint32 * minor_status, gss_cred_id_t cred_handle,
gss_release_buffer(). The solution is to overwrite the EBCDIC buffer
with ASCII to return it. */
- if (Curl_gss_convert_in_place(minor_status, output_token))
+ if(Curl_gss_convert_in_place(minor_status, output_token))
return GSS_S_FAILURE;
return rc;
@@ -1017,7 +1017,7 @@ Curl_gss_delete_sec_context_a(OM_uint32 * minor_status,
rc = gss_delete_sec_context(minor_status, context_handle, output_token);
- if (rc != GSS_S_COMPLETE || !output_token ||
+ if(rc != GSS_S_COMPLETE || !output_token ||
!output_token->length || !output_token->value)
return rc;
@@ -1025,7 +1025,7 @@ Curl_gss_delete_sec_context_a(OM_uint32 * minor_status,
gss_release_buffer(). The solution is to overwrite the EBCDIC buffer
with ASCII to return it. */
- if (Curl_gss_convert_in_place(minor_status, output_token))
+ if(Curl_gss_convert_in_place(minor_status, output_token))
return GSS_S_FAILURE;
return rc;
@@ -1046,12 +1046,12 @@ Curl_ldap_init_a(char * host, int port)
char * ehost;
void * result;
- if (!host)
+ if(!host)
return (void *) ldap_init(host, port);
i = strlen(host);
- if (!(ehost = malloc(i + 1)))
+ if(!(ehost = malloc(i + 1)))
return (void *) NULL;
QadrtConvertA2E(ehost, host, i, i);
@@ -1073,21 +1073,21 @@ Curl_ldap_simple_bind_s_a(void * ld, char * dn, char * passwd)
edn = (char *) NULL;
epasswd = (char *) NULL;
- if (dn) {
+ if(dn) {
i = strlen(dn);
- if (!(edn = malloc(i + 1)))
+ if(!(edn = malloc(i + 1)))
return LDAP_NO_MEMORY;
QadrtConvertA2E(edn, dn, i, i);
edn[i] = '\0';
}
- if (passwd) {
+ if(passwd) {
i = strlen(passwd);
- if (!(epasswd = malloc(i + 1))) {
- if (edn)
+ if(!(epasswd = malloc(i + 1))) {
+ if(edn)
free(edn);
return LDAP_NO_MEMORY;
@@ -1099,10 +1099,10 @@ Curl_ldap_simple_bind_s_a(void * ld, char * dn, char * passwd)
i = ldap_simple_bind_s(ld, edn, epasswd);
- if (epasswd)
+ if(epasswd)
free(epasswd);
- if (edn)
+ if(edn)
free(edn);
return i;
@@ -1126,10 +1126,10 @@ Curl_ldap_search_s_a(void * ld, char * base, int scope, char * filter,
eattrs = (char * *) NULL;
status = LDAP_SUCCESS;
- if (base) {
+ if(base) {
i = strlen(base);
- if (!(ebase = malloc(i + 1)))
+ if(!(ebase = malloc(i + 1)))
status = LDAP_NO_MEMORY;
else {
QadrtConvertA2E(ebase, base, i, i);
@@ -1137,10 +1137,10 @@ Curl_ldap_search_s_a(void * ld, char * base, int scope, char * filter,
}
}
- if (filter && status == LDAP_SUCCESS) {
+ if(filter && status == LDAP_SUCCESS) {
i = strlen(filter);
- if (!(efilter = malloc(i + 1)))
+ if(!(efilter = malloc(i + 1)))
status = LDAP_NO_MEMORY;
else {
QadrtConvertA2E(efilter, filter, i, i);
@@ -1148,17 +1148,17 @@ Curl_ldap_search_s_a(void * ld, char * base, int scope, char * filter,
}
}
- if (attrs && status == LDAP_SUCCESS) {
- for (i = 0; attrs[i++];)
+ if(attrs && status == LDAP_SUCCESS) {
+ for(i = 0; attrs[i++];)
;
- if (!(eattrs = calloc(i, sizeof *eattrs)))
+ if(!(eattrs = calloc(i, sizeof *eattrs)))
status = LDAP_NO_MEMORY;
else {
- for (j = 0; attrs[j]; j++) {
+ for(j = 0; attrs[j]; j++) {
i = strlen(attrs[j]);
- if (!(eattrs[j] = malloc(i + 1))) {
+ if(!(eattrs[j] = malloc(i + 1))) {
status = LDAP_NO_MEMORY;
break;
}
@@ -1169,22 +1169,22 @@ Curl_ldap_search_s_a(void * ld, char * base, int scope, char * filter,
}
}
- if (status == LDAP_SUCCESS)
+ if(status == LDAP_SUCCESS)
status = ldap_search_s(ld, ebase? ebase: "", scope,
efilter? efilter: "(objectclass=*)",
eattrs, attrsonly, res);
- if (eattrs) {
- for (j = 0; eattrs[j]; j++)
+ if(eattrs) {
+ for(j = 0; eattrs[j]; j++)
free(eattrs[j]);
free(eattrs);
}
- if (efilter)
+ if(efilter)
free(efilter);
- if (ebase)
+ if(ebase)
free(ebase);
return status;
@@ -1201,10 +1201,10 @@ Curl_ldap_get_values_len_a(void * ld, LDAPMessage * entry, const char * attr)
cp = (char *) NULL;
- if (attr) {
+ if(attr) {
i = strlen(attr);
- if (!(cp = malloc(i + 1))) {
+ if(!(cp = malloc(i + 1))) {
ldap_set_lderrno(ld, LDAP_NO_MEMORY, NULL,
ldap_err2string(LDAP_NO_MEMORY));
return (struct berval * *) NULL;
@@ -1216,11 +1216,11 @@ Curl_ldap_get_values_len_a(void * ld, LDAPMessage * entry, const char * attr)
result = ldap_get_values_len(ld, entry, cp);
- if (cp)
+ if(cp)
free(cp);
- /* Result data are binary in nature, so they haven't been converted to EBCDIC.
- Therefore do not convert. */
+ /* Result data are binary in nature, so they haven't been
+ converted to EBCDIC. Therefore do not convert. */
return result;
}
@@ -1244,12 +1244,12 @@ Curl_ldap_get_dn_a(void * ld, LDAPMessage * entry)
cp = ldap_get_dn(ld, entry);
- if (!cp)
+ if(!cp)
return cp;
i = strlen(cp);
- if (!(cp2 = malloc(i + 1)))
+ if(!(cp2 = malloc(i + 1)))
return cp2;
QadrtConvertE2A(cp2, cp, i, i);
@@ -1276,12 +1276,12 @@ Curl_ldap_first_attribute_a(void * ld,
cp = ldap_first_attribute(ld, entry, berptr);
- if (!cp)
+ if(!cp)
return cp;
i = strlen(cp);
- if (!(cp2 = malloc(i + 1)))
+ if(!(cp2 = malloc(i + 1)))
return cp2;
QadrtConvertE2A(cp2, cp, i, i);
@@ -1308,12 +1308,12 @@ Curl_ldap_next_attribute_a(void * ld,
cp = ldap_next_attribute(ld, entry, berptr);
- if (!cp)
+ if(!cp)
return cp;
i = strlen(cp);
- if (!(cp2 = malloc(i + 1)))
+ if(!(cp2 = malloc(i + 1)))
return cp2;
QadrtConvertE2A(cp2, cp, i, i);
@@ -1343,8 +1343,8 @@ convert_sockaddr(struct sockaddr_storage * dstaddr,
/* Convert a socket address into job CCSID, if needed. */
- if (!srcaddr || srclen < offsetof(struct sockaddr, sa_family) +
- sizeof srcaddr->sa_family || srclen > sizeof *dstaddr) {
+ if(!srcaddr || srclen < offsetof(struct sockaddr, sa_family) +
+ sizeof srcaddr->sa_family || srclen > sizeof *dstaddr) {
errno = EINVAL;
return -1;
}
@@ -1377,7 +1377,7 @@ Curl_os400_connect(int sd, struct sockaddr * destaddr, int addrlen)
i = convert_sockaddr(&laddr, destaddr, addrlen);
- if (i < 0)
+ if(i < 0)
return -1;
return connect(sd, (struct sockaddr *) &laddr, i);
@@ -1393,7 +1393,7 @@ Curl_os400_bind(int sd, struct sockaddr * localaddr, int addrlen)
i = convert_sockaddr(&laddr, localaddr, addrlen);
- if (i < 0)
+ if(i < 0)
return -1;
return bind(sd, (struct sockaddr *) &laddr, i);
@@ -1410,7 +1410,7 @@ Curl_os400_sendto(int sd, char * buffer, int buflen, int flags,
i = convert_sockaddr(&laddr, dstaddr, addrlen);
- if (i < 0)
+ if(i < 0)
return -1;
return sendto(sd, buffer, buflen, flags, (struct sockaddr *) &laddr, i);
@@ -1429,7 +1429,7 @@ Curl_os400_recvfrom(int sd, char * buffer, int buflen, int flags,
struct sockaddr_un * dstu;
struct sockaddr_storage laddr;
- if (!fromaddr || !addrlen || *addrlen <= 0)
+ if(!fromaddr || !addrlen || *addrlen <= 0)
return recvfrom(sd, buffer, buflen, flags, fromaddr, addrlen);
laddrlen = sizeof laddr;
@@ -1437,7 +1437,7 @@ Curl_os400_recvfrom(int sd, char * buffer, int buflen, int flags,
rcvlen = recvfrom(sd, buffer, buflen, flags,
(struct sockaddr *) &laddr, &laddrlen);
- if (rcvlen < 0)
+ if(rcvlen < 0)
return rcvlen;
switch (laddr.ss_family) {
@@ -1450,7 +1450,7 @@ Curl_os400_recvfrom(int sd, char * buffer, int buflen, int flags,
i = QadrtConvertE2A(dstu->sun_path, srcu->sun_path, i, laddrlen);
laddrlen = i + offsetof(struct sockaddr_un, sun_path);
- if (laddrlen < *addrlen)
+ if(laddrlen < *addrlen)
dstu->sun_path[i] = '\0';
break;
@@ -1459,10 +1459,10 @@ Curl_os400_recvfrom(int sd, char * buffer, int buflen, int flags,
break;
default:
- if (laddrlen > *addrlen)
+ if(laddrlen > *addrlen)
laddrlen = *addrlen;
- if (laddrlen)
+ if(laddrlen)
memcpy((char *) fromaddr, (char *) &laddr, laddrlen);
break;