[augeas-devel] [PATCH 1/3] * src/get.c: remove braindead use of alloca
David Lutterkort
lutter at redhat.com
Sat Jan 31 01:08:35 UTC 2009
---
src/get.c | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/src/get.c b/src/get.c
index 9357afe..b87241b 100644
--- a/src/get.c
+++ b/src/get.c
@@ -170,11 +170,13 @@ static void print_dict(struct dict *dict, int indent) {
#endif
static void get_expected_error(struct state *state, struct lens *l) {
- char *word, *p, *pat;
+ /* Size of the excerpt of the input text we'll show */
+ static const int wordlen = 10;
+ char word[wordlen+1];
+ char *p, *pat;
- word = alloca(11);
- strncpy(word, state->split->start, 10);
- word[10] = '\0';
+ strncpy(word, state->split->start, wordlen);
+ word[wordlen] = '\0';
for (p = word; *p != '\0' && *p != '\n'; p++);
*p = '\0';
--
1.6.0.6
More information about the augeas-devel
mailing list