From owner-p4-projects@FreeBSD.ORG Sun Jun 13 20:29:31 2004 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id D9C8016A4D1; Sun, 13 Jun 2004 20:29:30 +0000 (GMT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B344616A4CE for ; Sun, 13 Jun 2004 20:29:30 +0000 (GMT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 98A9E43D2F for ; Sun, 13 Jun 2004 20:29:30 +0000 (GMT) (envelope-from marcel@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.11/8.12.11) with ESMTP id i5DKSMJW045617 for ; Sun, 13 Jun 2004 20:28:22 GMT (envelope-from marcel@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.11/8.12.11/Submit) id i5DKSLSd045614 for perforce@freebsd.org; Sun, 13 Jun 2004 20:28:21 GMT (envelope-from marcel@freebsd.org) Date: Sun, 13 Jun 2004 20:28:21 GMT Message-Id: <200406132028.i5DKSLSd045614@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to marcel@freebsd.org using -f From: Marcel Moolenaar To: Perforce Change Reviews Subject: PERFORCE change 54854 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Jun 2004 20:29:31 -0000 http://perforce.freebsd.org/chv.cgi?CH=54854 Change 54854 by marcel@marcel_nfs on 2004/06/13 20:28:17 o KNFify db_variables.c o Change prototype for db_read_variable. o Make db_write_variable and db_set_variable usable. Affected files ... .. //depot/projects/gdb/sys/ddb/db_variables.c#2 edit .. //depot/projects/gdb/sys/ddb/db_variables.h#2 edit Differences ... ==== //depot/projects/gdb/sys/ddb/db_variables.c#2 (text+ko) ==== @@ -39,11 +39,6 @@ #include static int db_find_variable(struct db_variable **varp); -static void db_write_variable(struct db_variable *, db_expr_t *); - -#ifdef notused -static int db_set_variable(db_expr_t value); -#endif static struct db_variable db_vars[] = { { "radix", &db_radix, FCN_NULL }, @@ -51,123 +46,107 @@ { "maxwidth", &db_max_width, FCN_NULL }, { "tabstops", &db_tab_stop_width, FCN_NULL }, }; -static struct db_variable *db_evars = - db_vars + sizeof(db_vars)/sizeof(db_vars[0]); +static struct db_variable *db_evars = + db_vars + sizeof(db_vars)/sizeof(db_vars[0]); static int -db_find_variable(varp) - struct db_variable **varp; +db_find_variable(struct db_variable **varp) { - int t; struct db_variable *vp; + int t; t = db_read_token(); if (t == tIDENT) { - for (vp = db_vars; vp < db_evars; vp++) { - if (!strcmp(db_tok_string, vp->name)) { - *varp = vp; - return (1); + for (vp = db_vars; vp < db_evars; vp++) { + if (!strcmp(db_tok_string, vp->name)) { + *varp = vp; + return (1); + } } - } - for (vp = db_regs; vp < db_eregs; vp++) { - if (!strcmp(db_tok_string, vp->name)) { - *varp = vp; - return (1); + for (vp = db_regs; vp < db_eregs; vp++) { + if (!strcmp(db_tok_string, vp->name)) { + *varp = vp; + return (1); + } } - } } db_error("Unknown variable\n"); return (0); } int -db_get_variable(valuep) - db_expr_t *valuep; +db_get_variable(db_expr_t *valuep) { struct db_variable *vp; if (!db_find_variable(&vp)) - return (0); + return (0); - db_read_variable(vp, valuep); - - return (1); + return (db_read_variable(vp, valuep)); } -#ifdef notused -static int -db_set_variable(value) - db_expr_t value; +int +db_set_variable(db_expr_t value) { struct db_variable *vp; if (!db_find_variable(&vp)) - return (0); + return (0); - db_write_variable(vp, &value); - - return (1); + return (db_write_variable(vp, value)); } -#endif -void -db_read_variable(vp, valuep) - struct db_variable *vp; - db_expr_t *valuep; +int +db_read_variable(struct db_variable *vp, db_expr_t *valuep) { - db_varfcn_t *func = vp->fcn; + db_varfcn_t *func = vp->fcn; - if (func == FCN_NULL) - *valuep = *(vp->valuep); - else - (*func)(vp, valuep, DB_VAR_GET); + if (func == FCN_NULL) { + *valuep = *(vp->valuep); + return (1); + } + return ((*func)(vp, valuep, DB_VAR_GET)); } -static void -db_write_variable(vp, valuep) - struct db_variable *vp; - db_expr_t *valuep; +int +db_write_variable(struct db_variable *vp, db_expr_t value) { - db_varfcn_t *func = vp->fcn; + db_varfcn_t *func = vp->fcn; - if (func == FCN_NULL) - *(vp->valuep) = *valuep; - else - (*func)(vp, valuep, DB_VAR_SET); + if (func == FCN_NULL) { + *(vp->valuep) = value; + return (1); + } + return ((*func)(vp, &value, DB_VAR_SET)); } void -db_set_cmd(dummy1, dummy2, dummy3, dummy4) - db_expr_t dummy1; - boolean_t dummy2; - db_expr_t dummy3; - char * dummy4; +db_set_cmd(db_expr_t dummy1, boolean_t dummy2, db_expr_t dummy3, char *dummy4) { - db_expr_t value; struct db_variable *vp; - int t; + db_expr_t value; + int t; t = db_read_token(); if (t != tDOLLAR) { - db_error("Unknown variable\n"); - return; + db_error("Unknown variable\n"); + return; } if (!db_find_variable(&vp)) { - db_error("Unknown variable\n"); - return; + db_error("Unknown variable\n"); + return; } t = db_read_token(); if (t != tEQ) - db_unread_token(t); + db_unread_token(t); if (!db_expression(&value)) { - db_error("No value\n"); - return; + db_error("No value\n"); + return; } - if (db_read_token() != tEOL) { - db_error("?\n"); - } + if (db_read_token() != tEOL) + db_error("?\n"); - db_write_variable(vp, &value); + db_write_variable(vp, value); } ==== //depot/projects/gdb/sys/ddb/db_variables.h#2 (text+ko) ==== @@ -52,6 +52,7 @@ extern struct db_variable db_regs[]; /* machine registers */ extern struct db_variable *db_eregs; -void db_read_variable(struct db_variable *, db_expr_t *); +int db_read_variable(struct db_variable *, db_expr_t *); +int db_write_variable(struct db_variable *, db_expr_t); #endif /* _!DDB_DB_VARIABLES_H_ */