Module Name:    src
Committed By:   rillig
Date:           Fri Apr  2 15:06:35 UTC 2021

Modified Files:
        src/usr.bin/xlint/lint1: func.c tree.c

Log Message:
lint: rename getopname to op_name

There are several functions called 'get' that allocate memory.  Remove
this possible confusion.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.101 -r1.102 src/usr.bin/xlint/lint1/func.c
cvs rdiff -u -r1.259 -r1.260 src/usr.bin/xlint/lint1/tree.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/xlint/lint1/func.c
diff -u src/usr.bin/xlint/lint1/func.c:1.101 src/usr.bin/xlint/lint1/func.c:1.102
--- src/usr.bin/xlint/lint1/func.c:1.101	Fri Apr  2 12:16:50 2021
+++ src/usr.bin/xlint/lint1/func.c	Fri Apr  2 15:06:35 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: func.c,v 1.101 2021/04/02 12:16:50 rillig Exp $	*/
+/*	$NetBSD: func.c,v 1.102 2021/04/02 15:06:35 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: func.c,v 1.101 2021/04/02 12:16:50 rillig Exp $");
+__RCSID("$NetBSD: func.c,v 1.102 2021/04/02 15:06:35 rillig Exp $");
 #endif
 
 #include <stdlib.h>
@@ -447,7 +447,7 @@ check_case_label_enum(const tnode_t *tn,
 
 #if 0 /* not yet ready, see msg_130.c */
 	/* enum type mismatch: '%s' '%s' '%s' */
-	warning(130, type_name(ci->c_switch_type), getopname(EQ),
+	warning(130, type_name(ci->c_switch_type), op_name(EQ),
 	    type_name(tn->tn_type));
 #endif
 }

Index: src/usr.bin/xlint/lint1/tree.c
diff -u src/usr.bin/xlint/lint1/tree.c:1.259 src/usr.bin/xlint/lint1/tree.c:1.260
--- src/usr.bin/xlint/lint1/tree.c:1.259	Fri Apr  2 12:16:50 2021
+++ src/usr.bin/xlint/lint1/tree.c	Fri Apr  2 15:06:35 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: tree.c,v 1.259 2021/04/02 12:16:50 rillig Exp $	*/
+/*	$NetBSD: tree.c,v 1.260 2021/04/02 15:06:35 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: tree.c,v 1.259 2021/04/02 12:16:50 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.260 2021/04/02 15:06:35 rillig Exp $");
 #endif
 
 #include <float.h>
@@ -99,7 +99,7 @@ static	void	check_precedence_confusion(t
 extern sig_atomic_t fpe;
 
 static const char *
-getopname(op_t op)
+op_name(op_t op)
 {
 	return modtab[op].m_name;
 }
@@ -118,7 +118,7 @@ debug_node(const tnode_t *tn, int indent
 	op = tn->tn_op;
 	printf("%*s%s with type '%s'%s%s",
 	    2 * indent, "",
-	    op == CVT && !tn->tn_cast ? "convert" : getopname(op),
+	    op == CVT && !tn->tn_cast ? "convert" : op_name(op),
 	    type_name(tn->tn_type), tn->tn_lvalue ? ", lvalue" : "",
 	    tn->tn_parenthesized ? ", parenthesized" : "");
 
@@ -477,7 +477,7 @@ struct_or_union_member(tnode_t *tn, op_t
 			error(105, op == POINT ? "object" : "pointer");
 		} else {
 			/* unacceptable operand of '%s' */
-			error(111, getopname(op));
+			error(111, op_name(op));
 		}
 	}
 
@@ -999,7 +999,7 @@ typeok_ordered_comparison(op_t op,
 	const char *lx = lt == PTR ? "pointer" : "integer";
 	const char *rx = rt == PTR ? "pointer" : "integer";
 	/* illegal combination of %s (%s) and %s (%s), op %s */
-	warning(123, lx, type_name(ltp), rx, type_name(rtp), getopname(op));
+	warning(123, lx, type_name(ltp), rx, type_name(rtp), op_name(op));
 	return true;
 }
 
