diff options
-rw-r--r-- | lcd.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -29,14 +29,14 @@ static void break_up_string (char *in_string, int N, char *str1, char *str2, cha char *copy_input;
char *p;
- j=k=copypos=0;
+ j=k=copypos=0;
input_length=strlen(in_string);
copy_input = g_strdup(in_string);
for (j=0; j<SUBSTRING_CNT; j++) {
- char * interm_str= (char *)malloc((N+1)*sizeof(char));
- memset(interm_str,0, (N+1)*sizeof(char));
+ gchar *interm_str = g_strnfill (N, 0);
+
for (k=0; k<N; k++) {
copypos++; // next symbol
if (copypos>input_length) {
@@ -84,7 +84,7 @@ static void break_up_string (char *in_string, int N, char *str1, char *str2, cha strcpy(str3,interm_str);
break;
}
- free(interm_str);
+ g_free(interm_str);
}
|