Skip to content

Commit

Permalink
Re-indentation of source code, next batch.
Browse files Browse the repository at this point in the history
This also strips trailing whitespaces from lines where they existed.
This re-indentation was done using astyle-1.24 using the following options:

astyle --indent=spaces=4 --brackets=break --pad-oper --pad-header --suffix=none

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@18787 57a11ea4-9604-0410-9ed3-97b8803252fd
  • Loading branch information
cstim committed Mar 2, 2010
1 parent b325f24 commit ce99c42
Show file tree
Hide file tree
Showing 20 changed files with 1,255 additions and 1,238 deletions.
15 changes: 9 additions & 6 deletions lib/libc/gmtime_r.c
Expand Up @@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Expand All @@ -36,14 +36,16 @@ gmtime_r(const time_t *const timep, struct tm *p_tm)
static int time_mutex_inited = 0;
struct tm *tmp;

if (!time_mutex_inited) {
if (!time_mutex_inited)
{
time_mutex_inited = 1;
pthread_mutex_init(&time_mutex, NULL);
}

pthread_mutex_lock(&time_mutex);
tmp = gmtime(timep);
if (tmp) {
if (tmp)
{
memcpy(p_tm, tmp, sizeof(struct tm));
tmp = p_tm;
}
Expand All @@ -57,10 +59,11 @@ gmtime_r(const time_t *const timep, struct tm *p_tm)
{
static struct tm* tmp;
tmp = gmtime(timep);
if (tmp) {
if (tmp)
{
memcpy(p_tm, tmp, sizeof(struct tm));
tmp = p_tm;
}
}
return tmp;
}
#endif /* HAVE_PTHREAD_MUTEX_INIT */
Expand Down
4 changes: 2 additions & 2 deletions lib/libc/gmtime_r.h
Expand Up @@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Expand Down
2 changes: 1 addition & 1 deletion lib/libc/libc-missing-noop.c
Expand Up @@ -2,5 +2,5 @@ void gnc_libc_missing_noop (void);

void gnc_libc_missing_noop (void)
{
return;
return;
}
41 changes: 22 additions & 19 deletions lib/libc/localtime_r.c
Expand Up @@ -11,35 +11,38 @@
struct tm *
localtime_r(const time_t *const timep, struct tm *p_tm)
{
static pthread_mutex_t time_mutex;
static int time_mutex_inited = 0;
struct tm *tmp;
static pthread_mutex_t time_mutex;
static int time_mutex_inited = 0;
struct tm *tmp;

if (!time_mutex_inited) {
time_mutex_inited = 1;
pthread_mutex_init(&time_mutex, NULL);
}
if (!time_mutex_inited)
{
time_mutex_inited = 1;
pthread_mutex_init(&time_mutex, NULL);
}

pthread_mutex_lock(&time_mutex);
tmp = localtime(timep);
if (tmp) {
memcpy(p_tm, tmp, sizeof(struct tm));
tmp = p_tm;
}
pthread_mutex_unlock(&time_mutex);
pthread_mutex_lock(&time_mutex);
tmp = localtime(timep);
if (tmp)
{
memcpy(p_tm, tmp, sizeof(struct tm));
tmp = p_tm;
}
pthread_mutex_unlock(&time_mutex);

return tmp;
return tmp;
}
#else
struct tm *
localtime_r(const time_t *const timep, struct tm *p_tm)
{
static struct tm* tmp;
tmp = localtime(timep);
if (tmp) {
memcpy(p_tm, tmp, sizeof(struct tm));
tmp = p_tm;
}
if (tmp)
{
memcpy(p_tm, tmp, sizeof(struct tm));
tmp = p_tm;
}
return tmp;
}
#endif /* HAVE_PTHREAD_MUTEX_INIT */
Expand Down
100 changes: 50 additions & 50 deletions lib/libc/scm_strptime.c
@@ -1,15 +1,15 @@
/* Copyright (C) 1995,1996,1997,1998, 1999, 2000 Free Software Foundation, Inc.
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Expand Down Expand Up @@ -110,67 +110,67 @@ filltime (struct tm *bd_time, int zoff, char *zname);
static SCM
filltime (struct tm *bd_time, int zoff, char *zname)
{
SCM result = scm_make_vector (SCM_MAKINUM(11), SCM_UNDEFINED);

SCM_VELTS (result)[0] = SCM_MAKINUM (bd_time->tm_sec);
SCM_VELTS (result)[1] = SCM_MAKINUM (bd_time->tm_min);
SCM_VELTS (result)[2] = SCM_MAKINUM (bd_time->tm_hour);
SCM_VELTS (result)[3] = SCM_MAKINUM (bd_time->tm_mday);
SCM_VELTS (result)[4] = SCM_MAKINUM (bd_time->tm_mon);
SCM_VELTS (result)[5] = SCM_MAKINUM (bd_time->tm_year);
SCM_VELTS (result)[6] = SCM_MAKINUM (bd_time->tm_wday);
SCM_VELTS (result)[7] = SCM_MAKINUM (bd_time->tm_yday);
SCM_VELTS (result)[8] = SCM_MAKINUM (bd_time->tm_isdst);
SCM_VELTS (result)[9] = SCM_MAKINUM (zoff);
SCM_VELTS (result)[10] = zname ? scm_makfrom0str (zname) : SCM_BOOL_F;
return result;
SCM result = scm_make_vector (SCM_MAKINUM(11), SCM_UNDEFINED);

SCM_VELTS (result)[0] = SCM_MAKINUM (bd_time->tm_sec);
SCM_VELTS (result)[1] = SCM_MAKINUM (bd_time->tm_min);
SCM_VELTS (result)[2] = SCM_MAKINUM (bd_time->tm_hour);
SCM_VELTS (result)[3] = SCM_MAKINUM (bd_time->tm_mday);
SCM_VELTS (result)[4] = SCM_MAKINUM (bd_time->tm_mon);
SCM_VELTS (result)[5] = SCM_MAKINUM (bd_time->tm_year);
SCM_VELTS (result)[6] = SCM_MAKINUM (bd_time->tm_wday);
SCM_VELTS (result)[7] = SCM_MAKINUM (bd_time->tm_yday);
SCM_VELTS (result)[8] = SCM_MAKINUM (bd_time->tm_isdst);
SCM_VELTS (result)[9] = SCM_MAKINUM (zoff);
SCM_VELTS (result)[10] = zname ? scm_makfrom0str (zname) : SCM_BOOL_F;
return result;
}

#ifndef HAVE_STRPTIME
SCM_DEFINE (scm_strptime, "strptime", 2, 0, 0,
(SCM format, SCM string),
"Performs the reverse action to @code{strftime}, parsing @var{string}\n"
"according to the specification supplied in @var{template}. The\n"
"interpretation of month and day names is dependent on the current\n"
"locale. The\n"
"value returned is a pair. The CAR has an object with time components \n"
"in the form returned by @code{localtime} or @code{gmtime},\n"
"but the time zone components\n"
"are not usefully set.\n"
"The CDR reports the number of characters from @var{string} which\n"
"vwere used for the conversion.")
"Performs the reverse action to @code{strftime}, parsing @var{string}\n"
"according to the specification supplied in @var{template}. The\n"
"interpretation of month and day names is dependent on the current\n"
"locale. The\n"
"value returned is a pair. The CAR has an object with time components \n"
"in the form returned by @code{localtime} or @code{gmtime},\n"
"but the time zone components\n"
"are not usefully set.\n"
"The CDR reports the number of characters from @var{string} which\n"
"vwere used for the conversion.")
#define FUNC_NAME s_scm_strptime
{
struct tm t;
char *fmt, *str, *rest;
struct tm t;
char *fmt, *str, *rest;

SCM_VALIDATE_ROSTRING (1,format);
SCM_VALIDATE_ROSTRING (2,string);
SCM_VALIDATE_ROSTRING (1, format);
SCM_VALIDATE_ROSTRING (2, string);

SCM_COERCE_SUBSTR (format);
SCM_COERCE_SUBSTR (string);
fmt = SCM_ROCHARS (format);
str = SCM_ROCHARS (string);
SCM_COERCE_SUBSTR (format);
SCM_COERCE_SUBSTR (string);
fmt = SCM_ROCHARS (format);
str = SCM_ROCHARS (string);

/* initialize the struct tm */
/* initialize the struct tm */
#define tm_init(field) t.field = 0
tm_init (tm_sec);
tm_init (tm_min);
tm_init (tm_hour);
tm_init (tm_mday);
tm_init (tm_mon);
tm_init (tm_year);
tm_init (tm_wday);
tm_init (tm_yday);
tm_init (tm_sec);
tm_init (tm_min);
tm_init (tm_hour);
tm_init (tm_mday);
tm_init (tm_mon);
tm_init (tm_year);
tm_init (tm_wday);
tm_init (tm_yday);
#undef tm_init

t.tm_isdst = -1;
SCM_DEFER_INTS;
if ((rest = strptime (str, fmt, &t)) == NULL)
SCM_SYSERROR;
t.tm_isdst = -1;
SCM_DEFER_INTS;
if ((rest = strptime (str, fmt, &t)) == NULL)
SCM_SYSERROR;

SCM_ALLOW_INTS;
return scm_cons (filltime (&t, 0, NULL), SCM_MAKINUM (rest - str));
SCM_ALLOW_INTS;
return scm_cons (filltime (&t, 0, NULL), SCM_MAKINUM (rest - str));
}
#undef FUNC_NAME
#endif /* HAVE_STRPTIME */
Expand Down
64 changes: 32 additions & 32 deletions lib/libc/setenv.c
Expand Up @@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Expand Down Expand Up @@ -47,46 +47,46 @@
int
setenv(const char *name, const char *value, int overwrite)
{
const char *old_value = getenv(name);
int result = 0;
const char *old_value = getenv(name);
int result = 0;

if ((name == NULL) || (value == NULL)) return -1;
if ((name == NULL) || (value == NULL)) return -1;

if(overwrite || (!old_value))
{
char *new_value = g_strdup_printf("%s=%s", name, value);
if(putenv(new_value) != 0) result = -1;
if(old_value)
if (overwrite || (!old_value))
{
/* for now, do nothing, but it would be nice if we could figure
out a safe way to reclaim any memory that *we* allocated,
taking in to account whether or not other code (in other
system libs) is allowed to have cached a pointer into the
value via getenv -- is that kosher?
Also we have to *know* that we allocated the memory.
*/
char *new_value = g_strdup_printf("%s=%s", name, value);
if (putenv(new_value) != 0) result = -1;
if (old_value)
{
/* for now, do nothing, but it would be nice if we could figure
out a safe way to reclaim any memory that *we* allocated,
taking in to account whether or not other code (in other
system libs) is allowed to have cached a pointer into the
value via getenv -- is that kosher?
Also we have to *know* that we allocated the memory.
*/
}
}
}
return result;
return result;
}

int
unsetenv(const char *name)
{
int result = 0;
char *putenv_str;
if(name == NULL) return -1;
if(strchr(name, '=') != NULL) return -1;
if(*name == '\0') return -1;
putenv_str = g_strdup_printf("%s=", name);
if(!putenv_str) return -1;
int result = 0;
char *putenv_str;

if (name == NULL) return -1;
if (strchr(name, '=') != NULL) return -1;
if (*name == '\0') return -1;

putenv_str = g_strdup_printf("%s=", name);
if (!putenv_str) return -1;

result = putenv(putenv_str);
g_free(putenv_str);
return result;
result = putenv(putenv_str);
g_free(putenv_str);
return result;
}

#endif
4 changes: 2 additions & 2 deletions lib/libc/setenv.h
Expand Up @@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Expand Down

0 comments on commit ce99c42

Please sign in to comment.