summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--viewres.c32
1 files changed, 11 insertions, 21 deletions
diff --git a/viewres.c b/viewres.c
index cc76fbf..cb4e9e2 100644
--- a/viewres.c
+++ b/viewres.c
@@ -231,11 +231,9 @@ static Arg true_args[1] = {{ XtNstate, (XtArgVal) TRUE }};
static void
usage(void)
{
- const char **cpp;
-
fprintf(stderr, "usage: %s [-options...]\n", ProgramName);
fprintf(stderr, "\nwhere options include:\n");
- for (cpp = help_message; *cpp; cpp++) {
+ for (const char **cpp = help_message; *cpp; cpp++) {
fprintf(stderr, " %s\n", *cpp);
}
fprintf(stderr, "\n");
@@ -266,9 +264,6 @@ widget_to_node(Widget gw)
static void
initialize_widgetnode_list(XmuWidgetNode ***listp, int *sizep, int n)
{
- int i;
- XmuWidgetNode **l;
-
if (!*listp) {
*listp = (XmuWidgetNode **)
XtCalloc((unsigned int) n, (unsigned int) sizeof(XmuWidgetNode **));
@@ -276,6 +271,9 @@ initialize_widgetnode_list(XmuWidgetNode ***listp, int *sizep, int n)
return;
}
if (n > *sizep) {
+ int i;
+ XmuWidgetNode **l;
+
*listp = (XmuWidgetNode **) XtRealloc((char *) *listp, (unsigned int)
(n * sizeof(XmuWidgetNode **)));
if (!*listp) {
@@ -292,7 +290,6 @@ initialize_widgetnode_list(XmuWidgetNode ***listp, int *sizep, int n)
static Boolean
set_resource_labels(XmuWidgetNode *node)
{
- Cardinal i;
const char **cur;
XtResourceList res;
XmuWidgetNode **wn;
@@ -307,7 +304,7 @@ set_resource_labels(XmuWidgetNode *node)
cur = d->resource_labels;
res = node->resources;
wn = node->resourcewn;
- for (i = 0; i < node->nresources; i++, res++, wn++) {
+ for (Cardinal i = 0; i < node->nresources; i++, res++, wn++) {
if (*wn == node) { /* should match nnew */
*cur++ = res->resource_name;
*cur++ = res->resource_class;
@@ -323,7 +320,7 @@ set_resource_labels(XmuWidgetNode *node)
}
res = node->constraints;
wn = node->constraintwn;
- for (i = 0; i < node->nconstraints; i++, res++, wn++) {
+ for (Cardinal i = 0; i < node->nconstraints; i++, res++, wn++) {
if (*wn == node) { /* should match nnew */
*cur++ = res->resource_name;
*cur++ = res->resource_class;
@@ -415,9 +412,7 @@ remove_from_selected_list(XmuWidgetNode *node, Boolean updatewidget)
static void
remove_nodes_from_selected_list(int start, int count, Boolean updatewidget)
{
- int i;
-
- for (i = 0; i < count; i++) {
+ for (int i = 0; i < count; i++) {
XmuWidgetNode *p = selected_list.elements[start + i];
ViewresData *d = VData(p);
@@ -489,12 +484,11 @@ create_resource_lw(XmuWidgetNode *node)
static void
update_selection_items(void)
{
- int i;
static Arg args[1] = { {XtNsensitive, (XtArgVal) FALSE} };
Boolean show = FALSE, hide = FALSE;
Boolean ancestors = FALSE, descendants = FALSE;
- for (i = 0; i < selected_list.n_elements; i++) {
+ for (int i = 0; i < selected_list.n_elements; i++) {
XmuWidgetNode *node = selected_list.elements[i];
ViewresData *d = VData(node);
@@ -579,10 +573,8 @@ show_resources_callback(Widget gw, /* menu or toggle button */
return;
}
else {
- int i;
-
XUnmapWindow(XtDisplay(treeWidget), XtWindow(treeWidget));
- for (i = 0; i < selected_list.n_elements; i++) {
+ for (int i = 0; i < selected_list.n_elements; i++) {
do_resources(selected_list.elements[i], op, FALSE);
}
}
@@ -893,7 +885,6 @@ main(int argc, char *argv[])
Dimension canvasWidth, canvasHeight, sliderWidth, sliderHeight;
static XtCallbackRec callback_rec[2] = { {NULL, NULL}, {NULL, NULL} };
XtGravity grav;
- int i;
ProgramName = argv[0];
@@ -931,7 +922,7 @@ main(int argc, char *argv[])
XtSetArg(args[1], XtNheight, 1);
dummy = XtCreateWidget("dummy", widgetClass, toplevel, args, TWO);
rootNode = XmuWnNameToNode(widget_list, nwidgets, "Object");
- for (i = 0; i < nwidgets; i++) {
+ for (int i = 0; i < nwidgets; i++) {
XmuWidgetNode *node = &widget_list[i];
XmuWnFetchResources(node, dummy, rootNode);
@@ -1188,14 +1179,13 @@ do_single_arg(Widget w, String *params, Cardinal nparams,
struct _nametable table[], int nentries, XtCallbackProc proc)
{
int obj;
- int i;
if (nparams != 1) {
XBell(XtDisplay(w), 0);
return;
}
- for (i = 0; i < nentries; i++) {
+ for (int i = 0; i < nentries; i++) {
if (XmuCompareISOLatin1(params[0], table[i].name) == 0) {
obj = table[i].value;
goto found;