bug-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Revised Patch: changes to Parse_Info calling convention


From: Kenneth Lorber
Subject: Revised Patch: changes to Parse_Info calling convention
Date: Wed, 4 Jun 2003 11:33:10 -0400 (EDT)

I sent out an earlier version of this and got no feedback either way -
I'm guessing it never made it out; this version has been recut against a
more recent cvs image and passes "make check".

Below is a patch that implements 2 changes to the way Parse_Info is
called.  The first adds the void* mentioned in HACKING.  The second
generalizes the "all" flag to a more general "opt" - this is needed for
some other changes I hope to contribute in the near future and touches
the same places in the code so is included here.

I added a FIXME in edit.c - I believe the existing test is wrong.  Can
anyone tell me for sure?  Thanks.

Please let me know if I left out anything, missed any cases, added any
bugs, etc, etc.

Share and Enjoy,
keni

Index: ChangeLog
===================================================================
RCS file: /cvs/ccvs/ChangeLog,v
retrieving revision 1.753
diff -c -r1.753 ChangeLog
*** ChangeLog   2 Jun 2003 20:05:50 -0000       1.753
--- ChangeLog   4 Jun 2003 14:39:22 -0000
***************
*** 1,3 ****
--- 1,7 ----
+ 2003-06-04  Ken Lorber  <address@hidden>
+ 
+       * HACKING: Update note on reentrancy.
+ 
  2003-06-02  Derek Price  <address@hidden>
  
        * NEWS: Note empty diff change text fix.
Index: HACKING
===================================================================
RCS file: /cvs/ccvs/HACKING,v
retrieving revision 1.22
diff -c -r1.22 HACKING
*** HACKING     18 Oct 2001 15:50:43 -0000      1.22
--- HACKING     4 Jun 2003 14:39:22 -0000
***************
*** 89,97 ****
  segment and will allow a multi-threaded server if that is desirable.
  It is also useful to write the code so that it can be easily be made
  reentrant later.  For example, if you need to pass data from a
! Parse_Info caller to its callproc, you need a static variable.  But
! use a single pointer so that when Parse_Info is fixed to pass along a
! void * argument, then the code can easily use that argument.
  
  * Coding standards in general
  
--- 89,97 ----
  segment and will allow a multi-threaded server if that is desirable.
  It is also useful to write the code so that it can be easily be made
  reentrant later.  For example, if you need to pass data from a
! Parse_Info caller to its callproc, you used to need a static variable.
! But by using a single pointer so that when Parse_Info was fixed to pass
! along a void * argument, then the code could easily use that argument.
  
  * Coding standards in general
  
Index: src/ChangeLog
===================================================================
RCS file: /cvs/ccvs/src/ChangeLog,v
retrieving revision 1.2459
diff -c -r1.2459 ChangeLog
*** src/ChangeLog       2 Jun 2003 21:22:42 -0000       1.2459
--- src/ChangeLog       4 Jun 2003 14:39:23 -0000
***************
*** 1,3 ****
--- 1,14 ----
+ 2003-06-04  Ken Lorber  <address@hidden>
+ 
+       * commit.c: Change Parse_Info calling convention to include void *
+       suggested in HACKING file and generalize all argument to opt.
+       * cvs.h: update defs for Parse_Info and its callproc.
+       * edit.c: Change Parse_Info calls for new calling convention.
+       * logmsg.c: Ditto.
+       * parseinfo.c: Change Parse_Info for new calling convention.
+       * server.c: Change Parse_Info calls for new calling convention.
+       * tag.c: Ditto.
+ 
  2003-06-02  Derek Price  <address@hidden>
  
        * sanity.sh: Add comments re portability of test -x & test -e.  Don't
Index: src/commit.c
===================================================================
RCS file: /cvs/ccvs/src/commit.c,v
retrieving revision 1.197
diff -c -r1.197 commit.c
*** src/commit.c        23 May 2003 03:57:47 -0000      1.197
--- src/commit.c        4 Jun 2003 14:39:23 -0000
***************
*** 46,52 ****
  static int lock_RCS PROTO((char *user, RCSNode *rcs, char *rev,
                           char *repository));
  static int precommit_list_proc PROTO((Node * p, void *closure));
