Git development
 help / color / mirror / Atom feed
From: sean <seanlkml@sympatico.ca>
To: git@vger.kernel.org
Cc: Linus Torvalds <torvalds@osdl.org>
Subject: [PATCH] Another config file parsing fix.
Date: Sat, 6 May 2006 14:14:02 -0400	[thread overview]
Message-ID: <BAYC1-PASMTP050DC939D9D702CA1B3208AEAA0@CEZ.ICE> (raw)
Message-ID: <20060506141402.3909cb37.seanlkml@sympatico.ca> (raw)

If the variable we need to store should go into a section
that currently only has a single variable (not matching
the one we're trying to insert), we will already be into
the next section before we notice we've bypassed the correct
location to insert the variable.

To handle this case we store the current location as soon
as we find a variable matching the section of our new
variable.

Signed-off-by: Sean Estabrooks <seanlkml@sympatico.ca>


---

 config.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

1ba487db7393d773a2a4b7c404ba1b807272eb7d
diff --git a/config.c b/config.c
index 87fb220..41066e4 100644
--- a/config.c
+++ b/config.c
@@ -336,8 +336,10 @@ static int store_aux(const char* key, co
 			store.state = KEY_SEEN;
 			store.seen++;
 		} else if (strrchr(key, '.') - key == store.baselen &&
-			      !strncmp(key, store.key, store.baselen))
+			      !strncmp(key, store.key, store.baselen)) {
 					store.state = SECTION_SEEN;
+					store.offset[store.seen] = ftell(config_file);
+		}
 	}
 	return 0;
 }
-- 
1.3.2.g6e99a-dirty

             reply	other threads:[~2006-05-06 18:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20060506141402.3909cb37.seanlkml@sympatico.ca>
2006-05-06 18:14 ` sean [this message]
     [not found] ` <20060506142511.667fe954.seanlkml@sympatico.ca>
2006-05-06 18:25   ` [PATCH] Another config file parsing fix sean
     [not found]     ` <20060506154343.750a806a.seanlkml@sympatico.ca>
2006-05-06 19:43       ` [PATCH] t1300-repo-config: two new config parsing tests sean
2006-05-06 21:01     ` [PATCH] Another config file parsing fix Johannes Schindelin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BAYC1-PASMTP050DC939D9D702CA1B3208AEAA0@CEZ.ICE \
    --to=seanlkml@sympatico.ca \
    --cc=git@vger.kernel.org \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox