[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Rename 'FILE *fd' to 'FILE *fp'.
From: |
Tim Rühsen |
Subject: |
[PATCH] Rename 'FILE *fd' to 'FILE *fp'. |
Date: |
Tue, 12 May 2020 19:33:56 +0200 |
2020-05-12 Tim Rühsen <address@hidden>
* libpoke/pkl-ast.c (pkl_ast_lvalue_p): Rename 'FILE *fd'
to 'FILE *fp'.
(pkl_ast_print_1): Likewise.
(pkl_ast_print): Likewise.
* libpoke/pkl-ast.h (pkl_ast_print): Likewise.
* libpoke/pkl-diag.c (pkl_detailed_location): Likewise.
* libpoke/pkl-parser.c (pkl_parse_file): Likewise.
* libpoke/pkl-parser.h (pkl_parse_file): Likewise.
* libpoke/pkl-tab.y (load_module): Likewise.
* libpoke/pkl.c (pkl_compile_file): Likewise.
* poke/pk-cmd-editor.c (pk_cmd_editor): Likewise.
* poke/pk-cmd.c (pk_cmd_exec_script): Likewise.
---
ChangeLog | 15 +++++++++++++++
jitter | 2 +-
libpoke/pkl-ast.c | 18 +++++++++---------
libpoke/pkl-ast.h | 2 +-
libpoke/pkl-diag.c | 12 ++++++------
libpoke/pkl-parser.c | 6 +++---
libpoke/pkl-parser.h | 2 +-
libpoke/pkl-tab.y | 12 ++++++------
libpoke/pkl.c | 12 ++++++------
poke/pk-cmd-editor.c | 8 ++++----
poke/pk-cmd.c | 10 +++++-----
11 files changed, 57 insertions(+), 42 deletions(-)
diff --git a/jitter b/jitter
index 25386405..7f67aa43 160000
--- a/jitter
+++ b/jitter
@@ -1 +1 @@
-Subproject commit 25386405ae85e0662b799473cb0bb9245adcfa65
+Subproject commit 7f67aa439ed1ed0234e0f85cf2319a86d248f3e2
diff --git a/libpoke/pkl-ast.c b/libpoke/pkl-ast.c
index 59e12285..2f297011 100644
--- a/libpoke/pkl-ast.c
+++ b/libpoke/pkl-ast.c
@@ -2423,10 +2423,10 @@ pkl_ast_lvalue_p (pkl_ast_node node)
int i; \
for (i = 0; i < indent; i++) \
if (indent >= 2 && i % 2 == 0) \
- fprintf (fd, "|"); \
+ fprintf (fp, "|"); \
else \
- fprintf (fd, " "); \
- fprintf (fd, __VA_ARGS__); \
+ fprintf (fp, " "); \
+ fprintf (fp, __VA_ARGS__); \
} while (0)
#define PRINT_AST_IMM(NAME,MACRO,FMT) \
@@ -2441,7 +2441,7 @@ pkl_ast_lvalue_p (pkl_ast_node node)
do \
{ \
IPRINTF (#NAME ":\n"); \
- pkl_ast_print_1 (fd, PKL_AST_##MACRO (ast), indent + 2); \
+ pkl_ast_print_1 (fp, PKL_AST_##MACRO (ast), indent + 2); \
} \
while (0)
@@ -2462,13 +2462,13 @@ pkl_ast_lvalue_p (pkl_ast_node node)
child; \
child = PKL_AST_CHAIN (child)) \
{ \
- pkl_ast_print_1 (fd, child, indent + 2); \
+ pkl_ast_print_1 (fp, child, indent + 2); \
}
/* Auxiliary function used by `pkl_ast_print', defined below. */
static void
-pkl_ast_print_1 (FILE *fd, pkl_ast_node ast, int indent)
+pkl_ast_print_1 (FILE *fp, pkl_ast_node ast, int indent)
{
pkl_ast_node child;
size_t i;
@@ -2550,7 +2550,7 @@ pkl_ast_print_1 (FILE *fd, pkl_ast_node ast, int indent)
PRINT_AST_IMM (numops, EXP_NUMOPS, "%d");
IPRINTF ("operands:\n");
for (i = 0; i < PKL_AST_EXP_NUMOPS (ast); i++)
- pkl_ast_print_1 (fd, PKL_AST_EXP_OPERAND (ast, i),
+ pkl_ast_print_1 (fp, PKL_AST_EXP_OPERAND (ast, i),
indent + 2);
break;
}
@@ -2956,9 +2956,9 @@ pkl_ast_print_1 (FILE *fd, pkl_ast_node ast, int indent)
compiler. */
void
-pkl_ast_print (FILE *fd, pkl_ast_node ast)
+pkl_ast_print (FILE *fp, pkl_ast_node ast)
{
- pkl_ast_print_1 (fd, ast, 0);
+ pkl_ast_print_1 (fp, ast, 0);
}
#undef IPRINTF
diff --git a/libpoke/pkl-ast.h b/libpoke/pkl-ast.h
index c7f90c27..ed1e1cc7 100644
--- a/libpoke/pkl-ast.h
+++ b/libpoke/pkl-ast.h
@@ -1847,7 +1847,7 @@ void pkl_ast_node_free_chain (pkl_ast_node ast)
pkl_ast_node pkl_ast_reverse (pkl_ast_node ast)
__attribute__ ((visibility ("hidden")));
-void pkl_ast_print (FILE *fd, pkl_ast_node ast)
+void pkl_ast_print (FILE *fp, pkl_ast_node ast)
__attribute__ ((visibility ("hidden")));
#endif /* ! PKL_AST_H */
diff --git a/libpoke/pkl-diag.c b/libpoke/pkl-diag.c
index b54a65a8..08c02bee 100644
--- a/libpoke/pkl-diag.c
+++ b/libpoke/pkl-diag.c
@@ -63,17 +63,17 @@ pkl_detailed_location (pkl_ast ast, pkl_ast_loc loc,
}
else
{
- FILE *fd = ast->file;
+ FILE *fp = ast->file;
int c;
- off_t cur_pos = ftello (fd);
+ off_t cur_pos = ftello (fp);
off_t tmp;
/* Seek to the beginning of the file. */
- tmp = fseeko (fd, 0, SEEK_SET);
+ tmp = fseeko (fp, 0, SEEK_SET);
assert (tmp == 0);
- while ((c = fgetc (fd)) != EOF)
+ while ((c = fgetc (fp)) != EOF)
{
if (c == '\n')
{
@@ -91,7 +91,7 @@ pkl_detailed_location (pkl_ast ast, pkl_ast_loc loc,
{
if (c != '\n')
pk_printf ("%c", c);
- c = fgetc (fd);
+ c = fgetc (fp);
}
while (c != EOF && c != '\0' && c != '\n');
break;
@@ -99,7 +99,7 @@ pkl_detailed_location (pkl_ast ast, pkl_ast_loc loc,
}
/* Restore the file position so parsing can continue. */
- tmp = fseeko (fd, cur_pos, SEEK_SET);
+ tmp = fseeko (fp, cur_pos, SEEK_SET);
assert (tmp == 0);
}
diff --git a/libpoke/pkl-parser.c b/libpoke/pkl-parser.c
index dd46a94a..5dd42555 100644
--- a/libpoke/pkl-parser.c
+++ b/libpoke/pkl-parser.c
@@ -68,7 +68,7 @@ pkl_parser_free (struct pkl_parser *parser)
int
pkl_parse_file (pkl_compiler compiler, pkl_env *env,
- pkl_ast *ast, FILE *fd, const char *fname)
+ pkl_ast *ast, FILE *fp, const char *fname)
{
int ret;
struct pkl_parser *parser;
@@ -80,9 +80,9 @@ pkl_parse_file (pkl_compiler compiler, pkl_env *env,
parser->bootstrapped = pkl_bootstrapped_p (compiler);
parser->env = *env;
- parser->ast->file = fd;
+ parser->ast->file = fp;
parser->ast->filename = xstrdup (fname);
- pkl_tab_set_in (fd, parser->scanner);
+ pkl_tab_set_in (fp, parser->scanner);
ret = pkl_tab_parse (parser);
*ast = parser->ast;
*env = parser->env;
diff --git a/libpoke/pkl-parser.h b/libpoke/pkl-parser.h
index 36586bbb..d565ddf8 100644
--- a/libpoke/pkl-parser.h
+++ b/libpoke/pkl-parser.h
@@ -55,7 +55,7 @@ struct pkl_parser
#define PKL_PARSE_STATEMENT 3
int pkl_parse_file (pkl_compiler compiler, pkl_env *env, pkl_ast *ast,
- FILE *fd, const char *fname)
+ FILE *fp, const char *fname)
__attribute__ ((visibility ("hidden")));
int pkl_parse_buffer (pkl_compiler compiler, pkl_env *env, pkl_ast *ast,
diff --git a/libpoke/pkl-tab.y b/libpoke/pkl-tab.y
index b95b4ada..0e17f89b 100644
--- a/libpoke/pkl-tab.y
+++ b/libpoke/pkl-tab.y
@@ -198,7 +198,7 @@ load_module (struct pkl_parser *parser,
{
char *module_filename = NULL;
pkl_ast ast;
- FILE *fd;
+ FILE *fp;
module_filename = pkl_resolve_module (parser->compiler,
module,
@@ -214,8 +214,8 @@ load_module (struct pkl_parser *parser,
return 0;
}
- fd = fopen (module_filename, "rb");
- if (!fd)
+ fp = fopen (module_filename, "rb");
+ if (!fp)
{
free (module_filename);
return 1;
@@ -224,11 +224,11 @@ load_module (struct pkl_parser *parser,
/* Parse the file, using the given environment. The declarations
found in the parsed file are appended to that environment, so
nothing extra should be done about that. */
- if (pkl_parse_file (parser->compiler, &parser->env, &ast, fd,
+ if (pkl_parse_file (parser->compiler, &parser->env, &ast, fp,
module_filename)
!= 0)
{
- fclose (fd);
+ fclose (fp);
free (module_filename);
return 2;
}
@@ -245,7 +245,7 @@ load_module (struct pkl_parser *parser,
PKL_AST_PROGRAM_ELEMS (ast->ast) = NULL;
pkl_ast_free (ast);
- fclose (fd);
+ fclose (fp);
free (module_filename);
return 0;
}
diff --git a/libpoke/pkl.c b/libpoke/pkl.c
index db23d09d..d2a26252 100644
--- a/libpoke/pkl.c
+++ b/libpoke/pkl.c
@@ -396,20 +396,20 @@ pkl_compile_file (pkl_compiler compiler, const char
*fname)
int ret;
pkl_ast ast = NULL;
pvm_program program;
- FILE *fd;
+ FILE *fp;
pkl_env env = NULL;
compiler->compiling = PKL_COMPILING_PROGRAM;
- fd = fopen (fname, "rb");
- if (!fd)
+ fp = fopen (fname, "rb");
+ if (!fp)
{
perror (fname);
return 0;
}
env = pkl_env_dup_toplevel (compiler->env);
- ret = pkl_parse_file (compiler, &env, &ast, fd, fname);
+ ret = pkl_parse_file (compiler, &env, &ast, fp, fname);
if (ret == 1)
/* Parse error. */
goto error;
@@ -424,7 +424,7 @@ pkl_compile_file (pkl_compiler compiler, const char *fname)
goto error;
pvm_program_make_executable (program);
- fclose (fd);
+ fclose (fp);
/* Execute the program in the poke vm. */
{
@@ -442,7 +442,7 @@ pkl_compile_file (pkl_compiler compiler, const char *fname)
return 1;
error:
- fclose (fd);
+ fclose (fp);
error_no_close:
pkl_env_free (env);
return 0;
diff --git a/poke/pk-cmd-editor.c b/poke/pk-cmd-editor.c
index e2dc17f8..b8845fa2 100644
--- a/poke/pk-cmd-editor.c
+++ b/poke/pk-cmd-editor.c
@@ -37,7 +37,7 @@ pk_cmd_editor (int argc, struct pk_cmd_arg argv[], uint64_t
uflags)
char *cmdline;
char tmpfile[1024];
int des;
- FILE *f;
+ FILE *fp;
/* Do nothing (succesfully) if not in interactive mode. */
if (!poke_interactive_p)
@@ -94,14 +94,14 @@ pk_cmd_editor (int argc, struct pk_cmd_arg argv[], uint64_t
uflags)
/* If the editor returned success and a file got created, read the
contents of the file, turn newlines into spaces and execute
it. */
- if ((f = fopen (tmpfile, "r")) != NULL)
+ if ((fp = fopen (tmpfile, "r")) != NULL)
{
const int STEP = 128;
char *newline = xmalloc (STEP);
size_t size, i = 0;
int c;
- for (size = STEP; (c = fgetc (f)) != EOF; i++)
+ for (size = STEP; (c = fgetc (fp)) != EOF; i++)
{
if (i % STEP == 0)
{
@@ -114,7 +114,7 @@ pk_cmd_editor (int argc, struct pk_cmd_arg argv[], uint64_t
uflags)
newline[i] = c;
}
newline[i] = '\0';
- fclose (f);
+ fclose (fp);
if (*newline != '\0')
{
diff --git a/poke/pk-cmd.c b/poke/pk-cmd.c
index 439b2cc7..5eaaaa9d 100644
--- a/poke/pk-cmd.c
+++ b/poke/pk-cmd.c
@@ -630,9 +630,9 @@ pk_cmd_exec (const char *str)
int
pk_cmd_exec_script (const char *filename)
{
- FILE *fd = fopen (filename, "r");
+ FILE *fp = fopen (filename, "r");
- if (fd == NULL)
+ if (fp == NULL)
{
perror (filename);
return 1;
@@ -650,7 +650,7 @@ pk_cmd_exec_script (const char *filename)
/* Read a line from the file. */
errno = 0;
- ssize_t n = getline (&line, &line_len, fd);
+ ssize_t n = getline (&line, &line_len, fp);
if (n == -1)
{
@@ -682,12 +682,12 @@ pk_cmd_exec_script (const char *filename)
}
free (line);
- fclose (fd);
+ fclose (fp);
return 1;
error:
free (line);
- fclose (fd);
+ fclose (fp);
return 0;
}
--
2.26.2
- [PATCH] Rename 'FILE *fd' to 'FILE *fp'.,
Tim Rühsen <=