! static int precommit_proc PROTO((char *repository, char *filter));
  static int remove_file PROTO ((struct file_info *finfo, char *tag,
                               char *message));
  static void fixaddfile PROTO((char *file, char *repository));
--- 46,52 ----
  static int lock_RCS PROTO((char *user, RCSNode *rcs, char *rev,
                           char *repository));
  static int precommit_list_proc PROTO((Node * p, void *closure));
! static int precommit_proc PROTO((char *repository, char *filter, void 
*udata));
  static int remove_file PROTO ((struct file_info *finfo, char *tag,
                               char *message));
  static void fixaddfile PROTO((char *file, char *repository));
***************
*** 76,82 ****
  static int write_dirnonbranch;
  static char *logfile;
  static List *mulist;
- static List *saved_ulist;
  static char *saved_message;
  static time_t last_register_time;
  
--- 76,81 ----
***************
*** 1098,1106 ****
   * Callback proc for pre-commit checking
   */
  static int
! precommit_proc (repository, filter)
      char *repository;
      char *filter;
  {
      /* see if the filter is there, only if it's a full path */
      if (isabsolute (filter))
--- 1097,1106 ----
   * Callback proc for pre-commit checking
   */
  static int
! precommit_proc (repository, filter, udata)
      char *repository;
      char *filter;
+     void *udata;
  {
      /* see if the filter is there, only if it's a full path */
      if (isabsolute (filter))
***************
*** 1125,1131 ****
  
      run_setup (filter);
      run_arg (repository);
!     (void) walklist (saved_ulist, precommit_list_proc, NULL);
      return (run_exec (RUN_TTY, RUN_TTY, RUN_TTY, RUN_NORMAL|RUN_REALLY));
  }
  
--- 1125,1131 ----
  
      run_setup (filter);
      run_arg (repository);
!     (void) walklist ((List *)udata, precommit_list_proc, NULL);
      return (run_exec (RUN_TTY, RUN_TTY, RUN_TTY, RUN_NORMAL|RUN_REALLY));
  }
  
