Login | Register
My pages Projects Community openCollabNet

Discussions > commits > svn commit: r2464 - branches/fsvs-1.2.x/fsvs: . src

fsvs
Discussion topic

Back to topic list

svn commit: r2464 - branches/fsvs-1.2.x/fsvs: . src

Author pmarek
Full name P.Marek
Date 2012-10-29 09:53:11 PDT
Message Author: pmarek
Date: 2012-10-29 09:53:10-0700
New Revision: 2464

Modified:
   branches/fsvs-1.2.x/​fsvs/CHANGES
   branches/fsvs-1.2.x/​fsvs/configure.in
   branches/fsvs-1.2.x/​fsvs/src/commit.c
   branches/fsvs-1.2.x/​fsvs/src/cp_mv.c
   branches/fsvs-1.2.x/​fsvs/src/helper.c
   branches/fsvs-1.2.x/​fsvs/src/ignore.c
   branches/fsvs-1.2.x/​fsvs/src/waa.c

Log:
Don't use nested functions; trashes the copy feature.

Modified: branches/fsvs-1.2.x/​fsvs/CHANGES
Url: http://fsvs.tigris.o​rg/source/browse/fsv​s/branches/fsvs-1.2.​x/fsvs/CHANGES?view=​diff&pathrev=246​4&r1=2463&r2​=2464
====================​====================​====================​==================
--- branches/fsvs-1.2.x/​fsvs/CHANGES (original)
+++ branches/fsvs-1.2.x/​fsvs/CHANGES 2012-10-29 09:53:10-0700
@@ -1,6 +1,9 @@
 Changes since 1.2.5
 - configure.in fix for OS X Lion with clang; thanks, Ryan!
   http://fsvs.tigris.o​rg/issues/show_bug.c​gi?id=16
+- Removed nested functions, to make the stack non-executable
+ (gcc needs trampoline code).
+ See http://fsvs.tigris.o​rg/issues/show_bug.c​gi?id=17.
 
 Changes since 1.2.4
 - Bugfix: auto-props not applied for explicitly specified entries.

Modified: branches/fsvs-1.2.x/​fsvs/configure.in
Url: http://fsvs.tigris.o​rg/source/browse/fsv​s/branches/fsvs-1.2.​x/fsvs/configure.in?​view=diff&pathre​v=2464&r1=2463​&r2=2464
====================​====================​====================​==================
--- branches/fsvs-1.2.x/​fsvs/configure.in (original)
+++ branches/fsvs-1.2.x/​fsvs/configure.in 2012-10-29 09:53:10-0700
@@ -230,20 +230,6 @@
 fi
 AC_SUBST(HAVE_O_DIRECTORY)
 
-AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [[ #include <fcntl.h> ]],
- [[ void f1(int a) {
- int f2(void) {
- return a;
- }
- return f2();
- } ]] )],
- [need_fnested_functions=no], [need_fnested_functions=yes])
-if test x$have_o_directory = xyes ; then
- AC_DEFINE(NEED_FNEST​ED_FUNCTIONS, -fnested-functions, -fnested-functions needed)
-fi
-AC_SUBST(NEED_FNEST​ED_FUNCTIONS)
 
 AC_LINK_IFELSE(
     [AC_LANG_PROGRAM(

Modified: branches/fsvs-1.2.x/​fsvs/src/commit.c
Url: http://fsvs.tigris.o​rg/source/browse/fsv​s/branches/fsvs-1.2.​x/fsvs/src/commit.c?​view=diff&pathre​v=2464&r1=2463​&r2=2464
====================​====================​====================​==================
--- branches/fsvs-1.2.x/​fsvs/src/commit.c (original)
+++ branches/fsvs-1.2.x/​fsvs/src/commit.c 2012-10-29 09:53:10-0700
@@ -239,6 +239,37 @@
 
 
 
+/* Convenience function; checks for \c FSVS_PROP_COMMIT_PIPE.
+ * By putting that here we can avoid sending most of the parameters. */
+inline int send_a_prop(void *baton, int store_encoder,
+ struct estat *sts, change_any_prop_t function,
+ char *key, svn_string_t *value,
+ apr_pool_t *pool)
+{
+ int status;
+ svn_error_t *status_svn;
+
+ status=0;
+ /* We could tell the parent whether we need this property value, to avoid
+ * copying and freeing; but it's no performance problem, I think. */
+ if (store_encoder && strcmp(key, propval_commitpipe) == 0)
+ {
+ if (value)
+ STOPIF( hlp__strdup( &sts->decoder, value->data), NULL);
+ else
+ sts->decoder=NULL;
+ }
+
+ status_svn=function(baton, key, value, pool);
+ TEST_FOR_OUT_OF_DATE(sts, status_svn, "send user props");
+
+ex:
+ return status;
+}
+
+
+
+
 /** Send the user-defined properties.
  *
  * The property table is left cleaned up, ie. any deletions that were
@@ -257,7 +288,6 @@
         apr_pool_t *pool)
 {
     int status;
- svn_error_t *status_svn;
     datum key, value;
     hash_t db;
     svn_string_t *str;
@@ -265,31 +295,6 @@
 
     db=NULL;
 
- /* Convinience function; checks for \c FSVS_PROP_COMMIT_PIPE.
- * By putting that here we can avoid sending most of the parameters. */
- int send_a_prop(char *key, svn_string_t *value)
- {
- int status;
-
- status=0;
- /* We could tell the parent whether we need this property value, to avoid
- * copying and freeing; but it's no performance problem, I think. */
- if (store_encoder && strcmp(key, propval_commitpipe) == 0)
- {
- if (value)
- STOPIF( hlp__strdup( &sts->decoder, value->data), NULL);
- else
- sts->decoder=NULL;
- }
-
- status_svn=function(baton, key, value, pool);
- TEST_FOR_OUT_OF_DATE(sts, status_svn, "send user props");
-
-ex:
- return status;
- }
-
-
     /* First do auto-props. */
     STOPIF( ops__apply_group(sts, &db, pool), NULL);
 
@@ -310,7 +315,8 @@
             {
                 DEBUGP("removing property %s", key.dptr);
 
- STOPIF( send_a_prop(key.dptr, NULL), NULL);
+ STOPIF( send_a_prop(baton, store_encoder, sts, function,
+ key.dptr, NULL, pool), NULL);
                 STOPIF( hsh__register_delete(db, key), NULL);
             }
             else
@@ -319,7 +325,8 @@
                         value.dsize, value.dsize, value.dptr);
 
                 str=svn_string_ncrea​te(value.dptr, value.dsize-1, pool);
- STOPIF( send_a_prop(key.dptr, str), NULL);
+ STOPIF( send_a_prop(baton, store_encoder, sts, function,
+ key.dptr, str, pool), NULL);
             }
 
             status=prp__next( db, &key, &key);

Modified: branches/fsvs-1.2.x/​fsvs/src/cp_mv.c
Url: http://fsvs.tigris.o​rg/source/browse/fsv​s/branches/fsvs-1.2.​x/fsvs/src/cp_mv.c?v​iew=diff&pathrev​=2464&r1=2463​&r2=2464
====================​====================​====================​==================
--- branches/fsvs-1.2.x/​fsvs/src/cp_mv.c (original)
+++ branches/fsvs-1.2.x/​fsvs/src/cp_mv.c 2012-10-29 09:53:10-0700
@@ -507,6 +507,11 @@
 }
 
 
+
+static int common;
+int both(struct estat *a, struct estat *b) { common++; return 0; }
+
+
 /** -.
  *
  * The big question is - should this work recursively? Would mean that the
@@ -521,7 +526,6 @@
     static struct cm___candidate_t similar_dirs[MAX_DUP​L_ENTRIES*4];
     struct cm___candidate_t *cur, tmp_cand={0};
     size_t simil_dir_count;
- int common;
     struct estat **children, *curr;
     struct estat **others, *other_dir;
     int other_count, i;
@@ -587,7 +591,6 @@
         common=0;
         other_dir=similar_dirs[i].sts;
 
- int both(struct estat *a, struct estat*b) { common++; return 0; }
         STOPIF( ops__correlate_dirs(sts, other_dir,
                     NULL, both, NULL, NULL), NULL);
 

Modified: branches/fsvs-1.2.x/​fsvs/src/helper.c
Url: http://fsvs.tigris.o​rg/source/browse/fsv​s/branches/fsvs-1.2.​x/fsvs/src/helper.c?​view=diff&pathre​v=2464&r1=2463​&r2=2464
====================​====================​====================​==================
--- branches/fsvs-1.2.x/​fsvs/src/helper.c (original)
+++ branches/fsvs-1.2.x/​fsvs/src/helper.c 2012-10-29 09:53:10-0700
@@ -404,6 +404,42 @@
 /** @} */
 
 
