From owner-freebsd-arch@FreeBSD.ORG Fri Jul 26 07:26:20 2013 Return-Path: Delivered-To: arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 3D9DE99D; Fri, 26 Jul 2013 07:26:20 +0000 (UTC) (envelope-from jordan.hubbard@gmail.com) Received: from mail-pb0-x236.google.com (mail-pb0-x236.google.com [IPv6:2607:f8b0:400e:c01::236]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 0D547294D; Fri, 26 Jul 2013 07:26:20 +0000 (UTC) Received: by mail-pb0-f54.google.com with SMTP id ro12so1591843pbb.13 for ; Fri, 26 Jul 2013 00:26:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=content-type:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to:x-mailer; bh=XH2oYOJu+JTfaBJll2RyU3wVsS68+0qDkx/3Qx3nU5c=; b=cDgk7WxuahvexZU9e7qGJzv9fju3fdo0KTECLgawGCuji6+lr7tgHSvepdhmLkCejb wK8SMwTjgkbtXVPlLmD9kOpK2L9tsxNK/nFNYrMd946gI2RgcLidHP5rxcTHFFfQxxKe yPAJkItseywbMrhdkqbTc9h7Y5r5DmM6N08TfXPeAdy6BlEnh4BZ9fVxSPjbY9kKy834 zbgttML4quQQQAZYuXS8Xp6pE/WFwLadaCPhznAi4MAuo7Jn6EmwvVm1kb5xiuirZnge I/ZT6zmCfUN042e6GSuaMqSptBmYMAMYklgEJSMUCwCxClm4wMM5MqkS4l+kfqIfVyMk EePw== X-Received: by 10.68.172.34 with SMTP id az2mr51653210pbc.201.1374823579581; Fri, 26 Jul 2013 00:26:19 -0700 (PDT) Received: from [10.20.30.11] (106.sub-70-197-1.myvzw.com. [70.197.1.106]) by mx.google.com with ESMTPSA id s5sm58417404pbo.38.2013.07.26.00.26.17 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 26 Jul 2013 00:26:18 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 7.0 \(1786.1\)) Subject: Re: General purpose library for name/value pairs. From: Jordan Hubbard In-Reply-To: <20130725202832.GD1400@garage.freebsd.pl> Date: Fri, 26 Jul 2013 00:26:15 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: <818200C6-2AF2-465D-873B-CA610A9C763A@gmail.com> 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> <20130725202832.GD1400@garage.freebsd.pl> To: Pawel Jakub Dawidek X-Mailer: Apple Mail (2.1786.1) Cc: arch@FreeBSD.org X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Jul 2013 07:26:20 -0000 On Jul 25, 2013, at 1:28 PM, Pawel Jakub Dawidek = 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