[syslog-ng] [PATCH 1/3] value-pairs: Type hinting support

Gergely Nagy algernon at balabit.hu
Thu Nov 22 13:40:31 CET 2012


Balazs Scheidler <bazsi77 at gmail.com> writes:

>> +template_content
>> +               : string                                                 { $$.str = $1; $$.typehint =
>> NULL; } +               | LL_IDENTIFIER '(' string ')'     { $$.str = $3;
>> $$.typehint = $1; } +               ;
>> +
>
> can't we move template compilation here somehow? e.g. return logtemplate as a ptr?

We can. Turns out that the reason I did it this way, was due to the
filter expressions, but there type-hinting makes little sense, so I
updated the patch in such a way that template_content returns a
LogTemplate as <ptr>, and filter expressions don't support type hinting
anymore.

This did make the code a lot nicer, thanks!

I pushed the new code to feature/3.4/templates/cast-typehints for now,
as this is something I'll likely be poking at during the next few days,
and would need a througher review. So I'm not pushing it to
merge-queue/3.4 yet.

(The updated branch also adds a set of unit tests to guard the hinting &
type casting logic)

-- 
|8]



More information about the syslog-ng mailing list