Skip to contentSkip to conversation

edit: replace ASCII codes by symbolic names

PATCH Applied Ahmad Fatoum 2 participants 2 messages Sep 9, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 edit: replace ASCII codes by symbolic names

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

---
 commands/edit.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
commands/edit.c +5 -5
index 290222ce152f..ba6a8c7cdd78 100644
@@ -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)
Signature · 7 lines
2.20.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Applied
#1 lore raw
Quoted 7 lines · Ahmad Fatoum

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

---
 commands/edit.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Applied, thanks

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox