]> granicus.if.org Git - python/commitdiff
Moved PyMac_GetScript() to _localemodule, which is the only place where
authorJack Jansen <jack.jansen@cwi.nl>
Thu, 15 Jul 2004 13:31:39 +0000 (13:31 +0000)
committerJack Jansen <jack.jansen@cwi.nl>
Thu, 15 Jul 2004 13:31:39 +0000 (13:31 +0000)
it is used, and made it private. Should fix #978662.

Include/pymactoolbox.h
Modules/_localemodule.c
Python/mactoolboxglue.c

index a1e2a6f6e4a6cd1bc91d75b0bf98187adbb045fd..403ddf5034fcd24b8fd7a2bb16697758c78985fb 100644 (file)
@@ -13,7 +13,6 @@
 /*
 ** Helper routines for error codes and such.
 */
-char *PyMac_getscript(void);                           /* Get the default encoding for our 8bit character set */
 char *PyMac_StrError(int);                                     /* strerror with mac errors */
 extern PyObject *PyMac_OSErrException;         /* Exception for OSErr */
 PyObject *PyMac_GetOSErrException(void);       /* Initialize & return it */
index 0ab79cba6068fa0e19296f1637a7bfe57a99048a..0f8a71aadc83b76fcab9edf349e5f4ccc23edc8a 100644 (file)
@@ -30,7 +30,7 @@ This software comes with no warranty. Use at your own risk.
 #endif
 
 #if defined(__APPLE__)
-#include "pymactoolbox.h"
+#include <CoreFoundation/CoreFoundation.h>
 #endif
 
 #if defined(MS_WINDOWS)
@@ -406,10 +406,34 @@ PyLocale_getdefaultlocale(PyObject* self)
 #endif
 
 #if defined(__APPLE__)
+/*
+** Find out what the current script is.
+** Donated by Fredrik Lund.
+*/
+static char *mac_getscript(void)
+{
+    CFStringEncoding enc = CFStringGetSystemEncoding();
+    static CFStringRef name = NULL;
+    /* Return the code name for the encodings for which we have codecs. */
+    switch(enc) {
+    case kCFStringEncodingMacRoman: return "mac-roman";
+    case kCFStringEncodingMacGreek: return "mac-greek";
+    case kCFStringEncodingMacCyrillic: return "mac-cyrillic";
+    case kCFStringEncodingMacTurkish: return "mac-turkish";
+    case kCFStringEncodingMacIcelandic: return "mac-icelandic";
+    /* XXX which one is mac-latin2? */
+    }
+    if (!name) {
+        /* This leaks a an object. */
+        name = CFStringConvertEncodingToIANACharSetName(enc);
+    }
+    return (char *)CFStringGetCStringPtr(name, 0); 
+}
+
 static PyObject*
 PyLocale_getdefaultlocale(PyObject* self)
 {
-    return Py_BuildValue("Os", Py_None, PyMac_getscript());
+    return Py_BuildValue("Os", Py_None, mac_getscript());
 }
 #endif
 
index 7308ae4e8bd194196b35c1369ad8b805e8b02d4f..ba150622299e11134ef5f8c9d107594f77b36a21 100644 (file)
@@ -27,30 +27,6 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #include "pymactoolbox.h"
 
 
-/*
-** Find out what the current script is.
-** Donated by Fredrik Lund.
-*/
-char *PyMac_getscript()
-{
-    CFStringEncoding enc = CFStringGetSystemEncoding();
-    static CFStringRef name = NULL;
-    /* Return the code name for the encodings for which we have codecs. */
-    switch(enc) {
-    case kCFStringEncodingMacRoman: return "mac-roman";
-    case kCFStringEncodingMacGreek: return "mac-greek";
-    case kCFStringEncodingMacCyrillic: return "mac-cyrillic";
-    case kCFStringEncodingMacTurkish: return "mac-turkish";
-    case kCFStringEncodingMacIcelandic: return "mac-icelandic";
-    /* XXX which one is mac-latin2? */
-    }
-    if (!name) {
-        /* This leaks a an object. */
-        name = CFStringConvertEncodingToIANACharSetName(enc);
-    }
-    return (char *)CFStringGetCStringPtr(name, 0); 
-}
-
 /* Like strerror() but for Mac OS error numbers */
 char *PyMac_StrError(int err)
 {