mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <ahmad@a3f.at>
To: barebox@lists.infradead.org
Subject: [PATCH] edit: replace ASCII codes by symbolic names
Date: Mon,  9 Sep 2019 11:20:47 +0200	[thread overview]
Message-ID: <20190909092047.27504-1-ahmad@a3f.at> (raw)

Code has some magic numbers, replace them. This has the added benefit that
at least the touched lines are now charset-agnostic.

Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
---
 commands/edit.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/commands/edit.c b/commands/edit.c
index 290222ce152f..ba6a8c7cdd78 100644
--- a/commands/edit.c
+++ b/commands/edit.c
@@ -524,12 +524,12 @@ static int do_edit(int argc, char *argv[])
 			} else
 				delete_char(textx);
 			break;
-		case 13:
-		case 10:
+		case '\r':
+		case '\n':
 			split_line();
 			break;
 		case 127:
-		case 8:
+		case '\b':
 			if (textx > 0) {
 				textx--;
 				delete_char(textx);
@@ -542,10 +542,10 @@ static int do_edit(int argc, char *argv[])
 				merge_line(curline);
 			}
 			break;
-		case 4:
+		case CTL_CH('d'):
 			ret = save_file(argv[1]);
 			goto out;
-		case 3:
+		case CTL_CH('c'):
 			goto out;
 		default:
 			if ((signed char)c != -1)
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

             reply	other threads:[~2019-09-09  9:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-09  9:20 Ahmad Fatoum [this message]
2019-09-09 13:15 ` Sascha Hauer

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=20190909092047.27504-1-ahmad@a3f.at \
    --to=ahmad@a3f.at \
    --cc=barebox@lists.infradead.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