From: Robert P. J. Day Date: Sun, 2 Oct 2016 03:15:35 -0400 (EDT) Subject: [U-Boot] is there any issue with creating and using more than one hashtable? In-Reply-To: <20161001092329.49B43100D92@atlas.denx.de> References: <20161001081331.045ED100C3C@atlas.denx.de> <20161001092329.49B43100D92@atlas.denx.de> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Sat, 1 Oct 2016, Wolfgang Denk wrote: > Dear Robert, > > In message 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? that would be one solution, yes. i assume i would, of course, set that callback before adding the entry to the hashtable; otherwise, wouldn't do much good. ok, i think we've settled this, thanks. rday -- ======================================================================== Robert P. J. Day Ottawa, Ontario, CANADA http://crashcourse.ca Twitter: http://twitter.com/rpjday LinkedIn: http://ca.linkedin.com/in/rpjday ========================================================================