@@ -1184,7 +1184,7 @@ typeok_strict_bool_compatible(op_t op, i
 		error(211, tspec_name(lt), tspec_name(rt));
 	} else {
 		/* operands of '%s' have incompatible types (%s != %s) */
-		error(107, getopname(op), tspec_name(lt), tspec_name(rt));
+		error(107, op_name(op), tspec_name(lt), tspec_name(rt));
 	}
 
 	return false;
@@ -1222,17 +1222,17 @@ typeok_scalar_strict_bool(op_t op, const
 
 		if (!binary && !lbool) {
 			/* operand of '%s' must be bool, not '%s' */
-			error(330, getopname(op), tspec_name(lt));
+			error(330, op_name(op), tspec_name(lt));
 			ok = false;
 		}
 		if (binary && !lbool) {
 			/* left operand of '%s' must be bool, not '%s' */
-			error(331, getopname(op), tspec_name(lt));
+			error(331, op_name(op), tspec_name(lt));
 			ok = false;
 		}
 		if (binary && op != QUEST && !is_typeok_bool_operand(rn)) {
 			/* right operand of '%s' must be bool, not '%s' */
-			error(332, getopname(op), tspec_name(rt));
+			error(332, op_name(op), tspec_name(rt));
 			ok = false;
 		}
 		return ok;
@@ -1245,17 +1245,17 @@ typeok_scalar_strict_bool(op_t op, const
 
 		if (!binary && lbool) {
 			/* operand of '%s' must not be bool */
-			error(335, getopname(op));
+			error(335, op_name(op));
 			ok = false;
 		}
 		if (binary && lbool) {
 			/* left operand of '%s' must not be bool */
-			error(336, getopname(op));
+			error(336, op_name(op));
 			ok = false;
 		}
 		if (binary && rn->tn_type->t_tspec == BOOL) {
 			/* right operand of '%s' must not be bool */
-			error(337, getopname(op));
+			error(337, op_name(op));
 			ok = false;
 		}
 		return ok;
@@ -1712,7 +1712,7 @@ check_bad_enum_operation(op_t op, const 
 	}
 
 	/* dubious operation on enum, op %s */
-	warning(241, getopname(op));
+	warning(241, op_name(op));
 
 }
 
@@ -1790,7 +1790,7 @@ check_enum_int_mismatch(op_t op, int arg
 	default:
 		/* combination of '%s' and '%s', op %s */
 		warning(242, type_name(ln->tn_type), type_name(rn->tn_type),
-		    getopname(op));
+		    op_name(op));
 		break;
 	}
 }
@@ -2433,7 +2433,7 @@ convert_constant(op_t op, int arg, const
 			 */
 			if (nsz < osz && (v->v_quad & xmask) != 0) {
 				/* constant truncated by conv., op %s */
-				warning(306, getopname(op));
+				warning(306, op_name(op));
 			}
 		} else if (op == ANDASS || op == BITAND) {
 			/*
@@ -2446,12 +2446,12 @@ convert_constant(op_t op, int arg, const
 			    (nv->v_quad & xmask) != xmask) {
 				/* extra bits set to 0 in conv. of '%s' ... */
 				warning(309, type_name(gettyp(ot)),
-				    type_name(tp), getopname(op));
+				    type_name(tp), op_name(op));
 			} else if (nsz < osz &&
 				   (v->v_quad & xmask) != xmask &&
 				   (v->v_quad & xmask) != 0) {
 				/* constant truncated by conv., op %s */
-				warning(306, getopname(op));
+				warning(306, op_name(op));
 			}
 		} else if ((nt != PTR && is_uinteger(nt)) &&
 			   (ot != PTR && !is_uinteger(ot)) &&
@@ -2953,7 +2953,7 @@ build_assignment(op_t op, tnode_t *ln, t
 				error(212);
 			} else {
 				/* unknown operand size, op %s */
-				error(138, getopname(op));
+				error(138, op_name(op));
 			}
 			return NULL;
 		}

Reply via email to