Change in ...libosmocore[master]: vty: Simplify char escaping in asciidoc output

pespin gerrit-no-reply at lists.osmocom.org
Wed Jun 19 12:55:53 UTC 2019


pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/14538


Change subject: vty: Simplify char escaping in asciidoc output
......................................................................

vty: Simplify char escaping in asciidoc output

Change-Id: I7df6858bb98abffc1d5bf420f991ae5854b24638
---
M src/vty/command.c
1 file changed, 3 insertions(+), 8 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/38/14538/1

diff --git a/src/vty/command.c b/src/vty/command.c
index 89a2bc1..d8e7f7f 100644
--- a/src/vty/command.c
+++ b/src/vty/command.c
@@ -538,23 +538,18 @@
 
 	out_ptr = out;
 
-#define ADD(out, str) \
-	for (j = 0; j < strlen(str); ++j) \
-		*(out++) = str[j];
-
 	for (i = 0; i < _strlen; ++i) {
 		switch (inp[i]) {
 		case '|':
-			ADD(out_ptr, "\\|");
-			break;
+		/* Prepend escape character "\": */
+			*(out_ptr++) = '\\';
+			/* fall through */
 		default:
 			*(out_ptr++) = inp[i];
 			break;
 		}
 	}
 
-#undef ADD
-
 	out_ptr[0] = '\0';
 	return out;
 }

-- 
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/14538
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I7df6858bb98abffc1d5bf420f991ae5854b24638
Gerrit-Change-Number: 14538
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190619/8cc7ec8b/attachment.html>


More information about the gerrit-log mailing list