[OPEN-ILS-DEV] Dead functions

Mike Rylander mrylander at gmail.com
Mon Dec 15 22:40:28 EST 2008


On Mon, Dec 15, 2008 at 6:26 PM, Scott McKellar <mck9 at swbell.net> wrote:
> In utils.c there is a function file_to_string(), which reads a file and
> loads its contents into a growing_buffer.
>
> This function is called in only two places:
>
> 1. By jsonParseFile() (residing in osrf_json_tools.c)
> 2. By json_parse_file() (residing in osrf_legacy_json.c)
>
> These two functions are identical except in name.  Each calls
> file_to_string() to load a file into a string, and then parses the
> string to create a jsonObject.
>
> jsonParseFile() isn't called from anywhere.  json_parse_file() is
> called only by a thin wrapper named legacy_jsonParseFile(), which
> isn't called from anywhere.
>
> Two questions:
>
> 1. Can we get rid of this whole gaggle of unused functions?
>
> 2. If we want to keep some form of jsonParseFile(), would it make sense
>   to use mmap() instead of loading the file into a growing_buffer?  I
>   suspect that a memory-mapped file would be faster to read, but I
>   haven't tried to benchmark it.
>

YES YES A THOUSAND TIMES YES!

eh hem... Pardon me.  I was stuck in some dark and twisty passages,
all alike just earlier today.

Thinking about it a bit more rationally, I'd like to see a mmap-based
function.  I can see a good use for this as the basis of a dump/reload
utility.  I wonder if it's time to just take an axe to the legacy code
in trunk, though.  We've got 1.0 out there if there's a need for a
legacy-to-new bridge.

-- 
Mike Rylander
 | VP, Research and Design
 | Equinox Software, Inc. / The Evergreen Experts
 | phone:  1-877-OPEN-ILS (673-6457)
 | email:  miker at esilibrary.com
 | web:  http://www.esilibrary.com


More information about the Open-ils-dev mailing list