Re: Help with AREXX in a C program
Posted: Fri Dec 19, 2014 5:38 pm
@tonyw
Since CreateArgString() copies a string then ARexx can dispose of it when you call DeleteArgString(). However, I've seen a lot of ARexx code that just assigns unprocessed strings (not created with CreateArgString) to the argument array (e.g. rexxmsg->rm_Args[0] = "any string") and don't bother to free the results with DeleteArgString(). I'm guessing that a program is responsible for freeing unprocessed assigned argument strings and that strings created with CreateArgString() should be freed with DeleteArgString(). I've looked at the ARexx code in several major programs (Dopus4, YAM etc.) and the result string (result2) is created with CreateArgString() if the comand is successful and set to a failure number if the command failed. That indicates to me that the result string (result2) should be freed with DeleteArgString() if the result1 code is 0 (indicating success). It seems like there could be a lot of unfreed result strings could be left in the system by programs that don't free the result strings.
Since CreateArgString() copies a string then ARexx can dispose of it when you call DeleteArgString(). However, I've seen a lot of ARexx code that just assigns unprocessed strings (not created with CreateArgString) to the argument array (e.g. rexxmsg->rm_Args[0] = "any string") and don't bother to free the results with DeleteArgString(). I'm guessing that a program is responsible for freeing unprocessed assigned argument strings and that strings created with CreateArgString() should be freed with DeleteArgString(). I've looked at the ARexx code in several major programs (Dopus4, YAM etc.) and the result string (result2) is created with CreateArgString() if the comand is successful and set to a failure number if the command failed. That indicates to me that the result string (result2) should be freed with DeleteArgString() if the result1 code is 0 (indicating success). It seems like there could be a lot of unfreed result strings could be left in the system by programs that don't free the result strings.