Re: Problem with cmods
Christian Toepp <[email protected]>
| Newsgroups | gmane.comp.lang.pike.user |
|---|---|
| Message-ID | <[email protected]> |
On 25.03.2014 09:32, Chris Angelico wrote: > I don't know about 7.6, as I build 8.0 from git, but it's probably the > same. Try using push_string(make_shared_string(s)) instead of > push_text(s); that's what I do. Your way looks better, but give both a > try. Fist: my code is working, thx for the help. Next: i see push_string(make_shared_string(s)) in your answer. after debugging and checking the code with valgrind i have to say that this is not useful because it is a possible memory leak. better is: struct pike_string *ret; ret = make_shared_string(s); free(s); push_string(ret); it seems that make_shared_string() creates a copy of your char* and its up to you to free your memory. Best regards -Chris