m_getfld(), m_getfld_track_filepos(), and m_unknown() all take a FILE
*iob that's used to update *m_getfld_state_t, even though it's probably,
hopefully, the same as the previous calls. Create wrapper functions for
these with an arbitrary `2' suffix that don't have this parameter.
After checking the m_getfld_state_t is initialised, they pass in its
existing FILE *iob. This allows callers to transition to the wrappers
in the cases where it's obviously the same FILE *iob being passed in.
It isn't always obvious, in part because of the convention for calling
this variable `in', even when it's a file-level static, a word that also
occurs in comments.
void m_getfld_state_reset (m_getfld_state_t *);
void m_getfld_state_destroy (m_getfld_state_t *);
void m_getfld_track_filepos (m_getfld_state_t *, FILE *);
void m_getfld_state_reset (m_getfld_state_t *);
void m_getfld_state_destroy (m_getfld_state_t *);
void m_getfld_track_filepos (m_getfld_state_t *, FILE *);
+void m_getfld_track_filepos2(m_getfld_state_t *);
int m_getfld (m_getfld_state_t *, char[NAMESZ], char *, int *, FILE *);
int m_getfld (m_getfld_state_t *, char[NAMESZ], char *, int *, FILE *);
+int m_getfld2(m_getfld_state_t *, char[NAMESZ], char *, int *);
int m_gmprot (void);
char *m_name (int);
void m_unknown(m_getfld_state_t *, FILE *);
int m_gmprot (void);
char *m_name (int);
void m_unknown(m_getfld_state_t *, FILE *);
+void m_unknown2(m_getfld_state_t *);
/*
* Clear the screen, using the appropriate entry from the terminfo database
/*
* Clear the screen, using the appropriate entry from the terminfo database
(*gstate)->track_filepos = 1;
}
(*gstate)->track_filepos = 1;
}
+/* m_getfld_track_filepos() with the existing iob. */
+void m_getfld_track_filepos2(m_getfld_state_t *gstate)
+{
+ if (!*gstate)
+ adios(NULL, "m_getfld_track_filepos2 without gstate");
+
+ m_getfld_track_filepos(gstate, (*gstate)->iob);
+}
+
void m_getfld_state_destroy (m_getfld_state_t *gstate) {
m_getfld_state_t s = *gstate;
void m_getfld_state_destroy (m_getfld_state_t *gstate) {
m_getfld_state_t s = *gstate;
+/* m_getfld() with the existing iob. */
+int m_getfld2(m_getfld_state_t *gstate, char name[NAMESZ], char *buf, int *bufsz)
+{
+ if (!*gstate)
+ adios(NULL, "m_getfld2 without gstate");
+
+ return m_getfld(gstate, name, buf, bufsz, (*gstate)->iob);
+}
+
+
void
m_unknown(m_getfld_state_t *gstate, FILE *iob)
{
void
m_unknown(m_getfld_state_t *gstate, FILE *iob)
{
+/* m_unknown() with the existing iob. */
+void m_unknown2(m_getfld_state_t *gstate)
+{
+ if (!*gstate)
+ adios(NULL, "m_unknown2 without gstate");
+
+ m_unknown(gstate, (*gstate)->iob);
+}
+
+
/*
* test for msg delimiter string
*/
/*
* test for msg delimiter string
*/