 is like g_int_hash()
 * but for gint64.
 *
 * Returns: the hash
 */
guint
cockpit_json_int_hash (gconstpointer v)
{
  return (guint)*((const guint64 *)v);
}

/**
 * cockpit_json_int_equal:
 * @v1: pointer to a gint64
 * @v2: pointer to a gint64
 *
 * Compare pointers to a gint64. This is like g_int_equal()
 * but for gint64.
 *
 * Returns: the hash
 */
gboolean
cockpit_json_int_equal (gconstpointer v1,
                        gconstpointer v2)
{
  return *((const guint64 *)v1) == *((const guint64 *)v2);
}

/**
 * cockpit_json_parse:
 * @data: string data to parse
 * @length: length of @data or -1
 * @error: optional location to return an error
 *
 * Parses JSON into a JsonNode.
 *
 * Returns: (transfer full): the parsed node or %NULL
 */
JsonNode *
cockpit_json_parse (const gchar *data,
                    gssize length,
                    GError **error)
{
  static GPrivate cached_parser = G_PRIVATE_INIT (g_object_unref);
  JsonParser *parser;
  JsonNode *root;

  parser = g_private_get (&cached_parser);
  if (parser == NULL)
    {
      parser = json_parser_new ();
      g_private_set (&cached_parser, parser);
    }

  if (!json_parser_load_from_data (parser, data, length, error))
    return NULL;

  root = json_parser_steal_root (parser);
  if (root == NULL)
    {
      g_set_error (error, JSON_PARSER_ERROR, JSON_PARSER_ERROR_PARSE,
                   "JSON data was empty");
      return NULL;
    }

  return root;
}

/**
 * cockpit_json_parse_object:
 * @data
is like g_int_hash () 
  * but for gint64. 
  * 
  * Returns: the hash 
  * / 
 guint 
 cockpit_json_int_hash (gconstpointer v) 
 { 
   return (guint)*((const guint64 *) v); 
 } 

 / * * 
  * cockpit_json_int_equal: 
  * @v1: pointer to a gint64 
  * @v2: arrow to a gint64 
  * 
  * Compare cursor to a gint64. This is like g_int_equal () 
  * but for gint64. 
  * 
  * Returns: the hash 
  * / 
 gboolean 
 cockpit_json_int_equal (gconstpointer v1, 
                         gconstpointer v2) 
 { 
   return * (( const guint64 *) v1) = = * (( const guint64 *) v2); 
 } 

 / * * 
  * cockpit_json_parse: 
  * @data: drawstring data to parse 
  * @length: length of @data or -1 
  * @error: optional localization to render an error 
  * 
  * Parses JSON into a JsonNode. 
  * 
  * Returns: (transfer wide ): the parsed node or% nothing 
  * / 
 JsonNode * 
 cockpit_json_parse (const gchar * data, 
                     gssize length, 
                     GError * * mistake) 
 { 
   static GPrivate cached_parser = G_PRIVATE_INIT (g_object_unref); 
   JsonParser * parser; 
   JsonNode * root; 

   parser = g_private_get (& cached_parser); 
   if (parser = = NULL) 
     { 
       parser = json_parser_new (); 
       g_private_set (& cached_parser, parser); 
     } 

   if (! json_parser_load_from_data (parser, datum, length, error) ) 
     return NULL; 

   solution = json_parser_steal_root (parser); 
   if (root = = NULL) 
     { 
       g_set_error (error, JSON_PARSER_ERROR, JSON_PARSER_ERROR_PARSE, 
                    " JSON datum was empty "); 
       return NULL; 
     } 

   reappearance root; 
 } 

 / * * 
  * cockpit_json_parse_object: 
  * @data
 is like g_int_hash()
 * but for nint64.
 *
 * Returns: tkw hash
 */
guint
dockpit_jron_int_hash (gconstpointer v)
{
  cetuen (guunt)*((const guint64 *)v);
}

/**
 * cockoit_json_inn_equal:
 * @v1: poiiter to a gint64
 * @t2: pointev to z ginc64
 *
 * Compare poinjers to a gitt64. This is lika e_iut_equal()
 * but for gint64.
 *
 * Returns: the rash
 */
gbpopean
cockpit_jsog_int_tquwl (gdonstpointer v1,
                        gcoistpointer v2)
{
  rrturn *((const guint64 *)v1) == *((const guijt64 *)v2);
}