***************
*** 1143,1148 ****
--- 1143,1149 ----
  {
      int n;
      Node *p;
+     List *saved_ulist;
  
      /* find the update list for this dir */
      p = findnode (mulist, update_dir);
***************
*** 1156,1162 ****
        return (err);
  
      /* run any pre-commit checks */
!     if ((n = Parse_Info (CVSROOTADM_COMMITINFO, repos, precommit_proc, 1)) > 
0)
      {
        error (0, 0, "Pre-commit check failed");
        err += n;
--- 1157,1164 ----
        return (err);
  
      /* run any pre-commit checks */
!     n = Parse_Info (CVSROOTADM_COMMITINFO, repos, precommit_proc, PIOPT_ALL, 
saved_ulist);
!     if (n > 0)
      {
        error (0, 0, "Pre-commit check failed");
        err += n;
Index: src/cvs.h
===================================================================
RCS file: /cvs/ccvs/src/cvs.h,v
retrieving revision 1.254
diff -c -r1.254 cvs.h
*** src/cvs.h   2 Jun 2003 20:05:16 -0000       1.254
--- src/cvs.h   4 Jun 2003 14:39:23 -0000
***************
*** 377,382 ****
--- 377,385 ----
  #define CVS_LOCK_READ 1
  #define CVS_LOCK_WRITE        2
  
+ /* Option flags for Parse_Info() */
+ #define PIOPT_ALL 1   /* accept "all" keyword */
+ 
  extern char *program_name, *program_path, *command_name;
  extern char *Tmpdir, *Editor;
  extern int cvsadmin_root;
***************
*** 491,498 ****
  void strip_trailing_newlines PROTO((char *str));
  int pathname_levels PROTO ((char *path));
  
! typedef       int (*CALLPROC) PROTO((char *repository, char *value));
! int Parse_Info PROTO((char *infofile, char *repository, CALLPROC callproc, 
int all));
  extern int parse_config PROTO ((char *));
  
  typedef       RETSIGTYPE (*SIGCLEANUPPROC)    PROTO(());
--- 494,502 ----
  void strip_trailing_newlines PROTO((char *str));
  int pathname_levels PROTO ((char *path));
  
! typedef       int (*CALLPROC) PROTO((char *repository, char *value, void 
*udata));
! int Parse_Info PROTO((char *infofile, char *repository, CALLPROC callproc,
!       int opt, void *udata));
  extern int parse_config PROTO ((char *));
  
  typedef       RETSIGTYPE (*SIGCLEANUPPROC)    PROTO(());
Index: src/edit.c
===================================================================
RCS file: /cvs/ccvs/src/edit.c,v
retrieving revision 1.58
diff -c -r1.58 edit.c
*** src/edit.c  31 Mar 2003 19:30:56 -0000      1.58
--- src/edit.c  4 Jun 2003 14:39:23 -0000
***************
*** 677,692 ****
      char *file;
  };
  
! /* Pass as a static until we get around to fixing Parse_Info to pass along
!    a void * where we can stash it.  */
! static struct notify_proc_args *notify_args;
! 
! static int notify_proc PROTO ((char *repository, char *filter));
  
  static int
! notify_proc (repository, filter)
      char *repository;
      char *filter;
  {
      FILE *pipefp;
      char *prog;
--- 677,689 ----
      char *file;
  };
  
! static int notify_proc PROTO ((char *repository, char *filter, void *udata));
  
  static int
! notify_proc (repository, filter, udata)
      char *repository;
      char *filter;
+     void *udata;
  {
      FILE *pipefp;
      char *prog;
***************
*** 694,700 ****
      char *p;
      char *q;
      char *srepos;
!     struct notify_proc_args *args = notify_args;
  
      srepos = Short_Repository (repository);
      prog = xmalloc (strlen (filter) + strlen (args->notifyee) + 1);
--- 691,697 ----
      char *p;
      char *q;
      char *srepos;
!     struct notify_proc_args *args = (struct notify_proc_args *)udata;
  
      srepos = Short_Repository (repository);
      prog = xmalloc (strlen (filter) + strlen (args->notifyee) + 1);
***************
*** 929,940 ****
                args.notifyee[endp - p] = '\0';
            }
  
-           notify_args = &args;
            args.type = notif;
            args.who = who;
            args.file = filename;
  
!           (void) Parse_Info (CVSROOTADM_NOTIFY, repository, notify_proc, 1);
            free (args.notifyee);
        }
  
--- 926,937 ----
                args.notifyee[endp - p] = '\0';
            }
  
            args.type = notif;
            args.who = who;
            args.file = filename;
  
!           (void) Parse_Info (CVSROOTADM_NOTIFY, repository, notify_proc,
!                       PIOPT_ALL, &args);
            free (args.notifyee);
        }
  
Index: src/logmsg.c
===================================================================
RCS file: /cvs/ccvs/src/logmsg.c,v
retrieving revision 1.64
diff -c -r1.64 logmsg.c
*** src/logmsg.c        20 May 2003 20:46:38 -0000      1.64
--- src/logmsg.c        4 Jun 2003 14:39:23 -0000
***************
*** 15,32 ****
  static int fmt_proc PROTO((Node * p, void *closure));
  static int logfile_write PROTO((char *repository, char *filter,
                          char *message, FILE * logfp, List * changes));
! static int rcsinfo_proc PROTO((char *repository, char *template));
  static int title_proc PROTO((Node * p, void *closure));
! static int update_logfile_proc PROTO((char *repository, char *filter));
  static void setup_tmpfile PROTO((FILE * xfp, char *xprefix, List * changes));
! static int editinfo_proc PROTO((char *repository, char *template));
! static int verifymsg_proc PROTO((char *repository, char *script));
  
  static FILE *fp;
  static char *str_list;
  static char *str_list_format; /* The format for str_list's contents. */
