mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sam Ravnborg <sam@ravnborg.org>
To: Roman Zippel <zippel@linux-m68k.org>
Cc: Matthew Wilcox <matthew@wil.cx>,
	wookey@debian.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Support DOS line endings
Date: Thu, 13 Jul 2006 21:35:43 +0200	[thread overview]
Message-ID: <20060713193543.GB312@mars.ravnborg.org> (raw)
In-Reply-To: <Pine.LNX.4.64.0607132039560.12900@scrub.home>

On Thu, Jul 13, 2006 at 08:47:12PM +0200, Roman Zippel wrote:
> Hi,
> 
> On Thu, 13 Jul 2006, Sam Ravnborg wrote:
> 
> > >       if (p2[-1] == '\r')
> > >               p2[-1] = 0;
> > Negative index'es always make me supsicious.
> 
> Opencoding of the strchr is not much better, you can change the above also 
> to (*--p2 == '\r').
There is no semantic difference between decrementing a variable and a
negative index.
But I used this one anyway.
So now it look like this.

	Sam

diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index a69d8ac..b7e7281 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -195,6 +195,8 @@ load:
 			p2 = strchr(p, '\n');
 			if (p2)
 				*p2 = 0;
+			if (*--p2 == '\r')
+				*p2 = 0;
 			if (def == S_DEF_USER) {
 				sym = sym_find(line + 7);
 				if (!sym) {
@@ -266,6 +268,7 @@ load:
 				;
 			}
 			break;
+		case '\r':
 		case '\n':
 			break;
 		default:

  reply	other threads:[~2006-07-13 19:35 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-07 17:34 Matthew Wilcox
2006-07-07 22:35 ` Sam Ravnborg
2006-07-08  3:23 ` Roman Zippel
2006-07-13 18:18   ` Sam Ravnborg
2006-07-13 18:29     ` Matthew Wilcox
2006-07-13 18:47     ` Roman Zippel
2006-07-13 19:35       ` Sam Ravnborg [this message]
2006-07-13 20:02         ` Matthew Wilcox
2006-07-13 21:07           ` Sam Ravnborg
2006-07-13 21:41             ` Bernd Petrovitsch
2006-07-19 12:02               ` Alistair John Strachan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060713193543.GB312@mars.ravnborg.org \
    --to=sam@ravnborg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matthew@wil.cx \
    --cc=wookey@debian.org \
    --cc=zippel@linux-m68k.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®