summaryrefslogtreecommitdiff
path: root/libs/string.c
diff options
context:
space:
mode:
Diffstat (limited to 'libs/string.c')
-rw-r--r--libs/string.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/libs/string.c b/libs/string.c
index 9917e4f..8c2eab2 100644
--- a/libs/string.c
+++ b/libs/string.c
@@ -1,28 +1,30 @@
+#include "string.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include "string.h"
-String newString(char *string)
+String
+newString (char *string)
{
String s;
- if (string != NULL && strlen(string) > 0)
+ if (string != NULL && strlen (string) > 0)
{
- s.length = strlen(string);
- s.string = (char *)calloc(s.length + 1, sizeof(char));
- strcpy(s.string, string);
+ s.length = strlen (string);
+ s.string = (char *)calloc (s.length + 1, sizeof (char));
+ strcpy (s.string, string);
}
else
{
s.length = 0;
- s.string = (char *)calloc(1, sizeof(char));
+ s.string = (char *)calloc (1, sizeof (char));
}
return s;
}
-void freeString(String *s)
+void
+freeString (String *s)
{
s->length = 0;
- free(s->string);
+ free (s->string);
}