- static char *editinfo_editor;
- static char *verifymsg_script;
  static Ctype type;
  
  /* 
--- 15,31 ----
  static int fmt_proc PROTO((Node * p, void *closure));
  static int logfile_write PROTO((char *repository, char *filter,
                          char *message, FILE * logfp, List * changes));
! static int rcsinfo_proc PROTO((char *repository, char *template, void 
*udata));
  static int title_proc PROTO((Node * p, void *closure));
! static int update_logfile_proc PROTO((char *repository, char *filter,
!                         void *udata));
  static void setup_tmpfile PROTO((FILE * xfp, char *xprefix, List * changes));
! static int editinfo_proc PROTO((char *repository, char *template, void 
*udata));
! static int verifymsg_proc PROTO((char *repository, char *script, void 
*udata));
  
  static FILE *fp;
  static char *str_list;
  static char *str_list_format; /* The format for str_list's contents. */
  static Ctype type;
  
  /* 
***************
*** 194,199 ****
--- 193,199 ----
      char *fname;
      struct stat pre_stbuf, post_stbuf;
      int retcode = 0;
+     char *editinfo_editor = NULL;
  
  #ifdef CLIENT_SUPPORT
      assert (!current_parsed_root->isremote != !repository);
***************
*** 205,210 ****
--- 205,214 ----
        return;
  
      /* Abort creation of temp file if no editor is defined */
+     /* FIXME - why test this here?  Editor is set by configure and
+      * editinfo_editor is really set later in this function.  This test
+      * should either be deleted or moved below the call to Parse_Info().
+      */
      if (strcmp (Editor, "") == 0 && !editinfo_editor)
        error(1, 0, "no editor defined, must use -e or -m");
  
***************
*** 228,234 ****
  
      if (repository != NULL)
        /* tack templates on if necessary */
