diff mbox series

[3/3] jshn.c: write_key_string(): extract var

Message ID 20210222224755.50742-4-stokito@gmail.com
State New
Headers show
Series jshn: load envs only on formatting | expand

Commit Message

Sergey Ponomarev Feb. 22, 2021, 10:47 p.m. UTC
This makes code cleaner and helps compiler to optimize

Signed-off-by: Sergey Ponomarev <stokito@gmail.com>
---
 jshn.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/jshn.c b/jshn.c
index 8fdd290..7a2f935 100644
--- a/jshn.c
+++ b/jshn.c
@@ -96,8 +96,10 @@  static void add_json_string(const char *str)
 
 static void write_key_string(const char *key)
 {
-	while (*key) {
-		putc(isalnum(*key) ? *key : '_', stdout);
+	char k;
+	while ((k = *key)) {
+		k = isalnum(k) ? k : '_';
+		putc(k, stdout);
 		key++;
 	}
 }