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

Re: [XEN PATCH 06/11] libxl: convert libxl__json_object_to_yajl_gen to libxl__json_object_to_libjsonc_object


  • To: Anthony PERARD <anthony@xxxxxxxxxxxxxx>
  • From: Jason Andryuk <jason.andryuk@xxxxxxx>
  • Date: Sun, 31 Aug 2025 10:51:53 -0400
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=1bcot+OGzhe/4MxCl8iHfzF46vlYzg6Lns7JEnquZrA=; b=p8lgc0PzhuQof+G2qzOtBu0UvroQ3nuyzubLtVapdX54tYkOzSk8RL3nI4M6gjzNNQ21IUpTbfOpuGTvyRhDhr0a0ok1ammWqZv+/f/P6wYy5CCWh6GV7geEPYtoi7TktyXaTrO3NB0lpf/eDBIjM+dyTiPV4CeGCz9tFnBg/PsxXdqY0Y6HQn3KRT1L2HMcFRmOicr4Qec4ooXuCZjEpMSCvN04qbwDZLWrptFyYkhkbgRWxI6MTZwp6EEY9+QY0S1Jc5N3jrSMcoCZut2oKBfnJFUuIdKiCzJjxKWo/hO00189cu8VZe5kO349gdRFjoxXtQ6TfK7BWZ+qYu1luQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=r67MPouCFqACB2mGX7qHyAJWgpemF26rfMHg2IY4I5ngBgIYfDDGdF7omwUPN3m8QknheAAIShE4u6v1pxyQbuaS4Dc8pV14j9ZBIDzItENawKdugFnYAQr6XH6qLcWgHGKsQpjCJHM4E5ew5C9EpTIEEWSWbMGEpgOAraF786VlCov/YAFeyRWt6cLBD+vn5A4eMtYcZdFHrogPNi3F8/B+mPP5nFMM+/cU9/b5SxqIBJP4kdeZU1uwSiJsm7etMEL4LTZiGRKXWrdEXx/EHPaLyGJaiNKNz8AV8PyWQu2C/HTl1ofmpRNKvmwJxCi5HJQIieqyNYHNZtK9Y1CjaQ==
  • Cc: <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>
  • Delivery-date: Sun, 31 Aug 2025 14:52:08 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 2025-08-29 09:56, Anthony PERARD wrote:
On Wed, Aug 27, 2025 at 11:37:07AM -0400, Jason Andryuk wrote:
On 2025-08-08 10:55, Anthony PERARD wrote:
+    case JSON_NUMBER:
+        *jso_out = json_object_new_string(obj->u.string);

Is JSON_NUMBER calling json_object_new_string() correct?  It looks like the
yajl code falls back to a string, so that is okay but surprising.

Yeah, I think that's correct.
:-( maybe not. Even if we have these too comments:

     In libxl_internal.h, enum libxl__json_node_type:
         /* number is store in string, it's too big to be a long long or a 
double */
         JSON_NUMBER  = (1 << 4),

     In json_callback_number():
         /* If the conversion fail, we just store the original string. */

With yajl, we call yajl_gen_number(), which probably write 2^128 as:

     340282366920938463463374607431768211456

but this new json-c generator would write instead:

     "340282366920938463463374607431768211456"

I guess we might be able to replicate the same behavior by using
json_object_set_serializer() or json_object_new_double_s() (which use
the former). But I don't know if it is worth the effort. I hope we won't
have int bigger than 64 bits.

I didn't check, but I thought uint64_t is the biggest size libxl uses.

Regards,
Jason



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.