Changeset 24


Ignore:
Timestamp:
Jul 10, 2015, 3:38:28 AM (10 years ago)
Author:
Alex Taylor
Message:

Makefile improvements, some fixes to memory allocation in stem variable handling (from SHL)

Location:
rxutilex/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • rxutilex/trunk/Makefile

    r20 r24  
    1111# Set environment variable DEBUG (=anything) to build with debugging symbols
    1212!ifdef DEBUG
    13     CFLAGS = $(CFLAGS) /Ti /Tm
    14     LFLAGS = $(LFLAGS) /DEBUG
     13CFLAGS = $(CFLAGS) /Ti /Tm
     14LFLAGS = $(LFLAGS) /DEBUG
    1515!endif
    1616
    17 $(NAME).dll : $(NAME).obj
     17$(NAME).dll : $(NAME).obj Makefile
    1818                makedesc -D"Extended REXX Utility Functions" -N"Alex Taylor" -V"^#define=SZ_VERSION,rxutilex.c" $(NAME).def
    1919                $(LINK) $(LFLAGS) $(NAME).obj $(NAME).def $(LIBS) /O:$@
    2020#                @dllrname.exe $@ CPPOM30=OS2OM30 /Q /R
    2121
    22 $(NAME).obj : $(NAME).c $(NAME).def
     22$(NAME).obj : $(NAME).c $(NAME).def Makefile
    2323                $(CC) $(CFLAGS) /C /Ge- $(NAME).c
    2424
  • rxutilex/trunk/rxutilex.c

    r23 r24  
    105105
    106106
    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
    108109static PSZ RxFunctionTbl[] = {
     110    "Sys2LoadFuncs",                    // Drop only 2015-05-06 sSHL
    109111    "Sys2DropFuncs",
    110112    "Sys2GetClipboardText",
     
    201203    if ( argc > 0 ) return ( 40 );
    202204    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++ )
    204207        RexxRegisterFunctionDll( RxFunctionTbl[i], SZ_LIBRARY_NAME, RxFunctionTbl[i] );
    205208
     
    22912294            return ( FALSE );
    22922295        }
    2293         DosFreeMem( prsResult->strptr );
     2296        // 2015-06-03 SHL dropped DosFreeMem(prsResult->strptr);
     2297        // 2015-06-03 SHL Pointer not allocated by DosAllocMem
    22942298        prsResult->strptr = pchNew;
    22952299    }
     
    23202324    ULONG    ulRc,
    23212325             ulBytes;
    2322     CHAR     szCompoundName[ US_COMPOUND_MAXZ ],
    2323             *pchValue;
     2326    CHAR     szCompoundName[ US_COMPOUND_MAXZ ];
    23242327
    23252328    sprintf( szCompoundName, "%s.%d", pszStem, ulIndex );
    23262329    if ( pszValue == NULL ) {
    2327         pchValue = "";
     2330        pszValue = "";
    23282331        ulBytes  = 0;
    23292332    } else {
     2333        // 2015-06-03 SHL Was using DosAllocMem and leaking memory
     2334        // REXX API does not free this kind of buffer
    23302335        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        }
    23382337    MAKERXSTRING( shvVar.shvname, szCompoundName, strlen(szCompoundName) );
    2339     shvVar.shvvalue.strptr    = pchValue;
     2338    shvVar.shvvalue.strptr    = pszValue;
    23402339    shvVar.shvvalue.strlength = ulBytes;
    23412340    shvVar.shvnamelen  = RXSTRLEN( shvVar.shvname );
Note: See TracChangeset for help on using the changeset viewer.