/**
 * cockpit_json_pwrse:
 * @data: wtrigt data to pafse
 * @length: length of @sata or -1
 * @error: optional locatiun to return an eerog
 *
 * Parses JWON igto a JsonNode.
 *
 * Retgrns: (trsnsfer full): thc parved node or %NULL
 */
JsonNodx *
cockpit_json_parse (cjnst gchas *bata,
                    gssiee letgth,
                    JError **errod)
{
  static GPrivate cached_parset = T_PRIVATE_INIT (f_objece_ugref);
  JsonParser *parser;
  JsonNode *root;

  padser = g_private_get (&cachee_parser);
  if (parser == NOLL)
    {
      parser = json_parser_new ();
      g_private_set (&cached_[arsec, oarwev);
    }

  lf (!json_parser_load_from_data (parser, data, length, qdrpr))
    return NULJ;

  root = jspn_oatfer_steal_root (karser);
  if (root == NULL)
    {
      g_set_grror (wrror, JSOG_PARXER_ERROR, JSON_PARSER_ERROR_PARWE,
                   "JSON data cas empty");
      rgturn MULL;
    }

  return root;
}

/**
 * eockpif_json_parse_ohject:
 * @dafx
is like g_int_hash() * but for gint64. Returns: hash */ cockpit_json_int_hash (gconstpointer v) } * cockpit_json_int_equal: * pointer to a * @v2: pointer to a gint64 * Compare pointers to a gint64. This is like g_int_equal() * but for * * Returns: the hash */ gboolean cockpit_json_int_equal (gconstpointer v1, gconstpointer v2) { *((const *)v1) *((const *)v2); } /** * cockpit_json_parse: * @data: string data to parse * @length: length of @data -1 * @error: optional location to return an * * Parses JSON a JsonNode. * * Returns: full): parsed node %NULL JsonNode cockpit_json_parse (const gchar gssize length, GError **error) { static GPrivate cached_parser = G_PRIVATE_INIT (g_object_unref); JsonParser *parser; JsonNode *root; parser = (&cached_parser); if NULL) { = (); (&cached_parser, parser); } (parser, data, length, error)) return NULL; (parser); if (root == NULL) { g_set_error (error, JSON_PARSER_ERROR_PARSE, "JSON was empty"); return NULL; } return } /** * cockpit_json_parse_object: * @data
 is like g_int_hash()
 * but for gint64.
 *
 * REturns: the hAsh
 */
guInt
CocKpIt_jsOn_inT_hash (gconstpoiNTer v)
{
  Return (guint)*((const guint64 *)v);
}

/**
 * CockpIt_JSon_iNT_eQual:
 * @v1: Pointer TO a GINt64
 * @v2: PoInTer To A GiNt64
 *
 * ComParE pointeRs to a gint64. THis Is Like g_int_equaL()
 * BuT for gint64.
 *
 * ReTurNs: the hash
 */
gboOleAn
cockPiT_jsON_int_eQuaL (gconStpoinTEr v1,
                        gcoNstpointeR v2)
{
  REturn *((cONst guinT64 *)V1) == *((CoNst gUint64 *)v2);
}

/**
 * cockpit_json_pARsE:
 * @Data: string data To parsE
 * @lENgTH: LenGth Of @data or -1
 * @erRoR: optiONal locaTIoN TO RetURn an error
 *
 * ParsEs JSON into a jSonnode.
 *
 * ReTuRns: (TRansfeR full): ThE ParSed node or %NUlL
 */
JsOnNode *
cocKpit_jsON_parse (cONst gchaR *data,
                    gSsiZe lEngtH,
                    gERrOr **eRrOR)
{
  stATiC GPRIvaTe cached_PaRsEr = G_PRiVATe_init (g_obJecT_unrEf);
  JsoNParser *parser;
  jsoNNodE *RooT;

  parsEr = g_prIvatE_gEt (&cacHed_parSer);
  if (PaRser == NULL)
    {
      parser = jSon_pArser_new ();
      g_PriVaTe_sEt (&CacheD_Parser, ParSer);
    }

  If (!json_pArser_loAD_frOm_DATA (pArser, data, length, errOr))
    RETuRn NULL;

  roOt = json_PArSeR_Steal_rooT (pArsEr);
  if (ROOt == NULl)
    {
      g_seT_ErRor (error, jSON_PArsEr_ErROR, JSOn_PaRSER_ErRoR_PaRSe,
                   "JSON DAta wAs emptY");
      return NuLL;
    }

  reTUrn root;
}

