[m-rev.] for review: mdb command line completion

Simon Taylor stayl at cs.mu.OZ.AU
Thu Mar 7 01:07:41 AEDT 2002


On 06-Mar-2002, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> On 06-Mar-2002, Simon Taylor <stayl at cs.mu.OZ.AU> wrote:
> > > > +#define MR_MAX_COMMAND_LEN 32
> > > 
> > > You should document
> > > 	- what this is used for
> > > 	- what the units are
> > > 
> > > Also, 32 is probably too small.
> > 
> > I've moved this #define to where it is used so that the
> > meaning is obvious without documentation.
> 
> I still think 32 is too small.
> The efficiency cost of making this e.g. 256 would be minimal.
> 
> > > > +static char *
> > > > +MR_translate_double_underscores(char *start)
> > > ...
> > > > +	return start;
> > > > +}
> > > 
> > > The return type for that should be `void *'.
> > > 
> > > (Whoever designed C's string handling routines has a lot to answer for ;-)
> >
> > Sorry, you'll have to explain that.
> 
> I meant to say `void', instead of `void *'.

--- mercury_trace_completion.c	2002/03/06 14:05:28	1.1
+++ mercury_trace_completion.c	2002/03/06 14:05:56
@@ -154,7 +154,7 @@
 		/*
 		** We're completing an argument of the command.
 		*/
-		#define MR_MAX_COMMAND_NAME_LEN 32
+		#define MR_MAX_COMMAND_NAME_LEN 256
 		char command[MR_MAX_COMMAND_NAME_LEN];
 		char *expanded_command;
 		int command_len;
--- mercury_trace_tables.c	2002/03/06 11:32:12	1.2
+++ mercury_trace_tables.c	2002/03/06 12:54:16
@@ -41,7 +41,7 @@
 			MR_file_line_callback callback_func, int callback_arg);
 
 static	MR_bool	MR_parse_trailing_number(char *start, char **end, int *number);
-static	char	*MR_translate_double_underscores(char *str);
+static	void	MR_translate_double_underscores(char *str);
 static	char	*MR_get_module_info_name(int slot);
 
 typedef struct {
@@ -362,7 +362,7 @@
 /*
 ** Convert all occurrences of `__' to `:'.
 */
-static char *
+static void
 MR_translate_double_underscores(char *start)
 {
 	int	double_underscores = 0;
@@ -380,7 +380,6 @@
 		str++;
 	}
 	*(str - double_underscores) = '\0';
-	return start;
 }
 
 /* 
@@ -563,8 +562,8 @@
 	} else {
 		data->MR_complete_pf = -1;
 	}
-	data->MR_complete_name =
-			MR_translate_double_underscores(MR_copy_string(word));
+	data->MR_complete_name = MR_copy_string(word);
+	MR_translate_double_underscores(data->MR_complete_name);
 	data->MR_complete_name_len = strlen(data->MR_complete_name);
 	data->MR_complete_name_is_qualified =
 			strchr(data->MR_complete_name, ':') != NULL;
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list