+static const char *src;
+static const char *src_1, *src_2, *src_3;
+static int eop;
+static va_list va;
+static const char null=0;
+static int status;
+void Increment()
+{
+ src =src_1;
+ src_1=src_2;
+ src_2=src_3;
+
+ /* Next character. */
+ if (*src_3) src_3++;
+
+ /* If just prepared character in \c *src_3 is a \c \\0 ,
+ * wrap to next argument.
+ * (If there are still arguments.) */
+ if (!eop)
+ while (!*src_3)
+ {
+ src_3=va_arg(va, char*);
+ if (src_3)
+ DEBUGP("adding %s", src_3);
+ else
+ {
+ /* End of parameters. Let the pointers point to a valid character
+ * (instead of NULL), so that dereferencing works. */
+ eop=1;
+ src_3=&null;
+ break;
+ }
+ }
+}
+
+
 /** -.
  * \param dst A target buffer
  * \param len An optional length-saving field
@@ -440,11 +476,6 @@
     static const char ps[]={ PATH_SEPARATOR, 0 };
     int had_path;
     char *dest;
- const char *src;
- const char *src_1, *src_2, *src_3;
- int status, eop;
- va_list va;
- static const char null=0;
 
 
     status=0;
@@ -456,35 +487,6 @@
     src_1=src_2=src_3=&null;
 
 
- void Increment()
- {
- src =src_1;
- src_1=src_2;
- src_2=src_3;
-
- /* Next character. */
- if (*src_3) src_3++;
-
- /* If just prepared character in \c *src_3 is a \c \\0 ,
- * wrap to next argument.
- * (If there are still arguments.) */
- if (!eop)
- while (!*src_3)
- {
- src_3=va_arg(va, char*);
- if (src_3)
- DEBUGP("adding %s", src_3);
- else
- {
- /* End of parameters. Let the pointers point to a valid character
- * (instead of NULL), so that dereferencing works. */
- eop=1;
- src_3=&null;
- break;
- }
- }
- }
-
 
     /* Do first 4 characters */
     Increment();

Modified: branches/fsvs-1.2.x/​fsvs/src/ignore.c
Url: http://fsvs.tigris.o​rg/source/browse/fsv​s/branches/fsvs-1.2.​x/fsvs/src/ignore.c?​view=diff&pathre​v=2464&r1=2463​&r2=2464
====================​====================​====================​==================
--- branches/fsvs-1.2.x/​fsvs/src/ignore.c (original)
+++ branches/fsvs-1.2.x/​fsvs/src/ignore.c 2012-10-29 09:53:10-0700
@@ -955,6 +955,21 @@
 }
 
 
+static int data_seen;
+int have_now(struct ignore_t *ignore, int cur, char *err)
+{
+ int status;
+
+ status=0;
+ STOPIF_CODE_ERR(data_seen & cur, EINVAL,
+ "!The pattern \"%s\" includes more than a single %s specification.",
+ ignore->pattern, err);
+ data_seen |= cur;
+ex:
+ return status;
+}
+
+
 /** Does all necessary steps to use the given \c ignore_t structure.
  * */
 int ign___init_pattern_into(char *pattern, char *end, struct ignore_t *ignore)
@@ -962,7 +977,7 @@
     int status, stop;
     int and_value, cmp_value, speclen;
     char *cp, *eo_word, *param, *eo_parm;
- int data_seen, pattern_len;
+ int pattern_len;
 
 
     status=0;
@@ -980,19 +995,6 @@
 
 
     data_seen=0;
- int have_now(int cur, char *err)
- {
- int status;
-
- status=0;
- STOPIF_CODE_ERR(data_seen & cur, EINVAL,
- "!The pattern \"%s\" includes more than a single %s specification.",
- ignore->pattern, err);
- data_seen |= cur;
-ex:
- return status;
- }
-
 
     /* gcc reports "used unitialized" - it doesn't see that the loop gets
      * terminated in the case speclen==0. */
