From: David Levine Date: Sat, 22 Dec 2012 16:14:36 +0000 (-0600) Subject: Changed msg_style and msg_delim to be file static to m_getfld.c X-Git-Url: http://git.marmaro.de/?a=commitdiff_plain;h=e69044f7624abe5cb2cb796d528c0cc5f29515f7;p=mmh Changed msg_style and msg_delim to be file static to m_getfld.c instead of global. --- diff --git a/h/mh.h b/h/mh.h index 225d0c9..f29379e 100644 --- a/h/mh.h +++ b/h/mh.h @@ -252,8 +252,6 @@ struct msgs { #define MS_MSH 4 /* whacko msh */ extern int msg_count; /* m_getfld() indicators */ -extern int msg_style; /* .. */ -extern char *msg_delim; /* .. */ #define NOUSE 0 /* draft being re-used */ diff --git a/sbr/m_getfld.c b/sbr/m_getfld.c index 1d5d764..91a1d8c 100644 --- a/sbr/m_getfld.c +++ b/sbr/m_getfld.c @@ -212,21 +212,18 @@ Subsequent calls provide the state returned by the previous call. Along the way, I thought of these possible interface changes that we might want to consider before rototilling the internals: -1) To remove globals that don't need to be: - Change msg_style and msg_delim to be file static. - -2) To remove a global: +1) To remove a global: Change bufsz to be in-out instead of in, and therefore int * instead of int, and use that instead of global msg_count. There are only 3 call sites that use msg_count so it wouldn't take much effort to remove use of it. Of course, all call sites would have to change to provide an int * instead of an int. Some now pass constants. -3) To remove the state argument from the signature: +2) To remove the state argument from the signature: Given the Current usage and Restriction above, the state variable could be removed from the signature and just retained internally. -4) To remove the Restriction above: +3) To remove the Restriction above: One approach would be for m_getfld() to retain multiple copies of that state, one per iob that it sees. Another approach would be for the caller to store it in an opaque struct, the address of which is passed @@ -255,10 +252,7 @@ static unsigned char **pat_map; */ extern int msg_count; -/* - * defined in sbr/m_msgdef.c = MS_DEFAULT - */ -extern int msg_style; +static int msg_style = MS_DEFAULT; /* * The "full" delimiter string for a packed maildrop consists @@ -272,7 +266,7 @@ extern int msg_style; * is used in m_Eom because the first character of the string * has been read and matched before m_Eom is called. */ -extern char *msg_delim; /* defined in sbr/m_msgdef.c = "" */ +static char *msg_delim = ""; static unsigned char *fdelim; static unsigned char *delimend; static int fdelimlen; diff --git a/sbr/m_msgdef.c b/sbr/m_msgdef.c index d602973..9520012 100644 --- a/sbr/m_msgdef.c +++ b/sbr/m_msgdef.c @@ -15,19 +15,3 @@ * in uip/scansbr.c) */ int msg_count = 0; - -int msg_style = MS_DEFAULT; - -/* - * The "full" delimiter string for a packed maildrop consists - * of a newline followed by the actual delimiter. E.g., the - * full string for a Unix maildrop would be: "\n\nFrom ". - * "Fdelim" points to the start of the full string and is used - * in the BODY case of the main routine to search the buffer for - * a possible eom. Msg_delim points to the first character of - * the actual delim. string (i.e., fdelim+1). Edelim - * points to the 2nd character of actual delimiter string. It - * is used in m_Eom because the first character of the string - * has been read and matched before m_Eom is called. - */ -char *msg_delim = "";