From 4fea709b5f138c4087954b57664d5f171e02a399 Mon Sep 17 00:00:00 2001
From: Ben Pfaff <blp@cs.stanford.edu>
Date: Fri, 16 Sep 2022 16:08:25 -0700
Subject: [PATCH] APPLY DICTIONARY: Style improvements.

---
 src/language/dictionary/apply-dictionary.c | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/src/language/dictionary/apply-dictionary.c b/src/language/dictionary/apply-dictionary.c
index eae06df76c..354a517055 100644
--- a/src/language/dictionary/apply-dictionary.c
+++ b/src/language/dictionary/apply-dictionary.c
@@ -39,28 +39,25 @@
 int
 cmd_apply_dictionary (struct lexer *lexer, struct dataset *ds)
 {
-  struct file_handle *handle;
-  struct casereader *reader;
-  struct dictionary *dict;
-
-  int n_matched = 0;
-
-  int i;
-
   lex_match_id (lexer, "FROM");
   lex_match (lexer, T_EQUALS);
 
-  handle = fh_parse (lexer, FH_REF_FILE, dataset_session (ds));
+  struct file_handle *handle = fh_parse (lexer, FH_REF_FILE,
+                                         dataset_session (ds));
   if (!handle)
     return CMD_FAILURE;
-  reader = any_reader_open_and_decode (handle, NULL, &dict, NULL);
+
+  struct dictionary *dict;
+  struct casereader *reader = any_reader_open_and_decode (handle, NULL, &dict,
+                                                          NULL);
   fh_unref (handle);
   if (!reader)
     return CMD_FAILURE;
 
   casereader_destroy (reader);
 
-  for (i = 0; i < dict_get_n_vars (dict); i++)
+  size_t n_matched = 0;
+  for (size_t i = 0; i < dict_get_n_vars (dict); i++)
     {
       const struct variable *s = dict_get_var (dict, i);
       struct variable *t = dict_lookup_var (dataset_dict (ds),
-- 
2.30.2