Skip to contentSkip to conversation

another minor sparse change adding opnames.

PATCH New Dave Olien 1 participant 1 message Jun 23, 2003

lore
Share & tools
lore

Dave Olien

author
#0 lore raw

PATCH 1/1 another minor sparse change adding opnames.

Add more operations to the name list. Without these additions, the "and" operator is displayed as a null pointer.

In the original code, the "&" operator was within the name[] array, but didnt' have a string assigned to it. So printf() displayed it as the string "null". While I was at it, I added other operation names to the table.

show-parse.c +2 -1
@@ -607,7 +607,8 @@
 	static const char *name[] = {
 		['+'] = "add", ['-'] = "sub",
 		['*'] = "mul", ['/'] = "div",
-		['%'] = "mod"
+		['%'] = "mod", ['&'] = "and",
+		['|'] = "lor", ['^'] = "xor"
 	};
 	unsigned int op = expr->op;