Martin Stjernholm, Roxen IS @ Pike developers forum wrote:
/.../ (I fail to see the reason to use xalloc and realloc).
xalloc throws a pike error instead of returning NULL. xrealloc (in case that's what you meant) is otoh not a similar variant of realloc. It belongs to a set of malloc wrappers that looks like an old attempt to sort out the mess with different CRTs on windows. Ought to be cleaned away.
Is there a function which throws an error like xalloc() but does a realloc() instead?
P.S. What seems to puzzle me though, is that functions declared returning void in Pike, seem to require a pop_stack() after using apply() to call them.
Yes, the various apply functions always leaves a single svalue on the stack, so you don't need to know the type of the callable.
Erm... Does this mean that the void functions themselves do or do not need to leave an svalue at the stack before returning? First I thought, they should not leave anything. Then I found some sample code in the Shuffler which explicitly does a push_int(0) at the end of a void function, so I copied that. Which is it now?