# HG changeset patch # User Fredrik Lundh # Date 1257697086 -3600 # Node ID 52189358c0eca617f19272aff3cbe484a3204d0c # Parent 9f3809fc04b43f2b75dd97ce9fb01442a039ea55 Use C89 comments throughout. diff -r 9f3809fc04b43f2b75dd97ce9fb01442a039ea55 -r 52189358c0eca617f19272aff3cbe484a3204d0c cjson.c --- a/cjson.c Fri Nov 06 03:43:29 2009 +0100 +++ b/cjson.c Sun Nov 08 17:18:06 2009 +0100 @@ -15,10 +15,10 @@ #include typedef struct JSONData { - char *str; // the actual json string - char *end; // pointer to the string end - char *ptr; // pointer to the current parsing position - int all_unicode; // make all output strings unicode if true + char *str; /* the actual json string */ + char *end; /* pointer to the string end */ + char *ptr; /* pointer to the current parsing position */ + int all_unicode; /* make all output strings unicode if true */ } JSONData; @@ -136,7 +136,7 @@ Py_ssize_t len; char *ptr; - // look for the closing quote + /* look for the closing quote */ escaping = has_unicode = string_escape = False; ptr = jsondata->ptr + 1; while (True) { @@ -274,7 +274,7 @@ int c, is_float, should_stop; char *ptr; - // check if we got a floating point number + /* check if we got a floating point number */ ptr = jsondata->ptr; is_float = should_stop = False; while (True) { @@ -1223,7 +1223,7 @@ return encode_list(encode, object); } else if (PyTuple_Check(object)) { return encode_tuple(encode, object); - } else if (PyDict_Check(object)) { // use PyMapping_Check(object) instead? -Dan + } else if (PyDict_Check(object)) { /* use PyMapping_Check(object) instead? -Dan */ return encode_dict(encode, object); } else { PyErr_SetString(JSON_EncodeError, "object is not JSON encodable"); @@ -1271,13 +1271,13 @@ } -/* Decode JSON representation into pyhton objects */ +/* Decode JSON representation into Python objects */ static PyObject* JSON_decode(PyObject *self, PyObject *args, PyObject *kwargs) { static char *kwlist[] = {"json", "all_unicode", NULL}; - int all_unicode = False; // by default return unicode only when needed + int all_unicode = False; /* by default return unicode only when needed */ PyObject *object, *string, *str; JSONData jsondata; @@ -1297,7 +1297,7 @@ if (PyString_AsStringAndSize(str, &(jsondata.str), NULL) == -1) { Py_DECREF(str); - return NULL; // not a string object or it contains null bytes + return NULL; /* not a string object or it contains null bytes */ } jsondata.ptr = jsondata.str; @@ -1338,7 +1338,7 @@ "and unicode objects only where necessary, else it will return unicode\n" "objects everywhere (this is slower).")}, - {NULL, NULL} // sentinel + {NULL, NULL} /* sentinel */ }; PyDoc_STRVAR(module_doc, @@ -1375,7 +1375,7 @@ Py_INCREF(JSON_DecodeError); PyModule_AddObject(m, "DecodeError", JSON_DecodeError); - // Module version (the MODULE_VERSION macro is defined by setup.py) + /* Module version (the MODULE_VERSION macro is defined by setup.py) */ PyModule_AddStringConstant(m, "__version__", STRINGIFY(MODULE_VERSION)); }