From 25e2a6ed62f686d304f81f24ec0317eb1d273032 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Thu, 22 Feb 2007 09:19:25 +0000 Subject: - quilt/scripts/patchfns.in: Fix an off-by-one error in change_db_strip_level when inserting the strip level in the patch argument list. Also cleanup this function a bit. --- quilt.changes | 7 +++++++ quilt/scripts/patchfns.in | 16 +++++++++------- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/quilt.changes b/quilt.changes index 0934032..924e700 100644 --- a/quilt.changes +++ b/quilt.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Thu Feb 22 10:11:34 CET 2007 - khali@linux-fr.org + +- quilt/scripts/patchfns.in: Fix an off-by-one error in + change_db_strip_level when inserting the strip level in the + patch argument list. Also cleanup this function a bit. + ------------------------------------------------------------------- Wed Feb 21 21:29:29 CET 2007 - khali@linux-fr.org diff --git a/quilt/scripts/patchfns.in b/quilt/scripts/patchfns.in index 1c87139..070ee3a 100644 --- a/quilt/scripts/patchfns.in +++ b/quilt/scripts/patchfns.in @@ -185,10 +185,15 @@ change_db_strip_level() $j=$(j+1) NF-- } + function insert_arg(nr, value, j) { + for (j=NF; j>=nr; j--) + $(j+1)=$j + $nr=value + } + /^'"$(quote_re $patch)"'([ \t]|$)/ \ { p_printed=0 - for (i=2; i<=NF; i++) { - if ($i ~ /^#/) break + for (i=2; i<=NF && $i !~ /^#/; i++) { if ($i ~ /^-p/) { if ("'"$level"'" == "") remove_arg(i--) @@ -202,11 +207,8 @@ change_db_strip_level() continue } } - if (!p_printed && "'"$level"'" != "") { - for (j=NF; j>i; j--) - $(j+1)=$j - $i="'"$level"'" - } + if (!p_printed && "'"$level"'" != "") + insert_arg(2, "'"$level"'") } { print } ' $SERIES > $tmpfile -- cgit