@@ -1041,17 +1043,17 @@
 
         if (strncmp(ign__group_take, pattern, speclen)==0)
         {
- STOPIF( have_now(HAVE_GROUP, "group"), NULL);
+ STOPIF( have_now(ignore, HAVE_GROUP, "group"), NULL);
             ignore->group_nam​e=ign__group_take;
         }
         else if (strncmp(ign__group_ign, pattern, speclen)==0)
         {
- STOPIF( have_now(HAVE_GROUP, "group"), NULL);
+ STOPIF( have_now(ignore, HAVE_GROUP, "group"), NULL);
             ignore->group_nam​e=ign__group_ign;
         }
         else if (strncmp("group:", pattern, speclen)==0)
         {
- STOPIF( have_now(HAVE_GROUP, "group"), NULL);
+ STOPIF( have_now(ignore, HAVE_GROUP, "group"), NULL);
             STOPIF_CODE_ERR( !param || eo_parm==param, EINVAL,
                     "!Missing group name in pattern \"%s\".",
                     ignore->pattern);
@@ -1076,18 +1078,18 @@
         else if (strncmp("dironly", pattern, speclen)==0)
         {
             ignore->dir_only=1;
- STOPIF( have_now(HAVE_DIR, "dironly"), NULL);
+ STOPIF( have_now(ignore, HAVE_DIR, "dironly"), NULL);
             data_seen |= HAVE_PATTERN_SUBST;
         }
         else if (strncmp("nocase", pattern, speclen)==0 ||
                 strncmp("insens", pattern, speclen)==0)
         {
             ignore->is_icase=1;
- STOPIF( have_now(HAVE_CASE, "case ignore"), NULL);
+ STOPIF( have_now(ignore, HAVE_CASE, "case ignore"), NULL);
         }
         else if (strncmp("mode:", pattern, speclen)==0)
         {
- STOPIF( have_now(HAVE_MODE, "mode"), NULL);
+ STOPIF( have_now(ignore, HAVE_MODE, "mode"), NULL);
             STOPIF_CODE_ERR( !param, EINVAL,
                     "!Invalid mode specification in \"%s\".", ignore->pattern);
 

Modified: branches/fsvs-1.2.x/​fsvs/src/waa.c
Url: http://fsvs.tigris.o​rg/source/browse/fsv​s/branches/fsvs-1.2.​x/fsvs/src/waa.c?vie​w=diff&pathrev=2​464&r1=2463&​r2=2464
====================​====================​====================​==================
--- branches/fsvs-1.2.x/​fsvs/src/waa.c (original)
+++ branches/fsvs-1.2.x/​fsvs/src/waa.c 2012-10-29 09:53:10-0700
@@ -1406,6 +1406,80 @@
 }
 
 
+static struct estat *old;
+static struct estat current;
+static int nr_new;
+/** Compares the directories.
+ * Every element found in old will be dropped from current;
+ * only new elements are added to old, by temporarily using
+ * current.by_inode.
+ *
+ * Example:
+ *
+ * Old has these elements.
+ * b c e g h
+ *
+ * current gets these entries in by_name before the correlation
+ * (by_inode has just another order):
+ * A b c D e F g h NULL
+ * Now we need A, D, and F.
+ *
+ * After the loop current has:
+ * by_inode A D F
+ * by_name NULL b c NULL e NULL g h NULL
+ * with nr_new=3.
+ *
+ * */
+int new_entry(struct estat *sts, struct estat **sts_p)
+{
+ int status;
+ int ignore;
+
+ STOPIF( ign__is_ignore(sts, &ignore), NULL);
+ if (ignore>0)
+ DEBUGP("ignoring entry %s", sts->name);
+ else
+ {
+ sts->parent=old;
+
+ *sts_p=NULL;
+ current.by_inode[nr_new]=sts;
+ nr_new++;
+
+ DEBUGP("found a new one!");
+ sts->entry_status=FS_NEW;
+ sts->flags |= RF_ISNEW;
+
+ /* Has to be done in that order, so that ac__dispatch() already finds
+ * sts->do_filter_allows set. */
+ ops__set_todo_bits(sts);
+ STOPIF( ac__dispatch(sts), NULL);
+
+ ops__mark_parent_cc(sts, entry_status);
+ approx_entry_count++;
+
+
+ /* if it's a directory, add all subentries, too. */
+ if (S_ISDIR(sts->st.mode) &&
+ ops__are_children_in​teresting(sts) &&
+ (opt__get_int(OPT__FILTER) & FS_NEW))
+ {
+ STOPIF_CODE_ERR( chdir(sts->name) == -1, errno,
+ "chdir(%s)", sts->name);
+
+ STOPIF( waa__build_tree(sts), NULL);
+
+ STOPIF_CODE_ERR( chdir("..") == -1, errno,
+ "parent went away");
+ }
+
+ }
+
+ex:
+ return status;
+}
+
+
 /** Checks for new entries in this directory, and updates the
  * directory information.
  *
@@ -1418,14 +1492,14 @@
  *
  * On \c chdir() an eventual \c EACCES is ignored, and the "maybe changed"
  * status returned. */
-int waa__update_dir(struct estat *old)
+int waa__update_dir(struct estat *_old)
 {
     int dir_hdl, status;
- struct estat current;
- int nr_new, i;
+ int i;
     char *path;
 
 
+ old = _old;
     status=nr_new=0;
     dir_hdl=-1;
 
@@ -1457,76 +1531,6 @@
     if (current.entry_count == 0) goto after_compare;
 
 
- /* Now the directories get compared.
- * Every element found in old will be dropped from current;
- * only new elements are added to old, by temporarily using
- * current.by_inode.
- *
- * Example:
- *
- * Old has these elements.
- * b c e g h
- *
- * current gets these entries in by_name before the correlation
- * (by_inode has just another order):
- * A b c D e F g h NULL
- * Now we need A, D, and F.
- *
- * After the loop current has:
- * by_inode A D F
- * by_name NULL b c NULL e NULL g h NULL
- * with nr_new=3.
- *
- * */
- int new_entry(struct estat *sts, struct estat **sts_p)
- {
- int status;
- int ignore;
-
- STOPIF( ign__is_ignore(sts, &ignore), NULL);
- if (ignore>0)
- DEBUGP("ignoring entry %s", sts->name);
- else
- {
- sts->parent=old;
-
- *sts_p=NULL;
- current.by_inode[nr_new]=sts;
- nr_new++;
-
- DEBUGP("found a new one!");
- sts->entry_status=FS_NEW;
- sts->flags |= RF_ISNEW;
-
- /* Has to be done in that order, so that ac__dispatch() already finds
- * sts->do_filter_allows set. */
- ops__set_todo_bits(sts);
- STOPIF( ac__dispatch(sts), NULL);
-
- ops__mark_parent_cc(sts, entry_status);
- approx_entry_count++;
-
-
- /* if it's a directory, add all subentries, too. */
- if (S_ISDIR(sts->st.mode) &&
- ops__are_children_in​teresting(sts) &&
- (opt__get_int(OPT__FILTER) & FS_NEW))
- {
- STOPIF_CODE_ERR( chdir(sts->name) == -1, errno,
- "chdir(%s)", sts->name);
-
- STOPIF( waa__build_tree(sts), NULL);
-
- STOPIF_CODE_ERR( chdir("..") == -1, errno,
- "parent went away");
- }
-
- }
-
-ex:
- return status;
- }
-
     nr_new=0;
     STOPIF( ops__correlate_dirs( old, &current,
                 NULL, NULL, new_entry, NULL), NULL);
@@ -2831,6 +2835,19 @@
 }
 
 
+static struct estat **to_append;
+static int append_count;
+int remember_to_copy(struct estat *sts, struct estat **sts_p)
+{
+ char *path;
+ ops__build_path(&path, sts);
+ DEBUGP("copy %s", path);
+ to_append[append_count]=sts;
+ append_count++;
+ return 0;
+}
+
+
 /** -.
  *
  * \a dest must already exist; its name is \b not overwritten, as it is
@@ -2843,11 +2860,12 @@
 int waa__copy_entries(struct estat *src, struct estat *dest)
 {
     int status;
- struct estat *newdata, **to_append, **tmp;
- int append_count, left, space;
+ struct estat *newdata, **tmp;
+ int left, space;
 
 
     to_append=NULL;
+ append_count = 0;
     status=0;
 
     ops__copy_single_entry(src, dest);
@@ -2859,13 +2877,7 @@
     STOPIF( hlp__calloc( &to_append,
                 src->entry_count+1, sizeof(src->by_name[0])), NULL);
 
- int remember_to_copy(struct estat *sts, struct estat **sts_p)
- {
- to_append[append_count]=sts;
- append_count++;
- return 0;
- }
-
+// recursive calls trash the common array.
     STOPIF( ops__correlate_dirs( src, dest,
                 remember_to_copy,
                 waa__copy_entries,

« Previous message in topic | 1 of 1 | Next message in topic »

Messages

Show all messages in topic

svn commit: r2464 - branches/fsvs-1.2.x/fsvs: . src pmarek P.Marek 2012-10-29 09:53:11 PDT
Messages per page: