Branch: Tag:

2010-05-29

2010-05-29 14:00:31 by Martin Stjernholm <mast@lysator.liu.se>

Avoid indentation stuff in encode_json which actually only messes up
indentation.

Rev: src/modules/Gmp/mpz_glue.c:1.190

2:   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: mpz_glue.c,v 1.189 2010/05/29 13:57:43 grubba Exp $ + || $Id: mpz_glue.c,v 1.190 2010/05/29 14:00:31 mast Exp $   */      #include "global.h"
753:    */   static void mpzmod_get_string(INT32 args)   { +  /* Also called as json_encode (with some arguments). */    pop_n_elems(args);    push_string(low_get_mpz_digits(THIS, 10));   }
788:    push_string(s);   }    - /*! @decl string encode_json(int|void flags, int|void indent) -  *! -  *! Encode the value as a JSON string. -  *! -  *! @seealso -  *! @[digits()], @[Standards.JSON] -  */ - static void mpzmod_encode_json(INT32 args) - { -  INT_TYPE flags; -  INT_TYPE indent = 0; -  get_all_args("Gmp.mpz->encode_json", args, ".%i%i", &flags, &indent); -  -  if (indent) { -  push_text(" "); -  push_int(indent); -  o_multiply(); -  } -  mpzmod_digits(0); -  if (indent) { -  f_add(2); -  } -  -  stack_pop_n_elems_keep_top(args); - } -  +    /*! @decl string _sprintf(int ind, mapping opt)    */   static void mpzmod__sprintf(INT32 args)
2396:    ID_PROTECTED); \    \    ADD_FUNCTION("digits", mpzmod_digits,tFunc(tOr(tVoid,tInt),tStr), 0); \ -  ADD_FUNCTION("encode_json", mpzmod_encode_json, \ +  ADD_FUNCTION("encode_json", mpzmod_get_string, \    tFunc(tOr(tVoid,tInt) tOr(tVoid,tInt),tStr), 0); \    ADD_FUNCTION("_sprintf", mpzmod__sprintf, tFunc(tInt tMapping,tStr), \    ID_PROTECTED); \