On 29 January 2013 23:56, Stefan Marr <smalltalk@stefan-marr.de> wrote:
Hi Igor:
On 29 Jan 2013, at 11:26, Igor Stasenko wrote:
| repo repoPath cb branches headHandle | repo := NBExternalHandle new. repoPath := NBExternalAddress fromString: '/Users/smarr/tmp/filetree'.
why not just pass the string?
I had the feeling (i.e., I had crashes, and was checking with GDB) that plain Smalltalk strings ala 'test' are not actually passed properly into the function. What is passed in is a reference to the begin of the string, but not a properly null terminated string.
Do I miss something?
Yes, to ease work with strings there is a special 'String' type it will automatically make a null-terminated copy of string on stack and pass it to function. So, you don't need to manually do 'NBExternalAddress fromString:' and then symmetrical #free, to free used memory, ( which your code snippet does not includes btw ;) ).
Thanks Stefan
-- Stefan Marr Software Languages Lab Vrije Universiteit Brussel Pleinlaan 2 / B-1050 Brussels / Belgium http://soft.vub.ac.be/~smarr Phone: +32 2 629 2974 Fax: +32 2 629 3525
-- Best regards, Igor Stasenko.