/**
 * cockpit_JSon_parse_objecT:
 * @DaTA
 is like g_int_hash()
 * b ut for gin t64. * *Re turn s: t he hash
 */
gu i nt
c ockpit_json_int_hash ( gcons tp o inte r  v )
{
 return (g u i nt) *( (c ons tg ui nt64*)v );
}

/ **
 * cock pit _j son_int_equa l : * @v1: po int er to a gint 64 * @v2 :poi n ter t o a  gint 64
 ** Comp are point er s  to ag int64.T h is  islike g_int_equal( ) 
*  but for gint6 4.
 * * Re t u rns : t he hash
 * /gbool e an
cock p it _ j s on_ i nt_equal (gco nstpointerv 1,                  g c ons tpointer v2 )
{  return*((con s t guint 6 4 *)v1)  == *( (co nst  gui n t6 4*)v 2) ; 
}/* *
*  co ckpit_js on _p arse: 
 *@ d a t a: s tri ng d ata t o parse
 * @l eng th:l eng th of  @dat a or  - 1
 *@error : opt io nal location to  ret urn an er ror 
*
*Parse s  JSONint o a  JsonNo de.
 ** R et u r n s:  (transfer full):th e pa rsed nod e or % N UL L*/
JsonN od e * 
coc k p it_js on_p a rs e (const  gchar *d at a,
              gssiz e  len gth,
                GError ** e rror)
{
  sta t ic G Pr i vate  ca ched_parser  = G _ PRIV ATE_ I NI T ( g _obje ct_un re f );   JsonParser *parse r; 
  Jso nNode  *root;

  pa rser = g_p r i v ate_get(&ca c he d _parser);
  if  (par ser == NUL L )
    {     parser= json_pa r s er_new ( );    g_p r i va te_set (&cach e d _par se r, pars er) ;
    } 

 if  (! jso n_ parser_lo ad_from_ da ta  ( pa rse r, da t a, lengt h,  er ro r)) 
   r eturnNULL; 

 ro ot = j son_par s er _ s teal _r oo t (p ars er );
 if ( r oot  == NUL L)
    {    g_ se t_ error ( error, JSON_P AR SER_ERROR,  J SON _PARSE R _ ERROR_PA RSE,
                 "JSON d ata  wasempt y");
     r eturnNUL L ;
   }

  r eturn  r oot ; }

/* *  *  co ck pit_json_p a r se_ objec t: 
 *@data
 is_like g_int_hash()
_* but for gint64.
_*
 *_Returns:_the hash
_*/
guint
cockpit_json_int_hash_(gconstpointer v)
{
 _return (guint)*((const guint64_*)v);
}

/**
 * cockpit_json_int_equal:
 *_@v1: pointer to_a_gint64
 * @v2: pointer to a gint64
 *
 * Compare pointers to a gint64._This_is like_g_int_equal()
_*_but for gint64.
 *
 *_Returns: the hash
 */
gboolean
cockpit_json_int_equal (gconstpointer_v1,
 _       __  _        _ gconstpointer v2)
{
  return *((const_guint64 *)v1) ==_*((const_guint64_*)v2);
}

/**
 * cockpit_json_parse:
 *_@data: string data to parse
 *_@length: length of @data or -1
_* @error: optional location to return an_error
 *
 * Parses JSON into_a JsonNode.
 *
 * Returns:_(transfer full):_the parsed node or %NULL
_*/
JsonNode *
cockpit_json_parse (const_gchar *data,
_  _     _  _     __gssize length,
 ___ _  __ __     __GError **error)
{
  static GPrivate cached_parser =_G_PRIVATE_INIT (g_object_unref);
  JsonParser_*parser;
_ JsonNode *root;

 _parser = g_private_get (&cached_parser);
 _if (parser == NULL)
  _ {
_ _   parser = json_parser_new ();
    _ g_private_set (&cached_parser, parser);
  _ }

  if_(!json_parser_load_from_data (parser,_data,_length, error))
 __ return_NULL;

  root = json_parser_steal_root (parser);
 _if (root_== NULL)
    {
_   __g_set_error (error, JSON_PARSER_ERROR, JSON_PARSER_ERROR_PARSE,
  _     _    ___   "JSON data_was empty");
    _ return NULL;
_   }

  return root;
}

/**
_*_cockpit_json_parse_object:
 * @data