[OPEN-ILS-DEV] PATCH: oils_dataloader.c (miscellaneous)

Scott McKellar mck9 at swbell.net
Sat Jan 12 20:39:37 EST 2008


This patch plugs a minor memory leak and tidies up a few things.

1. In main() we allocate a growing_buffer named "json".  I added a 
line to free it.

2. In commitTransaction() and rollbackTransaction() I eliminated
a layer of jsonObjectClone(), along with the associated 
jsonObjectFree().  Now we extract the string we want directly from
the original object without making an unnecessary copy.

3. I renamed the four macros starting with "E" so as to start 
with "E_" instead.

4. All functions (other than main()) are now static, as are the three
variables that had been declared at global scope.

--------

The memory leak was admittedly minor, since it occurred near the 
end of main().

Identifiers starting with "E" followed by a capital letter are
reserved for use in <errno.h>.

The macros in question represent values to be returned from main(),
and three of them are negative.  I don't much like the idea of
returning negative numbers from main() because I don't know what
happens to them.  Traditional UNIX recognizes return values from
0 to 255.  However I left these negative values alone because there
may be shell scripts or something that capture them.

Scott McKellar
http://home.swbell.net/mck9/ct/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: oils_dataloader_c_1.patch
Type: text/x-patch
Size: 5715 bytes
Desc: 548007493-oils_dataloader_c_1.patch
Url : http://list.georgialibraries.org/pipermail/open-ils-dev/attachments/20080112/272e8262/oils_dataloader_c_1.bin


More information about the Open-ils-dev mailing list