mirror of
https://github.com/samsonjs/lake.git
synced 2026-04-27 14:57:43 +00:00
fix some compiler warnings on linux
This commit is contained in:
parent
f001af16ee
commit
ebf84f5761
3 changed files with 16 additions and 14 deletions
1
env.c
1
env.c
|
|
@ -1,5 +1,6 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
#include "lake.h"
|
#include "lake.h"
|
||||||
#include "env.h"
|
#include "env.h"
|
||||||
#include "hashtab.h"
|
#include "hashtab.h"
|
||||||
|
|
|
||||||
1
lake.c
1
lake.c
|
|
@ -16,6 +16,7 @@
|
||||||
#include "env.h"
|
#include "env.h"
|
||||||
#include "lake.h"
|
#include "lake.h"
|
||||||
#include "parse.h"
|
#include "parse.h"
|
||||||
|
#include "string.h"
|
||||||
|
|
||||||
static LakeVal _NIL = { TYPE_NIL, sizeof(LakeVal) };
|
static LakeVal _NIL = { TYPE_NIL, sizeof(LakeVal) };
|
||||||
LakeVal *NIL = &_NIL;
|
LakeVal *NIL = &_NIL;
|
||||||
|
|
|
||||||
28
string.c
28
string.c
|
|
@ -18,6 +18,20 @@ void str_free(LakeStr *str)
|
||||||
free(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)
|
LakeStr *str_make(void)
|
||||||
{
|
{
|
||||||
return str_from_c("");
|
return str_from_c("");
|
||||||
|
|
@ -33,25 +47,11 @@ LakeStr *str_copy(LakeStr *str)
|
||||||
return str_from_c(str->s);
|
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)
|
char *str_val(LakeStr *str)
|
||||||
{
|
{
|
||||||
return strdup(str->s);
|
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)
|
#define MIN(a, b) (a < b ? a : b)
|
||||||
|
|
||||||
LakeInt *str_cmp(LakeStr *a, LakeStr *b)
|
LakeInt *str_cmp(LakeStr *a, LakeStr *b)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue