pdf-devel
[Top][All Lists]
Advanced

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

Re: [pdf-devel] Patch for FS#56 (second try)


From: gerel
Subject: Re: [pdf-devel] Patch for FS#56 (second try)
Date: Mon, 21 Jul 2008 16:04:47 -0700 (PDT)

 > Date: Mon, 21 Jul 2008 23:27:40 +0200
 > From: address@hidden
 > 
 > Hi Gerel.
 > 
 >    address@hidden disp_fn
 >    +The function called when @var{element} is removed, can be NULL.
 > 
 > Would be good to explain there what the function does if the parameter
 > is NULL.

Sure.

 > 
 >    +  if (pdf_hash_add (props_hash, "isHidden", (void *) is_hidden,NULL) !=
 >    +      PDF_OK)
 >    +    {
 >    +      return PDF_ERROR;
 >    +    }
 > 
 > Will the memory used by 'is_hidden' be released when the hash is
 > destroyed being the last parameter NULL? As far as I understand in
 > this case the dispose function defined for the hash will be applied.
 > 

Right, we have two choices,

1. we pass each function call the element dispose function.
2. we give it at creation time, i.e. pdf_hash_create(). But now that I see
pdf_fsys_item_props_to_hash() doesn't create the hash table, which should if we
want to do this.


 > Also, in the same function:
 > 
 >  newelt->key = key;
 >  ...
 >  gl_sortedlist_add ((gl_list_t)table.keys, key_compare, key);
 > 
 > Is 'gl_sortedlist_add' making a copy of 'key'?

No, it is not. Also, remember that if the key is allocated from the heap you
could give pdf_hash_create() the key dispose function if you need to.

cheers

-gerel




reply via email to

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