[Git][cmucl/cmucl][issue-139-add-alias-local-external-format] 2 commits: Revert an unexpected space change that's not relevant

Raymond Toy (@rtoy) gitlab at common-lisp.net
Tue Nov 22 21:45:50 UTC 2022



Raymond Toy pushed to branch issue-139-add-alias-local-external-format at cmucl / cmucl


Commits:
ee9f2d02 by Raymond Toy at 2022-11-22T08:34:24-08:00
Revert an unexpected space change that's not relevant

Not sure why tabs were converted to spaces, but that has been reverted
so that the diff is smaller, as expected.

- - - - -
eb17d936 by Raymond Toy at 2022-11-22T13:44:34-08:00
Change os_get_locale_codeset to return the result of nl_langinfo

Update unix::unix-get-locale-codeset appropriately

- - - - -


4 changed files:

- src/code/unix.lisp
- src/i18n/locale/cmucl-unix.pot
- src/lisp/os-common.c
- tests/issues.lisp


Changes:

=====================================
src/code/unix.lisp
=====================================
@@ -2918,10 +2918,7 @@
 
 (defun unix-get-locale-codeset ()
   _N"Get the codeset from the locale"
-  (with-alien ((codeset (array c-call:char 512)))
-    (alien-funcall
+  (cast (alien-funcall
 	    (extern-alien "os_get_locale_codeset"
-			  (function void (* char) int))
-	    (cast codeset (* c-call:char))
-	    512)
-    (cast codeset c-string)))
+			  (function (* char))))
+	c-string))


=====================================
src/i18n/locale/cmucl-unix.pot
=====================================
@@ -1428,6 +1428,13 @@ msgstr ""
 msgid "Call setlocale(3c) with fixed args.  Returns 0 on success."
 msgstr ""
 
+#: src/code/unix.lisp
+msgid ""
+"Get LC_MESSAGES from the current locale.  If we can't, return\n"
+"  NIL.  A call to UNIX-SETLOCALE must have been done previously before\n"
+"  calling this so that the correct locale is returned."
+msgstr ""
+
 #: src/code/unix.lisp
 msgid "Get the codeset from the locale"
 msgstr ""


=====================================
src/lisp/os-common.c
=====================================
@@ -798,12 +798,8 @@ os_get_lc_messages(char *buf, int len)
     return locale ? 0 : -1;
 }
 
-void
-os_get_locale_codeset(char* codeset, int len)
+char *
+os_get_locale_codeset()
 {
-    char *code;
-    
-    code = nl_langinfo(CODESET);
-
-    strncpy(codeset, code, len);
+    return nl_langinfo(CODESET);
 }


=====================================
tests/issues.lisp
=====================================
@@ -727,24 +727,24 @@
   ;; using an explicit format of utf8 and verifying that we got the
   ;; right contents.
   (let ((string (concatenate 'string
-                             ;; This is "hello" in Korean
-                             '(#\Hangul_syllable_an
-                               #\Hangul_Syllable_Nyeong
-                               #\Hangul_Syllable_Ha
-                               #\Hangul_Syllable_Se
-                               #\Hangul_Syllable_Yo))))
+			     ;; This is "hello" in Korean
+			     '(#\Hangul_syllable_an
+			       #\Hangul_Syllable_Nyeong
+			       #\Hangul_Syllable_Ha
+			       #\Hangul_Syllable_Se
+			       #\Hangul_Syllable_Yo))))
     (with-open-file (s (merge-pathnames "out-utf8.txt"
-                                        *test-path*)
-                       :direction :output
-                       :if-exists :supersede)
+					*test-path*)
+		       :direction :output
+		       :if-exists :supersede)
       (write-line string s))
     (with-open-file (s (merge-pathnames "out-utf8.txt"
-                                        *test-path*)
-                       :direction :input
-                       :external-format :utf-8)
+					*test-path*)
+		       :direction :input
+		       :external-format :utf-8)
       (assert-equal (map 'list #'char-name string)
-                   (map 'list #'char-name (read-line s))))))
-
+		    (map 'list #'char-name (read-line s))))))
+  
 (define-test issue.139-locale-external-format
     (:tag :issues)
   ;; Just verify that :locale format exists



View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/10f6311f91ae56ce58b57e4bd412a5351f78737a...eb17d9369d6bfc901352f23f77e1f3e5df9fbd90

-- 
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/10f6311f91ae56ce58b57e4bd412a5351f78737a...eb17d9369d6bfc901352f23f77e1f3e5df9fbd90
You're receiving this email because of your account on gitlab.common-lisp.net.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/cmucl-cvs/attachments/20221122/48bf2443/attachment-0001.html>


More information about the cmucl-cvs mailing list