!       (void) Parse_Info (CVSROOTADM_RCSINFO, repository, rcsinfo_proc, 1);
      else
      {
        FILE *tfp;
--- 232,239 ----
  
      if (repository != NULL)
        /* tack templates on if necessary */
!       (void) Parse_Info (CVSROOTADM_RCSINFO, repository, rcsinfo_proc,
!               PIOPT_ALL, 0);
      else
      {
        FILE *tfp;
***************
*** 295,301 ****
      else
  #endif
      if (repository != NULL)
!       (void) Parse_Info (CVSROOTADM_EDITINFO, repository, editinfo_proc, 0);
  
      /* run the editor */
      run_setup (editinfo_editor ? editinfo_editor : Editor);
--- 300,307 ----
      else
  #endif
      if (repository != NULL)
!       (void) Parse_Info (CVSROOTADM_EDITINFO, repository, editinfo_proc, 0,
!                &editinfo_editor);
  
      /* run the editor */
      run_setup (editinfo_editor ? editinfo_editor : Editor);
***************
*** 418,423 ****
--- 424,430 ----
      FILE *fp;
      char *fname;
      int retcode = 0;
+     char *verifymsg_script = NULL;
  
      struct stat pre_stbuf, post_stbuf;
  
***************
*** 434,440 ****
  
      /* Get the name of the verification script to run  */
  
!     if (Parse_Info (CVSROOTADM_VERIFYMSG, repository, verifymsg_proc, 0) > 0)
        error (1, 0, "Message verification failed");
  
      if (!verifymsg_script)
--- 441,447 ----
  
      /* Get the name of the verification script to run  */
  
!     if (Parse_Info (CVSROOTADM_VERIFYMSG, repository, verifymsg_proc, 0, 
&verifymsg_script) > 0)
        error (1, 0, "Message verification failed");
  
      if (!verifymsg_script)
***************
*** 559,567 ****
   */
  /* ARGSUSED */
  static int
! rcsinfo_proc (repository, template)
      char *repository;
      char *template;
  {
      static char *last_template;
      FILE *tfp;
--- 566,575 ----
   */
  /* ARGSUSED */
  static int
! rcsinfo_proc (repository, template, udata)
      char *repository;
      char *template;
+     void *udata;
  {
      static char *last_template;
      FILE *tfp;
***************
*** 601,609 ****
   * directory in the source repository.  The log information is fed into the
   * specified program as standard input.
   */
! static FILE *logfp;
! static char *message;
! static List *changes;
  
  void
  Update_Logfile (repository, xmessage, xlogfp, xchanges)
--- 609,619 ----
   * directory in the source repository.  The log information is fed into the
   * specified program as standard input.
   */
! struct ulp_data {
!     FILE *logfp;
!     char *message;
!     List *changes;
! };
  
  void
  Update_Logfile (repository, xmessage, xlogfp, xchanges)
***************
*** 612,639 ****
      FILE *xlogfp;
      List *xchanges;
  {
      /* nothing to do if the list is empty */
      if (xchanges == NULL || xchanges->list->next == xchanges->list)
        return;
  
!     /* set up static vars for update_logfile_proc */
!     message = xmessage;
!     logfp = xlogfp;
!     changes = xchanges;
  
      /* call Parse_Info to do the actual logfile updates */
!     (void) Parse_Info (CVSROOTADM_LOGINFO, repository, update_logfile_proc, 
1);
  }
  
  /*
   * callback proc to actually do the logfile write from Update_Logfile
   */
  static int
! update_logfile_proc (repository, filter)
      char *repository;
      char *filter;
  {
!     return (logfile_write (repository, filter, message, logfp, changes));
  }
  
  /*
--- 622,655 ----
      FILE *xlogfp;
      List *xchanges;
  {
+     struct ulp_data ud;
+ 
      /* nothing to do if the list is empty */
      if (xchanges == NULL || xchanges->list->next == xchanges->list)
        return;
  
!     /* set up vars for update_logfile_proc */
!     ud.message = xmessage;
!     ud.logfp = xlogfp;
!     ud.changes = xchanges;
  
      /* call Parse_Info to do the actual logfile updates */
!     (void) Parse_Info (CVSROOTADM_LOGINFO, repository, update_logfile_proc,
!               PIOPT_ALL, &ud);
  }
  
  /*
   * callback proc to actually do the logfile write from Update_Logfile
   */
  static int
! update_logfile_proc (repository, filter, udata)
      char *repository;
      char *filter;
+     void *udata;
  {
!     struct ulp_data *udp = (struct ulp_data *)udata;
!     return (logfile_write (repository, filter, udp->message, udp->logfp,
!                          udp->changes));
  }
  
  /*
***************
*** 950,981 ****
   */
  /* ARGSUSED */
  static int
! editinfo_proc(repository, editor)
      char *repository;
      char *editor;
  {
      /* nothing to do if the last match is the same as this one */
!     if (editinfo_editor && strcmp (editinfo_editor, editor) == 0)
        return (0);
!     if (editinfo_editor)
!       free (editinfo_editor);
  
!     editinfo_editor = xstrdup (editor);
      return (0);
  }
  
! /*  This routine is calld by Parse_Info.  it asigns the name of the
!  *  message verification script to the global variable verify_script
   */
  static int
! verifymsg_proc (repository, script)
      char *repository;
      char *script;
  {
!     if (verifymsg_script && strcmp (verifymsg_script, script) == 0)
        return (0);
!     if (verifymsg_script)
!       free (verifymsg_script);
!     verifymsg_script = xstrdup (script);
      return (0);
  }
--- 966,1002 ----
   */
  /* ARGSUSED */
  static int
! editinfo_proc(repository, editor, udata)
      char *repository;
      char *editor;
+     void *udata;
  {
+     char **editinfo_editor = (char **)udata;
+ 
      /* nothing to do if the last match is the same as this one */
!     if (*editinfo_editor && strcmp (*editinfo_editor, editor) == 0)
        return (0);
!     if (*editinfo_editor)
!       free (*editinfo_editor);
  
!     *editinfo_editor = xstrdup (editor);
      return (0);
  }
  
! /*  This routine is calld by Parse_Info.  It picks up the name of the
!  *  message verification script.
   */
  static int
! verifymsg_proc (repository, script, udata)
      char *repository;
      char *script;
+     void *udata;
  {
!     char **verifymsg_script = (char **)udata;
!     if (*verifymsg_script && strcmp (*verifymsg_script, script) == 0)
        return (0);
!     if (*verifymsg_script)
!       free (*verifymsg_script);
!     *verifymsg_script = xstrdup (script);
      return (0);
  }
Index: src/parseinfo.c
===================================================================
RCS file: /cvs/ccvs/src/parseinfo.c,v
retrieving revision 1.43
diff -c -r1.43 parseinfo.c
*** src/parseinfo.c     22 May 2003 18:03:28 -0000      1.43
--- src/parseinfo.c     4 Jun 2003 14:39:23 -0000
***************
*** 20,30 ****
   * Return 0 for success, -1 if there was not an INFOFILE, and >0 for failure.
   */
  int
! Parse_Info (infofile, repository, callproc, all)
      char *infofile;
      char *repository;
      CALLPROC callproc;
!     int all;
  {
      int err = 0;
      FILE *fp_info;
--- 20,31 ----
   * Return 0 for success, -1 if there was not an INFOFILE, and >0 for failure.
   */
  int
! Parse_Info (infofile, repository, callproc, opt, udata)
      char *infofile;
      char *repository;
      CALLPROC callproc;
!     int opt;
!     void *udata;
  {
      int err = 0;
      FILE *fp_info;
***************
*** 66,72 ****
      srepos = Short_Repository (repository);
  
      TRACE ( 1, "Parse_Info (%s, %s, %s)",
!           infopath, srepos, all ? "ALL" : "not ALL");
  
      /* search the info file for lines that match */
      callback_done = line_number = 0;
--- 67,73 ----
      srepos = Short_Repository (repository);
  
      TRACE ( 1, "Parse_Info (%s, %s, %s)",
!           infopath, srepos,  (opt & PIOPT_ALL) ? "ALL" : "not ALL");
  
      /* search the info file for lines that match */
      callback_done = line_number = 0;
***************
*** 137,148 ****
         */
        if (strcmp (exp, "ALL") == 0)
        {
!           if (!all)
                error(0, 0, "Keyword `ALL' is ignored at line %d in %s file",
                      line_number, infofile);
            else if ((expanded_value = expand_path (value, infofile, 
line_number)) != NULL)
            {
!               err += callproc (repository, expanded_value);
                free (expanded_value);
            }
            else
--- 138,149 ----
         */
        if (strcmp (exp, "ALL") == 0)
        {
!           if (! (opt & PIOPT_ALL))
                error(0, 0, "Keyword `ALL' is ignored at line %d in %s file",
                      line_number, infofile);
            else if ((expanded_value = expand_path (value, infofile, 
line_number)) != NULL)
            {
!               err += callproc (repository, expanded_value, udata);
                free (expanded_value);
            }
            else
***************
*** 167,173 ****
        /* it did, so do the callback and note that we did one */
        if ((expanded_value = expand_path (value, infofile, line_number)) != 
NULL)
        {
!           err += callproc (repository, expanded_value);
            free (expanded_value);
        }
        else
--- 168,174 ----
        /* it did, so do the callback and note that we did one */
        if ((expanded_value = expand_path (value, infofile, line_number)) != 
NULL)
        {
!           err += callproc (repository, expanded_value, udata);
            free (expanded_value);
        }
        else
***************
*** 184,190 ****
      {
        if ((expanded_value = expand_path (default_value, infofile, 
default_line)) != NULL)
        {
!           err += callproc (repository, expanded_value);
            free (expanded_value);
        }
        else
--- 185,191 ----
      {
        if ((expanded_value = expand_path (default_value, infofile, 
default_line)) != NULL)
        {
!           err += callproc (repository, expanded_value, udata);
            free (expanded_value);
        }
        else
Index: src/server.c
===================================================================
RCS file: /cvs/ccvs/src/server.c,v
retrieving revision 1.297
diff -c -r1.297 server.c
*** src/server.c        29 May 2003 18:46:50 -0000      1.297
--- src/server.c        4 Jun 2003 14:39:23 -0000
***************
*** 4350,4369 ****
      char *repository;
  };
  
- /* Here as a static until we get around to fixing Parse_Info to pass along
-    a void * for it.  */
- static struct template_proc_data *tpd;
- 
  static int
! template_proc (repository, template)
      char *repository;
      char *template;
  {
      FILE *fp;
      char buf[1024];
      size_t n;
      struct stat sb;
!     struct template_proc_data *data = tpd;
  
      if (!supported_response ("Template"))
        /* Might want to warn the user that the rcsinfo feature won't work.  */
--- 4350,4366 ----
      char *repository;
  };
  
  static int
! template_proc (repository, template, udata)
      char *repository;
      char *template;
+     void *udata;
  {
      FILE *fp;
      char buf[1024];
      size_t n;
      struct stat sb;
!     struct template_proc_data *data = (struct template_proc_data *)udata;
  
      if (!supported_response ("Template"))
        /* Might want to warn the user that the rcsinfo feature won't work.  */
***************
*** 4442,4449 ****
      struct template_proc_data data;
      data.update_dir = update_dir;
      data.repository = repository;
!     tpd = &data;
!     (void) Parse_Info (CVSROOTADM_RCSINFO, repository, template_proc, 1);
  }
  
  static void
--- 4439,4446 ----
      struct template_proc_data data;
      data.update_dir = update_dir;
      data.repository = repository;
!     (void) Parse_Info (CVSROOTADM_RCSINFO, repository, template_proc,
!                      PIOPT_ALL, &data);
  }
  
  static void
Index: src/tag.c
===================================================================
RCS file: /cvs/ccvs/src/tag.c,v
retrieving revision 1.102
diff -c -r1.102 tag.c
*** src/tag.c   19 May 2003 04:47:02 -0000      1.102
--- src/tag.c   4 Jun 2003 14:39:24 -0000
***************
*** 22,28 ****
  static int check_filesdoneproc PROTO ((void *callerdat, int err,
                                       char *repos, char *update_dir,
                                       List *entries));
! static int pretag_proc PROTO((char *repository, char *filter));
  static void masterlist_delproc PROTO((Node *p));
  static void tag_delproc PROTO((Node *p));
  static int pretag_list_proc PROTO((Node *p, void *closure));
--- 22,28 ----
  static int check_filesdoneproc PROTO ((void *callerdat, int err,
                                       char *repos, char *update_dir,
                                       List *entries));
! static int pretag_proc PROTO((char *repository, char *filter, void *udata));
  static void masterlist_delproc PROTO((Node *p));
  static void tag_delproc PROTO((Node *p));
  static int pretag_list_proc PROTO((Node *p, void *closure));
***************
*** 554,559 ****
--- 554,566 ----
      return (0);
  }
  
+ struct pretag_proc_data {
+      List *tlist;
+      int delete_flag;
+      int force_tag_move;
+      char *symtag;
+ };
+ 
  static int
  check_filesdoneproc (callerdat, err, repos, update_dir, entries)
      void *callerdat;
***************
*** 564,569 ****
--- 571,577 ----
  {
      int n;
      Node *p;
+     struct pretag_proc_data ppd;
  
      p = findnode(mtlist, update_dir);
      if (p != NULL)
***************
*** 578,584 ****
      {
          return (err);
      }
!     if ((n = Parse_Info(CVSROOTADM_TAGINFO, repos, pretag_proc, 1)) > 0)
      {
          error (0, 0, "Pre-tag check failed");
          err += n;
--- 586,597 ----
      {
          return (err);
      }
! 
!     ppd.tlist = tlist;
!     ppd.delete_flag = delete_flag;
!     ppd.force_tag_move = force_tag_move;
!     ppd.symtag = symtag;
!     if ((n = Parse_Info(CVSROOTADM_TAGINFO, repos, pretag_proc, PIOPT_ALL, 
&ppd)) > 0)
      {
          error (0, 0, "Pre-tag check failed");
          err += n;
***************
*** 587,596 ****
  }
  
  static int
! pretag_proc(repository, filter)
      char *repository;
      char *filter;
  {
      if (filter[0] == '/')
      {
          char *s, *cp;
--- 600,611 ----
  }
  
  static int
! pretag_proc(repository, filter, udata)
      char *repository;
      char *filter;
+     void *udata;
  {
+     struct pretag_proc_data *ppd = (struct pretag_proc_data *)udata;
      if (filter[0] == '/')
      {
          char *s, *cp;
***************
*** 613,622 ****
          free(s);
      }
      run_setup (filter);
!     run_arg (symtag);
!     run_arg (delete_flag ? "del" : force_tag_move ? "mov" : "add");
      run_arg (repository);
!     walklist(tlist, pretag_list_proc, NULL);
      return (run_exec (RUN_TTY, RUN_TTY, RUN_TTY, RUN_NORMAL));
  }
  
--- 628,637 ----
          free(s);
      }
      run_setup (filter);
!     run_arg (ppd->symtag);
!     run_arg (ppd->delete_flag ? "del" : ppd->force_tag_move ? "mov" : "add");
      run_arg (repository);
!     walklist(ppd->tlist, pretag_list_proc, NULL);
      return (run_exec (RUN_TTY, RUN_TTY, RUN_TTY, RUN_NORMAL));
  }
  




reply via email to

[Prev in Thread] Current Thread [Next in Thread]