diff options
| author | Michael Meskes | 2001-09-19 14:09:32 +0000 |
|---|---|---|
| committer | Michael Meskes | 2001-09-19 14:09:32 +0000 |
| commit | f0212ced68990b004cf10d6577eedc6bbdf67c78 (patch) | |
| tree | 4d9cbb716de0337490dc418edae013ef13672524 /src/interfaces/ecpg/preproc/descriptor.c | |
| parent | 3baf7400d9e4d4a2dc82ff5e0ec4c6b7d33b3dc9 (diff) | |
- Synced preproc.y with gram.y.
- Synced pgc.l with scan.l.
- Synced keyword.c.
- Include the remaining patches by Christof Petig <[email protected]>.
Diffstat (limited to 'src/interfaces/ecpg/preproc/descriptor.c')
| -rw-r--r-- | src/interfaces/ecpg/preproc/descriptor.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/interfaces/ecpg/preproc/descriptor.c b/src/interfaces/ecpg/preproc/descriptor.c index 405f97a60f3..6542888dd7c 100644 --- a/src/interfaces/ecpg/preproc/descriptor.c +++ b/src/interfaces/ecpg/preproc/descriptor.c @@ -196,3 +196,24 @@ output_get_descr(char *desc_name, char *index) whenever_action(2 | 1); } + +/* I consider dynamic allocation overkill since at most two descriptor + variables are possible per statement. (input and output descriptor) + And descriptors are no normal variables, so they don't belong into + the variable list. +*/ + +#define MAX_DESCRIPTOR_NAMELEN 128 +struct variable *descriptor_variable(const char *name,int input) +{ static char descriptor_names[2][MAX_DESCRIPTOR_NAMELEN]; + static const struct ECPGtype descriptor_type = + { ECPGt_descriptor, 0 }; + static const struct variable varspace[2] = + {{ descriptor_names[0], (struct ECPGtype*)&descriptor_type, 0, NULL }, + { descriptor_names[1], (struct ECPGtype*)&descriptor_type, 0, NULL } + }; + + strncpy(descriptor_names[input],name,MAX_DESCRIPTOR_NAMELEN); + descriptor_names[input][MAX_DESCRIPTOR_NAMELEN-1]=0; + return (struct variable*)&varspace[input]; +} |
