This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 4/6] generated character data for libc/ctype


Am 23.03.2018 um 20:43 schrieb Corinna Vinschen:
On Mar 23 20:28, Thomas Wolff wrote:
While meditating, I noticed that the bit packing of the case conversion
entries could use some documentation.
The attached patch adds that (and some tweaking for consistent indentation);
no code changes.
Thomas
 From f8f4784437d319ad3ac2e3c629335fd0f50bee69 Mon Sep 17 00:00:00 2001
From: Thomas Wolff <towo@towo.net>
Date: Fri, 23 Mar 2018 20:07:22 +0100
Subject: [PATCH] comments to document struct caseconv_entry

explain design of compact (packed) struct caseconv_entry,
in case it needs to be modified for future Unicode versions;
indentation tweaks
[...]
    if (cce)
      switch (cce->mode)
        {
-      case TOLO:
-	return c + cce->delta;
-      case TOBOTH:
-	return c + 1;
-      case TO1:
-	switch (cce->delta)
-	  {
-	    case EVENCAP:
-	      if (!(c & 1))
-		return c + 1;
-	      break;
-	    case ODDCAP:
-	      if (c & 1)
-		return c + 1;
-	      break;
-	    default:
-	      break;
-	  }
+	case TOLO:
+	  return c + cce->delta;
+	case TOBOTH:
+	  return c + 1;
+	case TO1:
+	  switch (cce->delta)
+	    {
+	      case EVENCAP:
+		if (!(c & 1))
+		  return c + 1;
+		break;
+	      case ODDCAP:
+		if (c & 1)
+		  return c + 1;
+		break;
+	      default:
+		break;
+	    }
Thanks but the indentation for switch statements is correct as is.
Check and compare with other GNU sources like Cygwin or GDB.  The other
style is with sources taken from BSD as in vfprintf.c, but that's not
the case here.
Whichever the style is, the previous version was inconsistent in itself, with "case" sometimes indented from "{" and sometimes not:
    switch (cce->mode)
      {
      case TO1:
        switch (cce->delta)
          {
            case EVENCAP:

But I don't care so much, we can reduce the patch to the documentation, of couse.
Thomas


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]