[m-rev.] diff: avoid more warnings with clang
Julien Fischer
jfischer at opturion.com
Mon Mar 31 00:26:48 AEDT 2014
Branches: 14.01, master
-----------------------
Avoid C compiler warnings that occur when using clang with -Wall.
Except where noted otherwise below most of these warnings relate to implicit
conversions between 64- and 32-bit integers or the signedness of integers
differing in spots.
library/construct.m:
Delete an unused local variable in the implementation of get_functor_lex.
library/bitmap.m:
The function MR_bitmap_cmp returns an MR_Integer not an int.
library/thread.semaphore.m:
Change the count field of the ML_SEMAPHORE_STRUCT structure into
an MR_Integer (which is what gets passed in).
trace/mercury_trace_declarative.c:
Avoid a warning about fprintf being called where its second argument
is not a string literal. (In this case it can be replaced by a call
to fputs.)
library/io.m:
mdbcomp/rtti_access.m:
trace/mercury_trace.c:
trace/mercury_trace_cmd_breakpoint.c:
trace/mercury_trace_cmd_help.c:
trace/mercury_trace_completion.m:
trace/mercury_trace_declarative.[ch]:
trace/mercury_trace_external.c:
trace/mercury_trace_internal.c:
trace/mercury_trace_source.c:
trace/mercury_trace_tables.c:
trace/mercury_trace_vars.c:
util/info_to_mdb.c:
util/mfiltercc.c:
util/mdemangle.c:
util/mkinit.c:
util/mkinit_erl.c:
util/mkinit_common.h:
util/mkinit_common.c:
As above.
Julien.
diff --git a/library/bitmap.m b/library/bitmap.m
index 5bb2a1a..24e1379 100644
--- a/library/bitmap.m
+++ b/library/bitmap.m
@@ -1658,7 +1658,7 @@ bytes_equal(Index, MaxIndex, BM1, BM2) :-
bitmap_compare(Result::uo, BM1::in, BM2::in),
[will_not_call_mercury, thread_safe, promise_pure, will_not_modify_trail],
"
- int res;
+ MR_Integer res;
res = MR_bitmap_cmp(BM1, BM2);
Result = ((res < 0) ? MR_COMPARE_LESS
: (res == 0) ? MR_COMPARE_EQUAL
diff --git a/library/construct.m b/library/construct.m
index a6f5ced..0727ad7 100644
--- a/library/construct.m
+++ b/library/construct.m
@@ -510,7 +510,6 @@ get_functor_lex(TypeDesc, Ordinal) = FunctorNumber :-
MR_TypeInfo type_info;
MR_TypeCtorInfo type_ctor_info;
MR_Construct_Info construct_info;
- MR_bool success;
int num_functors;
type_info = (MR_TypeInfo) TypeDesc;
@@ -667,7 +666,7 @@ find_functor_2(TypeInfo, Functor, Arity, Num0, FunctorNumber, ArgTypes) :-
int args_size;
int alloc_size;
int size;
- int i;
+ MR_Unsigned i;
functor_desc = construct_info.functor_info.du_functor_desc;
arg_locns = functor_desc->MR_du_functor_arg_locns;
diff --git a/library/io.m b/library/io.m
index a64eaa3..0a0283c 100644
--- a/library/io.m
+++ b/library/io.m
@@ -7756,7 +7756,7 @@ io.putback_byte(binary_input_stream(Stream), Character, !IO) :-
MercuryFilePtr out = mercury_current_text_output();
char buf[5];
size_t len;
- int i;
+ size_t i;
if (Character <= 0x7f) {
if (MR_PUTCH(*out, Character) < 0) {
mercury_output_error(out);
@@ -8108,7 +8108,7 @@ io.write_char(output_stream(Stream), Character, !IO) :-
} else {
char buf[5];
size_t len;
- int i;
+ size_t i;
len = MR_utf8_encode(buf, Character);
for (i = 0; i < len; i++) {
if (MR_PUTCH(*Stream, buf[i]) < 0) {
diff --git a/library/thread.semaphore.m b/library/thread.semaphore.m
index d497fe9..ea52d8d 100644
--- a/library/thread.semaphore.m
+++ b/library/thread.semaphore.m
@@ -69,7 +69,7 @@
#include ""mercury_thread.h""
typedef struct ML_SEMAPHORE_STRUCT {
- int count;
+ MR_Integer count;
#ifndef MR_HIGHLEVEL_CODE
MR_Context *suspended_head;
MR_Context *suspended_tail;
diff --git a/mdbcomp/rtti_access.m b/mdbcomp/rtti_access.m
index 9c75a55..aa36845 100644
--- a/mdbcomp/rtti_access.m
+++ b/mdbcomp/rtti_access.m
@@ -790,9 +790,9 @@ read_string_table(ByteCode, StringTable, !Pos) :-
StringTableChars::out),
[will_not_call_mercury, thread_safe, promise_pure],
"
- char *buf;
- char *table;
- int i;
+ char *buf;
+ char *table;
+ MR_Unsigned i;
MR_allocate_aligned_string_msg(buf, Size, MR_ALLOC_ID);
table = ((char *) Bytes) + Offset;
diff --git a/trace/mercury_trace.c b/trace/mercury_trace.c
index c19d19e..d238985 100644
--- a/trace/mercury_trace.c
+++ b/trace/mercury_trace.c
@@ -702,8 +702,8 @@ MR_trace_retry(MR_EventInfo *event_info,
const MR_LabelLayout *return_label_layout;
const MR_LabelLayout *call_label;
const MR_ProcLayout *level_layout;
- int call_all_var_count;
- int call_long_var_count;
+ MR_Integer call_all_var_count;
+ MR_Integer call_long_var_count;
MR_Word *r_args;
int r_arg_max;
MR_Word *f_args;
@@ -1415,9 +1415,9 @@ MR_trace_find_input_arg(const MR_LabelLayout *label_layout,
MR_Word *saved_regs, MR_Word *base_sp, MR_Word *base_curfr,
MR_Float *saved_f_regs, MR_uint_least16_t var_num, MR_bool *succeeded)
{
- int i;
- int all_var_count;
- int long_var_count;
+ int i;
+ MR_Integer all_var_count;
+ MR_Integer long_var_count;
if (label_layout->MR_sll_var_nums == NULL) {
*succeeded = MR_FALSE;
diff --git a/trace/mercury_trace_browse.c b/trace/mercury_trace_browse.c
index 2a502f4..235531d 100644
--- a/trace/mercury_trace_browse.c
+++ b/trace/mercury_trace_browse.c
@@ -327,10 +327,10 @@ MR_trace_print_all_browser_params(FILE *fp, MR_bool mdb_command_format)
MR_trace_browse_ensure_init();
MR_TRACE_CALL_MERCURY(
ML_BROWSE_browser_params_to_string(MR_trace_browser_persistent_state,
- mdb_command_format, ¶m_string);
+ (MR_Word)mdb_command_format, ¶m_string);
);
- fprintf(fp, param_string);
+ fputs(param_string, fp);
}
void
diff --git a/trace/mercury_trace_cmd_breakpoint.c b/trace/mercury_trace_cmd_breakpoint.c
index 3ca8ae4..e65f8f3 100644
--- a/trace/mercury_trace_cmd_breakpoint.c
+++ b/trace/mercury_trace_cmd_breakpoint.c
@@ -367,7 +367,7 @@ MR_trace_cmd_break(char **words, int word_count, MR_TraceCmdInfo *cmd,
MR_MatchesInfo matches;
MR_TracePort port;
const MR_LabelLayout **matching_labels;
- int matching_port_count;
+ MR_Unsigned matching_port_count;
int slot;
MR_Unsigned i;
@@ -546,7 +546,7 @@ MR_trace_cmd_condition(char **words, int word_count, MR_TraceCmdInfo *cmd,
MR_SpyTest test;
char *what_str;
char *term_str;
- int len;
+ size_t len;
char *rest;
MR_SpyCond *cond;
MR_VarSpec var_spec;
@@ -624,7 +624,7 @@ MR_trace_cmd_condition(char **words, int word_count, MR_TraceCmdInfo *cmd,
term = MR_create_cterm(term_str, &rest, &mismatch, &error_point);
if (term == NULL) {
const char *msg;
- int j;
+ size_t j;
msg = "syntax error in term: ";
fprintf(MR_mdb_out, "%s%s\n", msg, term_str);
diff --git a/trace/mercury_trace_cmd_help.c b/trace/mercury_trace_cmd_help.c
index 3691699..ee6cfd7 100644
--- a/trace/mercury_trace_cmd_help.c
+++ b/trace/mercury_trace_cmd_help.c
@@ -123,7 +123,7 @@ MR_trace_read_help_text(void)
char *doc_chars = NULL;
int doc_char_max = 0;
int next_char_slot;
- int line_len;
+ size_t line_len;
int i;
next_char_slot = 0;
diff --git a/trace/mercury_trace_completion.c b/trace/mercury_trace_completion.c
index 5c8d235..9602775 100644
--- a/trace/mercury_trace_completion.c
+++ b/trace/mercury_trace_completion.c
@@ -221,7 +221,7 @@ static char *
MR_prepend_string(char *string, MR_CompleterData *data)
{
char *string_to_prepend;
- int string_to_prepend_len;
+ size_t string_to_prepend_len;
char *result;
string_to_prepend = (char *) *data;
diff --git a/trace/mercury_trace_declarative.c b/trace/mercury_trace_declarative.c
index 02d10c7..00c1697 100644
--- a/trace/mercury_trace_declarative.c
+++ b/trace/mercury_trace_declarative.c
@@ -1602,7 +1602,7 @@ MR_decl_trust_standard_library(void)
}
MR_bool
-MR_decl_remove_trusted(int n)
+MR_decl_remove_trusted(MR_Integer n)
{
MR_bool success;
MR_Word new_diagnoser;
@@ -1631,7 +1631,7 @@ MR_decl_print_all_trusted(FILE *fp, MR_bool mdb_command_format)
mdb_command_format, &trusted_list);
);
- fprintf(fp, trusted_list);
+ fputs(trusted_list, fp);
}
MR_bool
@@ -2209,7 +2209,7 @@ MR_trace_reset_implicit_subtree_counters(void)
static void
MR_trace_init_implicit_subtree_counters(MR_Unsigned size)
{
- int i;
+ size_t i;
MR_edt_implicit_subtree_counters = (MR_Unsigned *)
malloc(size * sizeof(MR_Unsigned));
@@ -2317,7 +2317,7 @@ MR_trace_decl_init_suspicion_table(char *pass_trace_counts_file,
MR_Word dice;
int num_modules;
int module_num;
- int num_files;
+ MR_Integer num_files;
int file_num;
int num_labels;
int label_num;
diff --git a/trace/mercury_trace_declarative.h b/trace/mercury_trace_declarative.h
index 29a6b96..ccaa21b 100644
--- a/trace/mercury_trace_declarative.h
+++ b/trace/mercury_trace_declarative.h
@@ -72,7 +72,7 @@ extern void MR_decl_add_trusted_module(const char *module_name);
extern void MR_decl_add_trusted_pred_or_func(
const MR_ProcLayout *entry);
extern void MR_decl_trust_standard_library(void);
-extern MR_bool MR_decl_remove_trusted(int n);
+extern MR_bool MR_decl_remove_trusted(MR_Integer n);
/*
** MR_trace_decl_set_default_search_mode sets the default search mode for
diff --git a/trace/mercury_trace_external.c b/trace/mercury_trace_external.c
index 5cc84d1..5c881ea 100644
--- a/trace/mercury_trace_external.c
+++ b/trace/mercury_trace_external.c
@@ -306,7 +306,7 @@ void
MR_trace_init_external(void)
{
int fd;
- int len;
+ size_t len;
FILE *file_in;
FILE *file_out;
int addr_family;
diff --git a/trace/mercury_trace_internal.c b/trace/mercury_trace_internal.c
index 3d117e8..11e041a 100644
--- a/trace/mercury_trace_internal.c
+++ b/trace/mercury_trace_internal.c
@@ -1187,7 +1187,8 @@ MR_trace_get_command(const char *prompt, FILE *mdb_in, FILE *mdb_out)
int cmd_char_max;
MR_bool single_quoted;
MR_bool double_quoted;
- int len, extra_len;
+ size_t len;
+ size_t extra_len;
line = MR_trace_getline(prompt, mdb_in, mdb_out);
diff --git a/trace/mercury_trace_source.c b/trace/mercury_trace_source.c
index b732935..f440923 100644
--- a/trace/mercury_trace_source.c
+++ b/trace/mercury_trace_source.c
@@ -189,8 +189,8 @@ MR_trace_source_open_server(MR_TraceSourceServer *server,
const char *msg;
char system_call[MR_SYSCALL_BUFFER_SIZE];
int status;
- int base_len;
- int i;
+ size_t base_len;
+ size_t i;
if (window_cmd != NULL) {
real_window_cmd = window_cmd;
diff --git a/trace/mercury_trace_tables.c b/trace/mercury_trace_tables.c
index 5e07552..5f5f9c5 100644
--- a/trace/mercury_trace_tables.c
+++ b/trace/mercury_trace_tables.c
@@ -99,7 +99,7 @@ typedef struct {
** The word to complete, with `__' translated into '.'.
*/
char *MR_complete_name;
- int MR_complete_name_len;
+ size_t MR_complete_name_len;
MR_bool MR_complete_name_is_qualified;
/*
@@ -340,7 +340,7 @@ MR_process_file_line_layouts(const char *file, int line,
MR_file_line_callback callback_func, int callback_arg)
{
const MR_ModuleFileLayout *file_layout;
- int i;
+ size_t i;
int j;
for (i = 0; i < MR_module_info_next; i++) {
@@ -390,7 +390,7 @@ MR_dump_module_tables(FILE *fp, MR_bool separate, MR_bool uci,
{
const MR_ModuleLayout *module;
const MR_ProcLayout *proc;
- int i;
+ size_t i;
int j;
if (module_name != NULL) {
@@ -424,7 +424,7 @@ MR_dump_module_tables(FILE *fp, MR_bool separate, MR_bool uci,
void
MR_dump_module_list(FILE *fp)
{
- int i;
+ size_t i;
fprintf(fp, "List of debuggable modules\n\n");
for (i = 0; i < MR_module_info_next; i++) {
@@ -658,18 +658,18 @@ void
MR_print_ambiguities(FILE *fp, MR_bool print_procs, MR_bool print_types,
MR_bool print_functors, char **arena_module_names, int arena_num_modules)
{
- int module_num;
+ unsigned module_num;
int proc_num;
int type_num;
int functor_num;
int end_proc_num;
int end_type_num;
int end_functor_num;
- int num_procs;
+ size_t num_procs;
int num_all_types;
int num_types;
- int num_functors;
- int next_proc_num;
+ size_t num_functors;
+ size_t next_proc_num;
int procs_in_module;
const MR_ModuleLayout *module;
const MR_ProcLayout **procs;
@@ -1081,7 +1081,7 @@ MR_parse_proc_spec(char *str, MR_ProcSpec *spec)
char *dash;
char *end;
int n;
- int len;
+ size_t len;
spec->MR_proc_module = NULL;
spec->MR_proc_name = NULL;
@@ -1332,7 +1332,7 @@ MR_process_matching_procedures(MR_ProcSpec *spec,
}
}
} else {
- int i;
+ unsigned i;
for (i = 0; i < MR_module_info_next; i++) {
MR_process_matching_procedures_in_module(MR_module_infos[i], spec,
@@ -1417,7 +1417,7 @@ MR_filter_user_preds(MR_MatchesInfo *matches)
{
const MR_ProcLayout *entry;
int filter_pos;
- int i;
+ size_t i;
filter_pos = 0;
for(i = 0; i < matches->match_proc_next; i++) {
@@ -1589,7 +1589,7 @@ MR_trace_proc_spec_completer_init_module(MR_ProcCompleterData *data)
char *name;
size_t name_len;
char *module_name;
- int module_name_len;
+ size_t module_name_len;
name = data->MR_complete_name;
name_len = data->MR_complete_name_len;
@@ -1653,9 +1653,9 @@ MR_trace_complete_proc(MR_ProcCompleterData *data)
{
char *completion;
char *name;
- int name_len;
+ size_t name_len;
char *unqualified_name;
- int unqualified_name_len;
+ size_t unqualified_name_len;
char *complete_module;
const MR_ModuleLayout *module_layout;
const MR_ProcLayout *proc_layout;
@@ -1714,8 +1714,8 @@ static char *
MR_format_proc_spec_completion(MR_PredFunc pred_or_func,
const char *module, const char *name)
{
- int size;
- int module_len;
+ size_t size;
+ size_t module_len;
int offset;
char *completion;
@@ -1793,7 +1793,8 @@ MR_proc_layout_stats(FILE *fp)
{
const MR_ModuleLayout *module_layout;
const MR_ProcLayout *proc_layout;
- int module_num, proc_num;
+ unsigned module_num;
+ int proc_num;
MR_Determinism detism;
int total;
int histogram[MR_DETISM_MAX + 1];
@@ -1836,7 +1837,7 @@ MR_label_layout_stats(FILE *fp)
const MR_ModuleLayout *module_layout;
const MR_ModuleFileLayout *file_layout;
const MR_LabelLayout *label_layout;
- int module_num;
+ unsigned module_num;
int file_num;
int label_num;
MR_TracePort port;
@@ -1927,7 +1928,7 @@ MR_var_name_stats(FILE *fp)
const MR_ModuleLayout *module_layout;
const MR_ProcLayout *proc_layout;
const MR_uint_least32_t *var_names;
- int module_num;
+ unsigned module_num;
int proc_num;
int var_num;
int num_var_nums;
diff --git a/trace/mercury_trace_vars.c b/trace/mercury_trace_vars.c
index 3b8c097..c8e5e31 100644
--- a/trace/mercury_trace_vars.c
+++ b/trace/mercury_trace_vars.c
@@ -196,7 +196,7 @@ static const char *MR_lookup_var_spec(MR_VarSpec var_spec,
MR_bool *is_ambiguous_ptr);
static char *MR_trace_var_completer_next(const char *word,
size_t word_len, MR_CompleterData *data);
-static int MR_trace_print_var_name(FILE *out,
+static size_t MR_trace_print_var_name(FILE *out,
const MR_ProcLayout *proc,
const MR_ValueDetails *var);
static const char *MR_trace_printed_var_name(
@@ -1602,8 +1602,8 @@ MR_trace_bad_path(char *fullpath, char *badpath)
{
char *s;
MR_bool found;
- int needed_bad_buf_len;
- int needed_good_buf_len;
+ size_t needed_bad_buf_len;
+ size_t needed_good_buf_len;
char *good_buf_ptr;
found = MR_FALSE;
@@ -1670,8 +1670,8 @@ const char *
MR_trace_bad_path_in_var(MR_VarSpec *var_spec, char *fullpath, char *badpath)
{
const char *path_msg;
- int suffix_len;
- int needed_len;
+ size_t suffix_len;
+ size_t needed_len;
path_msg = MR_trace_bad_path(fullpath, badpath);
suffix_len = 0;
@@ -1898,7 +1898,7 @@ MR_trace_browse_var(FILE *out, MR_bool print_var_name,
{
MR_TypeInfo type_info;
MR_Word *value;
- int len;
+ size_t len;
MR_bool saved_io_tabling_enabled;
char *bad_path;
@@ -2116,12 +2116,12 @@ MR_trace_var_completer_next(const char *word, size_t word_len,
return NULL;
}
-static int
+static size_t
MR_trace_print_var_name(FILE *out, const MR_ProcLayout *proc,
const MR_ValueDetails *value)
{
const char *buf;
- int len;
+ size_t len;
buf = MR_trace_printed_var_name(proc, value);
len = strlen(buf);
diff --git a/util/info_to_mdb.c b/util/info_to_mdb.c
index b63d6b4..bec2111 100644
--- a/util/info_to_mdb.c
+++ b/util/info_to_mdb.c
@@ -171,7 +171,7 @@ is_all_same_char(const char *line, const char what)
static MR_bool
is_command(const char *line, MR_bool *is_concept)
{
- int len;
+ size_t len;
len = strlen(line);
if (((line[0] == '`') || (line[0] == '\'')) && (line[len-2] == '\'')) {
@@ -199,8 +199,8 @@ get_command(const char *line, char *command)
static void
print_command_line(const char *line, MR_bool is_concept)
{
- int len;
- int i;
+ size_t len;
+ size_t i;
len = strlen(line);
for (i = 1; i < len - 2; i++) {
diff --git a/util/mdemangle.c b/util/mdemangle.c
index 183df20..87cdfd6 100644
--- a/util/mdemangle.c
+++ b/util/mdemangle.c
@@ -128,7 +128,7 @@ main(int argc, char **argv)
break;
}
- buf[len++] = c;
+ buf[len++] = (char) c;
c = getchar();
}
@@ -822,7 +822,7 @@ not_plain_mercury:
printf("<shared constant number %d for module %s>",
arity, module);
break;
-
+
default:
goto wrong_format;
}
@@ -973,7 +973,7 @@ strip_module_name(char **start_ptr, char *end,
static MR_bool
strip_prefix(char **str, const char *prefix)
{
- int len;
+ size_t len;
len = strlen(prefix);
@@ -994,7 +994,7 @@ strip_prefix(char **str, const char *prefix)
static MR_bool
strip_suffix(const char *start, char **end, const char *suffix)
{
- int len;
+ size_t len;
len = strlen(suffix);
diff --git a/util/mfiltercc.c b/util/mfiltercc.c
index 2abeae6..6b9ecad 100644
--- a/util/mfiltercc.c
+++ b/util/mfiltercc.c
@@ -39,7 +39,7 @@ main(void)
len = 0;
c = getchar();
while (c != EOF) {
- buf[len++] = c;
+ buf[len++] = (char) c;
if (c == '\n' || len >= sizeof(buf) - 1) {
break;
}
diff --git a/util/mkinit.c b/util/mkinit.c
index 6735f98..0309215 100644
--- a/util/mkinit.c
+++ b/util/mkinit.c
@@ -1201,7 +1201,7 @@ output_main(void)
static void
process_file(const char *filename)
{
- int len;
+ size_t len;
len = strlen(filename);
if (len >= 2 && strcmp(filename + len - 2, ".c") == 0) {
@@ -1233,11 +1233,11 @@ process_init_file(const char *filename)
const char * const reqfinal_str = "REQUIRED_FINAL ";
const char * const envvar_str = "ENVVAR ";
const char * const endinit_str = "ENDINIT";
- const int init_strlen = strlen(init_str);
- const int reqinit_strlen = strlen(reqinit_str);
- const int reqfinal_strlen = strlen(reqfinal_str);
- const int envvar_strlen = strlen(envvar_str);
- const int endinit_strlen = strlen(endinit_str);
+ const size_t init_strlen = strlen(init_str);
+ const size_t reqinit_strlen = strlen(reqinit_str);
+ const size_t reqfinal_strlen = strlen(reqfinal_str);
+ const size_t envvar_strlen = strlen(envvar_str);
+ const size_t endinit_strlen = strlen(endinit_str);
char line[MAXLINE];
FILE *cfile;
@@ -1252,7 +1252,7 @@ process_init_file(const char *filename)
while (get_line(cfile, line, MAXLINE) > 0) {
if (strncmp(line, init_str, init_strlen) == 0) {
char *func_name;
- int func_name_len;
+ size_t func_name_len;
int j;
for (j = init_strlen; MR_isalnumunder(line[j]); j++) {
diff --git a/util/mkinit_common.c b/util/mkinit_common.c
index 416ea64..6fe3c57 100644
--- a/util/mkinit_common.c
+++ b/util/mkinit_common.c
@@ -179,9 +179,9 @@ find_init_file(const char *base_name)
char *filename;
char *dirname;
String_List *dir_ptr;
- int dirlen;
- int baselen;
- int len;
+ size_t dirlen;
+ size_t baselen;
+ size_t len;
if (file_exists(base_name)) {
/* File is in current directory, so no search required */
@@ -245,11 +245,11 @@ file_exists(const char *filename)
*/
char *
-read_line(const char *filename, FILE *fp, int max)
+read_line(const char *filename, FILE *fp, size_t max)
{
char *buf;
int c;
- int i;
+ size_t i;
buf = checked_malloc(max + 1);
i = 0;
@@ -261,7 +261,7 @@ read_line(const char *filename, FILE *fp, int max)
return NULL;
}
- buf[i++] = c;
+ buf[i++] = (char) c;
}
if (c == '\n' || i > 0) {
@@ -291,7 +291,7 @@ get_line(FILE *file, char *line, int line_max)
limit = line_max - 2;
while ((c = getc(file)) != EOF && c != '\n') {
if (num_chars < limit) {
- line[num_chars++] = c;
+ line[num_chars++] = (char) c;
}
}
diff --git a/util/mkinit_common.h b/util/mkinit_common.h
index 5f8ff2a..79408f1 100644
--- a/util/mkinit_common.h
+++ b/util/mkinit_common.h
@@ -46,7 +46,7 @@ extern void process_file_list_file(char *filename);
extern void set_output_file(const char *output_file_name);
extern void add_init_file_dir(const char *dir_name);
extern void do_path_search(char **lfiles, int lnum_files);
-extern char *read_line(const char *filename, FILE *fp, int max);
+extern char *read_line(const char *filename, FILE *fp, size_t max);
extern int get_line(FILE *file, char *line, int line_max);
extern void *checked_malloc(size_t size);
extern void *checked_realloc(void *old_ptr, size_t size);
diff --git a/util/mkinit_erl.c b/util/mkinit_erl.c
index 1d0cb83..4430fd1 100644
--- a/util/mkinit_erl.c
+++ b/util/mkinit_erl.c
@@ -458,15 +458,15 @@ process_init_file(const char *filename, const char *prefix_str)
const char * const reqfinal_str = "REQUIRED_FINAL ";
const char * const envvar_str = "ENVVAR ";
const char * const endinit_str = "ENDINIT";
- const int prefix_strlen = strlen(prefix_str);
- const int init_strlen = strlen(init_str);
- const int reqinit_strlen = strlen(reqinit_str);
- const int reqfinal_strlen = strlen(reqfinal_str);
- const int envvar_strlen = strlen(envvar_str);
- const int endinit_strlen = strlen(endinit_str);
+ const size_t prefix_strlen = strlen(prefix_str);
+ const size_t init_strlen = strlen(init_str);
+ const size_t reqinit_strlen = strlen(reqinit_str);
+ const size_t reqfinal_strlen = strlen(reqfinal_str);
+ const size_t envvar_strlen = strlen(envvar_str);
+ const size_t endinit_strlen = strlen(endinit_str);
char line0[MAXLINE];
char * line;
- int len;
+ size_t len;
FILE *erl_file;
erl_file = fopen(filename, "r");
@@ -492,7 +492,7 @@ process_init_file(const char *filename, const char *prefix_str)
if (strncmp(line, init_str, init_strlen) == 0) {
char *func_name;
- int func_name_len;
+ size_t func_name_len;
func_name = line + init_strlen;
func_name_len = strlen(func_name);
More information about the reviews
mailing list