pdf-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [pdf-devel] Patch for FS#115


From: Jose E . Marchesi
Subject: Re: [pdf-devel] Patch for FS#115
Date: Sun, 18 Apr 2010 12:59:55 +0200 (CEST)

    
    Here is a patch for FS#115 with casting.

If you start working in a task, please set yourself as the asignee of
that task and change its status to STARTED.

    Note that we still need stdbool.h, I guess wa can't get rid of it.

It is not a problem to use stdbool's 'bool' type in pdf-list.h as long
as its usage is internal.

So,

    -typedef bool (*pdf_list_element_equals_fn_t) (const void *elt1, const void 
*elt2);
    +typedef pdf_bool_t (*pdf_list_element_equals_fn_t) (const void *elt1, 
const void *elt2);     

is fine, since we want the client to use pdf_bool_t instead of bool.

But then:

    -      list->gl_list = gl_list_nx_create_empty(GL_ARRAY_LIST, equals_fn, 
NULL,
    -                                              dispose_fn, 
allow_duplicates);
    +      list->gl_list = gl_list_nx_create_empty(GL_ARRAY_LIST,
    +                                              (bool(*)(const void*,const 
void *))equals_fn,
    +                                              NULL,dispose_fn, 
allow_duplicates);

Instead of making that cast I would create a new inlined static
function:

  bool *pdf_list_element_equals_fn (ELT1, ELT2)

that would call the user-supplied callback, casting the bool to
pdf_bool_t as appropriate.  Such an extra level of callback will allow
to make changes on the callback provided by pdf_list in the future.

Again, please put blank characters before open parenthesis and open
braces.

--
Jose E. Marchesi  <address@hidden>
                  http://www.jemarch.net
GNU Project       http://www.gnu.org




reply via email to

[Prev in Thread] Current Thread [Next in Thread]