Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
8cd72bdf
Commit
8cd72bdf
authored
Mar 31, 2014
by
Damien George
Browse files
py: Fix vstr_init for case that alloc = 0.
parent
43e92cfb
Changes
1
Hide whitespace changes
Inline
Side-by-side
py/vstr.c
View file @
8cd72bdf
...
...
@@ -10,6 +10,10 @@
#define ROUND_ALLOC(a) (((a) & ((~0) - 7)) + 8)
void
vstr_init
(
vstr_t
*
vstr
,
int
alloc
)
{
if
(
alloc
<
2
)
{
// need at least 1 byte for the null byte at the end
alloc
=
2
;
}
vstr
->
alloc
=
alloc
;
vstr
->
len
=
0
;
vstr
->
buf
=
m_new
(
char
,
vstr
->
alloc
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment