fix some compiler warnings on linux

This commit is contained in:
Sami Samhuri 2011-04-17 22:16:57 -07:00
parent f001af16ee
commit ebf84f5761
3 changed files with 16 additions and 14 deletions

1
env.c
View file

@ -1,5 +1,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "lake.h"
#include "env.h"
#include "hashtab.h"

1
lake.c
View file

@ -16,6 +16,7 @@
#include "env.h"
#include "lake.h"
#include "parse.h"
#include "string.h"
static LakeVal _NIL = { TYPE_NIL, sizeof(LakeVal) };
LakeVal *NIL = &_NIL;

View file

@ -18,6 +18,20 @@ void str_free(LakeStr *str)
free(str);
}
NILP str_set(LakeStr *str, char *s)
{
str->n = strlen(s);
str->s = strdup(s);
return NIL;
}
LakeStr *str_from_c(char *s)
{
LakeStr *str = str_alloc();
str_set(str, s);
return str;
}
LakeStr *str_make(void)
{
return str_from_c("");
@ -33,25 +47,11 @@ LakeStr *str_copy(LakeStr *str)
return str_from_c(str->s);
}
LakeStr *str_from_c(char *s)
{
LakeStr *str = str_alloc();
str_set(str, s);
return str;
}
char *str_val(LakeStr *str)
{
return strdup(str->s);
}
NILP str_set(LakeStr *str, char *s)
{
str->n = strlen(s);
str->s = strdup(s);
return NIL;
}
#define MIN(a, b) (a < b ? a : b)
LakeInt *str_cmp(LakeStr *a, LakeStr *b)