228 lines
6.9 KiB
Diff
228 lines
6.9 KiB
Diff
---
|
|
clients/uil/UilDiags.c | 26 ++++++++++++++------------
|
|
clients/uil/UilIODef.h | 2 +-
|
|
clients/uil/UilSrcSrc.c | 18 +++++++++++-------
|
|
tools/wml/Makefile.am | 6 ++++--
|
|
tools/wml/Uil.y | 2 +-
|
|
5 files changed, 31 insertions(+), 23 deletions(-)
|
|
|
|
--- a/clients/uil/UilDiags.c
|
|
+++ b/clients/uil/UilDiags.c
|
|
@@ -207,9 +207,9 @@ void diag_issue_diagnostic
|
|
va_list ap; /* ptr to variable length parameter */
|
|
int severity; /* severity of message */
|
|
int message_number; /* message number */
|
|
- char msg_buffer[132]; /* buffer to construct message */
|
|
+ char *msg_buffer = 0; /* buffer to construct message */
|
|
char ptr_buffer[buf_size]; /* buffer to construct pointer */
|
|
- char loc_buffer[132]; /* buffer to construct location */
|
|
+ char *loc_buffer = 0; /* buffer to construct location */
|
|
char src_buffer[buf_size]; /* buffer to hold source line */
|
|
|
|
/*
|
|
@@ -293,19 +293,18 @@ void diag_issue_diagnostic
|
|
va_start(ap, l_start_column);
|
|
|
|
#ifndef NO_MESSAGE_CATALOG
|
|
- vsnprintf( msg_buffer, sizeof(msg_buffer),
|
|
+ vasprintf(&msg_buffer,
|
|
catgets(uil_catd, UIL_SET1, msg_cat_table[ message_number ],
|
|
diag_rz_msg_table[ message_number ].ac_text),
|
|
ap );
|
|
#else
|
|
- vsnprintf( msg_buffer, sizeof(msg_buffer),
|
|
+ vasprintf(&msg_buffer,
|
|
diag_rz_msg_table[ message_number ].ac_text,
|
|
ap );
|
|
#endif
|
|
va_end(ap);
|
|
|
|
src_buffer[ 0 ] = 0;
|
|
- loc_buffer[ 0 ] = 0;
|
|
ptr_buffer[ 0 ] = 0;
|
|
|
|
if (az_src_rec != diag_k_no_source)
|
|
@@ -317,13 +316,13 @@ void diag_issue_diagnostic
|
|
*/
|
|
|
|
#ifndef NO_MESSAGE_CATALOG
|
|
- sprintf( loc_buffer,
|
|
+ asprintf(&loc_buffer,
|
|
catgets(uil_catd, UIL_SET_MISC,
|
|
UIL_MISC_0, "\t\t line: %d file: %s"),
|
|
az_src_rec->w_line_number,
|
|
src_get_file_name( az_src_rec ) );
|
|
#else
|
|
- sprintf( loc_buffer,
|
|
+ asprintf(&loc_buffer,
|
|
"\t\t line: %d file: %s",
|
|
az_src_rec->w_line_number,
|
|
src_get_file_name( az_src_rec ) );
|
|
@@ -371,7 +370,7 @@ void diag_issue_diagnostic
|
|
|
|
if (l_start_column != diag_k_no_column)
|
|
#ifndef NO_MESSAGE_CATALOG
|
|
- sprintf(loc_buffer,
|
|
+ asprintf(&loc_buffer,
|
|
catgets(uil_catd, UIL_SET_MISC,
|
|
UIL_MISC_1,
|
|
"\t\t line: %d position: %d file: %s"),
|
|
@@ -379,7 +378,7 @@ void diag_issue_diagnostic
|
|
l_start_column + 1,
|
|
src_get_file_name( az_src_rec ) );
|
|
#else
|
|
- sprintf(loc_buffer,
|
|
+ asprintf(&loc_buffer,
|
|
"\t\t line: %d position: %d file: %s",
|
|
az_src_rec->w_line_number,
|
|
l_start_column + 1,
|
|
@@ -387,13 +386,13 @@ void diag_issue_diagnostic
|
|
#endif
|
|
else
|
|
#ifndef NO_MESSAGE_CATALOG
|
|
- sprintf( loc_buffer, catgets(uil_catd, UIL_SET_MISC,
|
|
+ asprintf(&loc_buffer, catgets(uil_catd, UIL_SET_MISC,
|
|
UIL_MISC_0,
|
|
"\t\t line: %d file: %s"),
|
|
az_src_rec->w_line_number,
|
|
src_get_file_name( az_src_rec ) );
|
|
#else
|
|
- sprintf( loc_buffer,
|
|
+ asprintf(&loc_buffer,
|
|
"\t\t line: %d file: %s",
|
|
az_src_rec->w_line_number,
|
|
src_get_file_name( az_src_rec ) );
|
|
@@ -406,7 +405,8 @@ void diag_issue_diagnostic
|
|
*/
|
|
|
|
write_msg_to_standard_error
|
|
- ( message_number, src_buffer, ptr_buffer, msg_buffer, loc_buffer );
|
|
+ ( message_number, src_buffer, ptr_buffer, msg_buffer,
|
|
+ loc_buffer ? loc_buffer : "");
|
|
|
|
/*
|
|
** if we have a listing, place message in the source structure
|
|
@@ -428,6 +428,8 @@ void diag_issue_diagnostic
|
|
uil_exit( uil_k_severe_status );
|
|
}
|
|
|
|
+ free (loc_buffer);
|
|
+ free (msg_buffer);
|
|
}
|
|
|
|
/*
|
|
--- a/clients/uil/UilIODef.h
|
|
+++ b/clients/uil/UilIODef.h
|
|
@@ -75,7 +75,7 @@ typedef struct
|
|
char *c_buffer;
|
|
boolean v_position_before_get;
|
|
z_key last_key;
|
|
- char expanded_name[ 256 ];
|
|
+ char *expanded_name;
|
|
} uil_fcb_type;
|
|
|
|
#endif /* UilIODef_h */
|
|
--- a/clients/uil/UilSrcSrc.c
|
|
+++ b/clients/uil/UilSrcSrc.c
|
|
@@ -271,6 +271,7 @@ Uil_src_cleanup_source(void)
|
|
diag_k_no_source, diag_k_no_column,
|
|
src_az_source_file_table[i]->expanded_name);
|
|
}
|
|
+ _free_memory (src_az_source_file_table[i]->expanded_name);
|
|
_free_memory ((char*)src_az_source_file_table [i]);
|
|
src_az_source_file_table[i] = NULL;
|
|
}
|
|
@@ -626,13 +627,13 @@ open_source_file( XmConst char
|
|
static unsigned short main_dir_len = 0;
|
|
boolean main_file;
|
|
int i; /* loop index through include files */
|
|
- char buffer[256];
|
|
+ char *buffer;
|
|
|
|
|
|
/* place the file name in the expanded_name buffer */
|
|
|
|
- strncpy(buffer, c_file_name, sizeof(buffer));
|
|
- buffer[sizeof(buffer)-1] = '\0';
|
|
+ buffer = _get_memory (strlen (c_file_name) + 1);
|
|
+ strcpy (buffer, c_file_name);
|
|
|
|
/* Determine if this is the main file or an include file. */
|
|
|
|
@@ -674,11 +675,10 @@ open_source_file( XmConst char
|
|
}
|
|
|
|
if (!specific_directory) {
|
|
+ buffer = XtRealloc (buffer, main_dir_len + strlen (c_file_name) + 1);
|
|
_move (buffer, main_fcb -> expanded_name, main_dir_len);
|
|
_move (& buffer [main_dir_len],
|
|
c_file_name, strlen (c_file_name) + 1); /* + NULL */
|
|
- } else {
|
|
- strcpy (buffer, c_file_name);
|
|
}
|
|
|
|
/* Open the include file. */
|
|
@@ -701,6 +701,7 @@ open_source_file( XmConst char
|
|
if (inc_dir_len == 0) {
|
|
search_user_include = False;
|
|
}
|
|
+ buffer = XtRealloc (buffer, inc_dir_len + strlen (c_file_name) + 1);
|
|
_move (buffer, Uil_cmd_z_command.ac_include_dir[i], inc_dir_len);
|
|
|
|
/* Add '/' if not specified at end of directory */
|
|
@@ -724,6 +725,7 @@ open_source_file( XmConst char
|
|
|
|
/* Look in the default include directory. */
|
|
if (search_user_include) {
|
|
+ buffer = XtRealloc (buffer, sizeof c_include_dir - 1 + strlen (c_file_name) + 1);
|
|
_move(buffer, c_include_dir, sizeof c_include_dir - 1); /* no NULL */
|
|
_move(&buffer[sizeof c_include_dir - 1],
|
|
c_file_name, strlen (c_file_name) + 1); /* + NULL */
|
|
@@ -737,14 +739,16 @@ open_label:
|
|
|
|
/* check the open status. */
|
|
|
|
- if (az_fcb->az_file_ptr == NULL)
|
|
+ if (az_fcb->az_file_ptr == NULL) {
|
|
+ _free_memory (buffer);
|
|
return src_k_open_error;
|
|
+ }
|
|
|
|
/* open succeeded - place buffer address in fcb */
|
|
|
|
az_fcb->c_buffer = az_source_buffer->c_text;
|
|
az_fcb->c_buffer[ src_k_max_source_line_length ] = 0;
|
|
- strcpy(az_fcb->expanded_name, buffer);
|
|
+ az_fcb->expanded_name = buffer;
|
|
|
|
return src_k_open_normal;
|
|
}
|
|
--- a/tools/wml/Makefile.am
|
|
+++ b/tools/wml/Makefile.am
|
|
@@ -43,10 +43,12 @@ wmllex.c: wmllex.l
|
|
|
|
$(srcdir)/wmldbcreate.c: $(WMLTARGETS) UilLexPars.h
|
|
|
|
-UilLexPars.h: UilLexPars.c
|
|
+UilLexPars.h: Uil.h
|
|
+ rm -f $@
|
|
+ $(LN_S) Uil.h UilLexPars.h
|
|
|
|
UilLexPars.c: Uil.c
|
|
- $(LN_S) Uil.h UilLexPars.h
|
|
+ rm -f $@
|
|
$(LN_S) Uil.c UilLexPars.c
|
|
|
|
$(WMLTARGETS): wmluiltok wml UilLexPars.c $(TABLE)
|
|
--- a/tools/wml/Uil.y
|
|
+++ b/tools/wml/Uil.y
|
|
@@ -559,7 +559,7 @@ control_object_definition
|
|
|
|
object_specification
|
|
: CLASS_NAME
|
|
- { sar_set_object_class (&$1); }
|
|
+ { sar_set_object_class (&$1); $$ = gz_yynullval; }
|
|
opt_create_proc_ref
|
|
opt_variant
|
|
object_spec
|