1c-remove-var-from-list-ctxdiff.patch
text/x-patch
Filename: 1c-remove-var-from-list-ctxdiff.patch
Type: text/x-patch
Part: 2
Message:
Re: CommitFest 2009-09, two weeks on
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: context
| File | + | − |
|---|---|---|
| src/interfaces/ecpg/preproc/extern.h | 1 | 0 |
| src/interfaces/ecpg/preproc/variable.c | 24 | 0 |
diff -dcrpN pgsql.cursor_name/src/interfaces/ecpg/preproc/extern.h pgsql.removevarlist/src/interfaces/ecpg/preproc/extern.h
*** pgsql.cursor_name/src/interfaces/ecpg/preproc/extern.h 2009-09-08 10:12:40.000000000 +0200
--- pgsql.removevarlist/src/interfaces/ecpg/preproc/extern.h 2009-10-03 01:07:54.000000000 +0200
*************** extern struct descriptor *lookup_descrip
*** 90,95 ****
--- 90,96 ----
extern struct variable *descriptor_variable(const char *name, int input);
extern void add_variable_to_head(struct arguments **, struct variable *, struct variable *);
extern void add_variable_to_tail(struct arguments **, struct variable *, struct variable *);
+ extern void remove_variable_from_list(struct arguments ** list, struct variable * var);
extern void dump_variables(struct arguments *, int);
extern struct typedefs *get_typedef(char *);
extern void adjust_array(enum ECPGttype, char **, char **, char *, char *, int, bool);
diff -dcrpN pgsql.cursor_name/src/interfaces/ecpg/preproc/variable.c pgsql.removevarlist/src/interfaces/ecpg/preproc/variable.c
*** pgsql.cursor_name/src/interfaces/ecpg/preproc/variable.c 2009-08-07 13:06:28.000000000 +0200
--- pgsql.removevarlist/src/interfaces/ecpg/preproc/variable.c 2009-10-03 01:09:32.000000000 +0200
*************** add_variable_to_tail(struct arguments **
*** 401,406 ****
--- 401,430 ----
*list = new;
}
+ void
+ remove_variable_from_list(struct arguments ** list, struct variable * var)
+ {
+ struct arguments *p, *prev = NULL;
+ bool found = false;
+
+ for (p = *list; p; p = p->next)
+ {
+ if (p->variable == var)
+ {
+ found = true;
+ break;
+ }
+ prev = p;
+ }
+ if (found)
+ {
+ if (prev)
+ prev->next = p->next;
+ else
+ *list = p->next;
+ }
+ }
+
/* Dump out a list of all the variable on this list.
This is a recursive function that works from the end of the list and
deletes the list as we go on.