[U-Boot] is there any issue with creating and using more than one hashtable?

Wolfgang Denk wd at denx.de
Sat Oct 1 11:23:29 CEST 2016


Dear Robert,

In message <alpine.LFD.2.20.1610010456050.5186 at localhost.localdomain> you wrote:
>
> > 244                         /* If there is a callback, call it */
> > 245                         if (htab->table[idx].entry.callback &&
> > 246                             htab->table[idx].entry.callback(item.key,
...

>   just to follow up, the simple solution for me would be to *not*
> create that second hashtable with recognized u-boot variable names
> like "ipaddr", "gatewayip", "serverip" unless i absolutely plan on
> using those new values.

Well, I guess you don't need the callback funtionality for your
purposes, and you will probably not pull the data from the second
hash table back into the primary one, so why can you not just clear
the "callback" for any entries you process?

That would suppress the unwanted actions...

>   this is what i use to add/modify a new env variable -- is this the
> correct approach, to add it to the "env_htab" hashtable?
> 
>   int
>   add_entry_to_env(ENTRY* e)
>   {
>         ENTRY*  ep;
> 
>         printf("Adding stuff k: [%s], d: [%s] to env.\n", e->key, e->data);

Insert:
	
	e->callback = NULL;

here?

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Carelessly planned projects take three times longer to complete  than
expected.  Carefully  planned  projects  take  four  times  longer to
complete than expected, mostly  because  the  planners  expect  their
planning to reduce the time it takes.


More information about the U-Boot mailing list