mirror of
https://github.com/ProgramSnail/Lama.git
synced 2025-12-06 06:48:48 +00:00
Fix [0] arrays
This commit is contained in:
parent
94b31a70a4
commit
378b8e9785
2 changed files with 6 additions and 4 deletions
|
|
@ -463,7 +463,8 @@ extern void *Lsubstring (aint* args /*void *subj, aint p, aint l*/) {
|
||||||
r = (data *)alloc_string(ll);
|
r = (data *)alloc_string(ll);
|
||||||
pop_extra_root((void**)&args[0]);
|
pop_extra_root((void**)&args[0]);
|
||||||
|
|
||||||
strncpy(r->contents, (char *)args[0] + pp, ll);
|
char *r_contents = r->contents;
|
||||||
|
strncpy(r_contents, (char *)args[0] + pp, ll);
|
||||||
|
|
||||||
POST_GC();
|
POST_GC();
|
||||||
|
|
||||||
|
|
@ -751,7 +752,8 @@ extern void *Bstring (aint* args/*void *p*/) {
|
||||||
push_extra_root((void**)&args[0]);
|
push_extra_root((void**)&args[0]);
|
||||||
s = LmakeString(BOX(n));
|
s = LmakeString(BOX(n));
|
||||||
pop_extra_root((void**)&args[0]);
|
pop_extra_root((void**)&args[0]);
|
||||||
strncpy((char *)&TO_DATA(s)->contents, (char*)args[0], n + 1); // +1 because of '\0' in the end of C-strings
|
char *s_contents = (char *)&TO_DATA(s)->contents;
|
||||||
|
strncpy(s_contents, (char*)args[0], n + 1); // +1 because of '\0' in the end of C-strings
|
||||||
|
|
||||||
POST_GC();
|
POST_GC();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ typedef struct {
|
||||||
// last bit is used as MARK-BIT, the rest are used to store address where object should move
|
// last bit is used as MARK-BIT, the rest are used to store address where object should move
|
||||||
// last bit can be used because due to alignment we can assume that last two bits are always 0's
|
// last bit can be used because due to alignment we can assume that last two bits are always 0's
|
||||||
ptrt forward_address;
|
ptrt forward_address;
|
||||||
char contents[0];
|
char contents[];
|
||||||
} data;
|
} data;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
@ -95,7 +95,7 @@ typedef struct {
|
||||||
// last bit can be used because due to alignment we can assume that last two bits are always 0's
|
// last bit can be used because due to alignment we can assume that last two bits are always 0's
|
||||||
ptrt forward_address;
|
ptrt forward_address;
|
||||||
auint tag;
|
auint tag;
|
||||||
char contents[0];
|
char contents[];
|
||||||
} sexp;
|
} sexp;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue