IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 8, 2005, 5:11:17 PM (21 years ago)
Author:
jhoblitt
Message:

set a deallocation function to free strings

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/glueforge/templates/psdb/alloc.tt

    r4169 r4172  
    11[% USE format -%]
    22[% indented = format('%-15s %s') -%]
     3static void [% object_name %]Free([% object_name %] *object);
     4
    35[% object_name %] *[% object_name %]Alloc(
    46    [%- SET i = 0 -%]
     
    1820
    1921    object = psAlloc(sizeof([% object_name %]));
     22    psMemSetDeallocator(object, (psFreeFcn)[% object_name %]Free);
    2023
    2124[% FOREACH item = columns -%]
     
    2528    return object;
    2629}
     30
     31static void [% object_name %]Free([% object_name %] *object)
     32{
     33[% FOREACH item = columns -%]
     34[% IF item.type == "STR" -%]
     35    psFree(object->[% item.name %]);
     36[% END -%]
     37[% END -%]
     38}
Note: See TracChangeset for help on using the changeset viewer.