Date: Fri, 26 Jul 2013 00:26:15 -0700 From: Jordan Hubbard <jordan.hubbard@gmail.com> To: Pawel Jakub Dawidek <pjd@freebsd.org> Cc: arch@FreeBSD.org Subject: Re: General purpose library for name/value pairs. Message-ID: <818200C6-2AF2-465D-873B-CA610A9C763A@gmail.com> In-Reply-To: <20130725202832.GD1400@garage.freebsd.pl> References: <20130704215329.GG1402@garage.freebsd.pl> <4818.1373008073@critter.freebsd.dk> <20130705195255.GB25842@garage.freebsd.pl> <60317.1373055040@critter.freebsd.dk> <20130708150308.GE1383@garage.freebsd.pl> <717D098F-D07E-45B0-B9F0-8D8BCEF06923@mail.turbofuzz.com> <20130708213351.GB1405@garage.freebsd.pl> <D2E98A8F-F765-4A56-96CD-4410944A2910@turbofuzz.com> <20130725202832.GD1400@garage.freebsd.pl>
next in thread | previous in thread | raw e-mail | index | archive | help
On Jul 25, 2013, at 1:28 PM, Pawel Jakub Dawidek <pjd@freebsd.org> = wrote: > Returning to this thread after a short break. I removed all > {,u}int{8,16.32.64} types and implemented only 'number' type which is > uint64_t. Looks much nicer now. Indeed! > Not sure if you looked at the API, but with nvlist you can lookup > element by name: >=20 > const char *nvlist_get_string(const nvlist_t *nvl, const char = *name); Sorry, I must have misunderstood that function since I thought it would = just get you a named string - you can also do something like this? { { "name", "Pawel Jakub Dawidek" }, { "age", 37 }, { = "favorite-float-num", 1.E027 }, { "likes", { "cats", "ZFS", "fashion = models" } }, { "company", "wheel systems" } } And then look up "name" and get a string, "age" and get a number, = "favorite-float-num" for a float, "likes" for an array of strings, etc? Thanks, - Jordan
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?818200C6-2AF2-465D-873B-CA610A9C763A>