summaryrefslogtreecommitdiffstats
path: root/Modules/_localemodule.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/_localemodule.c')
-rw-r--r--Modules/_localemodule.c130
1 files changed, 65 insertions, 65 deletions
diff --git a/Modules/_localemodule.c b/Modules/_localemodule.c
index bf5d58d..7e475da 100644
--- a/Modules/_localemodule.c
+++ b/Modules/_localemodule.c
@@ -165,7 +165,7 @@ PyLocale_setlocale(PyObject* self, PyObject* args)
PyObject *result_object;
if (!PyArg_ParseTuple(args, "i|z:setlocale", &category, &locale))
- return NULL;
+ return NULL;
if (locale) {
/* set locale */
@@ -272,7 +272,7 @@ PyLocale_strcoll(PyObject* self, PyObject* args)
{
#if !defined(HAVE_WCSCOLL) || !defined(Py_USING_UNICODE)
char *s1,*s2;
-
+
if (!PyArg_ParseTuple(args, "ss:strcoll", &s1, &s2))
return NULL;
return PyInt_FromLong(strcoll(s1, s2));
@@ -280,7 +280,7 @@ PyLocale_strcoll(PyObject* self, PyObject* args)
PyObject *os1, *os2, *result = NULL;
wchar_t *ws1 = NULL, *ws2 = NULL;
int rel1 = 0, rel2 = 0, len1, len2;
-
+
if (!PyArg_UnpackTuple(args, "strcoll", 2, 2, &os1, &os2))
return NULL;
/* If both arguments are byte strings, use strcoll. */
@@ -305,7 +305,7 @@ PyLocale_strcoll(PyObject* self, PyObject* args)
Py_DECREF(os1);
}
return NULL;
- }
+ }
rel2 = 1;
}
/* Convert the unicode strings to wchar[]. */
@@ -434,7 +434,7 @@ static char *mac_getscript(void)
/* This leaks an object. */
name = CFStringConvertEncodingToIANACharSetName(enc);
}
- return (char *)CFStringGetCStringPtr(name, 0);
+ return (char *)CFStringGetCStringPtr(name, 0);
}
static PyObject*
@@ -447,9 +447,9 @@ PyLocale_getdefaultlocale(PyObject* self)
#ifdef HAVE_LANGINFO_H
#define LANGINFO(X) {#X, X}
static struct langinfo_constant{
- char* name;
- int value;
-} langinfo_constants[] =
+ char* name;
+ int value;
+} langinfo_constants[] =
{
/* These constants should exist on any langinfo implementation */
LANGINFO(DAY_1),
@@ -567,12 +567,12 @@ PyLocale_nl_langinfo(PyObject* self, PyObject* args)
returns numeric values in the char* return value, which would
crash PyString_FromString. */
for (i = 0; langinfo_constants[i].name; i++)
- if (langinfo_constants[i].value == item) {
- /* Check NULL as a workaround for GNU libc's returning NULL
- instead of an empty string for nl_langinfo(ERA). */
- const char *result = nl_langinfo(item);
- return PyString_FromString(result != NULL ? result : "");
- }
+ if (langinfo_constants[i].value == item) {
+ /* Check NULL as a workaround for GNU libc's returning NULL
+ instead of an empty string for nl_langinfo(ERA). */
+ const char *result = nl_langinfo(item);
+ return PyString_FromString(result != NULL ? result : "");
+ }
PyErr_SetString(PyExc_ValueError, "unsupported langinfo constant");
return NULL;
}
@@ -587,10 +587,10 @@ PyDoc_STRVAR(gettext__doc__,
static PyObject*
PyIntl_gettext(PyObject* self, PyObject *args)
{
- char *in;
- if (!PyArg_ParseTuple(args, "s", &in))
- return 0;
- return PyString_FromString(gettext(in));
+ char *in;
+ if (!PyArg_ParseTuple(args, "s", &in))
+ return 0;
+ return PyString_FromString(gettext(in));
}
PyDoc_STRVAR(dgettext__doc__,
@@ -600,10 +600,10 @@ PyDoc_STRVAR(dgettext__doc__,
static PyObject*
PyIntl_dgettext(PyObject* self, PyObject *args)
{
- char *domain, *in;
- if (!PyArg_ParseTuple(args, "zs", &domain, &in))
- return 0;
- return PyString_FromString(dgettext(domain, in));
+ char *domain, *in;
+ if (!PyArg_ParseTuple(args, "zs", &domain, &in))
+ return 0;
+ return PyString_FromString(dgettext(domain, in));
}
PyDoc_STRVAR(dcgettext__doc__,
@@ -613,11 +613,11 @@ PyDoc_STRVAR(dcgettext__doc__,
static PyObject*
PyIntl_dcgettext(PyObject *self, PyObject *args)
{
- char *domain, *msgid;
- int category;
- if (!PyArg_ParseTuple(args, "zsi", &domain, &msgid, &category))
- return 0;
- return PyString_FromString(dcgettext(domain,msgid,category));
+ char *domain, *msgid;
+ int category;
+ if (!PyArg_ParseTuple(args, "zsi", &domain, &msgid, &category))
+ return 0;
+ return PyString_FromString(dcgettext(domain,msgid,category));
}
PyDoc_STRVAR(textdomain__doc__,
@@ -627,15 +627,15 @@ PyDoc_STRVAR(textdomain__doc__,
static PyObject*
PyIntl_textdomain(PyObject* self, PyObject* args)
{
- char *domain;
- if (!PyArg_ParseTuple(args, "z", &domain))
- return 0;
- domain = textdomain(domain);
- if (!domain) {
- PyErr_SetFromErrno(PyExc_OSError);
- return NULL;
- }
- return PyString_FromString(domain);
+ char *domain;
+ if (!PyArg_ParseTuple(args, "z", &domain))
+ return 0;
+ domain = textdomain(domain);
+ if (!domain) {
+ PyErr_SetFromErrno(PyExc_OSError);
+ return NULL;
+ }
+ return PyString_FromString(domain);
}
PyDoc_STRVAR(bindtextdomain__doc__,
@@ -645,19 +645,19 @@ PyDoc_STRVAR(bindtextdomain__doc__,
static PyObject*
PyIntl_bindtextdomain(PyObject* self,PyObject*args)
{
- char *domain, *dirname;
- if (!PyArg_ParseTuple(args, "sz", &domain, &dirname))
- return 0;
- if (!strlen(domain)) {
- PyErr_SetString(Error, "domain must be a non-empty string");
- return 0;
- }
- dirname = bindtextdomain(domain, dirname);
- if (!dirname) {
- PyErr_SetFromErrno(PyExc_OSError);
- return NULL;
- }
- return PyString_FromString(dirname);
+ char *domain, *dirname;
+ if (!PyArg_ParseTuple(args, "sz", &domain, &dirname))
+ return 0;
+ if (!strlen(domain)) {
+ PyErr_SetString(Error, "domain must be a non-empty string");
+ return 0;
+ }
+ dirname = bindtextdomain(domain, dirname);
+ if (!dirname) {
+ PyErr_SetFromErrno(PyExc_OSError);
+ return NULL;
+ }
+ return PyString_FromString(dirname);
}
#ifdef HAVE_BIND_TEXTDOMAIN_CODESET
@@ -668,26 +668,26 @@ PyDoc_STRVAR(bind_textdomain_codeset__doc__,
static PyObject*
PyIntl_bind_textdomain_codeset(PyObject* self,PyObject*args)
{
- char *domain,*codeset;
- if (!PyArg_ParseTuple(args, "sz", &domain, &codeset))
- return NULL;
- codeset = bind_textdomain_codeset(domain, codeset);
- if (codeset)
- return PyString_FromString(codeset);
- Py_RETURN_NONE;
+ char *domain,*codeset;
+ if (!PyArg_ParseTuple(args, "sz", &domain, &codeset))
+ return NULL;
+ codeset = bind_textdomain_codeset(domain, codeset);
+ if (codeset)
+ return PyString_FromString(codeset);
+ Py_RETURN_NONE;
}
#endif
#endif
static struct PyMethodDef PyLocale_Methods[] = {
- {"setlocale", (PyCFunction) PyLocale_setlocale,
+ {"setlocale", (PyCFunction) PyLocale_setlocale,
METH_VARARGS, setlocale__doc__},
- {"localeconv", (PyCFunction) PyLocale_localeconv,
+ {"localeconv", (PyCFunction) PyLocale_localeconv,
METH_NOARGS, localeconv__doc__},
- {"strcoll", (PyCFunction) PyLocale_strcoll,
+ {"strcoll", (PyCFunction) PyLocale_strcoll,
METH_VARARGS, strcoll__doc__},
- {"strxfrm", (PyCFunction) PyLocale_strxfrm,
+ {"strxfrm", (PyCFunction) PyLocale_strxfrm,
METH_VARARGS, strxfrm__doc__},
#if defined(MS_WINDOWS) || defined(__APPLE__)
{"_getdefaultlocale", (PyCFunction) PyLocale_getdefaultlocale, METH_NOARGS},
@@ -711,7 +711,7 @@ static struct PyMethodDef PyLocale_Methods[] = {
{"bind_textdomain_codeset",(PyCFunction)PyIntl_bind_textdomain_codeset,
METH_VARARGS, bind_textdomain_codeset__doc__},
#endif
-#endif
+#endif
{NULL, NULL}
};
@@ -725,7 +725,7 @@ init_locale(void)
m = Py_InitModule("_locale", PyLocale_Methods);
if (m == NULL)
- return;
+ return;
d = PyModule_GetDict(m);
@@ -772,13 +772,13 @@ init_locale(void)
#ifdef HAVE_LANGINFO_H
for (i = 0; langinfo_constants[i].name; i++) {
- PyModule_AddIntConstant(m, langinfo_constants[i].name,
- langinfo_constants[i].value);
+ PyModule_AddIntConstant(m, langinfo_constants[i].name,
+ langinfo_constants[i].value);
}
#endif
}
-/*
+/*
Local variables:
c-basic-offset: 4
indent-tabs-mode: nil