Changeset 24
- Timestamp:
- Jul 10, 2015, 3:38:28 AM (10 years ago)
- Location:
- rxutilex/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
rxutilex/trunk/Makefile
r20 r24 11 11 # Set environment variable DEBUG (=anything) to build with debugging symbols 12 12 !ifdef DEBUG 13 14 13 CFLAGS = $(CFLAGS) /Ti /Tm 14 LFLAGS = $(LFLAGS) /DEBUG 15 15 !endif 16 16 17 $(NAME).dll : $(NAME).obj 17 $(NAME).dll : $(NAME).obj Makefile 18 18 makedesc -D"Extended REXX Utility Functions" -N"Alex Taylor" -V"^#define=SZ_VERSION,rxutilex.c" $(NAME).def 19 19 $(LINK) $(LFLAGS) $(NAME).obj $(NAME).def $(LIBS) /O:$@ 20 20 # @dllrname.exe $@ CPPOM30=OS2OM30 /Q /R 21 21 22 $(NAME).obj : $(NAME).c $(NAME).def 22 $(NAME).obj : $(NAME).c $(NAME).def Makefile 23 23 $(CC) $(CFLAGS) /C /Ge- $(NAME).c 24 24 -
rxutilex/trunk/rxutilex.c
r23 r24 105 105 106 106 107 // List of functions to be registered by Sys2LoadFuncs 107 // List of functions to be registered by Sys2LoadFuncs or dropped by Sys2DropFuncs 108 // Drop list starts at index 0, load list starts at index 1 108 109 static PSZ RxFunctionTbl[] = { 110 "Sys2LoadFuncs", // Drop only 2015-05-06 sSHL 109 111 "Sys2DropFuncs", 110 112 "Sys2GetClipboardText", … … 201 203 if ( argc > 0 ) return ( 40 ); 202 204 entries = sizeof(RxFunctionTbl) / sizeof(PSZ); 203 for ( i = 0; i < entries; i++ ) 205 // 2015-05-06 SHL No need to load self (i.e. Sys2LoadFuncs), but do want to drop self 206 for ( i = 1; i < entries; i++ ) 204 207 RexxRegisterFunctionDll( RxFunctionTbl[i], SZ_LIBRARY_NAME, RxFunctionTbl[i] ); 205 208 … … 2291 2294 return ( FALSE ); 2292 2295 } 2293 DosFreeMem( prsResult->strptr ); 2296 // 2015-06-03 SHL dropped DosFreeMem(prsResult->strptr); 2297 // 2015-06-03 SHL Pointer not allocated by DosAllocMem 2294 2298 prsResult->strptr = pchNew; 2295 2299 } … … 2320 2324 ULONG ulRc, 2321 2325 ulBytes; 2322 CHAR szCompoundName[ US_COMPOUND_MAXZ ], 2323 *pchValue; 2326 CHAR szCompoundName[ US_COMPOUND_MAXZ ]; 2324 2327 2325 2328 sprintf( szCompoundName, "%s.%d", pszStem, ulIndex ); 2326 2329 if ( pszValue == NULL ) { 2327 p chValue = "";2330 pszValue = ""; 2328 2331 ulBytes = 0; 2329 2332 } else { 2333 // 2015-06-03 SHL Was using DosAllocMem and leaking memory 2334 // REXX API does not free this kind of buffer 2330 2335 ulBytes = strlen( pszValue ); 2331 ulRc = DosAllocMem( (PVOID) &pchValue, ulBytes + 1, PAG_WRITE | PAG_COMMIT ); 2332 if ( ulRc != 0 ) { 2333 WriteErrorCode( ulRc, "DosAllocMem"); 2334 return FALSE; 2335 } 2336 memcpy( pchValue, pszValue, ulBytes ); 2337 } 2336 } 2338 2337 MAKERXSTRING( shvVar.shvname, szCompoundName, strlen(szCompoundName) ); 2339 shvVar.shvvalue.strptr = p chValue;2338 shvVar.shvvalue.strptr = pszValue; 2340 2339 shvVar.shvvalue.strlength = ulBytes; 2341 2340 shvVar.shvnamelen = RXSTRLEN( shvVar.shvname );
Note:
See TracChangeset
for help on using the changeset viewer.