Coding Philosophy
Most of the code was kept in as few files as possible, with the smallest possible number of parameters.
Whenever more parameters are required, it should always be possible to give NULL
or 0
as values to get a default behavior.
For example, the read_line_alloc
takes many parameters:
int read_line_alloc(void* in, DataSourceType in_type, char** line, int* sz_line, int i0, char from, char to, int keep_fromto, char interest, int* interest_count);The only really mandatory parameters are obviously
in
and line
.
All others can be set to NULL
, 0
or '\0'
:read_line_alloc(f, DATA_SOURCE_FILE, &line, NULL, 0, 0, 0, 0, 0, NULL);
will
read bytes from f
into line
starting from current position in f
until
a newline character (or end-of-file) has been reached. line
will be allocated but its size will
not be returned (only the number of characters read). No special character will be counted during file reading.
So, if you are not too sure what to put as a parameter, just zero it, it should be fine! :)
©Copyright 1999-2010 - Geeknet, Inc., All Rights Reserved