Subject | Re: please add ib_util_free in ib_util |
---|---|
Author | woodsmailbox |
Post date | 2009-03-29T17:58:05Z |
consider this:
try
p = ibutil_malloc(size)
code-that-uses-p-but-could-break
finally
ibutil_free(p)
end
instead of
try
p = malloc(size)
code-that-uses-p-but-could-break
p2 = ibutil_malloc(size)
memcpy(p2, p, size)
finally
free(p)
end
no biggie.
as a side note, a little API to push/pop parameters of different types would simplify udf writing... no more free_it flag, no more cstring, so \0 would be ok in strings, etc... something like a small wrapper around paramdsc passing style. i imagine it would also be faster, since you'd reuse the stack.
try
p = ibutil_malloc(size)
code-that-uses-p-but-could-break
finally
ibutil_free(p)
end
instead of
try
p = malloc(size)
code-that-uses-p-but-could-break
p2 = ibutil_malloc(size)
memcpy(p2, p, size)
finally
free(p)
end
no biggie.
as a side note, a little API to push/pop parameters of different types would simplify udf writing... no more free_it flag, no more cstring, so \0 would be ok in strings, etc... something like a small wrapper around paramdsc passing style. i imagine it would also be faster, since you'd reuse the stack.
> Why would you want to call it? It's the engine that should free pointers
> returned with ib_util_malloc.
>
>
> Adriano
>