Correct size increase in SigGroupHeadStore()

The code was increasing the size of the allocated memory by 16, but
only increasing the stored size by 10. Now uses one variable for both
places.
Coding style cleanup in detect-modbus files.
Remove an unused define COUNTER_DETECT_ALERTS

The only place this exists in the code is when it is defined.
Don't write target.tvar.idx in DetectFlowintParse

Match functions should not be writing to the SigMatch context. So just use
a local variable instead.
Fix bug in DetectFlowintParse() - Assigning to both parts of a Union

sfd->target.value was always being set, even if the targettype was
not FLOWINT_TARGET_VAL. This would cause the tvar to be overwritten
with garbage data.
DetectFlowintData - remove unused idx in TargetVar.

The idx inside TargetVar inside DetectFlowintData is never used, so remove
it.
Update copyright year in detect-flowbits files.
lua:  in streaming api, indicate open/close

The SCStreamingBuffer call now also returns two booleans:
    data, data_open, data_close = SCStreamingBuffer()

The first indicates this is the first data of this type for this
TCP session or HTTP transaction.

The second indicates this is the last data.

Ticket #1317.
pfring: fixes memleaks

This fixes some memory leaks
Bug #1184
pcre: fix var capture for non relative matches

Var capture setup depended on the match being relative due to a logic
error.
Introduce stats log API, convert existing output

Convert regular 'stats.log' output to this new API.

In addition to the current stats value, also give the last value. This
makes it easy to display the difference.
stats: introduce global config

As the stats api calls the loggers at a global interval, the global
interval should be configured globally.

 # global stats configuration
 stats:
   enabled: yes
   # The interval field (in seconds) controls at what interval
   # the loggers are invoked.
   interval: 8

If this config isn't found, the old config will be supported.
stats: initialize after outputs

Initialize stats after outputs so that we can check if we need to
initialize the stats api at all.
stats: disable stats if no loggers are enabled
output streaming: cleanup at runmode destruction
stats: expose stats to Lua output

Register with type 'stats':

    function init (args)
        local needs = {}
        needs["type"] = "stats"
        return needs
    end

The stats are passed as an array of tables:

    { 1, { name=<name>, tmname=<tm_name>, value=<value>, pvalue=<pvalue>}}
    { 2, { name=<name>, tmname=<tm_name>, value=<value>, pvalue=<pvalue>}}
    etc

Name is the counter name (e.g. decoder.invalid), tm_name is the thread name
(e.g. AFPacketeth05), value is current value, and pvalue is the value of the
last time the script was invoked.
MemBuffer: add expansion call

For some of the buffer users it's hard to predict how big the data
will be. In the stats.log case this depends on chosen runmode and
number of threads.

To deal with this case a 'MemBufferExpand' call is added. This realloc's
the buffer.
log-stats: expand membuffer if necessary

Many threads could lead to a membuffer size requirement bigger than
64k. So use the expansion call to grow the buffer as needed.
Clean up memory leaks in ac-tile code

Free some memory at exit that was not getting freed.

Change pid_pat_list to store copy of case-strings in the same block
of memory as the array of pointers.
Fix memory leak in ac-tile

Incorrectly reallocing the goto table after it was freed by calling
SCACTileReallocState() when really only want to realloc the output table.
This was causing a large goto table to be allocated and never used or
freed.