guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

srfi-13 string-trim isspace on char


From: Kevin Ryde
Subject: srfi-13 string-trim isspace on char
Date: Tue, 06 Apr 2004 11:25:20 +1000
User-agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3 (gnu/linux)

        * srfi-13.c (scm_string_trim, scm_string_trim_right,
        scm_string_trim_both): Cast to unsigned char for isspace.

glibc works with negative char values, but c99 doesn't allow them.

On solaris 7, isspace is an array lookup and a char as an index
provokes a warning from gcc (3.3 at least).

This would probably be for the 1.6 branch too.

--- srfi-13.c.~1.19.~   2003-04-07 08:05:29.000000000 +1000
+++ srfi-13.c   2004-04-06 11:21:46.000000000 +1000
@@ -1,6 +1,6 @@
 /* srfi-13.c --- SRFI-13 procedures for Guile
  *
- * Copyright (C) 2001 Free Software Foundation, Inc.
+ * Copyright (C) 2001, 2004 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -593,7 +593,7 @@
     {
       while (cstart < cend)
        {
-         if (!isspace(cstr[cstart]))
+         if (!isspace((int) (unsigned char) cstr[cstart]))
            break;
          cstart++;
        }
@@ -668,7 +668,7 @@
     {
       while (cstart < cend)
        {
-         if (!isspace(cstr[cend - 1]))
+         if (!isspace((int) (unsigned char) cstr[cend - 1]))
            break;
          cend--;
        }
@@ -743,13 +743,13 @@
     {
       while (cstart < cend)
        {
-         if (!isspace(cstr[cstart]))
+         if (!isspace((int) (unsigned char) cstr[cstart]))
            break;
          cstart++;
        }
       while (cstart < cend)
        {
-         if (!isspace(cstr[cend - 1]))
+         if (!isspace((int) (unsigned char) cstr[cend - 1]))
            break;
          cend--;
        }

reply via email to

[Prev in Thread] Current Thread [Next in Thread]