aboutsummaryrefslogtreecommitdiff
path: root/src/backend/port/nextstep/port.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/port/nextstep/port.c')
-rw-r--r--src/backend/port/nextstep/port.c75
1 files changed, 41 insertions, 34 deletions
diff --git a/src/backend/port/nextstep/port.c b/src/backend/port/nextstep/port.c
index 3da87b32eb8..baf026d5d1d 100644
--- a/src/backend/port/nextstep/port.c
+++ b/src/backend/port/nextstep/port.c
@@ -1,58 +1,65 @@
#ifndef _POSIX_SOURCE
-# include <libc.h>
+#include <libc.h>
#else
-# include <unistd.h>
-# include <stdlib.h>
+#include <unistd.h>
+#include <stdlib.h>
#endif
#include <string.h>
#include <sys/signal.h>
-void putenv(char* name)
+void
+putenv(char *name)
{
- extern char** environ;
- static int was_mallocated = 0;
- int size;
-
- /* Compute the size of environ array including the final NULL */
- for (size = 1; environ[size++];)
- /* nothing */;
-
- if (!was_mallocated) {
- char** tmp = environ;
- int i;
-
- was_mallocated = 1;
- environ = malloc (size * sizeof(char*));
- for (i = 0; i < size; i++)
- environ[i] = tmp[i];
- }
-
- environ = realloc (environ, (size + 1) * sizeof (char*));
- environ[size - 1] = strcpy (malloc (strlen (name) + 1), name);
- environ[size] = NULL;
+ extern char **environ;
+ static int was_mallocated = 0;
+ int size;
+
+ /* Compute the size of environ array including the final NULL */
+ for (size = 1; environ[size++];)
+ /* nothing */ ;
+
+ if (!was_mallocated)
+ {
+ char **tmp = environ;
+ int i;
+
+ was_mallocated = 1;
+ environ = malloc(size * sizeof(char *));
+ for (i = 0; i < size; i++)
+ environ[i] = tmp[i];
+ }
+
+ environ = realloc(environ, (size + 1) * sizeof(char *));
+ environ[size - 1] = strcpy(malloc(strlen(name) + 1), name);
+ environ[size] = NULL;
}
-char* strdup (const char* string)
+char *
+strdup(const char *string)
{
- return strcpy (malloc (strlen (string) + 1), string);
+ return strcpy(malloc(strlen(string) + 1), string);
}
#ifndef _POSIX_SOURCE
-int sigaddset(int *set, int signo)
+int
+sigaddset(int *set, int signo)
{
- *set |= sigmask(signo);
- return *set;
+ *set |= sigmask(signo);
+ return *set;
}
-int sigemptyset(int *set)
+int
+sigemptyset(int *set)
{
- return (*set = 0);
+ return (*set = 0);
}
-char *getcwd(char *buf, size_t size)
+char *
+getcwd(char *buf, size_t size)
{
- return getwd (buf);
+ return getwd(buf);
}
+
#endif