Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As a further work after issue #15 , I think it's our binding developers' responsibility to provide memory safe packages to other developers. So I wrote this very first PR of this project.
string
in Nim may contain '\0', not like null-terminatingcstring
. soIf
content
thatcurrHandler
returned contains '\0', it was not processed properly. So I turned to use original string'slen
function. For similar reason, it is required, not optional, to tell WebUI library exact length of the content when content contains nulls.The memory of temporary
cstring
object may be GC'ed unexpectedly before it is used by WebUI library. We may use other mechanism to prevent so, but usingwebui_malloc
is encouraged by WebUI document and seems to be a simpler, easier and safer solution.Return type of
proc malloc*
is missing. Is there something wrong with binding generation mechanism?