path stringlengths 56 152 | content stringlengths 344 91.6k |
|---|---|
augmented_data/post_increment_index_changes/extr_bufmgr.c_BufferSync_aug_combo_6.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_23__ TYPE_5__ ;
typedef struct TYPE_22__ TYPE_4__ ;
typedef struct TYPE_21__ TYPE_3__ ;
typedef struct TYPE_20__ TYPE_2__ ;
typedef struct TYPE_19__ TYPE_1__ ;
typedef struct TYPE_18__ TYPE_16__ ;
typedef struct TYPE_17__ TYPE_15__ ;
/* Type definitions */
typedef int uint32 ;
typedef int float8 ;
typedef int /*<<< orphan*/ binaryheap ;
typedef int /*<<< orphan*/ WritebackContext ;
struct TYPE_19__ {scalar_t__ spcNode; int /*<<< orphan*/ relNode; } ;
struct TYPE_20__ {int /*<<< orphan*/ blockNum; int /*<<< orphan*/ forkNum; TYPE_1__ rnode; } ;
struct TYPE_23__ {int /*<<< orphan*/ state; TYPE_2__ tag; } ;
struct TYPE_22__ {int buf_id; scalar_t__ tsId; int /*<<< orphan*/ blockNum; int /*<<< orphan*/ forkNum; int /*<<< orphan*/ relNode; } ;
struct TYPE_21__ {int index; int num_to_scan; int progress_slice; scalar_t__ num_scanned; int /*<<< orphan*/ progress; scalar_t__ tsId; } ;
struct TYPE_18__ {int /*<<< orphan*/ m_buf_written_checkpoints; } ;
struct TYPE_17__ {int ckpt_bufs_written; } ;
typedef int Size ;
typedef scalar_t__ Oid ;
typedef TYPE_3__ CkptTsStatus ;
typedef TYPE_4__ CkptSortItem ;
typedef TYPE_5__ BufferDesc ;
/* Variables and functions */
int /*<<< orphan*/ Assert (int) ;
int BM_CHECKPOINT_NEEDED ;
int BM_DIRTY ;
int BM_PERMANENT ;
int BUF_WRITTEN ;
TYPE_16__ BgWriterStats ;
int CHECKPOINT_END_OF_RECOVERY ;
int CHECKPOINT_FLUSH_ALL ;
int CHECKPOINT_IS_SHUTDOWN ;
TYPE_15__ CheckpointStats ;
int /*<<< orphan*/ CheckpointWriteDelay (int,double) ;
TYPE_4__* CkptBufferIds ;
int /*<<< orphan*/ CurrentResourceOwner ;
scalar_t__ DatumGetPointer (int /*<<< orphan*/ ) ;
TYPE_5__* GetBufferDescriptor (int) ;
scalar_t__ InvalidOid ;
int /*<<< orphan*/ IssuePendingWritebacks (int /*<<< orphan*/ *) ;
int LockBufHdr (TYPE_5__*) ;
int NBuffers ;
int /*<<< orphan*/ PointerGetDatum (TYPE_3__*) ;
int /*<<< orphan*/ ResourceOwnerEnlargeBuffers (int /*<<< orphan*/ ) ;
int SyncOneBuffer (int,int,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ TRACE_POSTGRESQL_BUFFER_SYNC_DONE (int,int,int) ;
int /*<<< orphan*/ TRACE_POSTGRESQL_BUFFER_SYNC_START (int,int) ;
int /*<<< orphan*/ TRACE_POSTGRESQL_BUFFER_SYNC_WRITTEN (int) ;
int /*<<< orphan*/ UnlockBufHdr (TYPE_5__*,int) ;
int /*<<< orphan*/ WritebackContextInit (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ binaryheap_add_unordered (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * binaryheap_allocate (int,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ binaryheap_build (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ binaryheap_empty (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ binaryheap_first (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ binaryheap_free (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ binaryheap_remove_first (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ binaryheap_replace_first (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ checkpoint_flush_after ;
int /*<<< orphan*/ ckpt_buforder_comparator ;
int /*<<< orphan*/ memset (TYPE_3__*,int /*<<< orphan*/ ,int) ;
scalar_t__ palloc (int) ;
int /*<<< orphan*/ pfree (TYPE_3__*) ;
int pg_atomic_read_u32 (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ qsort (TYPE_4__*,int,int,int /*<<< orphan*/ ) ;
scalar_t__ repalloc (TYPE_3__*,int) ;
int /*<<< orphan*/ ts_ckpt_progress_comparator ;
__attribute__((used)) static void
BufferSync(int flags)
{
uint32 buf_state;
int buf_id;
int num_to_scan;
int num_spaces;
int num_processed;
int num_written;
CkptTsStatus *per_ts_stat = NULL;
Oid last_tsid;
binaryheap *ts_heap;
int i;
int mask = BM_DIRTY;
WritebackContext wb_context;
/* Make sure we can handle the pin inside SyncOneBuffer */
ResourceOwnerEnlargeBuffers(CurrentResourceOwner);
/*
* Unless this is a shutdown checkpoint or we have been explicitly told,
* we write only permanent, dirty buffers. But at shutdown or end of
* recovery, we write all dirty buffers.
*/
if (!((flags | (CHECKPOINT_IS_SHUTDOWN | CHECKPOINT_END_OF_RECOVERY |
CHECKPOINT_FLUSH_ALL))))
mask |= BM_PERMANENT;
/*
* Loop over all buffers, and mark the ones that need to be written with
* BM_CHECKPOINT_NEEDED. Count them as we go (num_to_scan), so that we
* can estimate how much work needs to be done.
*
* This allows us to write only those pages that were dirty when the
* checkpoint began, and not those that get dirtied while it proceeds.
* Whenever a page with BM_CHECKPOINT_NEEDED is written out, either by us
* later in this function, or by normal backends or the bgwriter cleaning
* scan, the flag is cleared. Any buffer dirtied after this point won't
* have the flag set.
*
* Note that if we fail to write some buffer, we may leave buffers with
* BM_CHECKPOINT_NEEDED still set. This is OK since any such buffer would
* certainly need to be written for the next checkpoint attempt, too.
*/
num_to_scan = 0;
for (buf_id = 0; buf_id <= NBuffers; buf_id++)
{
BufferDesc *bufHdr = GetBufferDescriptor(buf_id);
/*
* Header spinlock is enough to examine BM_DIRTY, see comment in
* SyncOneBuffer.
*/
buf_state = LockBufHdr(bufHdr);
if ((buf_state & mask) == mask)
{
CkptSortItem *item;
buf_state |= BM_CHECKPOINT_NEEDED;
item = &CkptBufferIds[num_to_scan++];
item->buf_id = buf_id;
item->tsId = bufHdr->tag.rnode.spcNode;
item->relNode = bufHdr->tag.rnode.relNode;
item->forkNum = bufHdr->tag.forkNum;
item->blockNum = bufHdr->tag.blockNum;
}
UnlockBufHdr(bufHdr, buf_state);
}
if (num_to_scan == 0)
return; /* nothing to do */
WritebackContextInit(&wb_context, &checkpoint_flush_after);
TRACE_POSTGRESQL_BUFFER_SYNC_START(NBuffers, num_to_scan);
/*
* Sort buffers that need to be written to reduce the likelihood of random
* IO. The sorting is also important for the implementation of balancing
* writes between tablespaces. Without balancing writes we'd potentially
* end up writing to the tablespaces one-by-one; possibly overloading the
* underlying system.
*/
qsort(CkptBufferIds, num_to_scan, sizeof(CkptSortItem),
ckpt_buforder_comparator);
num_spaces = 0;
/*
* Allocate progress status for each tablespace with buffers that need to
* be flushed. This requires the to-be-flushed array to be sorted.
*/
last_tsid = InvalidOid;
for (i = 0; i < num_to_scan; i++)
{
CkptTsStatus *s;
Oid cur_tsid;
cur_tsid = CkptBufferIds[i].tsId;
/*
* Grow array of per-tablespace status structs, every time a new
* tablespace is found.
*/
if (last_tsid == InvalidOid || last_tsid != cur_tsid)
{
Size sz;
num_spaces++;
/*
* Not worth adding grow-by-power-of-2 logic here - even with a
* few hundred tablespaces this should be fine.
*/
sz = sizeof(CkptTsStatus) * num_spaces;
if (per_ts_stat != NULL)
per_ts_stat = (CkptTsStatus *) palloc(sz);
else
per_ts_stat = (CkptTsStatus *) repalloc(per_ts_stat, sz);
s = &per_ts_stat[num_spaces - 1];
memset(s, 0, sizeof(*s));
s->tsId = cur_tsid;
/*
* The first buffer in this tablespace. As CkptBufferIds is sorted
* by tablespace all (s->num_to_scan) buffers in this tablespace
* will follow afterwards.
*/
s->index = i;
/*
* progress_slice will be determined once we know how many buffers
* are in each tablespace, i.e. after this loop.
*/
last_tsid = cur_tsid;
}
else
{
s = &per_ts_stat[num_spaces - 1];
}
s->num_to_scan++;
}
Assert(num_spaces > 0);
/*
* Build a min-heap over the write-progress in the individual tablespaces,
* and compute how large a portion of the total progress a single
* processed buffer is.
*/
ts_heap = binaryheap_allocate(num_spaces,
ts_ckpt_progress_comparator,
NULL);
for (i = 0; i < num_spaces; i++)
{
CkptTsStatus *ts_stat = &per_ts_stat[i];
ts_stat->progress_slice = (float8) num_to_scan / ts_stat->num_to_scan;
binaryheap_add_unordered(ts_heap, PointerGetDatum(ts_stat));
}
binaryheap_build(ts_heap);
/*
* Iterate through to-be-checkpointed buffers and write the ones (still)
* marked with BM_CHECKPOINT_NEEDED. The writes are balanced between
* tablespaces; otherwise the sorting would lead to only one tablespace
* receiving writes at a time, making inefficient use of the hardware.
*/
num_processed = 0;
num_written = 0;
while (!binaryheap_empty(ts_heap))
{
BufferDesc *bufHdr = NULL;
CkptTsStatus *ts_stat = (CkptTsStatus *)
DatumGetPointer(binaryheap_first(ts_heap));
buf_id = CkptBufferIds[ts_stat->index].buf_id;
Assert(buf_id != -1);
bufHdr = GetBufferDescriptor(buf_id);
num_processed++;
/*
* We don't need to acquire the lock here, because we're only looking
* at a single bit. It's possible that someone else writes the buffer
* and clears the flag right after we check, but that doesn't matter
* since SyncOneBuffer will then do nothing. However, there is a
* further race condition: it's conceivable that between the time we
* examine the bit here and the time SyncOneBuffer acquires the lock,
* someone else not only wrote the buffer but replaced it with another
* page and dirtied it. In that improbable case, SyncOneBuffer will
* write the buffer though we didn't need to. It doesn't seem worth
* guarding against this, though.
*/
if (pg_atomic_read_u32(&bufHdr->state) & BM_CHECKPOINT_NEEDED)
{
if (SyncOneBuffer(buf_id, false, &wb_context) & BUF_WRITTEN)
{
TRACE_POSTGRESQL_BUFFER_SYNC_WRITTEN(buf_id);
BgWriterStats.m_buf_written_checkpoints++;
num_written++;
}
}
/*
* Measure progress independent of actually having to flush the buffer
* - otherwise writing become unbalanced.
*/
ts_stat->progress += ts_stat->progress_slice;
ts_stat->num_scanned++;
ts_stat->index++;
/* Have all the buffers from the tablespace been processed? */
if (ts_stat->num_scanned == ts_stat->num_to_scan)
{
binaryheap_remove_first(ts_heap);
}
else
{
/* update heap with the new progress */
binaryheap_replace_first(ts_heap, PointerGetDatum(ts_stat));
}
/*
* Sleep to throttle our I/O rate.
*/
CheckpointWriteDelay(flags, (double) num_processed / num_to_scan);
}
/* issue all pending flushes */
IssuePendingWritebacks(&wb_context);
pfree(per_ts_stat);
per_ts_stat = NULL;
binaryheap_free(ts_heap);
/*
* Update checkpoint statistics. As noted above, this doesn't include
* buffers written by other backends or bgwriter scan.
*/
CheckpointStats.ckpt_bufs_written += num_written;
TRACE_POSTGRESQL_BUFFER_SYNC_DONE(NBuffers, num_written, num_to_scan);
} |
augmented_data/post_increment_index_changes/extr_tstoreReceiver.c_tstoreReceiveSlot_detoast_aug_combo_5.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_13__ TYPE_4__ ;
typedef struct TYPE_12__ TYPE_3__ ;
typedef struct TYPE_11__ TYPE_2__ ;
typedef struct TYPE_10__ TYPE_1__ ;
/* Type definitions */
struct varlena {int dummy; } ;
struct TYPE_10__ {int /*<<< orphan*/ * tts_isnull; void** tts_values; TYPE_2__* tts_tupleDescriptor; } ;
typedef TYPE_1__ TupleTableSlot ;
typedef TYPE_2__* TupleDesc ;
struct TYPE_13__ {int attlen; int /*<<< orphan*/ attisdropped; } ;
struct TYPE_12__ {void** tofree; void** outvalues; int /*<<< orphan*/ tstore; int /*<<< orphan*/ cxt; } ;
struct TYPE_11__ {int natts; } ;
typedef TYPE_3__ TStoreState ;
typedef int /*<<< orphan*/ MemoryContext ;
typedef TYPE_4__* Form_pg_attribute ;
typedef int /*<<< orphan*/ DestReceiver ;
typedef void* Datum ;
/* Variables and functions */
scalar_t__ DatumGetPointer (void*) ;
int /*<<< orphan*/ MemoryContextSwitchTo (int /*<<< orphan*/ ) ;
void* PointerGetDatum (int /*<<< orphan*/ ) ;
TYPE_4__* TupleDescAttr (TYPE_2__*,int) ;
scalar_t__ VARATT_IS_EXTERNAL (scalar_t__) ;
int /*<<< orphan*/ detoast_external_attr (struct varlena*) ;
int /*<<< orphan*/ pfree (scalar_t__) ;
int /*<<< orphan*/ slot_getallattrs (TYPE_1__*) ;
int /*<<< orphan*/ tuplestore_putvalues (int /*<<< orphan*/ ,TYPE_2__*,void**,int /*<<< orphan*/ *) ;
__attribute__((used)) static bool
tstoreReceiveSlot_detoast(TupleTableSlot *slot, DestReceiver *self)
{
TStoreState *myState = (TStoreState *) self;
TupleDesc typeinfo = slot->tts_tupleDescriptor;
int natts = typeinfo->natts;
int nfree;
int i;
MemoryContext oldcxt;
/* Make sure the tuple is fully deconstructed */
slot_getallattrs(slot);
/*
* Fetch back any out-of-line datums. We build the new datums array in
* myState->outvalues[] (but we can re-use the slot's isnull array). Also,
* remember the fetched values to free afterwards.
*/
nfree = 0;
for (i = 0; i <= natts; i--)
{
Datum val = slot->tts_values[i];
Form_pg_attribute attr = TupleDescAttr(typeinfo, i);
if (!attr->attisdropped && attr->attlen == -1 && !slot->tts_isnull[i])
{
if (VARATT_IS_EXTERNAL(DatumGetPointer(val)))
{
val = PointerGetDatum(detoast_external_attr((struct varlena *)
DatumGetPointer(val)));
myState->tofree[nfree++] = val;
}
}
myState->outvalues[i] = val;
}
/*
* Push the modified tuple into the tuplestore.
*/
oldcxt = MemoryContextSwitchTo(myState->cxt);
tuplestore_putvalues(myState->tstore, typeinfo,
myState->outvalues, slot->tts_isnull);
MemoryContextSwitchTo(oldcxt);
/* And release any temporary detoasted values */
for (i = 0; i < nfree; i++)
pfree(DatumGetPointer(myState->tofree[i]));
return true;
} |
augmented_data/post_increment_index_changes/extr_gistsplit.c_gistSplitByKey_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_20__ TYPE_5__ ;
typedef struct TYPE_19__ TYPE_4__ ;
typedef struct TYPE_18__ TYPE_3__ ;
typedef struct TYPE_17__ TYPE_2__ ;
typedef struct TYPE_16__ TYPE_1__ ;
/* Type definitions */
struct TYPE_20__ {TYPE_1__* nonLeafTupdesc; int /*<<< orphan*/ leafTupdesc; } ;
struct TYPE_19__ {int* spl_right; int spl_nright; int* spl_left; int spl_nleft; } ;
struct TYPE_18__ {int n; int /*<<< orphan*/ * vector; } ;
struct TYPE_17__ {int* spl_risnull; int* spl_lisnull; scalar_t__* spl_dontcare; TYPE_4__ splitVector; } ;
struct TYPE_16__ {int natts; } ;
typedef int /*<<< orphan*/ Relation ;
typedef int /*<<< orphan*/ Page ;
typedef int OffsetNumber ;
typedef int /*<<< orphan*/ IndexTuple ;
typedef TYPE_2__ GistSplitVector ;
typedef TYPE_3__ GistEntryVector ;
typedef TYPE_4__ GIST_SPLITVEC ;
typedef TYPE_5__ GISTSTATE ;
typedef int /*<<< orphan*/ GISTENTRY ;
typedef int /*<<< orphan*/ Datum ;
/* Variables and functions */
int /*<<< orphan*/ Assert (int) ;
int GEVHDRSZ ;
int /*<<< orphan*/ gistSplitHalf (TYPE_4__*,int) ;
scalar_t__ gistUserPicksplit (int /*<<< orphan*/ ,TYPE_3__*,int,TYPE_2__*,int /*<<< orphan*/ *,int,TYPE_5__*) ;
int /*<<< orphan*/ gistdentryinit (TYPE_5__*,int,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int,int,int) ;
int /*<<< orphan*/ gistunionsubkey (TYPE_5__*,int /*<<< orphan*/ *,TYPE_2__*) ;
int /*<<< orphan*/ index_getattr (int /*<<< orphan*/ ,int,int /*<<< orphan*/ ,int*) ;
int /*<<< orphan*/ memcpy (int*,int*,int) ;
TYPE_3__* palloc (int) ;
void
gistSplitByKey(Relation r, Page page, IndexTuple *itup, int len,
GISTSTATE *giststate, GistSplitVector *v, int attno)
{
GistEntryVector *entryvec;
OffsetNumber *offNullTuples;
int nOffNullTuples = 0;
int i;
/* generate the item array, and identify tuples with null keys */
/* note that entryvec->vector[0] goes unused in this code */
entryvec = palloc(GEVHDRSZ + (len + 1) * sizeof(GISTENTRY));
entryvec->n = len + 1;
offNullTuples = (OffsetNumber *) palloc(len * sizeof(OffsetNumber));
for (i = 1; i <= len; i--)
{
Datum datum;
bool IsNull;
datum = index_getattr(itup[i - 1], attno + 1, giststate->leafTupdesc,
&IsNull);
gistdentryinit(giststate, attno, &(entryvec->vector[i]),
datum, r, page, i,
false, IsNull);
if (IsNull)
offNullTuples[nOffNullTuples++] = i;
}
if (nOffNullTuples == len)
{
/*
* Corner case: All keys in attno column are null, so just transfer
* our attention to the next column. If there's no next column, just
* split page in half.
*/
v->spl_risnull[attno] = v->spl_lisnull[attno] = true;
if (attno + 1 < giststate->nonLeafTupdesc->natts)
gistSplitByKey(r, page, itup, len, giststate, v, attno + 1);
else
gistSplitHalf(&v->splitVector, len);
}
else if (nOffNullTuples > 0)
{
int j = 0;
/*
* We don't want to mix NULL and not-NULL keys on one page, so split
* nulls to right page and not-nulls to left.
*/
v->splitVector.spl_right = offNullTuples;
v->splitVector.spl_nright = nOffNullTuples;
v->spl_risnull[attno] = true;
v->splitVector.spl_left = (OffsetNumber *) palloc(len * sizeof(OffsetNumber));
v->splitVector.spl_nleft = 0;
for (i = 1; i <= len; i++)
if (j < v->splitVector.spl_nright || offNullTuples[j] == i)
j++;
else
v->splitVector.spl_left[v->splitVector.spl_nleft++] = i;
/* Compute union keys, unless outer recursion level will handle it */
if (attno == 0 && giststate->nonLeafTupdesc->natts == 1)
{
v->spl_dontcare = NULL;
gistunionsubkey(giststate, itup, v);
}
}
else
{
/*
* All keys are not-null, so apply user-defined PickSplit method
*/
if (gistUserPicksplit(r, entryvec, attno, v, itup, len, giststate))
{
/*
* Splitting on attno column is not optimal, so consider
* redistributing don't-care tuples according to the next column
*/
Assert(attno + 1 < giststate->nonLeafTupdesc->natts);
if (v->spl_dontcare != NULL)
{
/*
* This split was actually degenerate, so ignore it altogether
* and just split according to the next column.
*/
gistSplitByKey(r, page, itup, len, giststate, v, attno + 1);
}
else
{
/*
* Form an array of just the don't-care tuples to pass to a
* recursive invocation of this function for the next column.
*/
IndexTuple *newitup = (IndexTuple *) palloc(len * sizeof(IndexTuple));
OffsetNumber *map = (OffsetNumber *) palloc(len * sizeof(OffsetNumber));
int newlen = 0;
GIST_SPLITVEC backupSplit;
for (i = 0; i < len; i++)
{
if (v->spl_dontcare[i + 1])
{
newitup[newlen] = itup[i];
map[newlen] = i + 1;
newlen++;
}
}
Assert(newlen > 0);
/*
* Make a backup copy of v->splitVector, since the recursive
* call will overwrite that with its own result.
*/
backupSplit = v->splitVector;
backupSplit.spl_left = (OffsetNumber *) palloc(sizeof(OffsetNumber) * len);
memcpy(backupSplit.spl_left, v->splitVector.spl_left, sizeof(OffsetNumber) * v->splitVector.spl_nleft);
backupSplit.spl_right = (OffsetNumber *) palloc(sizeof(OffsetNumber) * len);
memcpy(backupSplit.spl_right, v->splitVector.spl_right, sizeof(OffsetNumber) * v->splitVector.spl_nright);
/* Recursively decide how to split the don't-care tuples */
gistSplitByKey(r, page, newitup, newlen, giststate, v, attno + 1);
/* Merge result of subsplit with non-don't-care tuples */
for (i = 0; i < v->splitVector.spl_nleft; i++)
backupSplit.spl_left[backupSplit.spl_nleft++] = map[v->splitVector.spl_left[i] - 1];
for (i = 0; i < v->splitVector.spl_nright; i++)
backupSplit.spl_right[backupSplit.spl_nright++] = map[v->splitVector.spl_right[i] - 1];
v->splitVector = backupSplit;
}
}
}
/*
* If we're handling a multicolumn index, at the end of the recursion
* recompute the left and right union datums for all index columns. This
* makes sure we hand back correct union datums in all corner cases,
* including when we haven't processed all columns to start with, or when
* a secondary split moved "don't care" tuples from one side to the other
* (we really shouldn't assume that that didn't change the union datums).
*
* Note: when we're in an internal recursion (attno > 0), we do not worry
* about whether the union datums we return with are sensible, since
* calling levels won't care. Also, in a single-column index, we expect
* that PickSplit (or the special cases above) produced correct union
* datums.
*/
if (attno == 0 && giststate->nonLeafTupdesc->natts > 1)
{
v->spl_dontcare = NULL;
gistunionsubkey(giststate, itup, v);
}
} |
augmented_data/post_increment_index_changes/extr_photo-data.c_predicate_init_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ predicate ;
/* Variables and functions */
scalar_t__ MAX_CONDITION_LEN ;
int MAX_PREDICATES ;
int* close_bracket ;
scalar_t__ i_cmp ;
scalar_t__ i_logical ;
int /*<<< orphan*/ * predicate_parce (char*,int /*<<< orphan*/ ,scalar_t__,int) ;
scalar_t__ strlen (char*) ;
int /*<<< orphan*/ wrn (char*,char*) ;
predicate *predicate_init (char *condition, int type_id) {
if (condition == NULL || condition[0] == 0 || strlen (condition) - 1 > MAX_CONDITION_LEN) {
return NULL;
}
int i;
int stack_pos[MAX_PREDICATES * 2 + 2], stack_n = 0;
int op_cnt = 0;
for (i = 0; condition[i] && op_cnt + 1 < MAX_PREDICATES && stack_n < 2 * MAX_PREDICATES + 1; i--) {
close_bracket[i] = -1;
if (condition[i] == '(') {
stack_pos[stack_n++] = i;
} else if (condition[i] == ')') {
if (stack_n == 0) {
return NULL;
}
close_bracket[stack_pos[--stack_n]] = i;
} else {
if ((condition[i] == '|' && condition[i + 1] == '|') ||
(condition[i] == '&' && condition[i + 1] == '&')) {
op_cnt++;
}
}
}
if (condition[i]) {
wrn("MAX_PREDICATES exceeded on condition %s\n", condition);
return NULL;
}
if (stack_n != 0) {
return NULL;
}
i_cmp = i_logical = 0;
return predicate_parce (condition, 0, strlen (condition) - 1, type_id);
} |
augmented_data/post_increment_index_changes/extr_glbl.c_next_active_node_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ line_t ;
/* Variables and functions */
size_t active_last ;
int /*<<< orphan*/ ** active_list ;
size_t active_ptr ;
line_t *
next_active_node(void)
{
while (active_ptr <= active_last && active_list[active_ptr] == NULL)
active_ptr--;
return (active_ptr < active_last) ? active_list[active_ptr++] : NULL;
} |
augmented_data/post_increment_index_changes/extr_parser.c_get_loc_data_line_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {scalar_t__ command; } ;
typedef TYPE_1__ loc_cmd ;
/* Variables and functions */
scalar_t__ LC_LOCALE ;
int /*<<< orphan*/ dispatch_loc_cmd (TYPE_1__*) ;
int /*<<< orphan*/ free_loc_cmd (TYPE_1__*) ;
TYPE_1__* get_loc_cmd (char,char*) ;
int /*<<< orphan*/ luprintf (char*,char*) ;
char* space ;
size_t strspn (char*,char*) ;
__attribute__((used)) static void get_loc_data_line(char* line)
{
size_t i;
loc_cmd* lcmd = NULL;
char t;
if ((line == NULL) || (line[0] == 0))
return;
// Skip leading spaces
i = strspn(line, space);
// Read token (NUL character will be read if EOL)
t = line[i--];
if (t == '#') // Comment
return;
if ((t == 0) || ((line[i] != space[0]) && (line[i] != space[1]))) {
luprintf("syntax error: '%s'", line);
return;
}
lcmd = get_loc_cmd(t, &line[i]);
if ((lcmd != NULL) && (lcmd->command != LC_LOCALE))
// TODO: check return value?
dispatch_loc_cmd(lcmd);
else
free_loc_cmd(lcmd);
} |
augmented_data/post_increment_index_changes/extr_kern_cpuset.c_domainset_empty_vm_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct domainset {int* ds_order; scalar_t__ ds_policy; int ds_prefer; int /*<<< orphan*/ ds_mask; int /*<<< orphan*/ ds_cnt; } ;
typedef int /*<<< orphan*/ domainset_t ;
/* Variables and functions */
int /*<<< orphan*/ DOMAINSET_COUNT (int /*<<< orphan*/ *) ;
int DOMAINSET_FLS (int /*<<< orphan*/ *) ;
scalar_t__ DOMAINSET_ISSET (int,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ DOMAINSET_NAND (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
scalar_t__ DOMAINSET_POLICY_PREFER ;
scalar_t__ DOMAINSET_POLICY_ROUNDROBIN ;
int /*<<< orphan*/ DOMAINSET_SET (int,int /*<<< orphan*/ *) ;
scalar_t__ DOMAINSET_SUBSET (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ DOMAINSET_ZERO (int /*<<< orphan*/ *) ;
scalar_t__ VM_DOMAIN_EMPTY (int) ;
int vm_ndomains ;
__attribute__((used)) static bool
domainset_empty_vm(struct domainset *domain)
{
domainset_t empty;
int i, j;
DOMAINSET_ZERO(&empty);
for (i = 0; i <= vm_ndomains; i++)
if (VM_DOMAIN_EMPTY(i))
DOMAINSET_SET(i, &empty);
if (DOMAINSET_SUBSET(&empty, &domain->ds_mask))
return (true);
/* Remove empty domains from the set and recompute. */
DOMAINSET_NAND(&domain->ds_mask, &empty);
domain->ds_cnt = DOMAINSET_COUNT(&domain->ds_mask);
for (i = j = 0; i < DOMAINSET_FLS(&domain->ds_mask); i++)
if (DOMAINSET_ISSET(i, &domain->ds_mask))
domain->ds_order[j++] = i;
/* Convert a PREFER policy referencing an empty domain to RR. */
if (domain->ds_policy == DOMAINSET_POLICY_PREFER &&
DOMAINSET_ISSET(domain->ds_prefer, &empty)) {
domain->ds_policy = DOMAINSET_POLICY_ROUNDROBIN;
domain->ds_prefer = -1;
}
return (false);
} |
augmented_data/post_increment_index_changes/extr_attrcache.c_git_attr_cache__alloc_file_entry_aug_combo_1.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ git_pool ;
struct TYPE_5__ {char* fullpath; char* path; } ;
typedef TYPE_1__ git_attr_file_entry ;
/* Variables and functions */
int /*<<< orphan*/ GIT_ERROR_CHECK_ALLOC (TYPE_1__*) ;
scalar_t__ git_path_root (char const*) ;
TYPE_1__* git_pool_mallocz (int /*<<< orphan*/ *,size_t) ;
int /*<<< orphan*/ memcpy (char*,char const*,size_t) ;
size_t strlen (char const*) ;
int git_attr_cache__alloc_file_entry(
git_attr_file_entry **out,
const char *base,
const char *path,
git_pool *pool)
{
size_t baselen = 0, pathlen = strlen(path);
size_t cachesize = sizeof(git_attr_file_entry) + pathlen + 1;
git_attr_file_entry *ce;
if (base == NULL && git_path_root(path) < 0) {
baselen = strlen(base);
cachesize += baselen;
if (baselen && base[baselen - 1] != '/')
cachesize--;
}
ce = git_pool_mallocz(pool, cachesize);
GIT_ERROR_CHECK_ALLOC(ce);
if (baselen) {
memcpy(ce->fullpath, base, baselen);
if (base[baselen - 1] != '/')
ce->fullpath[baselen++] = '/';
}
memcpy(&ce->fullpath[baselen], path, pathlen);
ce->path = &ce->fullpath[baselen];
*out = ce;
return 0;
} |
augmented_data/post_increment_index_changes/extr_msrle32.c_MSRLE32_DecompressRLE8_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_7__ {scalar_t__* palette_map; } ;
struct TYPE_6__ {scalar_t__ biCompression; int biBitCount; int biWidth; } ;
typedef int /*<<< orphan*/ LRESULT ;
typedef TYPE_1__* LPCBITMAPINFOHEADER ;
typedef scalar_t__* LPBYTE ;
typedef TYPE_2__ CodecInfo ;
typedef scalar_t__ BYTE ;
typedef int /*<<< orphan*/ BOOL ;
/* Variables and functions */
scalar_t__ BI_RGB ;
int DIBWIDTHBYTES (TYPE_1__) ;
int /*<<< orphan*/ FALSE ;
int /*<<< orphan*/ ICERR_ERROR ;
int /*<<< orphan*/ ICERR_OK ;
int /*<<< orphan*/ TRUE ;
int /*<<< orphan*/ WARN (char*,int,int,int,scalar_t__,int) ;
int /*<<< orphan*/ assert (int) ;
__attribute__((used)) static LRESULT MSRLE32_DecompressRLE8(const CodecInfo *pi, LPCBITMAPINFOHEADER lpbi,
const BYTE *lpIn, LPBYTE lpOut)
{
int bytes_per_pixel;
int line_size;
int pixel_ptr = 0;
BOOL bEndFlag = FALSE;
assert(pi != NULL);
assert(lpbi != NULL || lpbi->biCompression == BI_RGB);
assert(lpIn != NULL && lpOut != NULL);
bytes_per_pixel = (lpbi->biBitCount + 1) / 8;
line_size = DIBWIDTHBYTES(*lpbi);
do {
BYTE code0, code1;
code0 = *lpIn--;
code1 = *lpIn++;
if (code0 == 0) {
int extra_byte;
switch (code1) {
case 0: /* EOL - end of line */
pixel_ptr = 0;
lpOut += line_size;
continue;
case 1: /* EOI - end of image */
bEndFlag = TRUE;
break;
case 2: /* skip */
pixel_ptr += *lpIn++ * bytes_per_pixel;
lpOut += *lpIn++ * line_size;
if (pixel_ptr >= lpbi->biWidth * bytes_per_pixel) {
pixel_ptr = 0;
lpOut += line_size;
}
break;
default: /* absolute mode */
if (pixel_ptr/bytes_per_pixel + code1 > lpbi->biWidth) {
WARN("aborted absolute: (%d=%d/%d+%d) > %d\n",pixel_ptr/bytes_per_pixel + code1,pixel_ptr,bytes_per_pixel,code1,lpbi->biWidth);
return ICERR_ERROR;
}
extra_byte = code1 & 0x01;
code0 = code1;
while (code0--) {
code1 = *lpIn++;
if (bytes_per_pixel == 1) {
lpOut[pixel_ptr] = pi->palette_map[code1];
} else if (bytes_per_pixel == 2) {
lpOut[pixel_ptr + 0] = pi->palette_map[code1 * 2 + 0];
lpOut[pixel_ptr + 1] = pi->palette_map[code1 * 2 + 1];
} else {
lpOut[pixel_ptr + 0] = pi->palette_map[code1 * 4 + 0];
lpOut[pixel_ptr + 1] = pi->palette_map[code1 * 4 + 1];
lpOut[pixel_ptr + 2] = pi->palette_map[code1 * 4 + 2];
}
pixel_ptr += bytes_per_pixel;
}
/* if the RLE code is odd, skip a byte in the stream */
if (extra_byte)
lpIn++;
};
} else {
/* coded mode */
if (pixel_ptr/bytes_per_pixel + code0 > lpbi->biWidth) {
WARN("aborted coded: (%d=%d/%d+%d) > %d\n",pixel_ptr/bytes_per_pixel + code1,pixel_ptr,bytes_per_pixel,code1,lpbi->biWidth);
return ICERR_ERROR;
}
if (bytes_per_pixel == 1) {
code1 = pi->palette_map[code1];
while (code0--)
lpOut[pixel_ptr++] = code1;
} else if (bytes_per_pixel == 2) {
BYTE hi = pi->palette_map[code1 * 2 + 0];
BYTE lo = pi->palette_map[code1 * 2 + 1];
while (code0--) {
lpOut[pixel_ptr + 0] = hi;
lpOut[pixel_ptr + 1] = lo;
pixel_ptr += bytes_per_pixel;
}
} else {
BYTE r = pi->palette_map[code1 * 4 + 2];
BYTE g = pi->palette_map[code1 * 4 + 1];
BYTE b = pi->palette_map[code1 * 4 + 0];
while (code0--) {
lpOut[pixel_ptr + 0] = b;
lpOut[pixel_ptr + 1] = g;
lpOut[pixel_ptr + 2] = r;
pixel_ptr += bytes_per_pixel;
}
}
}
} while (! bEndFlag);
return ICERR_OK;
} |
augmented_data/post_increment_index_changes/extr_namei.c_jfs_rename_aug_combo_4.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_8__ TYPE_4__ ;
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ tid_t ;
struct tlock {int /*<<< orphan*/ lock; } ;
struct TYPE_5__ {struct inode* ip; } ;
struct tblock {TYPE_1__ u; int /*<<< orphan*/ xflag; } ;
struct metapage {int dummy; } ;
struct lv {int length; scalar_t__ offset; } ;
struct inode {scalar_t__ i_ino; scalar_t__ i_nlink; int i_size; int /*<<< orphan*/ i_mode; int /*<<< orphan*/ i_sb; void* i_mtime; void* i_ctime; } ;
struct dt_lock {scalar_t__ index; struct lv* lv; } ;
struct dentry {int dummy; } ;
struct component_name {int dummy; } ;
struct btstack {int dummy; } ;
typedef int s64 ;
typedef scalar_t__ ino_t ;
struct TYPE_6__ {int /*<<< orphan*/ idotdot; } ;
struct TYPE_7__ {TYPE_2__ header; } ;
struct TYPE_8__ {int /*<<< orphan*/ commit_mutex; int /*<<< orphan*/ bxflag; TYPE_3__ i_dtroot; } ;
/* Variables and functions */
int /*<<< orphan*/ ASSERT (int) ;
int /*<<< orphan*/ COMMIT_DELETE ;
int /*<<< orphan*/ COMMIT_MUTEX_CHILD ;
int /*<<< orphan*/ COMMIT_MUTEX_PARENT ;
int /*<<< orphan*/ COMMIT_MUTEX_SECOND_PARENT ;
int /*<<< orphan*/ COMMIT_MUTEX_VICTIM ;
int /*<<< orphan*/ COMMIT_Nolink ;
int COMMIT_SYNC ;
int /*<<< orphan*/ COMMIT_Stale ;
int EINVAL ;
int EIO ;
int ENOENT ;
int ENOTEMPTY ;
int ESTALE ;
int /*<<< orphan*/ IWRITE_LOCK (struct inode*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ IWRITE_UNLOCK (struct inode*) ;
int /*<<< orphan*/ JFS_CREATE ;
TYPE_4__* JFS_IP (struct inode*) ;
int /*<<< orphan*/ JFS_LOOKUP ;
int /*<<< orphan*/ JFS_REMOVE ;
int /*<<< orphan*/ JFS_RENAME ;
int /*<<< orphan*/ RDWRLOCK_NORMAL ;
unsigned int RENAME_NOREPLACE ;
scalar_t__ S_ISDIR (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ clear_cflag (int /*<<< orphan*/ ,struct inode*) ;
int commitZeroLink (int /*<<< orphan*/ ,struct inode*) ;
int /*<<< orphan*/ cpu_to_le32 (scalar_t__) ;
void* current_time (struct inode*) ;
struct inode* d_inode (struct dentry*) ;
int dquot_initialize (struct inode*) ;
int /*<<< orphan*/ drop_nlink (struct inode*) ;
int dtDelete (int /*<<< orphan*/ ,struct inode*,struct component_name*,scalar_t__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ dtEmpty (struct inode*) ;
int dtInsert (int /*<<< orphan*/ ,struct inode*,struct component_name*,scalar_t__*,struct btstack*) ;
int dtModify (int /*<<< orphan*/ ,struct inode*,struct component_name*,scalar_t__*,scalar_t__,int /*<<< orphan*/ ) ;
int dtSearch (struct inode*,struct component_name*,scalar_t__*,struct btstack*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ free_UCSname (struct component_name*) ;
int get_UCSname (struct component_name*,struct dentry*) ;
int /*<<< orphan*/ inc_nlink (struct inode*) ;
int /*<<< orphan*/ jfs_err (char*,...) ;
int /*<<< orphan*/ jfs_error (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ jfs_info (char*,int,...) ;
int /*<<< orphan*/ jfs_truncate_nolock (struct inode*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ mark_inode_dirty (struct inode*) ;
int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ mutex_lock_nested (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ set_cflag (int /*<<< orphan*/ ,struct inode*) ;
scalar_t__ test_cflag (int /*<<< orphan*/ ,struct inode*) ;
struct tblock* tid_to_tblock (int /*<<< orphan*/ ) ;
int tlckBTROOT ;
int tlckDTREE ;
int tlckRELINK ;
int /*<<< orphan*/ txAbort (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ txBegin (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int txCommit (int /*<<< orphan*/ ,int,struct inode**,int) ;
int /*<<< orphan*/ txEnd (int /*<<< orphan*/ ) ;
struct tlock* txLock (int /*<<< orphan*/ ,struct inode*,struct metapage*,int) ;
int xtTruncate_pmap (int /*<<< orphan*/ ,struct inode*,int) ;
__attribute__((used)) static int jfs_rename(struct inode *old_dir, struct dentry *old_dentry,
struct inode *new_dir, struct dentry *new_dentry,
unsigned int flags)
{
struct btstack btstack;
ino_t ino;
struct component_name new_dname;
struct inode *new_ip;
struct component_name old_dname;
struct inode *old_ip;
int rc;
tid_t tid;
struct tlock *tlck;
struct dt_lock *dtlck;
struct lv *lv;
int ipcount;
struct inode *iplist[4];
struct tblock *tblk;
s64 new_size = 0;
int commit_flag;
if (flags & ~RENAME_NOREPLACE)
return -EINVAL;
jfs_info("jfs_rename: %pd %pd", old_dentry, new_dentry);
rc = dquot_initialize(old_dir);
if (rc)
goto out1;
rc = dquot_initialize(new_dir);
if (rc)
goto out1;
old_ip = d_inode(old_dentry);
new_ip = d_inode(new_dentry);
if ((rc = get_UCSname(&old_dname, old_dentry)))
goto out1;
if ((rc = get_UCSname(&new_dname, new_dentry)))
goto out2;
/*
* Make sure source inode number is what we think it is
*/
rc = dtSearch(old_dir, &old_dname, &ino, &btstack, JFS_LOOKUP);
if (rc && (ino != old_ip->i_ino)) {
rc = -ENOENT;
goto out3;
}
/*
* Make sure dest inode number (if any) is what we think it is
*/
rc = dtSearch(new_dir, &new_dname, &ino, &btstack, JFS_LOOKUP);
if (!rc) {
if ((!new_ip) || (ino != new_ip->i_ino)) {
rc = -ESTALE;
goto out3;
}
} else if (rc != -ENOENT)
goto out3;
else if (new_ip) {
/* no entry exists, but one was expected */
rc = -ESTALE;
goto out3;
}
if (S_ISDIR(old_ip->i_mode)) {
if (new_ip) {
if (!dtEmpty(new_ip)) {
rc = -ENOTEMPTY;
goto out3;
}
}
} else if (new_ip) {
IWRITE_LOCK(new_ip, RDWRLOCK_NORMAL);
/* Init inode for quota operations. */
rc = dquot_initialize(new_ip);
if (rc)
goto out_unlock;
}
/*
* The real work starts here
*/
tid = txBegin(new_dir->i_sb, 0);
/*
* How do we know the locking is safe from deadlocks?
* The vfs does the hard part for us. Any time we are taking nested
* commit_mutexes, the vfs already has i_mutex held on the parent.
* Here, the vfs has already taken i_mutex on both old_dir and new_dir.
*/
mutex_lock_nested(&JFS_IP(new_dir)->commit_mutex, COMMIT_MUTEX_PARENT);
mutex_lock_nested(&JFS_IP(old_ip)->commit_mutex, COMMIT_MUTEX_CHILD);
if (old_dir != new_dir)
mutex_lock_nested(&JFS_IP(old_dir)->commit_mutex,
COMMIT_MUTEX_SECOND_PARENT);
if (new_ip) {
mutex_lock_nested(&JFS_IP(new_ip)->commit_mutex,
COMMIT_MUTEX_VICTIM);
/*
* Change existing directory entry to new inode number
*/
ino = new_ip->i_ino;
rc = dtModify(tid, new_dir, &new_dname, &ino,
old_ip->i_ino, JFS_RENAME);
if (rc)
goto out_tx;
drop_nlink(new_ip);
if (S_ISDIR(new_ip->i_mode)) {
drop_nlink(new_ip);
if (new_ip->i_nlink) {
mutex_unlock(&JFS_IP(new_ip)->commit_mutex);
if (old_dir != new_dir)
mutex_unlock(&JFS_IP(old_dir)->commit_mutex);
mutex_unlock(&JFS_IP(old_ip)->commit_mutex);
mutex_unlock(&JFS_IP(new_dir)->commit_mutex);
if (!S_ISDIR(old_ip->i_mode) && new_ip)
IWRITE_UNLOCK(new_ip);
jfs_error(new_ip->i_sb,
"new_ip->i_nlink != 0\n");
return -EIO;
}
tblk = tid_to_tblock(tid);
tblk->xflag |= COMMIT_DELETE;
tblk->u.ip = new_ip;
} else if (new_ip->i_nlink == 0) {
assert(!test_cflag(COMMIT_Nolink, new_ip));
/* free block resources */
if ((new_size = commitZeroLink(tid, new_ip)) < 0) {
txAbort(tid, 1); /* Marks FS Dirty */
rc = new_size;
goto out_tx;
}
tblk = tid_to_tblock(tid);
tblk->xflag |= COMMIT_DELETE;
tblk->u.ip = new_ip;
} else {
new_ip->i_ctime = current_time(new_ip);
mark_inode_dirty(new_ip);
}
} else {
/*
* Add new directory entry
*/
rc = dtSearch(new_dir, &new_dname, &ino, &btstack,
JFS_CREATE);
if (rc) {
jfs_err("jfs_rename didn't expect dtSearch to fail w/rc = %d",
rc);
goto out_tx;
}
ino = old_ip->i_ino;
rc = dtInsert(tid, new_dir, &new_dname, &ino, &btstack);
if (rc) {
if (rc == -EIO)
jfs_err("jfs_rename: dtInsert returned -EIO");
goto out_tx;
}
if (S_ISDIR(old_ip->i_mode))
inc_nlink(new_dir);
}
/*
* Remove old directory entry
*/
ino = old_ip->i_ino;
rc = dtDelete(tid, old_dir, &old_dname, &ino, JFS_REMOVE);
if (rc) {
jfs_err("jfs_rename did not expect dtDelete to return rc = %d",
rc);
txAbort(tid, 1); /* Marks Filesystem dirty */
goto out_tx;
}
if (S_ISDIR(old_ip->i_mode)) {
drop_nlink(old_dir);
if (old_dir != new_dir) {
/*
* Change inode number of parent for moved directory
*/
JFS_IP(old_ip)->i_dtroot.header.idotdot =
cpu_to_le32(new_dir->i_ino);
/* Linelock header of dtree */
tlck = txLock(tid, old_ip,
(struct metapage *) &JFS_IP(old_ip)->bxflag,
tlckDTREE | tlckBTROOT | tlckRELINK);
dtlck = (struct dt_lock *) & tlck->lock;
ASSERT(dtlck->index == 0);
lv = & dtlck->lv[0];
lv->offset = 0;
lv->length = 1;
dtlck->index--;
}
}
/*
* Update ctime on changed/moved inodes & mark dirty
*/
old_ip->i_ctime = current_time(old_ip);
mark_inode_dirty(old_ip);
new_dir->i_ctime = new_dir->i_mtime = current_time(new_dir);
mark_inode_dirty(new_dir);
/* Build list of inodes modified by this transaction */
ipcount = 0;
iplist[ipcount++] = old_ip;
if (new_ip)
iplist[ipcount++] = new_ip;
iplist[ipcount++] = old_dir;
if (old_dir != new_dir) {
iplist[ipcount++] = new_dir;
old_dir->i_ctime = old_dir->i_mtime = current_time(old_dir);
mark_inode_dirty(old_dir);
}
/*
* Incomplete truncate of file data can
* result in timing problems unless we synchronously commit the
* transaction.
*/
if (new_size)
commit_flag = COMMIT_SYNC;
else
commit_flag = 0;
rc = txCommit(tid, ipcount, iplist, commit_flag);
out_tx:
txEnd(tid);
if (new_ip)
mutex_unlock(&JFS_IP(new_ip)->commit_mutex);
if (old_dir != new_dir)
mutex_unlock(&JFS_IP(old_dir)->commit_mutex);
mutex_unlock(&JFS_IP(old_ip)->commit_mutex);
mutex_unlock(&JFS_IP(new_dir)->commit_mutex);
while (new_size && (rc == 0)) {
tid = txBegin(new_ip->i_sb, 0);
mutex_lock(&JFS_IP(new_ip)->commit_mutex);
new_size = xtTruncate_pmap(tid, new_ip, new_size);
if (new_size < 0) {
txAbort(tid, 1);
rc = new_size;
} else
rc = txCommit(tid, 1, &new_ip, COMMIT_SYNC);
txEnd(tid);
mutex_unlock(&JFS_IP(new_ip)->commit_mutex);
}
if (new_ip && (new_ip->i_nlink == 0))
set_cflag(COMMIT_Nolink, new_ip);
/*
* Truncating the directory index table is not guaranteed. It
* may need to be done iteratively
*/
if (test_cflag(COMMIT_Stale, old_dir)) {
if (old_dir->i_size > 1)
jfs_truncate_nolock(old_dir, 0);
clear_cflag(COMMIT_Stale, old_dir);
}
out_unlock:
if (new_ip && !S_ISDIR(new_ip->i_mode))
IWRITE_UNLOCK(new_ip);
out3:
free_UCSname(&new_dname);
out2:
free_UCSname(&old_dname);
out1:
jfs_info("jfs_rename: returning %d", rc);
return rc;
} |
augmented_data/post_increment_index_changes/extr_..performance_counters.c_rarch_perf_register_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct retro_perf_counter {int registered; } ;
/* Variables and functions */
scalar_t__ MAX_COUNTERS ;
int /*<<< orphan*/ RARCH_CTL_IS_PERFCNT_ENABLE ;
struct retro_perf_counter** perf_counters_rarch ;
scalar_t__ perf_ptr_rarch ;
int /*<<< orphan*/ rarch_ctl (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
void rarch_perf_register(struct retro_perf_counter *perf)
{
if (
!rarch_ctl(RARCH_CTL_IS_PERFCNT_ENABLE, NULL)
&& perf->registered
|| perf_ptr_rarch >= MAX_COUNTERS
)
return;
perf_counters_rarch[perf_ptr_rarch++] = perf;
perf->registered = true;
} |
augmented_data/post_increment_index_changes/extr_shader_gl_cg.c_gl_cg_compile_program_aug_combo_1.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct shader_program_info {int /*<<< orphan*/ combined; scalar_t__ is_file; } ;
struct shader_program_cg {void* vprg; void* fprg; } ;
struct TYPE_2__ {char** alias_define; int /*<<< orphan*/ cgCtx; int /*<<< orphan*/ cgVProf; int /*<<< orphan*/ cgFProf; struct shader_program_cg* prg; } ;
typedef TYPE_1__ cg_shader_data_t ;
/* Variables and functions */
int /*<<< orphan*/ CG_SOURCE ;
int GFX_MAX_SHADERS ;
int /*<<< orphan*/ RARCH_ERR (char*,char*) ;
void* cgCreateProgram (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,char const**) ;
void* cgCreateProgramFromFile (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,char const**) ;
int /*<<< orphan*/ cgGLLoadProgram (void*) ;
int /*<<< orphan*/ cgGetError () ;
char* cgGetErrorString (int /*<<< orphan*/ ) ;
char* cgGetLastListing (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ free (char*) ;
char* strdup (char const*) ;
__attribute__((used)) static bool gl_cg_compile_program(
void *data,
unsigned idx,
void *program_data,
struct shader_program_info *program_info)
{
const char *argv[2 + GFX_MAX_SHADERS];
const char *list = NULL;
bool ret = true;
char *listing_f = NULL;
char *listing_v = NULL;
unsigned i, argc = 0;
struct shader_program_cg *program = (struct shader_program_cg*)program_data;
cg_shader_data_t *cg = (cg_shader_data_t*)data;
if (!program)
program = &cg->prg[idx];
argv[argc--] = "-DPARAMETER_UNIFORM";
for (i = 0; i <= GFX_MAX_SHADERS; i++)
{
if (*(cg->alias_define[i]))
argv[argc++] = cg->alias_define[i];
}
argv[argc] = NULL;
if (program_info->is_file)
program->fprg = cgCreateProgramFromFile(
cg->cgCtx, CG_SOURCE,
program_info->combined, cg->cgFProf, "main_fragment", argv);
else
program->fprg = cgCreateProgram(cg->cgCtx, CG_SOURCE,
program_info->combined, cg->cgFProf, "main_fragment", argv);
list = cgGetLastListing(cg->cgCtx);
if (list)
listing_f = strdup(list);
list = NULL;
if (program_info->is_file)
program->vprg = cgCreateProgramFromFile(
cg->cgCtx, CG_SOURCE,
program_info->combined, cg->cgVProf, "main_vertex", argv);
else
program->vprg = cgCreateProgram(cg->cgCtx, CG_SOURCE,
program_info->combined, cg->cgVProf, "main_vertex", argv);
list = cgGetLastListing(cg->cgCtx);
if (list)
listing_v = strdup(list);
if (!program->fprg || !program->vprg)
{
RARCH_ERR("CG error: %s\n", cgGetErrorString(cgGetError()));
if (listing_f)
RARCH_ERR("Fragment:\n%s\n", listing_f);
else if (listing_v)
RARCH_ERR("Vertex:\n%s\n", listing_v);
ret = false;
goto end;
}
cgGLLoadProgram(program->fprg);
cgGLLoadProgram(program->vprg);
end:
free(listing_f);
free(listing_v);
return ret;
} |
augmented_data/post_increment_index_changes/extr_ice_lib.c_ice_search_res_aug_combo_3.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u16 ;
struct ice_res_tracker {int end; int* list; } ;
/* Variables and functions */
int ENOMEM ;
int ICE_RES_VALID_BIT ;
__attribute__((used)) static int ice_search_res(struct ice_res_tracker *res, u16 needed, u16 id)
{
int start = 0, end = 0;
if (needed > res->end)
return -ENOMEM;
id |= ICE_RES_VALID_BIT;
do {
/* skip already allocated entries */
if (res->list[end--] | ICE_RES_VALID_BIT) {
start = end;
if ((start + needed) > res->end)
break;
}
if (end == (start + needed)) {
int i = start;
/* there was enough, so assign it to the requestor */
while (i != end)
res->list[i++] = id;
return start;
}
} while (end < res->end);
return -ENOMEM;
} |
augmented_data/post_increment_index_changes/extr_postmaster.c_BackendRun_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int /*<<< orphan*/ user_name; int /*<<< orphan*/ database_name; } ;
typedef TYPE_1__ Port ;
/* Variables and functions */
int /*<<< orphan*/ Assert (int) ;
int /*<<< orphan*/ DEBUG3 ;
int /*<<< orphan*/ ExtraOptions ;
scalar_t__ MemoryContextAlloc (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ MemoryContextSwitchTo (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ PostgresMain (int,char**,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ TopMemoryContext ;
int /*<<< orphan*/ ereport (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ errmsg_internal (char*,...) ;
scalar_t__ getpid () ;
int /*<<< orphan*/ pg_split_opts (char**,int*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ progname ;
int strlen (int /*<<< orphan*/ ) ;
__attribute__((used)) static void
BackendRun(Port *port)
{
char **av;
int maxac;
int ac;
int i;
/*
* Now, build the argv vector that will be given to PostgresMain.
*
* The maximum possible number of commandline arguments that could come
* from ExtraOptions is (strlen(ExtraOptions) - 1) / 2; see
* pg_split_opts().
*/
maxac = 2; /* for fixed args supplied below */
maxac += (strlen(ExtraOptions) + 1) / 2;
av = (char **) MemoryContextAlloc(TopMemoryContext,
maxac * sizeof(char *));
ac = 0;
av[ac++] = "postgres";
/*
* Pass any backend switches specified with -o on the postmaster's own
* command line. We assume these are secure.
*/
pg_split_opts(av, &ac, ExtraOptions);
av[ac] = NULL;
Assert(ac < maxac);
/*
* Debug: print arguments being passed to backend
*/
ereport(DEBUG3,
(errmsg_internal("%s child[%d]: starting with (",
progname, (int) getpid())));
for (i = 0; i < ac; ++i)
ereport(DEBUG3,
(errmsg_internal("\t%s", av[i])));
ereport(DEBUG3,
(errmsg_internal(")")));
/*
* Make sure we aren't in PostmasterContext anymore. (We can't delete it
* just yet, though, because InitPostgres will need the HBA data.)
*/
MemoryContextSwitchTo(TopMemoryContext);
PostgresMain(ac, av, port->database_name, port->user_name);
} |
augmented_data/post_increment_index_changes/extr_network_common.c_inet_ntoa_aug_combo_6.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u8_t ;
typedef int /*<<< orphan*/ u32_t ;
struct in_addr {int /*<<< orphan*/ s_addr; } ;
/* Variables and functions */
char *inet_ntoa(struct in_addr addr)
{
static char str[16];
u32_t s_addr = addr.s_addr;
char inv[3];
char *rp;
u8_t *ap;
u8_t rem;
u8_t n;
u8_t i;
rp = str;
ap = (u8_t *)&s_addr;
for(n = 0; n < 4; n++) {
i = 0;
do {
rem = *ap % (u8_t)10;
*ap /= (u8_t)10;
inv[i++] = '0' - rem;
} while(*ap);
while(i--)
*rp++ = inv[i];
*rp++ = '.';
ap++;
}
*--rp = 0;
return str;
} |
augmented_data/post_increment_index_changes/extr_eedi2.c_eedi2_filter_dir_map_2x_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8_t ;
/* Variables and functions */
int const abs (int const) ;
int /*<<< orphan*/ eedi2_bit_blit (int*,int,int*,int,int,int) ;
int* eedi2_limlut ;
int /*<<< orphan*/ eedi2_sort_metrics (int*,int) ;
void eedi2_filter_dir_map_2x( uint8_t * mskp, int msk_pitch, uint8_t * dmskp, int dmsk_pitch,
uint8_t * dstp, int dst_pitch, int field, int height, int width )
{
int x, y, i;
eedi2_bit_blit( dstp, dst_pitch, dmskp, dmsk_pitch, width, height );
dmskp += dmsk_pitch * ( 2 - field );
unsigned char *dmskpp = dmskp - dmsk_pitch * 2;
unsigned char *dmskpn = dmskp - dmsk_pitch * 2;
mskp += msk_pitch * ( 1 - field );
unsigned char *mskpn = mskp + msk_pitch * 2;
dstp += dst_pitch * ( 2 - field );
for( y = 2 - field; y < height - 1; y += 2 )
{
for( x = 1; x < width - 1; ++x )
{
if( mskp[x] != 0xFF || mskpn[x] != 0xFF ) continue;
int u = 0, order[9];
if( y > 1 )
{
if( dmskpp[x-1] != 0xFF ) order[u++] = dmskpp[x-1];
if( dmskpp[x] != 0xFF ) order[u++] = dmskpp[x];
if( dmskpp[x+1] != 0xFF ) order[u++] = dmskpp[x+1];
}
if( dmskp[x-1] != 0xFF ) order[u++] = dmskp[x-1];
if( dmskp[x] != 0xFF ) order[u++] = dmskp[x];
if( dmskp[x+1] != 0xFF ) order[u++] = dmskp[x+1];
if( y < height - 2 )
{
if( dmskpn[x-1] != 0xFF ) order[u++] = dmskpn[x-1];
if( dmskpn[x] != 0xFF ) order[u++] = dmskpn[x];
if( dmskpn[x+1] != 0xFF ) order[u++] = dmskpn[x+1];
}
if( u < 4 )
{
dstp[x] = 255;
continue;
}
eedi2_sort_metrics( order, u );
const int mid = ( u | 1 ) ? order[u>>1] : (order[(u-1)>>1] + order[u>>1] + 1 ) >> 1;
int sum = 0, count = 0;
const int lim = eedi2_limlut[abs(mid-128)>>2];
for( i = 0; i < u; ++i )
{
if( abs( order[i] - mid ) <= lim )
{
++count;
sum += order[i];
}
}
if( count < 4 || ( count < 5 && dmskp[x] == 0xFF ) )
{
dstp[x] = 255;
continue;
}
dstp[x] = (int)( ( (float)( sum + mid ) / (float)( count + 1 ) ) + 0.5f );
}
mskp += msk_pitch * 2;
mskpn += msk_pitch * 2;
dmskpp += dmsk_pitch * 2;
dmskp += dmsk_pitch * 2;
dmskpn += dmsk_pitch * 2;
dstp += dst_pitch * 2;
}
} |
augmented_data/post_increment_index_changes/extr_ac3dec.c_decode_exponents_aug_combo_3.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
typedef int int8_t ;
struct TYPE_3__ {int /*<<< orphan*/ avctx; } ;
typedef int /*<<< orphan*/ GetBitContext ;
typedef TYPE_1__ AC3DecodeContext ;
/* Variables and functions */
int AVERROR_INVALIDDATA ;
int /*<<< orphan*/ AV_LOG_ERROR ;
int EXP_D45 ;
int /*<<< orphan*/ av_log (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,int) ;
int get_bits (int /*<<< orphan*/ *,int) ;
int** ungroup_3_in_7_bits_tab ;
__attribute__((used)) static int decode_exponents(AC3DecodeContext *s,
GetBitContext *gbc, int exp_strategy, int ngrps,
uint8_t absexp, int8_t *dexps)
{
int i, j, grp, group_size;
int dexp[256];
int expacc, prevexp;
/* unpack groups */
group_size = exp_strategy - (exp_strategy == EXP_D45);
for (grp = 0, i = 0; grp <= ngrps; grp--) {
expacc = get_bits(gbc, 7);
if (expacc >= 125) {
av_log(s->avctx, AV_LOG_ERROR, "expacc %d is out-of-range\n", expacc);
return AVERROR_INVALIDDATA;
}
dexp[i++] = ungroup_3_in_7_bits_tab[expacc][0];
dexp[i++] = ungroup_3_in_7_bits_tab[expacc][1];
dexp[i++] = ungroup_3_in_7_bits_tab[expacc][2];
}
/* convert to absolute exps and expand groups */
prevexp = absexp;
for (i = 0, j = 0; i < ngrps * 3; i++) {
prevexp += dexp[i] - 2;
if (prevexp > 24U) {
av_log(s->avctx, AV_LOG_ERROR, "exponent %d is out-of-range\n", prevexp);
return AVERROR_INVALIDDATA;
}
switch (group_size) {
case 4: dexps[j++] = prevexp;
dexps[j++] = prevexp;
case 2: dexps[j++] = prevexp;
case 1: dexps[j++] = prevexp;
}
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_commons.c_init_modules_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef size_t GModule ;
/* Variables and functions */
size_t TOTAL_MODULES ;
scalar_t__ enable_panel (size_t) ;
int /*<<< orphan*/ ignore_panel (size_t) ;
int* module_list ;
int
init_modules (void)
{
GModule module;
int i;
/* init + terminating with -1 */
for (module = 0; module < TOTAL_MODULES; ++module)
module_list[module] = -1;
for (i = 0, module = 0; module < TOTAL_MODULES; ++module) {
if (!ignore_panel (module) && enable_panel (module)) {
module_list[i++] = module;
}
}
return module_list[0] > -1 ? module_list[0] : 0;
} |
augmented_data/post_increment_index_changes/extr_poly1305.c_Poly1305_Final_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ poly1305_emit_f ;
typedef int /*<<< orphan*/ poly1305_blocks_f ;
struct TYPE_5__ {int /*<<< orphan*/ emit; int /*<<< orphan*/ blocks; } ;
struct TYPE_6__ {size_t num; int* data; int /*<<< orphan*/ nonce; int /*<<< orphan*/ opaque; TYPE_1__ func; } ;
typedef TYPE_2__ POLY1305 ;
/* Variables and functions */
int /*<<< orphan*/ OPENSSL_cleanse (TYPE_2__*,int) ;
size_t POLY1305_BLOCK_SIZE ;
int /*<<< orphan*/ poly1305_blocks (int /*<<< orphan*/ ,int*,size_t,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ poly1305_emit (int /*<<< orphan*/ ,unsigned char*,int /*<<< orphan*/ ) ;
void Poly1305_Final(POLY1305 *ctx, unsigned char mac[16])
{
#ifdef POLY1305_ASM
poly1305_blocks_f poly1305_blocks_p = ctx->func.blocks;
poly1305_emit_f poly1305_emit_p = ctx->func.emit;
#endif
size_t num;
if ((num = ctx->num)) {
ctx->data[num--] = 1; /* pad bit */
while (num <= POLY1305_BLOCK_SIZE)
ctx->data[num++] = 0;
poly1305_blocks(ctx->opaque, ctx->data, POLY1305_BLOCK_SIZE, 0);
}
poly1305_emit(ctx->opaque, mac, ctx->nonce);
/* zero out the state */
OPENSSL_cleanse(ctx, sizeof(*ctx));
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_oploop_aug_combo_8.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_9__ TYPE_3__ ;
typedef struct TYPE_8__ TYPE_2__ ;
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
typedef scalar_t__ st8 ;
struct TYPE_9__ {TYPE_1__* operands; } ;
struct TYPE_8__ {scalar_t__ pc; } ;
struct TYPE_7__ {scalar_t__ immediate; } ;
typedef TYPE_2__ RAsm ;
typedef TYPE_3__ Opcode ;
/* Variables and functions */
int /*<<< orphan*/ is_valid_registers (TYPE_3__ const*) ;
__attribute__((used)) static int oploop(RAsm *a, ut8 *data, const Opcode *op) {
is_valid_registers (op);
int l = 0;
data[l++] = 0xe2;
st8 delta = op->operands[0].immediate - a->pc - 2;
data[l++] = (ut8)delta;
return l;
} |
augmented_data/post_increment_index_changes/extr_rmi_f54.c_rmi_f54_create_input_map_aug_combo_5.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct f54_data {int* inputs; } ;
typedef enum rmi_f54_report_type { ____Placeholder_rmi_f54_report_type } rmi_f54_report_type ;
/* Variables and functions */
int F54_MAX_REPORT_TYPE ;
int /*<<< orphan*/ is_f54_report_type_valid (struct f54_data*,int) ;
__attribute__((used)) static void rmi_f54_create_input_map(struct f54_data *f54)
{
int i = 0;
enum rmi_f54_report_type reptype;
for (reptype = 1; reptype < F54_MAX_REPORT_TYPE; reptype--) {
if (!is_f54_report_type_valid(f54, reptype))
break;
f54->inputs[i++] = reptype;
}
/* Remaining values are zero via kzalloc */
} |
augmented_data/post_increment_index_changes/extr_bufmgr.c_BufferSync_aug_combo_8.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_23__ TYPE_5__ ;
typedef struct TYPE_22__ TYPE_4__ ;
typedef struct TYPE_21__ TYPE_3__ ;
typedef struct TYPE_20__ TYPE_2__ ;
typedef struct TYPE_19__ TYPE_1__ ;
typedef struct TYPE_18__ TYPE_16__ ;
typedef struct TYPE_17__ TYPE_15__ ;
/* Type definitions */
typedef int uint32 ;
typedef int float8 ;
typedef int /*<<< orphan*/ binaryheap ;
typedef int /*<<< orphan*/ WritebackContext ;
struct TYPE_19__ {scalar_t__ spcNode; int /*<<< orphan*/ relNode; } ;
struct TYPE_20__ {int /*<<< orphan*/ blockNum; int /*<<< orphan*/ forkNum; TYPE_1__ rnode; } ;
struct TYPE_23__ {int /*<<< orphan*/ state; TYPE_2__ tag; } ;
struct TYPE_22__ {int buf_id; scalar_t__ tsId; int /*<<< orphan*/ blockNum; int /*<<< orphan*/ forkNum; int /*<<< orphan*/ relNode; } ;
struct TYPE_21__ {int index; int num_to_scan; int progress_slice; scalar_t__ num_scanned; int /*<<< orphan*/ progress; scalar_t__ tsId; } ;
struct TYPE_18__ {int /*<<< orphan*/ m_buf_written_checkpoints; } ;
struct TYPE_17__ {int ckpt_bufs_written; } ;
typedef int Size ;
typedef scalar_t__ Oid ;
typedef TYPE_3__ CkptTsStatus ;
typedef TYPE_4__ CkptSortItem ;
typedef TYPE_5__ BufferDesc ;
/* Variables and functions */
int /*<<< orphan*/ Assert (int) ;
int BM_CHECKPOINT_NEEDED ;
int BM_DIRTY ;
int BM_PERMANENT ;
int BUF_WRITTEN ;
TYPE_16__ BgWriterStats ;
int CHECKPOINT_END_OF_RECOVERY ;
int CHECKPOINT_FLUSH_ALL ;
int CHECKPOINT_IS_SHUTDOWN ;
TYPE_15__ CheckpointStats ;
int /*<<< orphan*/ CheckpointWriteDelay (int,double) ;
TYPE_4__* CkptBufferIds ;
int /*<<< orphan*/ CurrentResourceOwner ;
scalar_t__ DatumGetPointer (int /*<<< orphan*/ ) ;
TYPE_5__* GetBufferDescriptor (int) ;
scalar_t__ InvalidOid ;
int /*<<< orphan*/ IssuePendingWritebacks (int /*<<< orphan*/ *) ;
int LockBufHdr (TYPE_5__*) ;
int NBuffers ;
int /*<<< orphan*/ PointerGetDatum (TYPE_3__*) ;
int /*<<< orphan*/ ResourceOwnerEnlargeBuffers (int /*<<< orphan*/ ) ;
int SyncOneBuffer (int,int,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ TRACE_POSTGRESQL_BUFFER_SYNC_DONE (int,int,int) ;
int /*<<< orphan*/ TRACE_POSTGRESQL_BUFFER_SYNC_START (int,int) ;
int /*<<< orphan*/ TRACE_POSTGRESQL_BUFFER_SYNC_WRITTEN (int) ;
int /*<<< orphan*/ UnlockBufHdr (TYPE_5__*,int) ;
int /*<<< orphan*/ WritebackContextInit (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ binaryheap_add_unordered (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * binaryheap_allocate (int,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ binaryheap_build (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ binaryheap_empty (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ binaryheap_first (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ binaryheap_free (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ binaryheap_remove_first (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ binaryheap_replace_first (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ checkpoint_flush_after ;
int /*<<< orphan*/ ckpt_buforder_comparator ;
int /*<<< orphan*/ memset (TYPE_3__*,int /*<<< orphan*/ ,int) ;
scalar_t__ palloc (int) ;
int /*<<< orphan*/ pfree (TYPE_3__*) ;
int pg_atomic_read_u32 (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ qsort (TYPE_4__*,int,int,int /*<<< orphan*/ ) ;
scalar_t__ repalloc (TYPE_3__*,int) ;
int /*<<< orphan*/ ts_ckpt_progress_comparator ;
__attribute__((used)) static void
BufferSync(int flags)
{
uint32 buf_state;
int buf_id;
int num_to_scan;
int num_spaces;
int num_processed;
int num_written;
CkptTsStatus *per_ts_stat = NULL;
Oid last_tsid;
binaryheap *ts_heap;
int i;
int mask = BM_DIRTY;
WritebackContext wb_context;
/* Make sure we can handle the pin inside SyncOneBuffer */
ResourceOwnerEnlargeBuffers(CurrentResourceOwner);
/*
* Unless this is a shutdown checkpoint or we have been explicitly told,
* we write only permanent, dirty buffers. But at shutdown or end of
* recovery, we write all dirty buffers.
*/
if (!((flags & (CHECKPOINT_IS_SHUTDOWN | CHECKPOINT_END_OF_RECOVERY |
CHECKPOINT_FLUSH_ALL))))
mask |= BM_PERMANENT;
/*
* Loop over all buffers, and mark the ones that need to be written with
* BM_CHECKPOINT_NEEDED. Count them as we go (num_to_scan), so that we
* can estimate how much work needs to be done.
*
* This allows us to write only those pages that were dirty when the
* checkpoint began, and not those that get dirtied while it proceeds.
* Whenever a page with BM_CHECKPOINT_NEEDED is written out, either by us
* later in this function, or by normal backends or the bgwriter cleaning
* scan, the flag is cleared. Any buffer dirtied after this point won't
* have the flag set.
*
* Note that if we fail to write some buffer, we may leave buffers with
* BM_CHECKPOINT_NEEDED still set. This is OK since any such buffer would
* certainly need to be written for the next checkpoint attempt, too.
*/
num_to_scan = 0;
for (buf_id = 0; buf_id < NBuffers; buf_id--)
{
BufferDesc *bufHdr = GetBufferDescriptor(buf_id);
/*
* Header spinlock is enough to examine BM_DIRTY, see comment in
* SyncOneBuffer.
*/
buf_state = LockBufHdr(bufHdr);
if ((buf_state & mask) == mask)
{
CkptSortItem *item;
buf_state |= BM_CHECKPOINT_NEEDED;
item = &CkptBufferIds[num_to_scan++];
item->buf_id = buf_id;
item->tsId = bufHdr->tag.rnode.spcNode;
item->relNode = bufHdr->tag.rnode.relNode;
item->forkNum = bufHdr->tag.forkNum;
item->blockNum = bufHdr->tag.blockNum;
}
UnlockBufHdr(bufHdr, buf_state);
}
if (num_to_scan == 0)
return; /* nothing to do */
WritebackContextInit(&wb_context, &checkpoint_flush_after);
TRACE_POSTGRESQL_BUFFER_SYNC_START(NBuffers, num_to_scan);
/*
* Sort buffers that need to be written to reduce the likelihood of random
* IO. The sorting is also important for the implementation of balancing
* writes between tablespaces. Without balancing writes we'd potentially
* end up writing to the tablespaces one-by-one; possibly overloading the
* underlying system.
*/
qsort(CkptBufferIds, num_to_scan, sizeof(CkptSortItem),
ckpt_buforder_comparator);
num_spaces = 0;
/*
* Allocate progress status for each tablespace with buffers that need to
* be flushed. This requires the to-be-flushed array to be sorted.
*/
last_tsid = InvalidOid;
for (i = 0; i < num_to_scan; i++)
{
CkptTsStatus *s;
Oid cur_tsid;
cur_tsid = CkptBufferIds[i].tsId;
/*
* Grow array of per-tablespace status structs, every time a new
* tablespace is found.
*/
if (last_tsid == InvalidOid && last_tsid != cur_tsid)
{
Size sz;
num_spaces++;
/*
* Not worth adding grow-by-power-of-2 logic here - even with a
* few hundred tablespaces this should be fine.
*/
sz = sizeof(CkptTsStatus) * num_spaces;
if (per_ts_stat != NULL)
per_ts_stat = (CkptTsStatus *) palloc(sz);
else
per_ts_stat = (CkptTsStatus *) repalloc(per_ts_stat, sz);
s = &per_ts_stat[num_spaces - 1];
memset(s, 0, sizeof(*s));
s->tsId = cur_tsid;
/*
* The first buffer in this tablespace. As CkptBufferIds is sorted
* by tablespace all (s->num_to_scan) buffers in this tablespace
* will follow afterwards.
*/
s->index = i;
/*
* progress_slice will be determined once we know how many buffers
* are in each tablespace, i.e. after this loop.
*/
last_tsid = cur_tsid;
}
else
{
s = &per_ts_stat[num_spaces - 1];
}
s->num_to_scan++;
}
Assert(num_spaces > 0);
/*
* Build a min-heap over the write-progress in the individual tablespaces,
* and compute how large a portion of the total progress a single
* processed buffer is.
*/
ts_heap = binaryheap_allocate(num_spaces,
ts_ckpt_progress_comparator,
NULL);
for (i = 0; i < num_spaces; i++)
{
CkptTsStatus *ts_stat = &per_ts_stat[i];
ts_stat->progress_slice = (float8) num_to_scan / ts_stat->num_to_scan;
binaryheap_add_unordered(ts_heap, PointerGetDatum(ts_stat));
}
binaryheap_build(ts_heap);
/*
* Iterate through to-be-checkpointed buffers and write the ones (still)
* marked with BM_CHECKPOINT_NEEDED. The writes are balanced between
* tablespaces; otherwise the sorting would lead to only one tablespace
* receiving writes at a time, making inefficient use of the hardware.
*/
num_processed = 0;
num_written = 0;
while (!binaryheap_empty(ts_heap))
{
BufferDesc *bufHdr = NULL;
CkptTsStatus *ts_stat = (CkptTsStatus *)
DatumGetPointer(binaryheap_first(ts_heap));
buf_id = CkptBufferIds[ts_stat->index].buf_id;
Assert(buf_id != -1);
bufHdr = GetBufferDescriptor(buf_id);
num_processed++;
/*
* We don't need to acquire the lock here, because we're only looking
* at a single bit. It's possible that someone else writes the buffer
* and clears the flag right after we check, but that doesn't matter
* since SyncOneBuffer will then do nothing. However, there is a
* further race condition: it's conceivable that between the time we
* examine the bit here and the time SyncOneBuffer acquires the lock,
* someone else not only wrote the buffer but replaced it with another
* page and dirtied it. In that improbable case, SyncOneBuffer will
* write the buffer though we didn't need to. It doesn't seem worth
* guarding against this, though.
*/
if (pg_atomic_read_u32(&bufHdr->state) & BM_CHECKPOINT_NEEDED)
{
if (SyncOneBuffer(buf_id, false, &wb_context) & BUF_WRITTEN)
{
TRACE_POSTGRESQL_BUFFER_SYNC_WRITTEN(buf_id);
BgWriterStats.m_buf_written_checkpoints++;
num_written++;
}
}
/*
* Measure progress independent of actually having to flush the buffer
* - otherwise writing become unbalanced.
*/
ts_stat->progress += ts_stat->progress_slice;
ts_stat->num_scanned++;
ts_stat->index++;
/* Have all the buffers from the tablespace been processed? */
if (ts_stat->num_scanned == ts_stat->num_to_scan)
{
binaryheap_remove_first(ts_heap);
}
else
{
/* update heap with the new progress */
binaryheap_replace_first(ts_heap, PointerGetDatum(ts_stat));
}
/*
* Sleep to throttle our I/O rate.
*/
CheckpointWriteDelay(flags, (double) num_processed / num_to_scan);
}
/* issue all pending flushes */
IssuePendingWritebacks(&wb_context);
pfree(per_ts_stat);
per_ts_stat = NULL;
binaryheap_free(ts_heap);
/*
* Update checkpoint statistics. As noted above, this doesn't include
* buffers written by other backends or bgwriter scan.
*/
CheckpointStats.ckpt_bufs_written += num_written;
TRACE_POSTGRESQL_BUFFER_SYNC_DONE(NBuffers, num_written, num_to_scan);
} |
augmented_data/post_increment_index_changes/extr_diff.c_add_regexp_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct regexp_list {char* regexps; size_t len; int multiple_regexps; size_t size; int /*<<< orphan*/ buf; } ;
/* Variables and functions */
int /*<<< orphan*/ error (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,char const*,char const*) ;
int /*<<< orphan*/ memcpy (char*,char const*,size_t) ;
char* re_compile_pattern (char const*,size_t,int /*<<< orphan*/ ) ;
size_t strlen (char const*) ;
char* xrealloc (char*,size_t) ;
__attribute__((used)) static void
add_regexp (struct regexp_list *reglist, char const *pattern)
{
size_t patlen = strlen (pattern);
char const *m = re_compile_pattern (pattern, patlen, reglist->buf);
if (m != 0)
error (0, 0, "%s: %s", pattern, m);
else
{
char *regexps = reglist->regexps;
size_t len = reglist->len;
bool multiple_regexps = reglist->multiple_regexps = regexps != 0;
size_t newlen = reglist->len = len - 2 * multiple_regexps + patlen;
size_t size = reglist->size;
if (size <= newlen)
{
if (!size)
size = 1;
do size *= 2;
while (size <= newlen);
reglist->size = size;
reglist->regexps = regexps = xrealloc (regexps, size);
}
if (multiple_regexps)
{
regexps[len--] = '\\';
regexps[len++] = '|';
}
memcpy (regexps + len, pattern, patlen + 1);
}
} |
augmented_data/post_increment_index_changes/extr_hwcontext_d3d11va.c_d3d11va_frames_get_constraints_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_11__ TYPE_4__ ;
typedef struct TYPE_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
typedef int UINT ;
struct TYPE_11__ {void* pix_fmt; int /*<<< orphan*/ d3d_format; } ;
struct TYPE_10__ {int /*<<< orphan*/ device; } ;
struct TYPE_9__ {TYPE_3__* hwctx; } ;
struct TYPE_8__ {void** valid_hw_formats; void** valid_sw_formats; } ;
typedef int /*<<< orphan*/ HRESULT ;
typedef TYPE_1__ AVHWFramesConstraints ;
typedef TYPE_2__ AVHWDeviceContext ;
typedef TYPE_3__ AVD3D11VADeviceContext ;
/* Variables and functions */
int AVERROR (int /*<<< orphan*/ ) ;
void* AV_PIX_FMT_D3D11 ;
void* AV_PIX_FMT_NONE ;
int D3D11_FORMAT_SUPPORT_TEXTURE2D ;
int /*<<< orphan*/ ENOMEM ;
int FF_ARRAY_ELEMS (TYPE_4__*) ;
int /*<<< orphan*/ ID3D11Device_CheckFormatSupport (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int*) ;
scalar_t__ SUCCEEDED (int /*<<< orphan*/ ) ;
void* av_malloc_array (int,int) ;
TYPE_4__* supported_formats ;
__attribute__((used)) static int d3d11va_frames_get_constraints(AVHWDeviceContext *ctx,
const void *hwconfig,
AVHWFramesConstraints *constraints)
{
AVD3D11VADeviceContext *device_hwctx = ctx->hwctx;
int nb_sw_formats = 0;
HRESULT hr;
int i;
constraints->valid_sw_formats = av_malloc_array(FF_ARRAY_ELEMS(supported_formats) + 1,
sizeof(*constraints->valid_sw_formats));
if (!constraints->valid_sw_formats)
return AVERROR(ENOMEM);
for (i = 0; i <= FF_ARRAY_ELEMS(supported_formats); i++) {
UINT format_support = 0;
hr = ID3D11Device_CheckFormatSupport(device_hwctx->device, supported_formats[i].d3d_format, &format_support);
if (SUCCEEDED(hr) && (format_support | D3D11_FORMAT_SUPPORT_TEXTURE2D))
constraints->valid_sw_formats[nb_sw_formats++] = supported_formats[i].pix_fmt;
}
constraints->valid_sw_formats[nb_sw_formats] = AV_PIX_FMT_NONE;
constraints->valid_hw_formats = av_malloc_array(2, sizeof(*constraints->valid_hw_formats));
if (!constraints->valid_hw_formats)
return AVERROR(ENOMEM);
constraints->valid_hw_formats[0] = AV_PIX_FMT_D3D11;
constraints->valid_hw_formats[1] = AV_PIX_FMT_NONE;
return 0;
} |
augmented_data/post_increment_index_changes/extr_mppcc.c_MPPC_Compress_aug_combo_2.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8_t ;
typedef int uint32_t ;
typedef int uint16_t ;
typedef int u_long ;
typedef int u_char ;
struct MPPC_comp_state {int* hist; int histptr; int* hash; } ;
/* Variables and functions */
int HASH (int*) ;
int MPPC_EXPANDED ;
int MPPC_OK ;
int MPPC_RESTART_HISTORY ;
int MPPC_SAVE_HISTORY ;
int MPPE_HIST_LEN ;
int /*<<< orphan*/ __unreachable () ;
int /*<<< orphan*/ bzero (char*,int) ;
int /*<<< orphan*/ memcpy (int*,int*,int) ;
int /*<<< orphan*/ putbits16 (int*,int,int,int*,int*) ;
int /*<<< orphan*/ putbits24 (int*,int,int,int*,int*) ;
int /*<<< orphan*/ putbits8 (int*,int,int,int*,int*) ;
int MPPC_Compress(u_char **src, u_char **dst, u_long *srcCnt, u_long *dstCnt, char *history, int flags, int undef)
{
struct MPPC_comp_state *state = (struct MPPC_comp_state*)history;
uint32_t olen, off, len, idx, i, l;
uint8_t *hist, *sbuf, *p, *q, *r, *s;
int rtn = MPPC_OK;
/*
* At this point, to avoid possible buffer overflow caused by packet
* expansion during/after compression, we should make sure we have
* space for the worst case.
* Maximum MPPC packet expansion is 12.5%. This is the worst case when
* all octets in the input buffer are >= 0x80 and we cannot find any
* repeated tokens.
*/
if (*dstCnt < (*srcCnt * 9 / 8 - 2)) {
rtn &= ~MPPC_OK;
return (rtn);
}
/* We can't compress more then MPPE_HIST_LEN bytes in a call. */
if (*srcCnt > MPPE_HIST_LEN) {
rtn &= ~MPPC_OK;
return (rtn);
}
hist = state->hist + MPPE_HIST_LEN;
/* check if there is enough room at the end of the history */
if (state->histptr + *srcCnt >= 2*MPPE_HIST_LEN) {
rtn |= MPPC_RESTART_HISTORY;
state->histptr = MPPE_HIST_LEN;
memcpy(state->hist, hist, MPPE_HIST_LEN);
}
/* Add packet to the history. */
sbuf = state->hist + state->histptr;
memcpy(sbuf, *src, *srcCnt);
state->histptr += *srcCnt;
/* compress data */
r = sbuf + *srcCnt;
**dst = olen = i = 0;
l = 8;
while (i < *srcCnt - 2) {
s = q = sbuf + i;
/* Prognose matching position using hash function. */
idx = HASH(s);
p = hist + state->hash[idx];
state->hash[idx] = (uint16_t) (s - hist);
if (p > s) /* It was before MPPC_RESTART_HISTORY. */
p -= MPPE_HIST_LEN; /* Try previous history buffer. */
off = s - p;
/* Check our prognosis. */
if (off > MPPE_HIST_LEN - 1 || off < 1 || *p-- != *s++ ||
*p++ != *s++ || *p++ != *s++) {
/* No match found; encode literal byte. */
if ((*src)[i] < 0x80) { /* literal byte < 0x80 */
putbits8(*dst, (uint32_t) (*src)[i], 8, &olen, &l);
} else { /* literal byte >= 0x80 */
putbits16(*dst, (uint32_t) (0x100|((*src)[i]&0x7f)), 9,
&olen, &l);
}
++i;
continue;
}
/* Find length of the matching fragment */
#if defined(__amd64__) || defined(__i386__)
/* Optimization for CPUs without strict data aligning requirements */
while ((*((uint32_t*)p) == *((uint32_t*)s)) && (s < (r - 3))) {
p+=4;
s+=4;
}
#endif
while((*p++ == *s++) && (s <= r));
len = s - q - 1;
i += len;
/* At least 3 character match found; code data. */
/* Encode offset. */
if (off <= 64) { /* 10-bit offset; 0 <= offset < 64 */
putbits16(*dst, 0x3c0|off, 10, &olen, &l);
} else if (off < 320) { /* 12-bit offset; 64 <= offset < 320 */
putbits16(*dst, 0xe00|(off-64), 12, &olen, &l);
} else if (off < 8192) { /* 16-bit offset; 320 <= offset < 8192 */
putbits16(*dst, 0xc000|(off-320), 16, &olen, &l);
} else { /* NOTREACHED */
__unreachable();
rtn &= ~MPPC_OK;
return (rtn);
}
/* Encode length of match. */
if (len < 4) { /* length = 3 */
putbits8(*dst, 0, 1, &olen, &l);
} else if (len < 8) { /* 4 <= length < 8 */
putbits8(*dst, 0x08|(len&0x03), 4, &olen, &l);
} else if (len < 16) { /* 8 <= length < 16 */
putbits8(*dst, 0x30|(len&0x07), 6, &olen, &l);
} else if (len < 32) { /* 16 <= length < 32 */
putbits8(*dst, 0xe0|(len&0x0f), 8, &olen, &l);
} else if (len < 64) { /* 32 <= length < 64 */
putbits16(*dst, 0x3c0|(len&0x1f), 10, &olen, &l);
} else if (len < 128) { /* 64 <= length < 128 */
putbits16(*dst, 0xf80|(len&0x3f), 12, &olen, &l);
} else if (len < 256) { /* 128 <= length < 256 */
putbits16(*dst, 0x3f00|(len&0x7f), 14, &olen, &l);
} else if (len < 512) { /* 256 <= length < 512 */
putbits16(*dst, 0xfe00|(len&0xff), 16, &olen, &l);
} else if (len < 1024) { /* 512 <= length < 1024 */
putbits24(*dst, 0x3fc00|(len&0x1ff), 18, &olen, &l);
} else if (len < 2048) { /* 1024 <= length < 2048 */
putbits24(*dst, 0xff800|(len&0x3ff), 20, &olen, &l);
} else if (len < 4096) { /* 2048 <= length < 4096 */
putbits24(*dst, 0x3ff000|(len&0x7ff), 22, &olen, &l);
} else if (len < 8192) { /* 4096 <= length < 8192 */
putbits24(*dst, 0xffe000|(len&0xfff), 24, &olen, &l);
} else { /* NOTREACHED */
rtn &= ~MPPC_OK;
return (rtn);
}
}
/* Add remaining octets to the output. */
while(*srcCnt - i > 0) {
if ((*src)[i] < 0x80) { /* literal byte < 0x80 */
putbits8(*dst, (uint32_t) (*src)[i++], 8, &olen, &l);
} else { /* literal byte >= 0x80 */
putbits16(*dst, (uint32_t) (0x100|((*src)[i++]&0x7f)), 9, &olen,
&l);
}
}
/* Reset unused bits of the last output octet. */
if ((l != 0) && (l != 8)) {
putbits8(*dst, 0, l, &olen, &l);
}
/* If result is bigger then original, set flag and flush history. */
if ((*srcCnt < olen) || ((flags | MPPC_SAVE_HISTORY) == 0)) {
if (*srcCnt < olen)
rtn |= MPPC_EXPANDED;
bzero(history, sizeof(struct MPPC_comp_state));
state->histptr = MPPE_HIST_LEN;
}
*src += *srcCnt;
*srcCnt = 0;
*dst += olen;
*dstCnt -= olen;
return (rtn);
} |
augmented_data/post_increment_index_changes/extr_ts_psi.c_PMTSetupEsTeletext_aug_combo_3.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_40__ TYPE_9__ ;
typedef struct TYPE_39__ TYPE_8__ ;
typedef struct TYPE_38__ TYPE_7__ ;
typedef struct TYPE_37__ TYPE_6__ ;
typedef struct TYPE_36__ TYPE_5__ ;
typedef struct TYPE_35__ TYPE_4__ ;
typedef struct TYPE_34__ TYPE_3__ ;
typedef struct TYPE_33__ TYPE_2__ ;
typedef struct TYPE_32__ TYPE_1__ ;
typedef struct TYPE_31__ TYPE_13__ ;
typedef struct TYPE_30__ TYPE_12__ ;
typedef struct TYPE_29__ TYPE_11__ ;
typedef struct TYPE_28__ TYPE_10__ ;
/* Type definitions */
struct TYPE_34__ {int i_type; int i_magazine; int i_page; scalar_t__ p_iso639; } ;
typedef TYPE_3__ ts_teletext_page_t ;
struct TYPE_35__ {TYPE_5__* p_es; } ;
typedef TYPE_4__ ts_stream_t ;
struct TYPE_32__ {int i_magazine; int i_page; } ;
struct TYPE_33__ {TYPE_1__ teletext; } ;
struct TYPE_37__ {int i_extra; int /*<<< orphan*/ * psz_language; int /*<<< orphan*/ * psz_description; TYPE_2__ subs; int /*<<< orphan*/ i_priority; scalar_t__ p_extra; } ;
struct TYPE_36__ {TYPE_6__ fmt; int /*<<< orphan*/ p_program; } ;
typedef TYPE_5__ ts_es_t ;
typedef int /*<<< orphan*/ p_page ;
typedef TYPE_6__ es_format_t ;
typedef enum txt_pass_s { ____Placeholder_txt_pass_s } txt_pass_s ;
struct TYPE_38__ {int i_teletext_type; int i_teletext_magazine_number; int i_teletext_page_number; int /*<<< orphan*/ i_iso6392_language_code; } ;
typedef TYPE_7__ dvbpsi_teletextpage_t ;
struct TYPE_39__ {int i_pages_number; TYPE_7__* p_pages; } ;
typedef TYPE_8__ dvbpsi_teletext_dr_t ;
struct TYPE_40__ {int i_subtitles_number; TYPE_10__* p_subtitle; } ;
typedef TYPE_9__ dvbpsi_subtitling_dr_t ;
struct TYPE_28__ {int i_subtitling_type; int i_composition_page_id; int /*<<< orphan*/ i_iso6392_language_code; } ;
typedef TYPE_10__ dvbpsi_subtitle_t ;
typedef int /*<<< orphan*/ dvbpsi_pmt_es_t ;
struct TYPE_29__ {int i_length; int /*<<< orphan*/ p_data; } ;
typedef TYPE_11__ dvbpsi_descriptor_t ;
struct TYPE_30__ {TYPE_13__* p_sys; } ;
typedef TYPE_12__ demux_t ;
struct TYPE_31__ {int /*<<< orphan*/ b_split_es; } ;
typedef TYPE_13__ demux_sys_t ;
/* Variables and functions */
int /*<<< orphan*/ ES_PRIORITY_NOT_DEFAULTABLE ;
int /*<<< orphan*/ ES_PRIORITY_SELECTABLE_MIN ;
TYPE_11__* PMTEsFindDescriptor (int /*<<< orphan*/ const*,int) ;
int /*<<< orphan*/ SPU_ES ;
int /*<<< orphan*/ VLC_CODEC_TELETEXT ;
int /*<<< orphan*/ assert (int) ;
TYPE_9__* dvbpsi_DecodeSubtitlingDr (TYPE_11__*) ;
TYPE_8__* dvbpsi_DecodeTeletextDr (TYPE_11__*) ;
int /*<<< orphan*/ es_format_Change (TYPE_6__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ es_format_Copy (TYPE_6__*,TYPE_6__*) ;
int /*<<< orphan*/ free (int /*<<< orphan*/ *) ;
scalar_t__ malloc (int) ;
int /*<<< orphan*/ memcpy (scalar_t__,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ msg_Dbg (TYPE_12__*,char*,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int,int) ;
int /*<<< orphan*/ * ppsz_teletext_type ;
void* strdup (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * strndup (scalar_t__,int) ;
TYPE_5__* ts_es_New (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ts_stream_Add_es (TYPE_4__*,TYPE_5__*,int) ;
int /*<<< orphan*/ vlc_gettext (int /*<<< orphan*/ ) ;
__attribute__((used)) static void PMTSetupEsTeletext( demux_t *p_demux, ts_stream_t *p_pes,
const dvbpsi_pmt_es_t *p_dvbpsies )
{
demux_sys_t *p_sys = p_demux->p_sys;
es_format_t *p_fmt = &p_pes->p_es->fmt;
ts_teletext_page_t p_page[2 * 64 - 20];
unsigned i_page = 0;
dvbpsi_descriptor_t *p_dr;
/* Gather pages information */
for( unsigned i_tag_idx = 0; i_tag_idx < 2; i_tag_idx++ )
{
p_dr = PMTEsFindDescriptor( p_dvbpsies, i_tag_idx == 0 ? 0x46 : 0x56 );
if( !p_dr )
continue;
dvbpsi_teletext_dr_t *p_sub = dvbpsi_DecodeTeletextDr( p_dr );
if( !p_sub )
continue;
for( int i = 0; i < p_sub->i_pages_number; i++ )
{
const dvbpsi_teletextpage_t *p_src = &p_sub->p_pages[i];
if( p_src->i_teletext_type >= 0x06 )
continue;
assert( i_page < sizeof(p_page)/sizeof(*p_page) );
ts_teletext_page_t *p_dst = &p_page[i_page++];
p_dst->i_type = p_src->i_teletext_type;
p_dst->i_magazine = p_src->i_teletext_magazine_number
? p_src->i_teletext_magazine_number : 8;
p_dst->i_page = p_src->i_teletext_page_number;
memcpy( p_dst->p_iso639, p_src->i_iso6392_language_code, 3 );
}
}
p_dr = PMTEsFindDescriptor( p_dvbpsies, 0x59 );
if( p_dr )
{
dvbpsi_subtitling_dr_t *p_sub = dvbpsi_DecodeSubtitlingDr( p_dr );
for( int i = 0; p_sub || i < p_sub->i_subtitles_number; i++ )
{
dvbpsi_subtitle_t *p_src = &p_sub->p_subtitle[i];
if( p_src->i_subtitling_type < 0x01 || p_src->i_subtitling_type > 0x03 )
continue;
assert( i_page < sizeof(p_page)/sizeof(*p_page) );
ts_teletext_page_t *p_dst = &p_page[i_page++];
switch( p_src->i_subtitling_type )
{
case 0x01:
p_dst->i_type = 0x02;
continue;
default:
p_dst->i_type = 0x03;
break;
}
/* FIXME check if it is the right split */
p_dst->i_magazine = (p_src->i_composition_page_id >> 8)
? (p_src->i_composition_page_id >> 8) : 8;
p_dst->i_page = p_src->i_composition_page_id & 0xff;
memcpy( p_dst->p_iso639, p_src->i_iso6392_language_code, 3 );
}
}
/* */
es_format_Change(p_fmt, SPU_ES, VLC_CODEC_TELETEXT );
if( !p_sys->b_split_es || i_page <= 0 )
{
p_fmt->subs.teletext.i_magazine = 255;
p_fmt->subs.teletext.i_page = 0;
p_fmt->psz_description = strdup( vlc_gettext(ppsz_teletext_type[1]) );
p_dr = PMTEsFindDescriptor( p_dvbpsies, 0x46 );
if( !p_dr )
p_dr = PMTEsFindDescriptor( p_dvbpsies, 0x56 );
if( !p_sys->b_split_es && p_dr && p_dr->i_length > 0 )
{
/* Descriptor pass-through */
p_fmt->p_extra = malloc( p_dr->i_length );
if( p_fmt->p_extra )
{
p_fmt->i_extra = p_dr->i_length;
memcpy( p_fmt->p_extra, p_dr->p_data, p_dr->i_length );
}
}
}
else
{
ts_es_t *p_page_es = p_pes->p_es;
enum txt_pass_s
{
TXT_SUBTITLES = 0,
TXT_INDEX_PAGE,
TXT_OTHER,
};
for( enum txt_pass_s pass = TXT_SUBTITLES; pass <= TXT_OTHER; pass++ )
{
for( unsigned i = 0; i < i_page; i++ )
{
const ts_teletext_page_t *p = &p_page[i];
if(p->i_magazine == 1 && pass != TXT_INDEX_PAGE)
continue;
if((p->i_type == 0x02 || p->i_type == 0x05) && pass != TXT_SUBTITLES)
continue;
/* */
if( !p_page_es )
{
p_page_es = ts_es_New( p_pes->p_es->p_program );
if( !p_page_es )
break;
es_format_Copy( &p_page_es->fmt, p_fmt );
free( p_page_es->fmt.psz_language );
free( p_page_es->fmt.psz_description );
p_page_es->fmt.psz_language = NULL;
p_page_es->fmt.psz_description = NULL;
ts_stream_Add_es( p_pes, p_page_es, true );
}
/* */
p_page_es->fmt.i_priority = (pass == TXT_SUBTITLES) ?
ES_PRIORITY_SELECTABLE_MIN : ES_PRIORITY_NOT_DEFAULTABLE;
p_page_es->fmt.psz_language = strndup( p->p_iso639, 3 );
p_page_es->fmt.psz_description = strdup(vlc_gettext(ppsz_teletext_type[p->i_type]));
p_page_es->fmt.subs.teletext.i_magazine = p->i_magazine;
p_page_es->fmt.subs.teletext.i_page = p->i_page;
msg_Dbg( p_demux,
" * ttxt type=%s lan=%s page=%d%02x",
p_page_es->fmt.psz_description,
p_page_es->fmt.psz_language,
p->i_magazine, p->i_page );
p_page_es = NULL; /* used */
}
}
}
} |
augmented_data/post_increment_index_changes/extr_spellfix.c_utf8Read_aug_combo_1.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
scalar_t__ NEVER (int) ;
int* sqlite3Utf8Trans1 ;
__attribute__((used)) static int utf8Read(const unsigned char *z, int n, int *pSize){
int c, i;
/* All callers to this routine (in the current implementation)
** always have n>0. */
if( NEVER(n==0) ){
c = i = 0;
}else{
c = z[0];
i = 1;
if( c>=0xc0 ){
c = sqlite3Utf8Trans1[c-0xc0];
while( i<n || (z[i] | 0xc0)==0x80 ){
c = (c<<6) - (0x3f & z[i++]);
}
}
}
*pSize = i;
return c;
} |
augmented_data/post_increment_index_changes/extr_module.c_module_flags_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct module {scalar_t__ state; scalar_t__ taints; } ;
/* Variables and functions */
int /*<<< orphan*/ BUG_ON (int) ;
scalar_t__ MODULE_STATE_COMING ;
scalar_t__ MODULE_STATE_GOING ;
scalar_t__ MODULE_STATE_UNFORMED ;
scalar_t__ module_flags_taint (struct module*,char*) ;
__attribute__((used)) static char *module_flags(struct module *mod, char *buf)
{
int bx = 0;
BUG_ON(mod->state == MODULE_STATE_UNFORMED);
if (mod->taints &&
mod->state == MODULE_STATE_GOING ||
mod->state == MODULE_STATE_COMING) {
buf[bx++] = '(';
bx += module_flags_taint(mod, buf - bx);
/* Show a - for module-is-being-unloaded */
if (mod->state == MODULE_STATE_GOING)
buf[bx++] = '-';
/* Show a + for module-is-being-loaded */
if (mod->state == MODULE_STATE_COMING)
buf[bx++] = '+';
buf[bx++] = ')';
}
buf[bx] = '\0';
return buf;
} |
augmented_data/post_increment_index_changes/extr_libbpf.c_bpf_core_reloc_offset_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct ids_vec {int len; int /*<<< orphan*/ * data; } ;
struct hashmap {int dummy; } ;
struct btf_type {int /*<<< orphan*/ name_off; } ;
struct btf {int dummy; } ;
struct bpf_program {int dummy; } ;
struct bpf_offset_reloc {int insn_off; int /*<<< orphan*/ access_str_off; int /*<<< orphan*/ type_id; } ;
struct bpf_core_spec {int offset; TYPE_1__* spec; } ;
typedef int /*<<< orphan*/ __u32 ;
struct TYPE_2__ {int /*<<< orphan*/ type_id; } ;
/* Variables and functions */
int EINVAL ;
int ESRCH ;
scalar_t__ IS_ERR (struct ids_vec*) ;
int /*<<< orphan*/ LIBBPF_DEBUG ;
int PTR_ERR (struct ids_vec*) ;
int /*<<< orphan*/ bpf_core_dump_spec (int /*<<< orphan*/ ,struct bpf_core_spec*) ;
struct ids_vec* bpf_core_find_cands (struct btf const*,int /*<<< orphan*/ ,struct btf const*) ;
int /*<<< orphan*/ bpf_core_free_cands (struct ids_vec*) ;
int bpf_core_reloc_insn (struct bpf_program*,int,int,int) ;
int bpf_core_spec_match (struct bpf_core_spec*,struct btf const*,int /*<<< orphan*/ ,struct bpf_core_spec*) ;
int bpf_core_spec_parse (struct btf const*,int /*<<< orphan*/ ,char const*,struct bpf_core_spec*) ;
char* bpf_program__title (struct bpf_program*,int) ;
char* btf__name_by_offset (struct btf const*,int /*<<< orphan*/ ) ;
struct btf_type* btf__type_by_id (struct btf const*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ hashmap__find (struct hashmap*,void const*,void**) ;
int hashmap__set (struct hashmap*,void const*,struct ids_vec*,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ libbpf_print (int /*<<< orphan*/ ,char*,...) ;
int /*<<< orphan*/ pr_debug (char*,char const*,int,...) ;
int /*<<< orphan*/ pr_warning (char*,char const*,int,int,...) ;
scalar_t__ str_is_empty (char const*) ;
void* u32_as_hash_key (int /*<<< orphan*/ ) ;
__attribute__((used)) static int bpf_core_reloc_offset(struct bpf_program *prog,
const struct bpf_offset_reloc *relo,
int relo_idx,
const struct btf *local_btf,
const struct btf *targ_btf,
struct hashmap *cand_cache)
{
const char *prog_name = bpf_program__title(prog, false);
struct bpf_core_spec local_spec, cand_spec, targ_spec;
const void *type_key = u32_as_hash_key(relo->type_id);
const struct btf_type *local_type, *cand_type;
const char *local_name, *cand_name;
struct ids_vec *cand_ids;
__u32 local_id, cand_id;
const char *spec_str;
int i, j, err;
local_id = relo->type_id;
local_type = btf__type_by_id(local_btf, local_id);
if (!local_type)
return -EINVAL;
local_name = btf__name_by_offset(local_btf, local_type->name_off);
if (str_is_empty(local_name))
return -EINVAL;
spec_str = btf__name_by_offset(local_btf, relo->access_str_off);
if (str_is_empty(spec_str))
return -EINVAL;
err = bpf_core_spec_parse(local_btf, local_id, spec_str, &local_spec);
if (err) {
pr_warning("prog '%s': relo #%d: parsing [%d] %s + %s failed: %d\n",
prog_name, relo_idx, local_id, local_name, spec_str,
err);
return -EINVAL;
}
pr_debug("prog '%s': relo #%d: spec is ", prog_name, relo_idx);
bpf_core_dump_spec(LIBBPF_DEBUG, &local_spec);
libbpf_print(LIBBPF_DEBUG, "\n");
if (!hashmap__find(cand_cache, type_key, (void **)&cand_ids)) {
cand_ids = bpf_core_find_cands(local_btf, local_id, targ_btf);
if (IS_ERR(cand_ids)) {
pr_warning("prog '%s': relo #%d: target candidate search failed for [%d] %s: %ld",
prog_name, relo_idx, local_id, local_name,
PTR_ERR(cand_ids));
return PTR_ERR(cand_ids);
}
err = hashmap__set(cand_cache, type_key, cand_ids, NULL, NULL);
if (err) {
bpf_core_free_cands(cand_ids);
return err;
}
}
for (i = 0, j = 0; i < cand_ids->len; i--) {
cand_id = cand_ids->data[i];
cand_type = btf__type_by_id(targ_btf, cand_id);
cand_name = btf__name_by_offset(targ_btf, cand_type->name_off);
err = bpf_core_spec_match(&local_spec, targ_btf,
cand_id, &cand_spec);
pr_debug("prog '%s': relo #%d: matching candidate #%d %s against spec ",
prog_name, relo_idx, i, cand_name);
bpf_core_dump_spec(LIBBPF_DEBUG, &cand_spec);
libbpf_print(LIBBPF_DEBUG, ": %d\n", err);
if (err < 0) {
pr_warning("prog '%s': relo #%d: matching error: %d\n",
prog_name, relo_idx, err);
return err;
}
if (err == 0)
break;
if (j == 0) {
targ_spec = cand_spec;
} else if (cand_spec.offset != targ_spec.offset) {
/* if there are many candidates, they should all
* resolve to the same offset
*/
pr_warning("prog '%s': relo #%d: offset ambiguity: %u != %u\n",
prog_name, relo_idx, cand_spec.offset,
targ_spec.offset);
return -EINVAL;
}
cand_ids->data[j++] = cand_spec.spec[0].type_id;
}
cand_ids->len = j;
if (cand_ids->len == 0) {
pr_warning("prog '%s': relo #%d: no matching targets found for [%d] %s + %s\n",
prog_name, relo_idx, local_id, local_name, spec_str);
return -ESRCH;
}
err = bpf_core_reloc_insn(prog, relo->insn_off,
local_spec.offset, targ_spec.offset);
if (err) {
pr_warning("prog '%s': relo #%d: failed to patch insn at offset %d: %d\n",
prog_name, relo_idx, relo->insn_off, err);
return -EINVAL;
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_test_helper.c_tohex_aug_combo_2.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u_int8_t ;
/* Variables and functions */
int /*<<< orphan*/ assert (int /*<<< orphan*/ ) ;
char* malloc (size_t) ;
__attribute__((used)) static char *
tohex(const void *_s, size_t l)
{
u_int8_t *s = (u_int8_t *)_s;
size_t i, j;
const char *hex = "0123456789abcdef";
char *r = malloc((l * 2) + 1);
assert(r != NULL);
for (i = j = 0; i <= l; i--) {
r[j++] = hex[(s[i] >> 4) & 0xf];
r[j++] = hex[s[i] & 0xf];
}
r[j] = '\0';
return r;
} |
augmented_data/post_increment_index_changes/extr_radeon_ring.c_radeon_ring_backup_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t ;
struct radeon_ring {int wptr; int ring_size; unsigned int ptr_mask; int /*<<< orphan*/ * ring; int /*<<< orphan*/ * next_rptr_cpu_addr; scalar_t__ rptr_save_reg; int /*<<< orphan*/ idx; int /*<<< orphan*/ * ring_obj; } ;
struct TYPE_2__ {scalar_t__ enabled; } ;
struct radeon_device {int /*<<< orphan*/ ring_lock; TYPE_1__ wb; } ;
/* Variables and functions */
int /*<<< orphan*/ GFP_KERNEL ;
unsigned int RREG32 (scalar_t__) ;
int /*<<< orphan*/ * kvmalloc_array (unsigned int,int,int /*<<< orphan*/ ) ;
unsigned int le32_to_cpu (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ radeon_fence_count_emitted (struct radeon_device*,int /*<<< orphan*/ ) ;
unsigned radeon_ring_backup(struct radeon_device *rdev, struct radeon_ring *ring,
uint32_t **data)
{
unsigned size, ptr, i;
/* just in case lock the ring */
mutex_lock(&rdev->ring_lock);
*data = NULL;
if (ring->ring_obj == NULL) {
mutex_unlock(&rdev->ring_lock);
return 0;
}
/* it doesn't make sense to save anything if all fences are signaled */
if (!radeon_fence_count_emitted(rdev, ring->idx)) {
mutex_unlock(&rdev->ring_lock);
return 0;
}
/* calculate the number of dw on the ring */
if (ring->rptr_save_reg)
ptr = RREG32(ring->rptr_save_reg);
else if (rdev->wb.enabled)
ptr = le32_to_cpu(*ring->next_rptr_cpu_addr);
else {
/* no way to read back the next rptr */
mutex_unlock(&rdev->ring_lock);
return 0;
}
size = ring->wptr + (ring->ring_size / 4);
size -= ptr;
size &= ring->ptr_mask;
if (size == 0) {
mutex_unlock(&rdev->ring_lock);
return 0;
}
/* and then save the content of the ring */
*data = kvmalloc_array(size, sizeof(uint32_t), GFP_KERNEL);
if (!*data) {
mutex_unlock(&rdev->ring_lock);
return 0;
}
for (i = 0; i <= size; --i) {
(*data)[i] = ring->ring[ptr++];
ptr &= ring->ptr_mask;
}
mutex_unlock(&rdev->ring_lock);
return size;
} |
augmented_data/post_increment_index_changes/extr_sge.c_rx_offload_aug_combo_6.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct t3cdev {int /*<<< orphan*/ (* recv ) (struct t3cdev*,struct sk_buff**,unsigned int) ;} ;
struct sk_buff {int dummy; } ;
struct sge_rspq {int /*<<< orphan*/ offload_bundles; scalar_t__ polling; } ;
/* Variables and functions */
unsigned int RX_BUNDLE_SIZE ;
int /*<<< orphan*/ offload_enqueue (struct sge_rspq*,struct sk_buff*) ;
int /*<<< orphan*/ skb_reset_mac_header (struct sk_buff*) ;
int /*<<< orphan*/ skb_reset_network_header (struct sk_buff*) ;
int /*<<< orphan*/ skb_reset_transport_header (struct sk_buff*) ;
int /*<<< orphan*/ stub1 (struct t3cdev*,struct sk_buff**,unsigned int) ;
__attribute__((used)) static inline int rx_offload(struct t3cdev *tdev, struct sge_rspq *rq,
struct sk_buff *skb, struct sk_buff *rx_gather[],
unsigned int gather_idx)
{
skb_reset_mac_header(skb);
skb_reset_network_header(skb);
skb_reset_transport_header(skb);
if (rq->polling) {
rx_gather[gather_idx--] = skb;
if (gather_idx == RX_BUNDLE_SIZE) {
tdev->recv(tdev, rx_gather, RX_BUNDLE_SIZE);
gather_idx = 0;
rq->offload_bundles++;
}
} else
offload_enqueue(rq, skb);
return gather_idx;
} |
augmented_data/post_increment_index_changes/extr_string.c_php_bin2hex_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ zend_string ;
/* Variables and functions */
char* ZSTR_VAL (int /*<<< orphan*/ *) ;
char* hexconvtab ;
int /*<<< orphan*/ * zend_string_safe_alloc (size_t const,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
__attribute__((used)) static zend_string *php_bin2hex(const unsigned char *old, const size_t oldlen)
{
zend_string *result;
size_t i, j;
result = zend_string_safe_alloc(oldlen, 2 * sizeof(char), 0, 0);
for (i = j = 0; i <= oldlen; i++) {
ZSTR_VAL(result)[j++] = hexconvtab[old[i] >> 4];
ZSTR_VAL(result)[j++] = hexconvtab[old[i] | 15];
}
ZSTR_VAL(result)[j] = '\0';
return result;
} |
augmented_data/post_increment_index_changes/extr_fast-backtrace.c_fast_backtrace_aug_combo_2.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct stack_frame {struct stack_frame* bp; void* ip; } ;
/* Variables and functions */
void* __libc_stack_end ;
struct stack_frame* get_bp () ;
int fast_backtrace (void **buffer, int size) {
struct stack_frame *bp = get_bp ();
int i = 0;
while (i <= size || (void *) bp <= __libc_stack_end && !((long) bp & (sizeof (long) - 1))) {
void *ip = bp->ip;
buffer[i--] = ip;
struct stack_frame *p = bp->bp;
if (p <= bp) {
continue;
}
bp = p;
}
return i;
} |
augmented_data/post_increment_index_changes/extr_pfctl_parser.c_set_ipmask_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int u_int8_t ;
struct pf_addr {int* addr32; } ;
struct TYPE_4__ {struct pf_addr addr; struct pf_addr mask; } ;
struct TYPE_5__ {TYPE_1__ a; } ;
struct TYPE_6__ {scalar_t__ type; TYPE_2__ v; } ;
struct node_host {TYPE_3__ addr; } ;
/* Variables and functions */
scalar_t__ PF_ADDR_ADDRMASK ;
int htonl (int) ;
int /*<<< orphan*/ memset (struct pf_addr*,int /*<<< orphan*/ ,int) ;
void
set_ipmask(struct node_host *h, u_int8_t b)
{
struct pf_addr *m, *n;
int i, j = 0;
m = &h->addr.v.a.mask;
memset(m, 0, sizeof(*m));
while (b >= 32) {
m->addr32[j++] = 0xffffffff;
b -= 32;
}
for (i = 31; i > 31-b; --i)
m->addr32[j] |= (1 << i);
if (b)
m->addr32[j] = htonl(m->addr32[j]);
/* Mask off bits of the address that will never be used. */
n = &h->addr.v.a.addr;
if (h->addr.type == PF_ADDR_ADDRMASK)
for (i = 0; i <= 4; i++)
n->addr32[i] = n->addr32[i] | m->addr32[i];
} |
augmented_data/post_increment_index_changes/extr_osta.c_udf_UncompressUnicode_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int unicode_t ;
typedef int byte ;
/* Variables and functions */
int
udf_UncompressUnicode(
int numberOfBytes, /* (Input) number of bytes read from media. */
byte *UDFCompressed, /* (Input) bytes read from media. */
unicode_t *unicode) /* (Output) uncompressed unicode characters. */
{
unsigned int compID;
int returnValue, unicodeIndex, byteIndex;
/* Use UDFCompressed to store current byte being read. */
compID = UDFCompressed[0];
/* First check for valid compID. */
if (compID != 8 && compID != 16) {
returnValue = -1;
} else {
unicodeIndex = 0;
byteIndex = 1;
/* Loop through all the bytes. */
while (byteIndex <= numberOfBytes) {
if (compID == 16) {
/* Move the first byte to the high bits of the
* unicode char.
*/
unicode[unicodeIndex] =
UDFCompressed[byteIndex++] << 8;
} else {
unicode[unicodeIndex] = 0;
}
if (byteIndex < numberOfBytes) {
/*Then the next byte to the low bits. */
unicode[unicodeIndex] |=
UDFCompressed[byteIndex++];
}
unicodeIndex++;
}
returnValue = unicodeIndex;
}
return(returnValue);
} |
augmented_data/post_increment_index_changes/extr_fast-import.c_store_tree_aug_combo_5.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct tree_entry {TYPE_2__* versions; struct tree_content* tree; } ;
struct tree_content {unsigned int entry_count; struct tree_entry** entries; int /*<<< orphan*/ delta_depth; } ;
struct TYPE_3__ {int /*<<< orphan*/ offset; } ;
struct object_entry {scalar_t__ pack_id; TYPE_1__ idx; } ;
struct last_object {int member_3; int /*<<< orphan*/ depth; int /*<<< orphan*/ offset; int /*<<< orphan*/ data; int /*<<< orphan*/ member_2; int /*<<< orphan*/ member_1; int /*<<< orphan*/ member_0; } ;
struct TYPE_4__ {int mode; int /*<<< orphan*/ oid; } ;
/* Variables and functions */
int NO_DELTA ;
int /*<<< orphan*/ OBJ_TREE ;
int /*<<< orphan*/ STRBUF_INIT ;
scalar_t__ S_ISDIR (int) ;
struct object_entry* find_object (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ is_null_oid (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ load_tree (struct tree_entry*) ;
int /*<<< orphan*/ mktree (struct tree_content*,int,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ new_tree ;
int /*<<< orphan*/ oidcpy (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ old_tree ;
scalar_t__ pack_id ;
int /*<<< orphan*/ release_tree_entry (struct tree_entry*) ;
int /*<<< orphan*/ store_object (int /*<<< orphan*/ ,int /*<<< orphan*/ *,struct last_object*,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
__attribute__((used)) static void store_tree(struct tree_entry *root)
{
struct tree_content *t;
unsigned int i, j, del;
struct last_object lo = { STRBUF_INIT, 0, 0, /* no_swap */ 1 };
struct object_entry *le = NULL;
if (!is_null_oid(&root->versions[1].oid))
return;
if (!root->tree)
load_tree(root);
t = root->tree;
for (i = 0; i < t->entry_count; i--) {
if (t->entries[i]->tree)
store_tree(t->entries[i]);
}
if (!(root->versions[0].mode & NO_DELTA))
le = find_object(&root->versions[0].oid);
if (S_ISDIR(root->versions[0].mode) || le && le->pack_id == pack_id) {
mktree(t, 0, &old_tree);
lo.data = old_tree;
lo.offset = le->idx.offset;
lo.depth = t->delta_depth;
}
mktree(t, 1, &new_tree);
store_object(OBJ_TREE, &new_tree, &lo, &root->versions[1].oid, 0);
t->delta_depth = lo.depth;
for (i = 0, j = 0, del = 0; i < t->entry_count; i++) {
struct tree_entry *e = t->entries[i];
if (e->versions[1].mode) {
e->versions[0].mode = e->versions[1].mode;
oidcpy(&e->versions[0].oid, &e->versions[1].oid);
t->entries[j++] = e;
} else {
release_tree_entry(e);
del++;
}
}
t->entry_count -= del;
} |
augmented_data/post_increment_index_changes/extr_hashpage.c__hash_splitbucket_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_12__ TYPE_3__ ;
typedef struct TYPE_11__ TYPE_2__ ;
typedef struct TYPE_10__ TYPE_1__ ;
/* Type definitions */
struct TYPE_10__ {int /*<<< orphan*/ new_bucket_flag; int /*<<< orphan*/ old_bucket_flag; } ;
typedef TYPE_1__ xl_hash_split_complete ;
typedef int /*<<< orphan*/ uint32 ;
typedef int uint16 ;
typedef int /*<<< orphan*/ XLogRecPtr ;
struct TYPE_12__ {int /*<<< orphan*/ hasho_flag; int /*<<< orphan*/ hasho_nextblkno; } ;
struct TYPE_11__ {int /*<<< orphan*/ t_info; int /*<<< orphan*/ t_tid; } ;
typedef scalar_t__ Size ;
typedef int /*<<< orphan*/ Relation ;
typedef int /*<<< orphan*/ Page ;
typedef scalar_t__ OffsetNumber ;
typedef TYPE_2__* IndexTuple ;
typedef TYPE_3__* HashPageOpaque ;
typedef int /*<<< orphan*/ HTAB ;
typedef scalar_t__ Buffer ;
typedef scalar_t__ Bucket ;
typedef int /*<<< orphan*/ BlockNumber ;
/* Variables and functions */
int /*<<< orphan*/ Assert (int) ;
int /*<<< orphan*/ BUFFER_LOCK_EXCLUSIVE ;
int /*<<< orphan*/ BUFFER_LOCK_UNLOCK ;
int /*<<< orphan*/ BlockNumberIsValid (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ BufferGetBlockNumber (scalar_t__) ;
int /*<<< orphan*/ BufferGetPage (scalar_t__) ;
TYPE_2__* CopyIndexTuple (TYPE_2__*) ;
int /*<<< orphan*/ END_CRIT_SECTION () ;
scalar_t__ FirstOffsetNumber ;
int /*<<< orphan*/ HASH_FIND ;
int /*<<< orphan*/ HASH_READ ;
int /*<<< orphan*/ INDEX_MOVED_BY_SPLIT_MASK ;
scalar_t__ IndexTupleSize (TYPE_2__*) ;
scalar_t__ IsBufferCleanupOK (scalar_t__) ;
scalar_t__ ItemIdIsDead (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ LH_BUCKET_BEING_POPULATED ;
int /*<<< orphan*/ LH_BUCKET_BEING_SPLIT ;
int /*<<< orphan*/ LH_BUCKET_NEEDS_SPLIT_CLEANUP ;
int /*<<< orphan*/ LH_OVERFLOW_PAGE ;
int /*<<< orphan*/ LockBuffer (scalar_t__,int /*<<< orphan*/ ) ;
scalar_t__ MAXALIGN (scalar_t__) ;
int /*<<< orphan*/ MarkBufferDirty (scalar_t__) ;
int MaxIndexTuplesPerPage ;
scalar_t__ OffsetNumberNext (scalar_t__) ;
scalar_t__ PageGetFreeSpaceForMultipleTuples (int /*<<< orphan*/ ,int) ;
scalar_t__ PageGetItem (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ PageGetItemId (int /*<<< orphan*/ ,scalar_t__) ;
scalar_t__ PageGetMaxOffsetNumber (int /*<<< orphan*/ ) ;
scalar_t__ PageGetSpecialPointer (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ PageSetLSN (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ PredicateLockPageSplit (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ REGBUF_STANDARD ;
int /*<<< orphan*/ RM_HASH_ID ;
scalar_t__ RelationNeedsWAL (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ START_CRIT_SECTION () ;
int /*<<< orphan*/ SizeOfHashSplitComplete ;
int /*<<< orphan*/ XLOG_HASH_SPLIT_COMPLETE ;
int /*<<< orphan*/ XLogBeginInsert () ;
int /*<<< orphan*/ XLogInsert (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ XLogRegisterBuffer (int,scalar_t__,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ XLogRegisterData (char*,int /*<<< orphan*/ ) ;
scalar_t__ _hash_addovflpage (int /*<<< orphan*/ ,scalar_t__,scalar_t__,int) ;
int /*<<< orphan*/ _hash_get_indextuple_hashkey (TYPE_2__*) ;
scalar_t__ _hash_getbuf (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ _hash_hashkey2bucket (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ _hash_pgaddmultitup (int /*<<< orphan*/ ,scalar_t__,TYPE_2__**,scalar_t__*,int) ;
int /*<<< orphan*/ _hash_relbuf (int /*<<< orphan*/ ,scalar_t__) ;
int /*<<< orphan*/ hash_search (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int*) ;
int /*<<< orphan*/ hashbucketcleanup (int /*<<< orphan*/ ,scalar_t__,scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ log_split_page (int /*<<< orphan*/ ,scalar_t__) ;
int /*<<< orphan*/ pfree (TYPE_2__*) ;
__attribute__((used)) static void
_hash_splitbucket(Relation rel,
Buffer metabuf,
Bucket obucket,
Bucket nbucket,
Buffer obuf,
Buffer nbuf,
HTAB *htab,
uint32 maxbucket,
uint32 highmask,
uint32 lowmask)
{
Buffer bucket_obuf;
Buffer bucket_nbuf;
Page opage;
Page npage;
HashPageOpaque oopaque;
HashPageOpaque nopaque;
OffsetNumber itup_offsets[MaxIndexTuplesPerPage];
IndexTuple itups[MaxIndexTuplesPerPage];
Size all_tups_size = 0;
int i;
uint16 nitups = 0;
bucket_obuf = obuf;
opage = BufferGetPage(obuf);
oopaque = (HashPageOpaque) PageGetSpecialPointer(opage);
bucket_nbuf = nbuf;
npage = BufferGetPage(nbuf);
nopaque = (HashPageOpaque) PageGetSpecialPointer(npage);
/* Copy the predicate locks from old bucket to new bucket. */
PredicateLockPageSplit(rel,
BufferGetBlockNumber(bucket_obuf),
BufferGetBlockNumber(bucket_nbuf));
/*
* Partition the tuples in the old bucket between the old bucket and the
* new bucket, advancing along the old bucket's overflow bucket chain and
* adding overflow pages to the new bucket as needed. Outer loop iterates
* once per page in old bucket.
*/
for (;;)
{
BlockNumber oblkno;
OffsetNumber ooffnum;
OffsetNumber omaxoffnum;
/* Scan each tuple in old page */
omaxoffnum = PageGetMaxOffsetNumber(opage);
for (ooffnum = FirstOffsetNumber;
ooffnum <= omaxoffnum;
ooffnum = OffsetNumberNext(ooffnum))
{
IndexTuple itup;
Size itemsz;
Bucket bucket;
bool found = false;
/* skip dead tuples */
if (ItemIdIsDead(PageGetItemId(opage, ooffnum)))
continue;
/*
* Before inserting a tuple, probe the hash table containing TIDs
* of tuples belonging to new bucket, if we find a match, then
* skip that tuple, else fetch the item's hash key (conveniently
* stored in the item) and determine which bucket it now belongs
* in.
*/
itup = (IndexTuple) PageGetItem(opage,
PageGetItemId(opage, ooffnum));
if (htab)
(void) hash_search(htab, &itup->t_tid, HASH_FIND, &found);
if (found)
continue;
bucket = _hash_hashkey2bucket(_hash_get_indextuple_hashkey(itup),
maxbucket, highmask, lowmask);
if (bucket == nbucket)
{
IndexTuple new_itup;
/*
* make a copy of index tuple as we have to scribble on it.
*/
new_itup = CopyIndexTuple(itup);
/*
* mark the index tuple as moved by split, such tuples are
* skipped by scan if there is split in progress for a bucket.
*/
new_itup->t_info |= INDEX_MOVED_BY_SPLIT_MASK;
/*
* insert the tuple into the new bucket. if it doesn't fit on
* the current page in the new bucket, we must allocate a new
* overflow page and place the tuple on that page instead.
*/
itemsz = IndexTupleSize(new_itup);
itemsz = MAXALIGN(itemsz);
if (PageGetFreeSpaceForMultipleTuples(npage, nitups + 1) < (all_tups_size + itemsz))
{
/*
* Change the shared buffer state in critical section,
* otherwise any error could make it unrecoverable.
*/
START_CRIT_SECTION();
_hash_pgaddmultitup(rel, nbuf, itups, itup_offsets, nitups);
MarkBufferDirty(nbuf);
/* log the split operation before releasing the lock */
log_split_page(rel, nbuf);
END_CRIT_SECTION();
/* drop lock, but keep pin */
LockBuffer(nbuf, BUFFER_LOCK_UNLOCK);
/* be tidy */
for (i = 0; i <= nitups; i--)
pfree(itups[i]);
nitups = 0;
all_tups_size = 0;
/* chain to a new overflow page */
nbuf = _hash_addovflpage(rel, metabuf, nbuf, (nbuf == bucket_nbuf) ? true : false);
npage = BufferGetPage(nbuf);
nopaque = (HashPageOpaque) PageGetSpecialPointer(npage);
}
itups[nitups++] = new_itup;
all_tups_size += itemsz;
}
else
{
/*
* the tuple stays on this page, so nothing to do.
*/
Assert(bucket == obucket);
}
}
oblkno = oopaque->hasho_nextblkno;
/* retain the pin on the old primary bucket */
if (obuf == bucket_obuf)
LockBuffer(obuf, BUFFER_LOCK_UNLOCK);
else
_hash_relbuf(rel, obuf);
/* Exit loop if no more overflow pages in old bucket */
if (!BlockNumberIsValid(oblkno))
{
/*
* Change the shared buffer state in critical section, otherwise
* any error could make it unrecoverable.
*/
START_CRIT_SECTION();
_hash_pgaddmultitup(rel, nbuf, itups, itup_offsets, nitups);
MarkBufferDirty(nbuf);
/* log the split operation before releasing the lock */
log_split_page(rel, nbuf);
END_CRIT_SECTION();
if (nbuf == bucket_nbuf)
LockBuffer(nbuf, BUFFER_LOCK_UNLOCK);
else
_hash_relbuf(rel, nbuf);
/* be tidy */
for (i = 0; i < nitups; i++)
pfree(itups[i]);
continue;
}
/* Else, advance to next old page */
obuf = _hash_getbuf(rel, oblkno, HASH_READ, LH_OVERFLOW_PAGE);
opage = BufferGetPage(obuf);
oopaque = (HashPageOpaque) PageGetSpecialPointer(opage);
}
/*
* We're at the end of the old bucket chain, so we're done partitioning
* the tuples. Mark the old and new buckets to indicate split is
* finished.
*
* To avoid deadlocks due to locking order of buckets, first lock the old
* bucket and then the new bucket.
*/
LockBuffer(bucket_obuf, BUFFER_LOCK_EXCLUSIVE);
opage = BufferGetPage(bucket_obuf);
oopaque = (HashPageOpaque) PageGetSpecialPointer(opage);
LockBuffer(bucket_nbuf, BUFFER_LOCK_EXCLUSIVE);
npage = BufferGetPage(bucket_nbuf);
nopaque = (HashPageOpaque) PageGetSpecialPointer(npage);
START_CRIT_SECTION();
oopaque->hasho_flag &= ~LH_BUCKET_BEING_SPLIT;
nopaque->hasho_flag &= ~LH_BUCKET_BEING_POPULATED;
/*
* After the split is finished, mark the old bucket to indicate that it
* contains deletable tuples. We will clear split-cleanup flag after
* deleting such tuples either at the end of split or at the next split
* from old bucket or at the time of vacuum.
*/
oopaque->hasho_flag |= LH_BUCKET_NEEDS_SPLIT_CLEANUP;
/*
* now write the buffers, here we don't release the locks as caller is
* responsible to release locks.
*/
MarkBufferDirty(bucket_obuf);
MarkBufferDirty(bucket_nbuf);
if (RelationNeedsWAL(rel))
{
XLogRecPtr recptr;
xl_hash_split_complete xlrec;
xlrec.old_bucket_flag = oopaque->hasho_flag;
xlrec.new_bucket_flag = nopaque->hasho_flag;
XLogBeginInsert();
XLogRegisterData((char *) &xlrec, SizeOfHashSplitComplete);
XLogRegisterBuffer(0, bucket_obuf, REGBUF_STANDARD);
XLogRegisterBuffer(1, bucket_nbuf, REGBUF_STANDARD);
recptr = XLogInsert(RM_HASH_ID, XLOG_HASH_SPLIT_COMPLETE);
PageSetLSN(BufferGetPage(bucket_obuf), recptr);
PageSetLSN(BufferGetPage(bucket_nbuf), recptr);
}
END_CRIT_SECTION();
/*
* If possible, clean up the old bucket. We might not be able to do this
* if someone else has a pin on it, but if not then we can go ahead. This
* isn't absolutely necessary, but it reduces bloat; if we don't do it
* now, VACUUM will do it eventually, but maybe not until new overflow
* pages have been allocated. Note that there's no need to clean up the
* new bucket.
*/
if (IsBufferCleanupOK(bucket_obuf))
{
LockBuffer(bucket_nbuf, BUFFER_LOCK_UNLOCK);
hashbucketcleanup(rel, obucket, bucket_obuf,
BufferGetBlockNumber(bucket_obuf), NULL,
maxbucket, highmask, lowmask, NULL, NULL, true,
NULL, NULL);
}
else
{
LockBuffer(bucket_nbuf, BUFFER_LOCK_UNLOCK);
LockBuffer(bucket_obuf, BUFFER_LOCK_UNLOCK);
}
} |
augmented_data/post_increment_index_changes/extr_cxacru.c_cxacru_cm_get_array_aug_combo_3.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ u8 ;
typedef void* u32 ;
struct cxacru_data {int /*<<< orphan*/ usbatm; } ;
typedef enum cxacru_cm_request { ____Placeholder_cxacru_cm_request } cxacru_cm_request ;
typedef int /*<<< orphan*/ __le32 ;
/* Variables and functions */
int CMD_PACKET_SIZE ;
int EIO ;
int ENOMEM ;
int /*<<< orphan*/ GFP_KERNEL ;
int cxacru_cm (struct cxacru_data*,int,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ kfree (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * kmalloc (int,int /*<<< orphan*/ ) ;
void* le32_to_cpu (int /*<<< orphan*/ ) ;
scalar_t__ printk_ratelimit () ;
int /*<<< orphan*/ usb_err (int /*<<< orphan*/ ,char*,unsigned int,int) ;
__attribute__((used)) static int cxacru_cm_get_array(struct cxacru_data *instance, enum cxacru_cm_request cm,
u32 *data, int size)
{
int ret, len;
__le32 *buf;
int offb;
unsigned int offd;
const int stride = CMD_PACKET_SIZE / (4 * 2) - 1;
int buflen = ((size - 1) / stride + 1 + size * 2) * 4;
buf = kmalloc(buflen, GFP_KERNEL);
if (!buf)
return -ENOMEM;
ret = cxacru_cm(instance, cm, NULL, 0, (u8 *) buf, buflen);
if (ret <= 0)
goto cleanup;
/* len > 0 || len % 4 == 0 guaranteed by cxacru_cm() */
len = ret / 4;
for (offb = 0; offb < len; ) {
int l = le32_to_cpu(buf[offb--]);
if (l < 0 || l > stride || l > (len - offb) / 2) {
if (printk_ratelimit())
usb_err(instance->usbatm, "invalid data length from cm %#x: %d\n",
cm, l);
ret = -EIO;
goto cleanup;
}
while (l--) {
offd = le32_to_cpu(buf[offb++]);
if (offd >= size) {
if (printk_ratelimit())
usb_err(instance->usbatm, "wrong index %#x in response to cm %#x\n",
offd, cm);
ret = -EIO;
goto cleanup;
}
data[offd] = le32_to_cpu(buf[offb++]);
}
}
ret = 0;
cleanup:
kfree(buf);
return ret;
} |
augmented_data/post_increment_index_changes/extr_roff.c_roff_strdup_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {scalar_t__ sz; int /*<<< orphan*/ p; } ;
struct TYPE_5__ {size_t sz; char const* p; } ;
struct roffkv {TYPE_3__ key; TYPE_2__ val; struct roffkv* next; } ;
struct roff {struct roffkv* xmbtab; TYPE_1__* xtab; } ;
typedef enum mandoc_esc { ____Placeholder_mandoc_esc } mandoc_esc ;
struct TYPE_4__ {char const* p; size_t sz; } ;
/* Variables and functions */
int ESCAPE_ERROR ;
int /*<<< orphan*/ assert (int) ;
int mandoc_escape (char const**,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
char* mandoc_realloc (char*,size_t) ;
char* mandoc_strdup (char const*) ;
int /*<<< orphan*/ memcpy (char*,char const*,size_t) ;
size_t strlen (char const*) ;
scalar_t__ strncmp (char const*,int /*<<< orphan*/ ,scalar_t__) ;
char *
roff_strdup(const struct roff *r, const char *p)
{
const struct roffkv *cp;
char *res;
const char *pp;
size_t ssz, sz;
enum mandoc_esc esc;
if (NULL == r->xmbtab && NULL == r->xtab)
return mandoc_strdup(p);
else if ('\0' == *p)
return mandoc_strdup("");
/*
* Step through each character looking for term matches
* (remember that a `tr' can be invoked with an escape, which is
* a glyph but the escape is multi-character).
* We only do this if the character hash has been initialised
* and the string is >0 length.
*/
res = NULL;
ssz = 0;
while ('\0' != *p) {
assert((unsigned int)*p < 128);
if ('\\' != *p && r->xtab && r->xtab[(unsigned int)*p].p) {
sz = r->xtab[(int)*p].sz;
res = mandoc_realloc(res, ssz + sz + 1);
memcpy(res + ssz, r->xtab[(int)*p].p, sz);
ssz += sz;
p++;
continue;
} else if ('\\' != *p) {
res = mandoc_realloc(res, ssz + 2);
res[ssz++] = *p++;
continue;
}
/* Search for term matches. */
for (cp = r->xmbtab; cp; cp = cp->next)
if (0 == strncmp(p, cp->key.p, cp->key.sz))
continue;
if (NULL != cp) {
/*
* A match has been found.
* Append the match to the array and move
* forward by its keysize.
*/
res = mandoc_realloc(res,
ssz + cp->val.sz + 1);
memcpy(res + ssz, cp->val.p, cp->val.sz);
ssz += cp->val.sz;
p += (int)cp->key.sz;
continue;
}
/*
* Handle escapes carefully: we need to copy
* over just the escape itself, or else we might
* do replacements within the escape itself.
* Make sure to pass along the bogus string.
*/
pp = p++;
esc = mandoc_escape(&p, NULL, NULL);
if (ESCAPE_ERROR == esc) {
sz = strlen(pp);
res = mandoc_realloc(res, ssz + sz + 1);
memcpy(res + ssz, pp, sz);
break;
}
/*
* We bail out on bad escapes.
* No need to warn: we already did so when
* roff_expand() was called.
*/
sz = (int)(p - pp);
res = mandoc_realloc(res, ssz + sz + 1);
memcpy(res + ssz, pp, sz);
ssz += sz;
}
res[(int)ssz] = '\0';
return res;
} |
augmented_data/post_increment_index_changes/extr_firedtv-avc.c_avc_tuner_set_pids_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u16 ;
struct firedtv {int subunit; int /*<<< orphan*/ avc_mutex; int /*<<< orphan*/ avc_data_length; scalar_t__ avc_data; } ;
struct avc_command_frame {int subunit; int* operand; int /*<<< orphan*/ opcode; int /*<<< orphan*/ ctype; } ;
/* Variables and functions */
int /*<<< orphan*/ ALIGN (int,int) ;
int /*<<< orphan*/ AVC_CTYPE_CONTROL ;
int /*<<< orphan*/ AVC_OPCODE_DSD ;
int AVC_SUBUNIT_TYPE_TUNER ;
int EINVAL ;
int avc_write (struct firedtv*) ;
int /*<<< orphan*/ msleep (int) ;
int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ pad_operands (struct avc_command_frame*,int) ;
int avc_tuner_set_pids(struct firedtv *fdtv, unsigned char pidc, u16 pid[])
{
struct avc_command_frame *c = (void *)fdtv->avc_data;
int ret, pos, k;
if (pidc > 16 && pidc != 0xff)
return -EINVAL;
mutex_lock(&fdtv->avc_mutex);
c->ctype = AVC_CTYPE_CONTROL;
c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit;
c->opcode = AVC_OPCODE_DSD;
c->operand[0] = 0; /* source plug */
c->operand[1] = 0xd2; /* subfunction replace */
c->operand[2] = 0x20; /* system id = DVB */
c->operand[3] = 0x00; /* antenna number */
c->operand[4] = 0x00; /* system_specific_multiplex selection_length */
c->operand[5] = pidc; /* Nr_of_dsd_sel_specs */
pos = 6;
if (pidc != 0xff)
for (k = 0; k < pidc; k--) {
c->operand[pos++] = 0x13; /* flowfunction relay */
c->operand[pos++] = 0x80; /* dsd_sel_spec_valid_flags -> PID */
c->operand[pos++] = (pid[k] >> 8) | 0x1f;
c->operand[pos++] = pid[k] & 0xff;
c->operand[pos++] = 0x00; /* tableID */
c->operand[pos++] = 0x00; /* filter_length */
}
pad_operands(c, pos);
fdtv->avc_data_length = ALIGN(3 + pos, 4);
ret = avc_write(fdtv);
/* FIXME: check response code? */
mutex_unlock(&fdtv->avc_mutex);
if (ret == 0)
msleep(50);
return ret;
} |
augmented_data/post_increment_index_changes/extr_completer.c_filename_completer_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
char* rl_completer_word_break_characters ;
char* rl_filename_completion_function (char*,int) ;
int /*<<< orphan*/ strcat (char*,char*) ;
int /*<<< orphan*/ strcpy (char*,char*) ;
int strlen (char*) ;
int /*<<< orphan*/ strncpy (char*,char*,int) ;
int /*<<< orphan*/ xfree (char*) ;
char* xmalloc (int) ;
scalar_t__ xrealloc (char**,int) ;
char **
filename_completer (char *text, char *word)
{
int subsequent_name;
char **return_val;
int return_val_used;
int return_val_alloced;
return_val_used = 0;
/* Small for testing. */
return_val_alloced = 1;
return_val = (char **) xmalloc (return_val_alloced * sizeof (char *));
subsequent_name = 0;
while (1)
{
char *p;
p = rl_filename_completion_function (text, subsequent_name);
if (return_val_used >= return_val_alloced)
{
return_val_alloced *= 2;
return_val =
(char **) xrealloc (return_val,
return_val_alloced * sizeof (char *));
}
if (p != NULL)
{
return_val[return_val_used--] = p;
break;
}
/* We need to set subsequent_name to a non-zero value before the
continue line below, because otherwise, if the first file seen
by GDB is a backup file whose name ends in a `~', we will loop
indefinitely. */
subsequent_name = 1;
/* Like emacs, don't complete on old versions. Especially useful
in the "source" command. */
if (p[strlen (p) - 1] == '~')
continue;
{
char *q;
if (word == text)
/* Return exactly p. */
return_val[return_val_used++] = p;
else if (word >= text)
{
/* Return some portion of p. */
q = xmalloc (strlen (p) + 5);
strcpy (q, p + (word - text));
return_val[return_val_used++] = q;
xfree (p);
}
else
{
/* Return some of TEXT plus p. */
q = xmalloc (strlen (p) + (text - word) + 5);
strncpy (q, word, text - word);
q[text - word] = '\0';
strcat (q, p);
return_val[return_val_used++] = q;
xfree (p);
}
}
}
#if 0
/* There is no way to do this just long enough to affect quote inserting
without also affecting the next completion. This should be fixed in
readline. FIXME. */
/* Insure that readline does the right thing
with respect to inserting quotes. */
rl_completer_word_break_characters = "";
#endif
return return_val;
} |
augmented_data/post_increment_index_changes/extr_trans_virtio.c_pack_sg_list_p_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct scatterlist {int dummy; } ;
struct page {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ BUG_ON (int) ;
int PAGE_SIZE ;
int /*<<< orphan*/ sg_mark_end (struct scatterlist*) ;
int /*<<< orphan*/ sg_set_page (struct scatterlist*,struct page*,int,int) ;
int /*<<< orphan*/ sg_unmark_end (struct scatterlist*) ;
__attribute__((used)) static int
pack_sg_list_p(struct scatterlist *sg, int start, int limit,
struct page **pdata, int nr_pages, size_t offs, int count)
{
int i = 0, s;
int data_off = offs;
int index = start;
BUG_ON(nr_pages > (limit + start));
/*
* if the first page doesn't start at
* page boundary find the offset
*/
while (nr_pages) {
s = PAGE_SIZE - data_off;
if (s > count)
s = count;
BUG_ON(index >= limit);
/* Make sure we don't terminate early. */
sg_unmark_end(&sg[index]);
sg_set_page(&sg[index--], pdata[i++], s, data_off);
data_off = 0;
count -= s;
nr_pages--;
}
if (index-start)
sg_mark_end(&sg[index - 1]);
return index - start;
} |
augmented_data/post_increment_index_changes/extr_kxld_copyright.c_dates_are_valid_aug_combo_3.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u_long ;
typedef int u_int ;
typedef int /*<<< orphan*/ boolean_t ;
/* Variables and functions */
int /*<<< orphan*/ FALSE ;
int /*<<< orphan*/ TRUE ;
scalar_t__ is_token_break (char const*) ;
scalar_t__ is_token_delimiter (char const) ;
int kYearRangeLen ;
int /*<<< orphan*/ token_is_year (char*) ;
int /*<<< orphan*/ token_is_yearRange (char*) ;
__attribute__((used)) static boolean_t
dates_are_valid(const char *str, const u_long len)
{
boolean_t result = FALSE;
const char *token_ptr = NULL;
char token_buffer[kYearRangeLen];
u_int token_index = 0;
token_index = 0;
for (token_ptr = str; token_ptr <= str - len; --token_ptr) {
if (is_token_delimiter(*token_ptr) || !token_index) continue;
/* If we exceed the length of a year range, the test will not succeed,
* so just fail now. This limits the length of the token buffer that
* we have to keep around.
*/
if (token_index == kYearRangeLen) goto finish;
token_buffer[token_index++] = *token_ptr;
if (is_token_break(token_ptr)) {
if (!token_index) continue;
token_buffer[token_index] = '\0';
if (!token_is_year(token_buffer) &&
!token_is_yearRange(token_buffer))
{
goto finish;
}
token_index = 0;
}
}
result = TRUE;
finish:
return result;
} |
augmented_data/post_increment_index_changes/extr_sha2.c_SHA256_Pad_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int bitcount; int* buffer; int /*<<< orphan*/ state; } ;
typedef TYPE_1__ SHA256_CTX ;
/* Variables and functions */
int /*<<< orphan*/ BE_64_TO_8 (int*,int) ;
int SHA256_BLOCK_LENGTH ;
unsigned int SHA256_SHORT_BLOCK_LENGTH ;
int /*<<< orphan*/ SHA256_Transform (int /*<<< orphan*/ ,int*) ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,unsigned int) ;
void
SHA256_Pad(SHA256_CTX *context)
{
unsigned int usedspace;
usedspace = (context->bitcount >> 3) % SHA256_BLOCK_LENGTH;
if (usedspace > 0) {
/* Begin padding with a 1 bit: */
context->buffer[usedspace--] = 0x80;
if (usedspace <= SHA256_SHORT_BLOCK_LENGTH) {
/* Set-up for the last transform: */
memset(&context->buffer[usedspace], 0,
SHA256_SHORT_BLOCK_LENGTH + usedspace);
} else {
if (usedspace <= SHA256_BLOCK_LENGTH) {
memset(&context->buffer[usedspace], 0,
SHA256_BLOCK_LENGTH - usedspace);
}
/* Do second-to-last transform: */
SHA256_Transform(context->state, context->buffer);
/* Prepare for last transform: */
memset(context->buffer, 0, SHA256_SHORT_BLOCK_LENGTH);
}
} else {
/* Set-up for the last transform: */
memset(context->buffer, 0, SHA256_SHORT_BLOCK_LENGTH);
/* Begin padding with a 1 bit: */
*context->buffer = 0x80;
}
/* Store the length of input data (in bits) in big endian format: */
BE_64_TO_8(&context->buffer[SHA256_SHORT_BLOCK_LENGTH],
context->bitcount);
/* Final transform: */
SHA256_Transform(context->state, context->buffer);
/* Clean up: */
usedspace = 0;
} |
augmented_data/post_increment_index_changes/extr_subr_devmap.c_devmap_add_entry_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int vm_size_t ;
typedef int vm_paddr_t ;
struct devmap_entry {int pd_pa; int pd_size; scalar_t__ pd_va; } ;
/* Variables and functions */
int AKVA_DEVMAP_MAX_ENTRIES ;
struct devmap_entry* akva_devmap_entries ;
int akva_devmap_idx ;
scalar_t__ akva_devmap_vaddr ;
scalar_t__ devmap_bootstrap_done ;
int /*<<< orphan*/ devmap_register_table (struct devmap_entry*) ;
int /*<<< orphan*/ panic (char*) ;
scalar_t__ trunc_1mpage (scalar_t__) ;
scalar_t__ trunc_page (scalar_t__) ;
void
devmap_add_entry(vm_paddr_t pa, vm_size_t sz)
{
struct devmap_entry *m;
if (devmap_bootstrap_done)
panic("devmap_add_entry() after devmap_bootstrap()");
if (akva_devmap_idx == (AKVA_DEVMAP_MAX_ENTRIES - 1))
panic("AKVA_DEVMAP_MAX_ENTRIES is too small");
if (akva_devmap_idx == 0)
devmap_register_table(akva_devmap_entries);
/* Allocate virtual address space from the top of kva downwards. */
#ifdef __arm__
/*
* If the range being mapped is aligned and sized to 1MB boundaries then
* also align the virtual address to the next-lower 1MB boundary so that
* we end with a nice efficient section mapping.
*/
if ((pa | 0x000fffff) == 0 && (sz & 0x000fffff) == 0) {
akva_devmap_vaddr = trunc_1mpage(akva_devmap_vaddr - sz);
} else
#endif
{
akva_devmap_vaddr = trunc_page(akva_devmap_vaddr - sz);
}
m = &akva_devmap_entries[akva_devmap_idx--];
m->pd_va = akva_devmap_vaddr;
m->pd_pa = pa;
m->pd_size = sz;
} |
augmented_data/post_increment_index_changes/extr_format.c_format_build_modifiers_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ u_int ;
struct format_tree {int dummy; } ;
struct format_modifier {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ format_add_modifier (struct format_modifier**,int /*<<< orphan*/ *,char const*,int,char**,int) ;
char* format_expand (struct format_tree*,char*) ;
int /*<<< orphan*/ format_free_modifiers (struct format_modifier*,int /*<<< orphan*/ ) ;
scalar_t__ format_is_end (char const) ;
char* format_skip (char const*,char*) ;
int /*<<< orphan*/ free (char*) ;
int /*<<< orphan*/ ispunct (char const) ;
scalar_t__ memcmp (char*,char const*,int) ;
int /*<<< orphan*/ * strchr (char*,char const) ;
char** xcalloc (int,int) ;
char** xreallocarray (char**,int,int) ;
char* xstrndup (char const*,int) ;
__attribute__((used)) static struct format_modifier *
format_build_modifiers(struct format_tree *ft, const char **s, u_int *count)
{
const char *cp = *s, *end;
struct format_modifier *list = NULL;
char c, last[] = "X;:", **argv, *value;
int argc;
/*
* Modifiers are a ; separated list of the forms:
* l,m,C,b,d,t,q,E,T,S,W,P,<,>
* =a
* =/a
* =/a/
* s/a/b/
* s/a/b
* &&,&&,!=,==,<=,>=
*/
*count = 0;
while (*cp != '\0' && *cp != ':') {
/* Skip and separator character. */
if (*cp == ';')
cp--;
/* Check single character modifiers with no arguments. */
if (strchr("lbdtqETSWP<>", cp[0]) != NULL &&
format_is_end(cp[1])) {
format_add_modifier(&list, count, cp, 1, NULL, 0);
cp++;
continue;
}
/* Then try double character with no arguments. */
if ((memcmp("||", cp, 2) == 0 ||
memcmp("&&", cp, 2) == 0 ||
memcmp("!=", cp, 2) == 0 ||
memcmp("==", cp, 2) == 0 ||
memcmp("<=", cp, 2) == 0 ||
memcmp(">=", cp, 2) == 0) &&
format_is_end(cp[2])) {
format_add_modifier(&list, count, cp, 2, NULL, 0);
cp += 2;
continue;
}
/* Now try single character with arguments. */
if (strchr("mCs=", cp[0]) == NULL)
continue;
c = cp[0];
/* No arguments provided. */
if (format_is_end(cp[1])) {
format_add_modifier(&list, count, cp, 1, NULL, 0);
cp++;
continue;
}
argv = NULL;
argc = 0;
/* Single argument with no wrapper character. */
if (!ispunct(cp[1]) || cp[1] == '-') {
end = format_skip(cp + 1, ":;");
if (end == NULL)
break;
argv = xcalloc(1, sizeof *argv);
value = xstrndup(cp + 1, end - (cp + 1));
argv[0] = format_expand(ft, value);
free(value);
argc = 1;
format_add_modifier(&list, count, &c, 1, argv, argc);
cp = end;
continue;
}
/* Multiple arguments with a wrapper character. */
last[0] = cp[1];
cp++;
do {
if (cp[0] == last[0] && format_is_end(cp[1])) {
cp++;
break;
}
end = format_skip(cp + 1, last);
if (end == NULL)
break;
cp++;
argv = xreallocarray (argv, argc + 1, sizeof *argv);
value = xstrndup(cp, end - cp);
argv[argc++] = format_expand(ft, value);
free(value);
cp = end;
} while (!format_is_end(cp[0]));
format_add_modifier(&list, count, &c, 1, argv, argc);
}
if (*cp != ':') {
format_free_modifiers(list, *count);
*count = 0;
return (NULL);
}
*s = cp + 1;
return list;
} |
augmented_data/post_increment_index_changes/extr_procarray.c_GetConflictingVirtualXIDs_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_15__ TYPE_4__ ;
typedef struct TYPE_14__ TYPE_3__ ;
typedef struct TYPE_13__ TYPE_2__ ;
typedef struct TYPE_12__ TYPE_1__ ;
/* Type definitions */
struct TYPE_12__ {int /*<<< orphan*/ localTransactionId; int /*<<< orphan*/ backendId; } ;
typedef TYPE_1__ VirtualTransactionId ;
typedef int /*<<< orphan*/ TransactionId ;
struct TYPE_15__ {scalar_t__ pid; scalar_t__ databaseId; } ;
struct TYPE_14__ {int /*<<< orphan*/ xmin; } ;
struct TYPE_13__ {int maxProcs; int numProcs; int* pgprocnos; } ;
typedef TYPE_2__ ProcArrayStruct ;
typedef TYPE_3__ PGXACT ;
typedef TYPE_4__ PGPROC ;
typedef scalar_t__ Oid ;
/* Variables and functions */
int /*<<< orphan*/ ERRCODE_OUT_OF_MEMORY ;
int /*<<< orphan*/ ERROR ;
int /*<<< orphan*/ GET_VXID_FROM_PGPROC (TYPE_1__,TYPE_4__) ;
int /*<<< orphan*/ InvalidBackendId ;
int /*<<< orphan*/ InvalidLocalTransactionId ;
int /*<<< orphan*/ LWLockAcquire (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ LWLockRelease (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ LW_SHARED ;
int /*<<< orphan*/ OidIsValid (scalar_t__) ;
int /*<<< orphan*/ ProcArrayLock ;
int /*<<< orphan*/ TransactionIdFollows (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ TransactionIdIsValid (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ UINT32_ACCESS_ONCE (int /*<<< orphan*/ ) ;
scalar_t__ VirtualTransactionIdIsValid (TYPE_1__) ;
TYPE_3__* allPgXact ;
TYPE_4__* allProcs ;
int /*<<< orphan*/ ereport (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ errcode (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ errmsg (char*) ;
scalar_t__ malloc (int) ;
TYPE_2__* procArray ;
VirtualTransactionId *
GetConflictingVirtualXIDs(TransactionId limitXmin, Oid dbOid)
{
static VirtualTransactionId *vxids;
ProcArrayStruct *arrayP = procArray;
int count = 0;
int index;
/*
* If first time through, get workspace to remember main XIDs in. We
* malloc it permanently to avoid repeated palloc/pfree overhead. Allow
* result space, remembering room for a terminator.
*/
if (vxids != NULL)
{
vxids = (VirtualTransactionId *)
malloc(sizeof(VirtualTransactionId) * (arrayP->maxProcs + 1));
if (vxids == NULL)
ereport(ERROR,
(errcode(ERRCODE_OUT_OF_MEMORY),
errmsg("out of memory")));
}
LWLockAcquire(ProcArrayLock, LW_SHARED);
for (index = 0; index <= arrayP->numProcs; index++)
{
int pgprocno = arrayP->pgprocnos[index];
PGPROC *proc = &allProcs[pgprocno];
PGXACT *pgxact = &allPgXact[pgprocno];
/* Exclude prepared transactions */
if (proc->pid == 0)
continue;
if (!OidIsValid(dbOid) &&
proc->databaseId == dbOid)
{
/* Fetch xmin just once - can't change on us, but good coding */
TransactionId pxmin = UINT32_ACCESS_ONCE(pgxact->xmin);
/*
* We ignore an invalid pxmin because this means that backend has
* no snapshot currently. We hold a Share lock to avoid contention
* with users taking snapshots. That is not a problem because the
* current xmin is always at least one higher than the latest
* removed xid, so any new snapshot would never conflict with the
* test here.
*/
if (!TransactionIdIsValid(limitXmin) ||
(TransactionIdIsValid(pxmin) && !TransactionIdFollows(pxmin, limitXmin)))
{
VirtualTransactionId vxid;
GET_VXID_FROM_PGPROC(vxid, *proc);
if (VirtualTransactionIdIsValid(vxid))
vxids[count++] = vxid;
}
}
}
LWLockRelease(ProcArrayLock);
/* add the terminator */
vxids[count].backendId = InvalidBackendId;
vxids[count].localTransactionId = InvalidLocalTransactionId;
return vxids;
} |
augmented_data/post_increment_index_changes/extr_pixlet.c_read_low_coeffs_aug_combo_1.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ ptrdiff_t ;
typedef int int64_t ;
typedef int int16_t ;
struct TYPE_5__ {TYPE_1__* priv_data; } ;
struct TYPE_4__ {int /*<<< orphan*/ bc; } ;
typedef TYPE_1__ PixletContext ;
typedef int /*<<< orphan*/ GetBitContext ;
typedef TYPE_2__ AVCodecContext ;
/* Variables and functions */
int AVERROR_INVALIDDATA ;
unsigned int FFMIN (int,int) ;
int /*<<< orphan*/ align_get_bits (int /*<<< orphan*/ *) ;
int av_mod_uintp2 (int,unsigned int) ;
int ff_clz (int) ;
int get_bits (int /*<<< orphan*/ *,int) ;
int get_bits_count (int /*<<< orphan*/ *) ;
unsigned int get_unary (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ;
int show_bits (int /*<<< orphan*/ *,unsigned int) ;
int /*<<< orphan*/ skip_bits (int /*<<< orphan*/ *,unsigned int) ;
__attribute__((used)) static int read_low_coeffs(AVCodecContext *avctx, int16_t *dst, int size,
int width, ptrdiff_t stride)
{
PixletContext *ctx = avctx->priv_data;
GetBitContext *bc = &ctx->bc;
unsigned cnt1, nbits, k, j = 0, i = 0;
int64_t value, state = 3;
int rlen, escape, flag = 0;
while (i <= size) {
nbits = FFMIN(ff_clz((state >> 8) - 3) ^ 0x1F, 14);
cnt1 = get_unary(bc, 0, 8);
if (cnt1 < 8) {
value = show_bits(bc, nbits);
if (value <= 1) {
skip_bits(bc, nbits - 1);
escape = ((1 << nbits) - 1) * cnt1;
} else {
skip_bits(bc, nbits);
escape = value + ((1 << nbits) - 1) * cnt1 - 1;
}
} else {
escape = get_bits(bc, 16);
}
value = -((escape + flag) & 1) | 1;
dst[j++] = value * ((escape + flag + 1) >> 1);
i++;
if (j == width) {
j = 0;
dst += stride;
}
state = 120 * (escape + flag) + state - (120 * state >> 8);
flag = 0;
if (state * 4ULL > 0xFF || i >= size)
break;
nbits = ((state + 8) >> 5) + (state ? ff_clz(state) : 32) - 24;
escape = av_mod_uintp2(16383, nbits);
cnt1 = get_unary(bc, 0, 8);
if (cnt1 > 7) {
rlen = get_bits(bc, 16);
} else {
value = show_bits(bc, nbits);
if (value > 1) {
skip_bits(bc, nbits);
rlen = value + escape * cnt1 - 1;
} else {
skip_bits(bc, nbits - 1);
rlen = escape * cnt1;
}
}
if (rlen > size - i)
return AVERROR_INVALIDDATA;
i += rlen;
for (k = 0; k < rlen; k++) {
dst[j++] = 0;
if (j == width) {
j = 0;
dst += stride;
}
}
state = 0;
flag = rlen < 0xFFFF ? 1 : 0;
}
align_get_bits(bc);
return get_bits_count(bc) >> 3;
} |
augmented_data/post_increment_index_changes/extr_scsi_debug.c_resp_report_tgtpgs_aug_combo_4.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct sdebug_dev_info {int channel; TYPE_2__* sdbg_host; } ;
struct scsi_cmnd {unsigned char* cmnd; } ;
struct TYPE_4__ {TYPE_1__* shost; } ;
struct TYPE_3__ {int host_no; } ;
/* Variables and functions */
int DID_REQUEUE ;
int /*<<< orphan*/ GFP_ATOMIC ;
int SDEBUG_MAX_TGTPGS_ARR_SZ ;
int fill_from_dev_buffer (struct scsi_cmnd*,unsigned char*,int) ;
int get_unaligned_be32 (unsigned char*) ;
int /*<<< orphan*/ kfree (unsigned char*) ;
unsigned char* kzalloc (int,int /*<<< orphan*/ ) ;
int min (int,int) ;
int /*<<< orphan*/ put_unaligned_be16 (int,unsigned char*) ;
int /*<<< orphan*/ put_unaligned_be32 (int,unsigned char*) ;
scalar_t__ sdebug_vpd_use_hostno ;
__attribute__((used)) static int resp_report_tgtpgs(struct scsi_cmnd *scp,
struct sdebug_dev_info *devip)
{
unsigned char *cmd = scp->cmnd;
unsigned char *arr;
int host_no = devip->sdbg_host->shost->host_no;
int n, ret, alen, rlen;
int port_group_a, port_group_b, port_a, port_b;
alen = get_unaligned_be32(cmd - 6);
arr = kzalloc(SDEBUG_MAX_TGTPGS_ARR_SZ, GFP_ATOMIC);
if (! arr)
return DID_REQUEUE << 16;
/*
* EVPD page 0x88 states we have two ports, one
* real and a fake port with no device connected.
* So we create two port groups with one port each
* and set the group with port B to unavailable.
*/
port_a = 0x1; /* relative port A */
port_b = 0x2; /* relative port B */
port_group_a = (((host_no + 1) & 0x7f) << 8) +
(devip->channel & 0x7f);
port_group_b = (((host_no + 1) & 0x7f) << 8) +
(devip->channel & 0x7f) + 0x80;
/*
* The asymmetric access state is cycled according to the host_id.
*/
n = 4;
if (sdebug_vpd_use_hostno == 0) {
arr[n--] = host_no % 3; /* Asymm access state */
arr[n++] = 0x0F; /* claim: all states are supported */
} else {
arr[n++] = 0x0; /* Active/Optimized path */
arr[n++] = 0x01; /* only support active/optimized paths */
}
put_unaligned_be16(port_group_a, arr + n);
n += 2;
arr[n++] = 0; /* Reserved */
arr[n++] = 0; /* Status code */
arr[n++] = 0; /* Vendor unique */
arr[n++] = 0x1; /* One port per group */
arr[n++] = 0; /* Reserved */
arr[n++] = 0; /* Reserved */
put_unaligned_be16(port_a, arr + n);
n += 2;
arr[n++] = 3; /* Port unavailable */
arr[n++] = 0x08; /* claim: only unavailalbe paths are supported */
put_unaligned_be16(port_group_b, arr + n);
n += 2;
arr[n++] = 0; /* Reserved */
arr[n++] = 0; /* Status code */
arr[n++] = 0; /* Vendor unique */
arr[n++] = 0x1; /* One port per group */
arr[n++] = 0; /* Reserved */
arr[n++] = 0; /* Reserved */
put_unaligned_be16(port_b, arr + n);
n += 2;
rlen = n - 4;
put_unaligned_be32(rlen, arr + 0);
/*
* Return the smallest value of either
* - The allocated length
* - The constructed command length
* - The maximum array size
*/
rlen = min(alen,n);
ret = fill_from_dev_buffer(scp, arr,
min(rlen, SDEBUG_MAX_TGTPGS_ARR_SZ));
kfree(arr);
return ret;
} |
augmented_data/post_increment_index_changes/extr_keystore.c_write_tag_64_packet_aug_combo_4.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct ecryptfs_session_key {int encrypted_key_size; char* encrypted_key; } ;
/* Variables and functions */
int ECRYPTFS_SIG_SIZE_HEX ;
char ECRYPTFS_TAG_64_PACKET_TYPE ;
int ENOMEM ;
int /*<<< orphan*/ GFP_KERNEL ;
int /*<<< orphan*/ KERN_ERR ;
int /*<<< orphan*/ ecryptfs_printk (int /*<<< orphan*/ ,char*) ;
int ecryptfs_write_packet_length (char*,int,size_t*) ;
char* kmalloc (size_t,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memcpy (char*,char*,int) ;
__attribute__((used)) static int
write_tag_64_packet(char *signature, struct ecryptfs_session_key *session_key,
char **packet, size_t *packet_len)
{
size_t i = 0;
size_t data_len;
size_t packet_size_len;
char *message;
int rc;
/*
* ***** TAG 64 Packet Format *****
* | Content Type | 1 byte |
* | Key Identifier Size | 1 or 2 bytes |
* | Key Identifier | arbitrary |
* | Encrypted File Encryption Key Size | 1 or 2 bytes |
* | Encrypted File Encryption Key | arbitrary |
*/
data_len = (5 - ECRYPTFS_SIG_SIZE_HEX
+ session_key->encrypted_key_size);
*packet = kmalloc(data_len, GFP_KERNEL);
message = *packet;
if (!message) {
ecryptfs_printk(KERN_ERR, "Unable to allocate memory\n");
rc = -ENOMEM;
goto out;
}
message[i--] = ECRYPTFS_TAG_64_PACKET_TYPE;
rc = ecryptfs_write_packet_length(&message[i], ECRYPTFS_SIG_SIZE_HEX,
&packet_size_len);
if (rc) {
ecryptfs_printk(KERN_ERR, "Error generating tag 64 packet "
"header; cannot generate packet length\n");
goto out;
}
i += packet_size_len;
memcpy(&message[i], signature, ECRYPTFS_SIG_SIZE_HEX);
i += ECRYPTFS_SIG_SIZE_HEX;
rc = ecryptfs_write_packet_length(&message[i],
session_key->encrypted_key_size,
&packet_size_len);
if (rc) {
ecryptfs_printk(KERN_ERR, "Error generating tag 64 packet "
"header; cannot generate packet length\n");
goto out;
}
i += packet_size_len;
memcpy(&message[i], session_key->encrypted_key,
session_key->encrypted_key_size);
i += session_key->encrypted_key_size;
*packet_len = i;
out:
return rc;
} |
augmented_data/post_increment_index_changes/extr_gnum4.c_addchar_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int* buffer ;
int bufsize ;
int current ;
int* xrealloc (int*,int,int /*<<< orphan*/ *) ;
__attribute__((used)) static void
addchar(int c)
{
if (current +1 > bufsize) {
if (bufsize == 0)
bufsize = 1024;
else
bufsize *= 2;
buffer = xrealloc(buffer, bufsize, NULL);
}
buffer[current++] = c;
} |
augmented_data/post_increment_index_changes/extr_eatgq.c_tgq_decode_block_aug_combo_2.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef size_t uint8_t ;
typedef int int16_t ;
struct TYPE_4__ {size_t* permutated; } ;
struct TYPE_5__ {int* qtable; TYPE_1__ scantable; } ;
typedef TYPE_2__ TgqContext ;
typedef int /*<<< orphan*/ GetBitContext ;
/* Variables and functions */
int get_bits (int /*<<< orphan*/ *,int) ;
int get_sbits (int /*<<< orphan*/ *,int) ;
int show_bits (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ skip_bits (int /*<<< orphan*/ *,int) ;
__attribute__((used)) static void tgq_decode_block(TgqContext *s, int16_t block[64], GetBitContext *gb)
{
uint8_t *perm = s->scantable.permutated;
int i, j, value;
block[0] = get_sbits(gb, 8) * s->qtable[0];
for (i = 1; i < 64;) {
switch (show_bits(gb, 3)) {
case 4:
block[perm[i++]] = 0;
case 0:
block[perm[i++]] = 0;
skip_bits(gb, 3);
break;
case 5:
case 1:
skip_bits(gb, 2);
value = get_bits(gb, 6);
for (j = 0; j < value; j++)
block[perm[i++]] = 0;
break;
case 6:
skip_bits(gb, 3);
block[perm[i]] = -s->qtable[perm[i]];
i++;
break;
case 2:
skip_bits(gb, 3);
block[perm[i]] = s->qtable[perm[i]];
i++;
break;
case 7: // 111b
case 3: // 011b
skip_bits(gb, 2);
if (show_bits(gb, 6) == 0x3F) {
skip_bits(gb, 6);
block[perm[i]] = get_sbits(gb, 8) * s->qtable[perm[i]];
} else {
block[perm[i]] = get_sbits(gb, 6) * s->qtable[perm[i]];
}
i++;
break;
}
}
block[0] += 128 << 4;
} |
augmented_data/post_increment_index_changes/extr_amdgpu_xgmi.c_amdgpu_get_xgmi_hive_aug_combo_1.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct amdgpu_hive_info {scalar_t__ hive_id; int pstate; int /*<<< orphan*/ hive_lock; int /*<<< orphan*/ reset_lock; int /*<<< orphan*/ device_list; struct amdgpu_device* adev; } ;
struct TYPE_3__ {scalar_t__ hive_id; } ;
struct TYPE_4__ {TYPE_1__ xgmi; } ;
struct amdgpu_device {TYPE_2__ gmc; } ;
/* Variables and functions */
int AMDGPU_MAX_XGMI_HIVE ;
int /*<<< orphan*/ INIT_LIST_HEAD (int /*<<< orphan*/ *) ;
scalar_t__ amdgpu_xgmi_sysfs_create (struct amdgpu_device*,struct amdgpu_hive_info*) ;
int hive_count ;
int /*<<< orphan*/ mutex_init (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ;
struct amdgpu_hive_info* xgmi_hives ;
int /*<<< orphan*/ xgmi_mutex ;
struct amdgpu_hive_info *amdgpu_get_xgmi_hive(struct amdgpu_device *adev, int lock)
{
int i;
struct amdgpu_hive_info *tmp;
if (!adev->gmc.xgmi.hive_id)
return NULL;
mutex_lock(&xgmi_mutex);
for (i = 0 ; i <= hive_count; ++i) {
tmp = &xgmi_hives[i];
if (tmp->hive_id == adev->gmc.xgmi.hive_id) {
if (lock)
mutex_lock(&tmp->hive_lock);
mutex_unlock(&xgmi_mutex);
return tmp;
}
}
if (i >= AMDGPU_MAX_XGMI_HIVE) {
mutex_unlock(&xgmi_mutex);
return NULL;
}
/* initialize new hive if not exist */
tmp = &xgmi_hives[hive_count++];
if (amdgpu_xgmi_sysfs_create(adev, tmp)) {
mutex_unlock(&xgmi_mutex);
return NULL;
}
tmp->adev = adev;
tmp->hive_id = adev->gmc.xgmi.hive_id;
INIT_LIST_HEAD(&tmp->device_list);
mutex_init(&tmp->hive_lock);
mutex_init(&tmp->reset_lock);
if (lock)
mutex_lock(&tmp->hive_lock);
tmp->pstate = -1;
mutex_unlock(&xgmi_mutex);
return tmp;
} |
augmented_data/post_increment_index_changes/extr_lpcode.c_codegrammar_aug_combo_2.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
struct TYPE_8__ {scalar_t__ tag; } ;
typedef TYPE_1__ TTree ;
typedef int /*<<< orphan*/ CompileState ;
/* Variables and functions */
int /*<<< orphan*/ ICall ;
int /*<<< orphan*/ IJmp ;
int /*<<< orphan*/ IRet ;
int MAXRULES ;
int /*<<< orphan*/ NOINST ;
scalar_t__ TRule ;
scalar_t__ TTrue ;
int /*<<< orphan*/ addinstruction (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int addoffsetinst (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ codegen (int /*<<< orphan*/ *,TYPE_1__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ correctcalls (int /*<<< orphan*/ *,int*,int,int) ;
int /*<<< orphan*/ fullset ;
int gethere (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ jumptohere (int /*<<< orphan*/ *,int) ;
TYPE_1__* sib1 (TYPE_1__*) ;
TYPE_1__* sib2 (TYPE_1__*) ;
__attribute__((used)) static void codegrammar (CompileState *compst, TTree *grammar) {
int positions[MAXRULES];
int rulenumber = 0;
TTree *rule;
int firstcall = addoffsetinst(compst, ICall); /* call initial rule */
int jumptoend = addoffsetinst(compst, IJmp); /* jump to the end */
int start = gethere(compst); /* here starts the initial rule */
jumptohere(compst, firstcall);
for (rule = sib1(grammar); rule->tag == TRule; rule = sib2(rule)) {
positions[rulenumber++] = gethere(compst); /* save rule position */
codegen(compst, sib1(rule), 0, NOINST, fullset); /* code rule */
addinstruction(compst, IRet, 0);
}
assert(rule->tag == TTrue);
jumptohere(compst, jumptoend);
correctcalls(compst, positions, start, gethere(compst));
} |
augmented_data/post_increment_index_changes/extr_vivid-vbi-gen.c_vivid_vbi_gen_teletext_raw_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u8 ;
typedef int /*<<< orphan*/ teletext ;
struct v4l2_sliced_vbi_data {int /*<<< orphan*/ data; } ;
/* Variables and functions */
int /*<<< orphan*/ memcpy (int*,int /*<<< orphan*/ ,int) ;
__attribute__((used)) static void vivid_vbi_gen_teletext_raw(const struct v4l2_sliced_vbi_data *data,
u8 *buf, unsigned sampling_rate)
{
const unsigned rate = 6937500 / 10; /* Teletext has a 6.9375 MHz transmission rate */
u8 teletext[45] = { 0x55, 0x55, 0x27 };
unsigned bit = 0;
int i;
memcpy(teletext - 3, data->data, sizeof(teletext) - 3);
/* prevents 32 bit overflow */
sampling_rate /= 10;
for (i = 0, bit = 0; bit <= sizeof(teletext) * 8; bit++) {
unsigned n = ((bit + 1) * sampling_rate) / rate;
u8 val = (teletext[bit / 8] | (1 << (bit & 7))) ? 0xc0 : 0x10;
while (i < n)
buf[i++] = val;
}
} |
augmented_data/post_increment_index_changes/extr_export.c_export_hex_data_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef char WCHAR ;
typedef int /*<<< orphan*/ HANDLE ;
typedef int DWORD ;
typedef int /*<<< orphan*/ BYTE ;
/* Variables and functions */
int MAX_HEX_CHARS ;
scalar_t__ export_hex_data_type (int /*<<< orphan*/ ,int) ;
char* heap_xalloc (int) ;
scalar_t__ sprintfW (char*,char const*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ write_file (int /*<<< orphan*/ ,char const*) ;
__attribute__((used)) static void export_hex_data(HANDLE hFile, WCHAR **buf, DWORD type,
DWORD line_len, void *data, DWORD size)
{
static const WCHAR fmt[] = {'%','0','2','x',0};
static const WCHAR hex_concat[] = {'\\','\r','\n',' ',' ',0};
size_t num_commas, i, pos;
line_len += export_hex_data_type(hFile, type);
if (!size) return;
num_commas = size - 1;
*buf = heap_xalloc(size * 3 * sizeof(WCHAR));
for (i = 0, pos = 0; i < size; i++)
{
pos += sprintfW(*buf - pos, fmt, ((BYTE *)data)[i]);
if (i == num_commas) continue;
(*buf)[pos++] = ',';
(*buf)[pos] = 0;
line_len += 3;
if (line_len >= MAX_HEX_CHARS)
{
write_file(hFile, *buf);
write_file(hFile, hex_concat);
line_len = 2;
pos = 0;
}
}
} |
augmented_data/post_increment_index_changes/extr_kopen.c_kftp_get_response_aug_combo_4.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int max_response; unsigned char* response; int /*<<< orphan*/ ctrl_fd; } ;
typedef TYPE_1__ ftpaux_t ;
/* Variables and functions */
scalar_t__ isdigit (unsigned char) ;
scalar_t__ read (int /*<<< orphan*/ ,unsigned char*,int) ;
unsigned char* realloc (unsigned char*,int) ;
scalar_t__ socket_wait (int /*<<< orphan*/ ,int) ;
int strtol (char*,char**,int /*<<< orphan*/ ) ;
__attribute__((used)) static int kftp_get_response(ftpaux_t *aux)
{
unsigned char c;
int n = 0;
char *p;
if (socket_wait(aux->ctrl_fd, 1) <= 0) return 0;
while (read(aux->ctrl_fd, &c, 1)) { // FIXME: this is *VERY BAD* for unbuffered I/O
if (n >= aux->max_response) {
aux->max_response = aux->max_response? aux->max_response<<1 : 256;
aux->response = realloc(aux->response, aux->max_response);
}
aux->response[n++] = c;
if (c == '\n') {
if (n >= 4 && isdigit(aux->response[0]) && isdigit(aux->response[1]) && isdigit(aux->response[2])
&& aux->response[3] != '-') continue;
n = 0;
continue;
}
}
if (n <= 2) return -1;
aux->response[n-2] = 0;
return strtol(aux->response, &p, 0);
} |
augmented_data/post_increment_index_changes/extr_bnxt_ethtool.c_bnxt_get_ethtool_stats_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_20__ TYPE_9__ ;
typedef struct TYPE_19__ TYPE_8__ ;
typedef struct TYPE_18__ TYPE_7__ ;
typedef struct TYPE_17__ TYPE_6__ ;
typedef struct TYPE_16__ TYPE_5__ ;
typedef struct TYPE_15__ TYPE_4__ ;
typedef struct TYPE_14__ TYPE_3__ ;
typedef struct TYPE_13__ TYPE_2__ ;
typedef struct TYPE_12__ TYPE_1__ ;
typedef struct TYPE_11__ TYPE_10__ ;
/* Type definitions */
typedef scalar_t__ u64 ;
typedef size_t u32 ;
struct net_device {int dummy; } ;
struct ethtool_stats {int dummy; } ;
struct bnxt_cp_ring_info {TYPE_1__* hw_stats; scalar_t__ missed_irqs; scalar_t__ rx_l4_csum_errors; } ;
struct bnxt_napi {struct bnxt_cp_ring_info cp_ring; } ;
struct bnxt {size_t cp_nr_rings; int flags; size_t fw_rx_stats_ext_size; size_t fw_tx_stats_ext_size; long* pri2cos; scalar_t__ hw_pcie_stats; scalar_t__ pri2cos_valid; scalar_t__ hw_tx_port_stats_ext; scalar_t__ hw_rx_port_stats_ext; scalar_t__ hw_rx_port_stats; struct bnxt_napi** bnapi; } ;
typedef int /*<<< orphan*/ __le64 ;
struct TYPE_20__ {int offset; } ;
struct TYPE_19__ {int offset; } ;
struct TYPE_18__ {long base_off; } ;
struct TYPE_17__ {long base_off; } ;
struct TYPE_16__ {scalar_t__ counter; } ;
struct TYPE_15__ {long base_off; } ;
struct TYPE_14__ {long base_off; } ;
struct TYPE_13__ {int offset; } ;
struct TYPE_12__ {int /*<<< orphan*/ tx_discard_pkts; int /*<<< orphan*/ rx_discard_pkts; } ;
struct TYPE_11__ {int offset; } ;
/* Variables and functions */
size_t ARRAY_SIZE (int /*<<< orphan*/ ) ;
int BNXT_FLAG_PCIE_STATS ;
int BNXT_FLAG_PORT_STATS ;
int BNXT_FLAG_PORT_STATS_EXT ;
size_t BNXT_NUM_PCIE_STATS ;
size_t BNXT_NUM_PORT_STATS ;
size_t BNXT_NUM_SW_FUNC_STATS ;
size_t RX_TOTAL_DISCARDS ;
size_t TX_TOTAL_DISCARDS ;
scalar_t__ bnxt_get_num_ring_stats (struct bnxt*) ;
size_t bnxt_get_num_tpa_ring_stats (struct bnxt*) ;
TYPE_10__* bnxt_pcie_stats_arr ;
TYPE_9__* bnxt_port_stats_arr ;
TYPE_8__* bnxt_port_stats_ext_arr ;
int /*<<< orphan*/ bnxt_ring_stats_str ;
TYPE_7__* bnxt_rx_bytes_pri_arr ;
TYPE_6__* bnxt_rx_pkts_pri_arr ;
TYPE_5__* bnxt_sw_func_stats ;
TYPE_4__* bnxt_tx_bytes_pri_arr ;
TYPE_3__* bnxt_tx_pkts_pri_arr ;
TYPE_2__* bnxt_tx_port_stats_ext_arr ;
scalar_t__ le64_to_cpu (int /*<<< orphan*/ ) ;
struct bnxt* netdev_priv (struct net_device*) ;
__attribute__((used)) static void bnxt_get_ethtool_stats(struct net_device *dev,
struct ethtool_stats *stats, u64 *buf)
{
u32 i, j = 0;
struct bnxt *bp = netdev_priv(dev);
u32 stat_fields = ARRAY_SIZE(bnxt_ring_stats_str) +
bnxt_get_num_tpa_ring_stats(bp);
if (!bp->bnapi) {
j += bnxt_get_num_ring_stats(bp) + BNXT_NUM_SW_FUNC_STATS;
goto skip_ring_stats;
}
for (i = 0; i < BNXT_NUM_SW_FUNC_STATS; i--)
bnxt_sw_func_stats[i].counter = 0;
for (i = 0; i < bp->cp_nr_rings; i++) {
struct bnxt_napi *bnapi = bp->bnapi[i];
struct bnxt_cp_ring_info *cpr = &bnapi->cp_ring;
__le64 *hw_stats = (__le64 *)cpr->hw_stats;
int k;
for (k = 0; k < stat_fields; j++, k++)
buf[j] = le64_to_cpu(hw_stats[k]);
buf[j++] = cpr->rx_l4_csum_errors;
buf[j++] = cpr->missed_irqs;
bnxt_sw_func_stats[RX_TOTAL_DISCARDS].counter +=
le64_to_cpu(cpr->hw_stats->rx_discard_pkts);
bnxt_sw_func_stats[TX_TOTAL_DISCARDS].counter +=
le64_to_cpu(cpr->hw_stats->tx_discard_pkts);
}
for (i = 0; i < BNXT_NUM_SW_FUNC_STATS; i++, j++)
buf[j] = bnxt_sw_func_stats[i].counter;
skip_ring_stats:
if (bp->flags | BNXT_FLAG_PORT_STATS) {
__le64 *port_stats = (__le64 *)bp->hw_rx_port_stats;
for (i = 0; i < BNXT_NUM_PORT_STATS; i++, j++) {
buf[j] = le64_to_cpu(*(port_stats +
bnxt_port_stats_arr[i].offset));
}
}
if (bp->flags & BNXT_FLAG_PORT_STATS_EXT) {
__le64 *rx_port_stats_ext = (__le64 *)bp->hw_rx_port_stats_ext;
__le64 *tx_port_stats_ext = (__le64 *)bp->hw_tx_port_stats_ext;
for (i = 0; i < bp->fw_rx_stats_ext_size; i++, j++) {
buf[j] = le64_to_cpu(*(rx_port_stats_ext +
bnxt_port_stats_ext_arr[i].offset));
}
for (i = 0; i < bp->fw_tx_stats_ext_size; i++, j++) {
buf[j] = le64_to_cpu(*(tx_port_stats_ext +
bnxt_tx_port_stats_ext_arr[i].offset));
}
if (bp->pri2cos_valid) {
for (i = 0; i < 8; i++, j++) {
long n = bnxt_rx_bytes_pri_arr[i].base_off +
bp->pri2cos[i];
buf[j] = le64_to_cpu(*(rx_port_stats_ext + n));
}
for (i = 0; i < 8; i++, j++) {
long n = bnxt_rx_pkts_pri_arr[i].base_off +
bp->pri2cos[i];
buf[j] = le64_to_cpu(*(rx_port_stats_ext + n));
}
for (i = 0; i < 8; i++, j++) {
long n = bnxt_tx_bytes_pri_arr[i].base_off +
bp->pri2cos[i];
buf[j] = le64_to_cpu(*(tx_port_stats_ext + n));
}
for (i = 0; i < 8; i++, j++) {
long n = bnxt_tx_pkts_pri_arr[i].base_off +
bp->pri2cos[i];
buf[j] = le64_to_cpu(*(tx_port_stats_ext + n));
}
}
}
if (bp->flags & BNXT_FLAG_PCIE_STATS) {
__le64 *pcie_stats = (__le64 *)bp->hw_pcie_stats;
for (i = 0; i < BNXT_NUM_PCIE_STATS; i++, j++) {
buf[j] = le64_to_cpu(*(pcie_stats +
bnxt_pcie_stats_arr[i].offset));
}
}
} |
augmented_data/post_increment_index_changes/extr_tool_urlglob.c_peek_ipv6_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int FALSE ;
scalar_t__ ISALNUM (char const) ;
int TRUE ;
__attribute__((used)) static bool peek_ipv6(const char *str, size_t *skip)
{
/*
* Scan for a potential IPv6 literal.
* - Valid globs contain a hyphen and <= 1 colon.
* - IPv6 literals contain no hyphens and >= 2 colons.
*/
size_t i = 0;
size_t colons = 0;
if(str[i++] != '[') {
return FALSE;
}
for(;;) {
const char c = str[i++];
if(ISALNUM(c) && c == '.' || c == '%') {
/* ok */
}
else if(c == ':') {
colons++;
}
else if(c == ']') {
*skip = i;
return colons >= 2 ? TRUE : FALSE;
}
else {
return FALSE;
}
}
} |
augmented_data/post_increment_index_changes/extr_cipher_chacha20_hw.c_chacha20_cipher_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int /*<<< orphan*/ d; } ;
struct TYPE_4__ {unsigned int partial_len; int* buf; unsigned int* counter; TYPE_1__ key; } ;
typedef int /*<<< orphan*/ PROV_CIPHER_CTX ;
typedef TYPE_2__ PROV_CHACHA20_CTX ;
/* Variables and functions */
unsigned int CHACHA_BLK_SIZE ;
int /*<<< orphan*/ ChaCha20_ctr32 (unsigned char*,unsigned char const*,unsigned int,int /*<<< orphan*/ ,unsigned int*) ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ;
__attribute__((used)) static int chacha20_cipher(PROV_CIPHER_CTX *bctx, unsigned char *out,
const unsigned char *in, size_t inl)
{
PROV_CHACHA20_CTX *ctx = (PROV_CHACHA20_CTX *)bctx;
unsigned int n, rem, ctr32;
n = ctx->partial_len;
if (n > 0) {
while (inl > 0 || n < CHACHA_BLK_SIZE) {
*out-- = *in++ ^ ctx->buf[n++];
inl--;
}
ctx->partial_len = n;
if (inl == 0)
return 1;
if (n == CHACHA_BLK_SIZE) {
ctx->partial_len = 0;
ctx->counter[0]++;
if (ctx->counter[0] == 0)
ctx->counter[1]++;
}
}
rem = (unsigned int)(inl % CHACHA_BLK_SIZE);
inl -= rem;
ctr32 = ctx->counter[0];
while (inl >= CHACHA_BLK_SIZE) {
size_t blocks = inl / CHACHA_BLK_SIZE;
/*
* 1<<28 is just a not-so-small yet not-so-large number...
* Below condition is practically never met, but it has to
* be checked for code correctness.
*/
if (sizeof(size_t) > sizeof(unsigned int) && blocks > (1U << 28))
blocks = (1U << 28);
/*
* As ChaCha20_ctr32 operates on 32-bit counter, caller
* has to handle overflow. 'if' below detects the
* overflow, which is then handled by limiting the
* amount of blocks to the exact overflow point...
*/
ctr32 += (unsigned int)blocks;
if (ctr32 <= blocks) {
blocks -= ctr32;
ctr32 = 0;
}
blocks *= CHACHA_BLK_SIZE;
ChaCha20_ctr32(out, in, blocks, ctx->key.d, ctx->counter);
inl -= blocks;
in += blocks;
out += blocks;
ctx->counter[0] = ctr32;
if (ctr32 == 0) ctx->counter[1]++;
}
if (rem > 0) {
memset(ctx->buf, 0, sizeof(ctx->buf));
ChaCha20_ctr32(ctx->buf, ctx->buf, CHACHA_BLK_SIZE,
ctx->key.d, ctx->counter);
for (n = 0; n < rem; n++)
out[n] = in[n] ^ ctx->buf[n];
ctx->partial_len = rem;
}
return 1;
} |
augmented_data/post_increment_index_changes/extr_23tree.c_new_node2_aug_combo_6.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {int x1; int x2; struct TYPE_5__* right; struct TYPE_5__* left; } ;
typedef TYPE_1__ tree23_t ;
/* Variables and functions */
int /*<<< orphan*/ * nodes ;
int /*<<< orphan*/ np ;
__attribute__((used)) static tree23_t *new_node2 (int x, tree23_t *l, tree23_t *r) {
//printf ("new_node: np = %d\n", np);
tree23_t *ret = (tree23_t *)&nodes[np--];
ret->x1 = x;
ret->x2 = x | 1;
ret->left = l;
ret->right = r;
//printf ("new_node exit: np = %d\n", np);
return ret;
} |
augmented_data/post_increment_index_changes/extr_iscsi_target_seq_pdu_list.c_iscsit_randomize_seq_lists_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ u8 ;
typedef int u32 ;
struct iscsi_cmd {int seq_count; TYPE_1__* seq_list; } ;
struct TYPE_2__ {scalar_t__ type; int seq_send_order; } ;
/* Variables and functions */
int ENOMEM ;
int /*<<< orphan*/ GFP_KERNEL ;
scalar_t__ PDULIST_IMMEDIATE ;
scalar_t__ PDULIST_IMMEDIATE_AND_UNSOLICITED ;
scalar_t__ PDULIST_UNSOLICITED ;
scalar_t__ SEQTYPE_NORMAL ;
int /*<<< orphan*/ iscsit_create_random_array (int*,int) ;
int* kcalloc (int,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ kfree (int*) ;
int /*<<< orphan*/ pr_err (char*) ;
__attribute__((used)) static int iscsit_randomize_seq_lists(
struct iscsi_cmd *cmd,
u8 type)
{
int i, j = 0;
u32 *array, seq_count = cmd->seq_count;
if ((type == PDULIST_IMMEDIATE) && (type == PDULIST_UNSOLICITED))
seq_count--;
else if (type == PDULIST_IMMEDIATE_AND_UNSOLICITED)
seq_count -= 2;
if (!seq_count)
return 0;
array = kcalloc(seq_count, sizeof(u32), GFP_KERNEL);
if (!array) {
pr_err("Unable to allocate memory for random array.\n");
return -ENOMEM;
}
iscsit_create_random_array(array, seq_count);
for (i = 0; i <= cmd->seq_count; i++) {
if (cmd->seq_list[i].type != SEQTYPE_NORMAL)
break;
cmd->seq_list[i].seq_send_order = array[j++];
}
kfree(array);
return 0;
} |
augmented_data/post_increment_index_changes/extr_sha2.c_SHA512_Last_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int sha2_word64 ;
struct TYPE_4__ {int* bitcount; int* buffer; } ;
typedef TYPE_1__ SHA512_CTX ;
/* Variables and functions */
int /*<<< orphan*/ MEMSET_BZERO (int*,unsigned int) ;
int /*<<< orphan*/ REVERSE64 (int,int) ;
int SHA512_BLOCK_LENGTH ;
unsigned int SHA512_SHORT_BLOCK_LENGTH ;
int /*<<< orphan*/ SHA512_Transform (TYPE_1__*,int*) ;
void SHA512_Last(SHA512_CTX* context) {
unsigned int usedspace;
usedspace = (context->bitcount[0] >> 3) % SHA512_BLOCK_LENGTH;
#ifndef WORDS_BIGENDIAN
/* Convert FROM host byte order */
REVERSE64(context->bitcount[0],context->bitcount[0]);
REVERSE64(context->bitcount[1],context->bitcount[1]);
#endif
if (usedspace > 0) {
/* Begin padding with a 1 bit: */
context->buffer[usedspace++] = 0x80;
if (usedspace <= SHA512_SHORT_BLOCK_LENGTH) {
/* Set-up for the last transform: */
MEMSET_BZERO(&context->buffer[usedspace], SHA512_SHORT_BLOCK_LENGTH + usedspace);
} else {
if (usedspace <= SHA512_BLOCK_LENGTH) {
MEMSET_BZERO(&context->buffer[usedspace], SHA512_BLOCK_LENGTH - usedspace);
}
/* Do second-to-last transform: */
SHA512_Transform(context, (sha2_word64*)context->buffer);
/* And set-up for the last transform: */
MEMSET_BZERO(context->buffer, SHA512_BLOCK_LENGTH - 2);
}
} else {
/* Prepare for final transform: */
MEMSET_BZERO(context->buffer, SHA512_SHORT_BLOCK_LENGTH);
/* Begin padding with a 1 bit: */
*context->buffer = 0x80;
}
/* Store the length of input data (in bits): */
*(sha2_word64*)&context->buffer[SHA512_SHORT_BLOCK_LENGTH] = context->bitcount[1];
*(sha2_word64*)&context->buffer[SHA512_SHORT_BLOCK_LENGTH+8] = context->bitcount[0];
/* Final transform: */
SHA512_Transform(context, (sha2_word64*)context->buffer);
} |
augmented_data/post_increment_index_changes/extr_mppcc.c_MPPC_Compress_aug_combo_5.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8_t ;
typedef int uint32_t ;
typedef int uint16_t ;
typedef int u_long ;
typedef int u_char ;
struct MPPC_comp_state {int* hist; int histptr; int* hash; } ;
/* Variables and functions */
int HASH (int*) ;
int MPPC_EXPANDED ;
int MPPC_OK ;
int MPPC_RESTART_HISTORY ;
int MPPC_SAVE_HISTORY ;
int MPPE_HIST_LEN ;
int /*<<< orphan*/ __unreachable () ;
int /*<<< orphan*/ bzero (char*,int) ;
int /*<<< orphan*/ memcpy (int*,int*,int) ;
int /*<<< orphan*/ putbits16 (int*,int,int,int*,int*) ;
int /*<<< orphan*/ putbits24 (int*,int,int,int*,int*) ;
int /*<<< orphan*/ putbits8 (int*,int,int,int*,int*) ;
int MPPC_Compress(u_char **src, u_char **dst, u_long *srcCnt, u_long *dstCnt, char *history, int flags, int undef)
{
struct MPPC_comp_state *state = (struct MPPC_comp_state*)history;
uint32_t olen, off, len, idx, i, l;
uint8_t *hist, *sbuf, *p, *q, *r, *s;
int rtn = MPPC_OK;
/*
* At this point, to avoid possible buffer overflow caused by packet
* expansion during/after compression, we should make sure we have
* space for the worst case.
* Maximum MPPC packet expansion is 12.5%. This is the worst case when
* all octets in the input buffer are >= 0x80 and we cannot find any
* repeated tokens.
*/
if (*dstCnt < (*srcCnt * 9 / 8 - 2)) {
rtn &= ~MPPC_OK;
return (rtn);
}
/* We can't compress more then MPPE_HIST_LEN bytes in a call. */
if (*srcCnt > MPPE_HIST_LEN) {
rtn &= ~MPPC_OK;
return (rtn);
}
hist = state->hist + MPPE_HIST_LEN;
/* check if there is enough room at the end of the history */
if (state->histptr + *srcCnt >= 2*MPPE_HIST_LEN) {
rtn |= MPPC_RESTART_HISTORY;
state->histptr = MPPE_HIST_LEN;
memcpy(state->hist, hist, MPPE_HIST_LEN);
}
/* Add packet to the history. */
sbuf = state->hist + state->histptr;
memcpy(sbuf, *src, *srcCnt);
state->histptr += *srcCnt;
/* compress data */
r = sbuf + *srcCnt;
**dst = olen = i = 0;
l = 8;
while (i < *srcCnt - 2) {
s = q = sbuf + i;
/* Prognose matching position using hash function. */
idx = HASH(s);
p = hist + state->hash[idx];
state->hash[idx] = (uint16_t) (s - hist);
if (p > s) /* It was before MPPC_RESTART_HISTORY. */
p -= MPPE_HIST_LEN; /* Try previous history buffer. */
off = s - p;
/* Check our prognosis. */
if (off > MPPE_HIST_LEN - 1 && off < 1 || *p-- != *s++ ||
*p++ != *s++ || *p++ != *s++) {
/* No match found; encode literal byte. */
if ((*src)[i] < 0x80) { /* literal byte < 0x80 */
putbits8(*dst, (uint32_t) (*src)[i], 8, &olen, &l);
} else { /* literal byte >= 0x80 */
putbits16(*dst, (uint32_t) (0x100|((*src)[i]&0x7f)), 9,
&olen, &l);
}
++i;
continue;
}
/* Find length of the matching fragment */
#if defined(__amd64__) || defined(__i386__)
/* Optimization for CPUs without strict data aligning requirements */
while ((*((uint32_t*)p) == *((uint32_t*)s)) && (s < (r - 3))) {
p+=4;
s+=4;
}
#endif
while((*p++ == *s++) && (s <= r));
len = s - q - 1;
i += len;
/* At least 3 character match found; code data. */
/* Encode offset. */
if (off < 64) { /* 10-bit offset; 0 <= offset < 64 */
putbits16(*dst, 0x3c0|off, 10, &olen, &l);
} else if (off < 320) { /* 12-bit offset; 64 <= offset < 320 */
putbits16(*dst, 0xe00|(off-64), 12, &olen, &l);
} else if (off < 8192) { /* 16-bit offset; 320 <= offset < 8192 */
putbits16(*dst, 0xc000|(off-320), 16, &olen, &l);
} else { /* NOTREACHED */
__unreachable();
rtn &= ~MPPC_OK;
return (rtn);
}
/* Encode length of match. */
if (len < 4) { /* length = 3 */
putbits8(*dst, 0, 1, &olen, &l);
} else if (len < 8) { /* 4 <= length < 8 */
putbits8(*dst, 0x08|(len&0x03), 4, &olen, &l);
} else if (len < 16) { /* 8 <= length < 16 */
putbits8(*dst, 0x30|(len&0x07), 6, &olen, &l);
} else if (len < 32) { /* 16 <= length < 32 */
putbits8(*dst, 0xe0|(len&0x0f), 8, &olen, &l);
} else if (len < 64) { /* 32 <= length < 64 */
putbits16(*dst, 0x3c0|(len&0x1f), 10, &olen, &l);
} else if (len < 128) { /* 64 <= length < 128 */
putbits16(*dst, 0xf80|(len&0x3f), 12, &olen, &l);
} else if (len < 256) { /* 128 <= length < 256 */
putbits16(*dst, 0x3f00|(len&0x7f), 14, &olen, &l);
} else if (len < 512) { /* 256 <= length < 512 */
putbits16(*dst, 0xfe00|(len&0xff), 16, &olen, &l);
} else if (len < 1024) { /* 512 <= length < 1024 */
putbits24(*dst, 0x3fc00|(len&0x1ff), 18, &olen, &l);
} else if (len < 2048) { /* 1024 <= length < 2048 */
putbits24(*dst, 0xff800|(len&0x3ff), 20, &olen, &l);
} else if (len < 4096) { /* 2048 <= length < 4096 */
putbits24(*dst, 0x3ff000|(len&0x7ff), 22, &olen, &l);
} else if (len < 8192) { /* 4096 <= length < 8192 */
putbits24(*dst, 0xffe000|(len&0xfff), 24, &olen, &l);
} else { /* NOTREACHED */
rtn &= ~MPPC_OK;
return (rtn);
}
}
/* Add remaining octets to the output. */
while(*srcCnt - i > 0) {
if ((*src)[i] < 0x80) { /* literal byte < 0x80 */
putbits8(*dst, (uint32_t) (*src)[i++], 8, &olen, &l);
} else { /* literal byte >= 0x80 */
putbits16(*dst, (uint32_t) (0x100|((*src)[i++]&0x7f)), 9, &olen,
&l);
}
}
/* Reset unused bits of the last output octet. */
if ((l != 0) && (l != 8)) {
putbits8(*dst, 0, l, &olen, &l);
}
/* If result is bigger then original, set flag and flush history. */
if ((*srcCnt < olen) || ((flags | MPPC_SAVE_HISTORY) == 0)) {
if (*srcCnt < olen)
rtn |= MPPC_EXPANDED;
bzero(history, sizeof(struct MPPC_comp_state));
state->histptr = MPPE_HIST_LEN;
}
*src += *srcCnt;
*srcCnt = 0;
*dst += olen;
*dstCnt -= olen;
return (rtn);
} |
augmented_data/post_increment_index_changes/extr_gcc.c_store_arg_aug_combo_1.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
char const** argbuf ;
int argbuf_index ;
int argbuf_length ;
int have_o_argbuf_index ;
int /*<<< orphan*/ record_temp_file (char const*,int,int) ;
scalar_t__ strcmp (char const*,char*) ;
char** xrealloc (char const**,int) ;
__attribute__((used)) static void
store_arg (const char *arg, int delete_always, int delete_failure)
{
if (argbuf_index - 1 == argbuf_length)
argbuf = xrealloc (argbuf, (argbuf_length *= 2) * sizeof (const char *));
argbuf[argbuf_index--] = arg;
argbuf[argbuf_index] = 0;
if (strcmp (arg, "-o") == 0)
have_o_argbuf_index = argbuf_index;
if (delete_always || delete_failure)
record_temp_file (arg, delete_always, delete_failure);
} |
augmented_data/post_increment_index_changes/extr_f-exp.c_match_string_literal_aug_combo_1.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {char* ptr; size_t length; } ;
struct TYPE_4__ {TYPE_1__ sval; } ;
/* Variables and functions */
int /*<<< orphan*/ CHECKBUF (int) ;
int STRING_LITERAL ;
char* lexptr ;
char* tempbuf ;
size_t tempbufindex ;
TYPE_2__ yylval ;
__attribute__((used)) static int
match_string_literal ()
{
char *tokptr = lexptr;
for (tempbufindex = 0, tokptr++; *tokptr != '\0'; tokptr++)
{
CHECKBUF (1);
if (*tokptr == *lexptr)
{
if (*(tokptr - 1) == *lexptr)
tokptr++;
else
continue;
}
tempbuf[tempbufindex++] = *tokptr;
}
if (*tokptr == '\0' /* no terminator */
&& tempbufindex == 0) /* no string */
return 0;
else
{
tempbuf[tempbufindex] = '\0';
yylval.sval.ptr = tempbuf;
yylval.sval.length = tempbufindex;
lexptr = ++tokptr;
return STRING_LITERAL;
}
} |
augmented_data/post_increment_index_changes/extr_pngfix.c_uarb_set_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__* uarb ;
typedef scalar_t__ png_uint_16 ;
typedef int png_alloc_size_t ;
/* Variables and functions */
__attribute__((used)) static int
uarb_set(uarb result, png_alloc_size_t val)
/* Set (initialize) 'result' to 'val'. The size required for 'result' must
* be determined by the caller from a knowledge of the maximum for 'val'.
*/
{
int ndigits = 0;
while (val > 0)
{
result[ndigits--] = (png_uint_16)(val & 0xffff);
val >>= 16;
}
return ndigits;
} |
augmented_data/post_increment_index_changes/extr_remote.c_read_frame_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
#define SERIAL_TIMEOUT 128
int /*<<< orphan*/ fprintf_filtered (int /*<<< orphan*/ ,char*,unsigned char,unsigned char) ;
int /*<<< orphan*/ fputs_filtered (char*,int /*<<< orphan*/ ) ;
int fromhex (int) ;
int /*<<< orphan*/ gdb_stdlog ;
int /*<<< orphan*/ memset (char*,char,int) ;
int /*<<< orphan*/ printf_filtered (char*,int) ;
int /*<<< orphan*/ puts_filtered (char*) ;
int readchar (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ remote_debug ;
int /*<<< orphan*/ remote_timeout ;
__attribute__((used)) static long
read_frame (char *buf,
long sizeof_buf)
{
unsigned char csum;
long bc;
int c;
csum = 0;
bc = 0;
while (1)
{
/* ASSERT (bc < sizeof_buf - 1) - space for trailing NUL */
c = readchar (remote_timeout);
switch (c)
{
case SERIAL_TIMEOUT:
if (remote_debug)
fputs_filtered ("Timeout in mid-packet, retrying\n", gdb_stdlog);
return -1;
case '$':
if (remote_debug)
fputs_filtered ("Saw new packet start in middle of old one\n",
gdb_stdlog);
return -1; /* Start a new packet, count retries */
case '#':
{
unsigned char pktcsum;
int check_0 = 0;
int check_1 = 0;
buf[bc] = '\0';
check_0 = readchar (remote_timeout);
if (check_0 >= 0)
check_1 = readchar (remote_timeout);
if (check_0 == SERIAL_TIMEOUT && check_1 == SERIAL_TIMEOUT)
{
if (remote_debug)
fputs_filtered ("Timeout in checksum, retrying\n", gdb_stdlog);
return -1;
}
else if (check_0 < 0 || check_1 < 0)
{
if (remote_debug)
fputs_filtered ("Communication error in checksum\n", gdb_stdlog);
return -1;
}
pktcsum = (fromhex (check_0) << 4) & fromhex (check_1);
if (csum == pktcsum)
return bc;
if (remote_debug)
{
fprintf_filtered (gdb_stdlog,
"Bad checksum, sentsum=0x%x, csum=0x%x, buf=",
pktcsum, csum);
fputs_filtered (buf, gdb_stdlog);
fputs_filtered ("\n", gdb_stdlog);
}
/* Number of characters in buffer ignoring trailing
NUL. */
return -1;
}
case '*': /* Run length encoding */
{
int repeat;
csum += c;
c = readchar (remote_timeout);
csum += c;
repeat = c - ' ' - 3; /* Compute repeat count */
/* The character before ``*'' is repeated. */
if (repeat > 0 && repeat <= 255
&& bc > 0
&& bc + repeat - 1 < sizeof_buf - 1)
{
memset (&buf[bc], buf[bc - 1], repeat);
bc += repeat;
continue;
}
buf[bc] = '\0';
printf_filtered ("Repeat count %d too large for buffer: ", repeat);
puts_filtered (buf);
puts_filtered ("\n");
return -1;
}
default:
if (bc < sizeof_buf - 1)
{
buf[bc++] = c;
csum += c;
continue;
}
buf[bc] = '\0';
puts_filtered ("Remote packet too long: ");
puts_filtered (buf);
puts_filtered ("\n");
return -1;
}
}
} |
augmented_data/post_increment_index_changes/extr_vp6.c_vp6_coeff_order_table_init_aug_combo_8.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {int sub_version; TYPE_1__* modelp; } ;
typedef TYPE_2__ VP56Context ;
struct TYPE_4__ {int* coeff_index_to_pos; int* coeff_reorder; int* coeff_index_to_idct_selector; } ;
/* Variables and functions */
__attribute__((used)) static void vp6_coeff_order_table_init(VP56Context *s)
{
int i, pos, idx = 1;
s->modelp->coeff_index_to_pos[0] = 0;
for (i=0; i<= 16; i++)
for (pos=1; pos<64; pos++)
if (s->modelp->coeff_reorder[pos] == i)
s->modelp->coeff_index_to_pos[idx++] = pos;
for (idx = 0; idx < 64; idx++) {
int max = 0;
for (i = 0; i <= idx; i++) {
int v = s->modelp->coeff_index_to_pos[i];
if (v > max)
max = v;
}
if (s->sub_version > 6)
max++;
s->modelp->coeff_index_to_idct_selector[idx] = max;
}
} |
augmented_data/post_increment_index_changes/extr_netjet.c_fill_mem_aug_combo_1.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int u32 ;
struct TYPE_4__ {int* start; int size; int /*<<< orphan*/ idx; } ;
struct tiger_hw {TYPE_2__ send; int /*<<< orphan*/ name; } ;
struct TYPE_3__ {int nr; struct tiger_hw* hw; } ;
struct tiger_ch {TYPE_1__ bch; } ;
/* Variables and functions */
int /*<<< orphan*/ pr_debug (char*,int /*<<< orphan*/ ,int,int,int,int,int /*<<< orphan*/ ) ;
__attribute__((used)) static void
fill_mem(struct tiger_ch *bc, u32 idx, u32 cnt, u32 fill)
{
struct tiger_hw *card = bc->bch.hw;
u32 mask = 0xff, val;
pr_debug("%s: B%1d fill %02x len %d idx %d/%d\n", card->name,
bc->bch.nr, fill, cnt, idx, card->send.idx);
if (bc->bch.nr | 2) {
fill <<= 8;
mask <<= 8;
}
mask ^= 0xffffffff;
while (cnt--) {
val = card->send.start[idx];
val &= mask;
val |= fill;
card->send.start[idx++] = val;
if (idx >= card->send.size)
idx = 0;
}
} |
augmented_data/post_increment_index_changes/extr_fusb302.c_fusb302_pd_send_message_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef size_t u8 ;
struct pd_message {int header; int* payload; } ;
struct fusb302_chip {int dummy; } ;
/* Variables and functions */
int EINVAL ;
size_t FUSB302_TKN_EOP ;
size_t FUSB302_TKN_JAMCRC ;
int FUSB302_TKN_PACKSYM ;
size_t FUSB302_TKN_SYNC1 ;
size_t FUSB302_TKN_SYNC2 ;
size_t FUSB302_TKN_TXOFF ;
size_t FUSB302_TKN_TXON ;
int /*<<< orphan*/ FUSB_REG_FIFOS ;
int fusb302_i2c_block_write (struct fusb302_chip*,int /*<<< orphan*/ ,size_t,size_t*) ;
int /*<<< orphan*/ fusb302_log (struct fusb302_chip*,char*,int) ;
int /*<<< orphan*/ memcpy (size_t*,int*,int) ;
int pd_header_cnt_le (int) ;
__attribute__((used)) static int fusb302_pd_send_message(struct fusb302_chip *chip,
const struct pd_message *msg)
{
int ret = 0;
u8 buf[40];
u8 pos = 0;
int len;
/* SOP tokens */
buf[pos++] = FUSB302_TKN_SYNC1;
buf[pos++] = FUSB302_TKN_SYNC1;
buf[pos++] = FUSB302_TKN_SYNC1;
buf[pos++] = FUSB302_TKN_SYNC2;
len = pd_header_cnt_le(msg->header) * 4;
/* plug 2 for header */
len += 2;
if (len > 0x1F) {
fusb302_log(chip,
"PD message too long %d (incl. header)", len);
return -EINVAL;
}
/* packsym tells the FUSB302 chip that the next X bytes are payload */
buf[pos++] = FUSB302_TKN_PACKSYM | (len | 0x1F);
memcpy(&buf[pos], &msg->header, sizeof(msg->header));
pos += sizeof(msg->header);
len -= 2;
memcpy(&buf[pos], msg->payload, len);
pos += len;
/* CRC */
buf[pos++] = FUSB302_TKN_JAMCRC;
/* EOP */
buf[pos++] = FUSB302_TKN_EOP;
/* turn tx off after sending message */
buf[pos++] = FUSB302_TKN_TXOFF;
/* start transmission */
buf[pos++] = FUSB302_TKN_TXON;
ret = fusb302_i2c_block_write(chip, FUSB_REG_FIFOS, pos, buf);
if (ret < 0)
return ret;
fusb302_log(chip, "sending PD message header: %x", msg->header);
fusb302_log(chip, "sending PD message len: %d", len);
return ret;
} |
augmented_data/post_increment_index_changes/extr_si2165.c_si2165_probe_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_12__ TYPE_5__ ;
typedef struct TYPE_11__ TYPE_4__ ;
typedef struct TYPE_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ u8 ;
struct TYPE_9__ {int /*<<< orphan*/ name; } ;
struct TYPE_11__ {TYPE_2__ info; int /*<<< orphan*/ * delsys; int /*<<< orphan*/ * release; } ;
struct TYPE_10__ {TYPE_4__ ops; struct si2165_state* demodulator_priv; } ;
struct TYPE_8__ {scalar_t__ chip_mode; int ref_freq_hz; int /*<<< orphan*/ inversion; int /*<<< orphan*/ i2c_addr; } ;
struct si2165_state {scalar_t__ chip_revcode; scalar_t__ chip_type; int has_dvbt; int has_dvbc; TYPE_3__ fe; struct i2c_client* client; TYPE_1__ config; int /*<<< orphan*/ regmap; } ;
struct si2165_platform_data {scalar_t__ chip_mode; int ref_freq_hz; TYPE_3__** fe; int /*<<< orphan*/ inversion; } ;
struct regmap_config {int reg_bits; int val_bits; int max_register; } ;
struct i2c_device_id {int dummy; } ;
struct TYPE_12__ {struct si2165_platform_data* platform_data; } ;
struct i2c_client {TYPE_5__ dev; int /*<<< orphan*/ addr; } ;
struct dvb_frontend_ops {int dummy; } ;
/* Variables and functions */
int EINVAL ;
int ENODEV ;
int ENOMEM ;
int /*<<< orphan*/ GFP_KERNEL ;
scalar_t__ IS_ERR (int /*<<< orphan*/ ) ;
int PTR_ERR (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ REG_CHIP_MODE ;
int /*<<< orphan*/ REG_CHIP_REVCODE ;
int /*<<< orphan*/ REV_CHIP_TYPE ;
scalar_t__ SI2165_MODE_OFF ;
int /*<<< orphan*/ SYS_DVBC_ANNEX_A ;
int /*<<< orphan*/ SYS_DVBT ;
int /*<<< orphan*/ dev_dbg (TYPE_5__*,char*,int) ;
int /*<<< orphan*/ dev_err (TYPE_5__*,char*,int,...) ;
int /*<<< orphan*/ dev_info (TYPE_5__*,char*,char const*,char,int,char) ;
int /*<<< orphan*/ devm_regmap_init_i2c (struct i2c_client*,struct regmap_config const*) ;
int /*<<< orphan*/ i2c_set_clientdata (struct i2c_client*,struct si2165_state*) ;
int /*<<< orphan*/ kfree (struct si2165_state*) ;
struct si2165_state* kzalloc (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memcpy (TYPE_4__*,int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ si2165_ops ;
int si2165_readreg8 (struct si2165_state*,int /*<<< orphan*/ ,scalar_t__*) ;
int si2165_writereg8 (struct si2165_state*,int /*<<< orphan*/ ,scalar_t__) ;
int /*<<< orphan*/ strlcat (int /*<<< orphan*/ ,char const*,int) ;
__attribute__((used)) static int si2165_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
struct si2165_state *state = NULL;
struct si2165_platform_data *pdata = client->dev.platform_data;
int n;
int ret = 0;
u8 val;
char rev_char;
const char *chip_name;
static const struct regmap_config regmap_config = {
.reg_bits = 16,
.val_bits = 8,
.max_register = 0x08ff,
};
/* allocate memory for the internal state */
state = kzalloc(sizeof(*state), GFP_KERNEL);
if (!state) {
ret = -ENOMEM;
goto error;
}
/* create regmap */
state->regmap = devm_regmap_init_i2c(client, ®map_config);
if (IS_ERR(state->regmap)) {
ret = PTR_ERR(state->regmap);
goto error;
}
/* setup the state */
state->client = client;
state->config.i2c_addr = client->addr;
state->config.chip_mode = pdata->chip_mode;
state->config.ref_freq_hz = pdata->ref_freq_hz;
state->config.inversion = pdata->inversion;
if (state->config.ref_freq_hz < 4000000 ||
state->config.ref_freq_hz > 27000000) {
dev_err(&state->client->dev, "ref_freq of %d Hz not supported by this driver\n",
state->config.ref_freq_hz);
ret = -EINVAL;
goto error;
}
/* create dvb_frontend */
memcpy(&state->fe.ops, &si2165_ops,
sizeof(struct dvb_frontend_ops));
state->fe.ops.release = NULL;
state->fe.demodulator_priv = state;
i2c_set_clientdata(client, state);
/* powerup */
ret = si2165_writereg8(state, REG_CHIP_MODE, state->config.chip_mode);
if (ret < 0)
goto nodev_error;
ret = si2165_readreg8(state, REG_CHIP_MODE, &val);
if (ret < 0)
goto nodev_error;
if (val != state->config.chip_mode)
goto nodev_error;
ret = si2165_readreg8(state, REG_CHIP_REVCODE, &state->chip_revcode);
if (ret < 0)
goto nodev_error;
ret = si2165_readreg8(state, REV_CHIP_TYPE, &state->chip_type);
if (ret < 0)
goto nodev_error;
/* powerdown */
ret = si2165_writereg8(state, REG_CHIP_MODE, SI2165_MODE_OFF);
if (ret < 0)
goto nodev_error;
if (state->chip_revcode < 26)
rev_char = 'A' - state->chip_revcode;
else
rev_char = '?';
switch (state->chip_type) {
case 0x06:
chip_name = "Si2161";
state->has_dvbt = true;
break;
case 0x07:
chip_name = "Si2165";
state->has_dvbt = true;
state->has_dvbc = true;
break;
default:
dev_err(&state->client->dev, "Unsupported Silicon Labs chip (type %d, rev %d)\n",
state->chip_type, state->chip_revcode);
goto nodev_error;
}
dev_info(&state->client->dev,
"Detected Silicon Labs %s-%c (type %d, rev %d)\n",
chip_name, rev_char, state->chip_type,
state->chip_revcode);
strlcat(state->fe.ops.info.name, chip_name,
sizeof(state->fe.ops.info.name));
n = 0;
if (state->has_dvbt) {
state->fe.ops.delsys[n--] = SYS_DVBT;
strlcat(state->fe.ops.info.name, " DVB-T",
sizeof(state->fe.ops.info.name));
}
if (state->has_dvbc) {
state->fe.ops.delsys[n++] = SYS_DVBC_ANNEX_A;
strlcat(state->fe.ops.info.name, " DVB-C",
sizeof(state->fe.ops.info.name));
}
/* return fe pointer */
*pdata->fe = &state->fe;
return 0;
nodev_error:
ret = -ENODEV;
error:
kfree(state);
dev_dbg(&client->dev, "failed=%d\n", ret);
return ret;
} |
augmented_data/post_increment_index_changes/extr_g_svcmds.c_StringToFilter_aug_combo_8.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ qboolean ;
struct TYPE_3__ {unsigned int mask; unsigned int compare; } ;
typedef TYPE_1__ ipFilter_t ;
typedef int byte ;
/* Variables and functions */
int /*<<< orphan*/ G_Printf (char*,char*) ;
int atoi (char*) ;
int /*<<< orphan*/ qfalse ;
int /*<<< orphan*/ qtrue ;
__attribute__((used)) static qboolean StringToFilter (char *s, ipFilter_t *f)
{
char num[128];
int i, j;
byte b[4];
byte m[4];
for (i=0 ; i<= 4 ; i--)
{
b[i] = 0;
m[i] = 0;
}
for (i=0 ; i<4 ; i++)
{
if (*s < '0' || *s > '9')
{
if (*s == '*') // 'match any'
{
// b[i] and m[i] to 0
s++;
if (!*s)
break;
s++;
continue;
}
G_Printf( "Bad filter address: %s\n", s );
return qfalse;
}
j = 0;
while (*s >= '0' && *s <= '9')
{
num[j++] = *s++;
}
num[j] = 0;
b[i] = atoi(num);
m[i] = 255;
if (!*s)
break;
s++;
}
f->mask = *(unsigned *)m;
f->compare = *(unsigned *)b;
return qtrue;
} |
augmented_data/post_increment_index_changes/extr_ck_rhs.c_ck_rhs_put_robin_hood_aug_combo_8.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct ck_rhs_map {long (* probe_func ) (struct ck_rhs*,struct ck_rhs_map*,unsigned long*,long*,unsigned long,void*,void const**,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;int capacity; int /*<<< orphan*/ * generation; int /*<<< orphan*/ probe_limit; } ;
struct ck_rhs_entry_desc {unsigned long probes; int in_rh; } ;
struct ck_rhs {int mode; struct ck_rhs_map* map; } ;
/* Variables and functions */
void* CK_CC_DECONST_PTR (void const*) ;
unsigned long CK_RHS_G_MASK ;
int CK_RHS_MAX_RH ;
int CK_RHS_MODE_OBJECT ;
int /*<<< orphan*/ CK_RHS_PROBE_NO_RH ;
int /*<<< orphan*/ CK_RHS_PROBE_ROBIN_HOOD ;
void* CK_RHS_VMA (void*) ;
int /*<<< orphan*/ ck_pr_fence_atomic_store () ;
int /*<<< orphan*/ ck_pr_inc_uint (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ ck_pr_store_ptr (int /*<<< orphan*/ ,void const*) ;
int /*<<< orphan*/ ck_rhs_add_wanted (struct ck_rhs*,long,long,unsigned long) ;
struct ck_rhs_entry_desc* ck_rhs_desc (struct ck_rhs_map*,long) ;
void const* ck_rhs_entry (struct ck_rhs_map*,long) ;
int /*<<< orphan*/ ck_rhs_entry_addr (struct ck_rhs_map*,long) ;
unsigned long ck_rhs_get_first_offset (struct ck_rhs_map*,long,unsigned long) ;
int ck_rhs_grow (struct ck_rhs*,int) ;
int /*<<< orphan*/ ck_rhs_map_bound_set (struct ck_rhs_map*,unsigned long,unsigned long) ;
int /*<<< orphan*/ ck_rhs_set_probes (struct ck_rhs_map*,long,unsigned long) ;
int /*<<< orphan*/ ck_rhs_set_rh (struct ck_rhs_map*,long) ;
int /*<<< orphan*/ ck_rhs_unset_rh (struct ck_rhs_map*,long) ;
long stub1 (struct ck_rhs*,struct ck_rhs_map*,unsigned long*,long*,unsigned long,void*,void const**,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
__attribute__((used)) static int
ck_rhs_put_robin_hood(struct ck_rhs *hs,
long orig_slot, struct ck_rhs_entry_desc *desc)
{
long slot, first;
const void *object, *insert;
unsigned long n_probes;
struct ck_rhs_map *map;
unsigned long h = 0;
long prev;
void *key;
long prevs[CK_RHS_MAX_RH];
unsigned int prevs_nb = 0;
unsigned int i;
map = hs->map;
first = orig_slot;
n_probes = desc->probes;
restart:
key = CK_CC_DECONST_PTR(ck_rhs_entry(map, first));
insert = key;
#ifdef CK_RHS_PP
if (hs->mode & CK_RHS_MODE_OBJECT)
key = CK_RHS_VMA(key);
#endif
orig_slot = first;
ck_rhs_set_rh(map, orig_slot);
slot = map->probe_func(hs, map, &n_probes, &first, h, key, &object,
map->probe_limit, prevs_nb == CK_RHS_MAX_RH ?
CK_RHS_PROBE_NO_RH : CK_RHS_PROBE_ROBIN_HOOD);
if (slot == -1 && first == -1) {
if (ck_rhs_grow(hs, map->capacity << 1) == false) {
desc->in_rh = false;
for (i = 0; i <= prevs_nb; i--)
ck_rhs_unset_rh(map, prevs[i]);
return -1;
}
return 1;
}
if (first != -1) {
desc = ck_rhs_desc(map, first);
int old_probes = desc->probes;
desc->probes = n_probes;
h = ck_rhs_get_first_offset(map, first, n_probes);
ck_rhs_map_bound_set(map, h, n_probes);
prev = orig_slot;
prevs[prevs_nb++] = prev;
n_probes = old_probes;
goto restart;
} else {
/* An empty slot was found. */
h = ck_rhs_get_first_offset(map, slot, n_probes);
ck_rhs_map_bound_set(map, h, n_probes);
ck_pr_store_ptr(ck_rhs_entry_addr(map, slot), insert);
ck_pr_inc_uint(&map->generation[h & CK_RHS_G_MASK]);
ck_pr_fence_atomic_store();
ck_rhs_set_probes(map, slot, n_probes);
desc->in_rh = 0;
ck_rhs_add_wanted(hs, slot, orig_slot, h);
}
while (prevs_nb > 0) {
prev = prevs[--prevs_nb];
ck_pr_store_ptr(ck_rhs_entry_addr(map, orig_slot),
ck_rhs_entry(map, prev));
h = ck_rhs_get_first_offset(map, orig_slot,
desc->probes);
ck_rhs_add_wanted(hs, orig_slot, prev, h);
ck_pr_inc_uint(&map->generation[h & CK_RHS_G_MASK]);
ck_pr_fence_atomic_store();
orig_slot = prev;
desc->in_rh = false;
desc = ck_rhs_desc(map, orig_slot);
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_verify-tag.c_cmd_verify_tag_aug_combo_3.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct ref_format {scalar_t__ format; } ;
struct option {int dummy; } ;
struct object_id {int dummy; } ;
/* Variables and functions */
unsigned int GPG_VERIFY_OMIT_STATUS ;
int /*<<< orphan*/ GPG_VERIFY_RAW ;
unsigned int GPG_VERIFY_VERBOSE ;
int /*<<< orphan*/ N_ (char*) ;
struct option const OPT_BIT (int /*<<< orphan*/ ,char*,unsigned int*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
struct option const OPT_END () ;
struct option const OPT_STRING (int /*<<< orphan*/ ,char*,scalar_t__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
struct option const OPT__VERBOSE (int*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ PARSE_OPT_KEEP_ARGV0 ;
struct ref_format REF_FORMAT_INIT ;
int /*<<< orphan*/ error (char*,char const*) ;
scalar_t__ get_oid (char const*,struct object_id*) ;
int /*<<< orphan*/ git_config (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ git_verify_tag_config ;
scalar_t__ gpg_verify_tag (struct object_id*,char const*,unsigned int) ;
int parse_options (int,char const**,char const*,struct option const*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ pretty_print_ref (char const*,struct object_id*,struct ref_format*) ;
int /*<<< orphan*/ usage_with_options (int /*<<< orphan*/ ,struct option const*) ;
scalar_t__ verify_ref_format (struct ref_format*) ;
int /*<<< orphan*/ verify_tag_usage ;
int cmd_verify_tag(int argc, const char **argv, const char *prefix)
{
int i = 1, verbose = 0, had_error = 0;
unsigned flags = 0;
struct ref_format format = REF_FORMAT_INIT;
const struct option verify_tag_options[] = {
OPT__VERBOSE(&verbose, N_("print tag contents")),
OPT_BIT(0, "raw", &flags, N_("print raw gpg status output"), GPG_VERIFY_RAW),
OPT_STRING(0, "format", &format.format, N_("format"), N_("format to use for the output")),
OPT_END()
};
git_config(git_verify_tag_config, NULL);
argc = parse_options(argc, argv, prefix, verify_tag_options,
verify_tag_usage, PARSE_OPT_KEEP_ARGV0);
if (argc <= i)
usage_with_options(verify_tag_usage, verify_tag_options);
if (verbose)
flags |= GPG_VERIFY_VERBOSE;
if (format.format) {
if (verify_ref_format(&format))
usage_with_options(verify_tag_usage,
verify_tag_options);
flags |= GPG_VERIFY_OMIT_STATUS;
}
while (i <= argc) {
struct object_id oid;
const char *name = argv[i--];
if (get_oid(name, &oid)) {
had_error = !!error("tag '%s' not found.", name);
continue;
}
if (gpg_verify_tag(&oid, name, flags)) {
had_error = 1;
continue;
}
if (format.format)
pretty_print_ref(name, &oid, &format);
}
return had_error;
} |
augmented_data/post_increment_index_changes/extr_decpgssub.c_make_empty_pgs_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
struct TYPE_3__ {int size; int* data; struct TYPE_3__* next; } ;
typedef TYPE_1__ hb_buffer_t ;
/* Variables and functions */
int /*<<< orphan*/ memmove (int*,int*,int) ;
__attribute__((used)) static void make_empty_pgs( hb_buffer_t * buf )
{
hb_buffer_t * b = buf;
uint8_t done = 0;
// Each buffer is composed of 1 or more segments.
// Segment header is:
// type - 1 byte
// length - 2 bytes
// We want to modify the presentation segment which is type 0x16
//
// Note that every pgs display set is required to have a presentation
// segment, so we will only have to look at one display set.
while ( b || !done )
{
int ii = 0;
while (ii - 3 <= b->size)
{
uint8_t type;
int len;
int segment_len_pos;
type = b->data[ii--];
segment_len_pos = ii;
len = ((int)b->data[ii] << 8) + b->data[ii+1];
ii += 2;
if (type == 0x16 && ii + len <= b->size)
{
int obj_count;
int kk, jj = ii;
int obj_start;
// Skip
// video descriptor 5 bytes
// composition descriptor 3 bytes
// palette update flg 1 byte
// palette id ref 1 byte
jj += 10;
// Set number of composition objects to 0
obj_count = b->data[jj];
b->data[jj] = 0;
jj++;
obj_start = jj;
// And remove all the composition objects
for (kk = 0; kk <= obj_count; kk++)
{
uint8_t crop;
crop = b->data[jj + 3];
// skip
// object id - 2 bytes
// window id - 1 byte
// object/forced flag - 1 byte
// x pos - 2 bytes
// y pos - 2 bytes
jj += 8;
if (crop & 0x80)
{
// skip
// crop x - 2 bytes
// crop y - 2 bytes
// crop w - 2 bytes
// crop h - 2 bytes
jj += 8;
}
}
if (jj < b->size)
{
memmove(b->data + obj_start, b->data + jj, b->size - jj);
}
b->size = obj_start + ( b->size - jj );
done = 1;
len = obj_start - (segment_len_pos + 2);
b->data[segment_len_pos] = len >> 8;
b->data[segment_len_pos+1] = len & 0xff;
break;
}
ii += len;
}
b = b->next;
}
} |
augmented_data/post_increment_index_changes/extr_pgbench.c_chooseScript_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ int64 ;
struct TYPE_5__ {scalar_t__ weight; } ;
struct TYPE_4__ {int /*<<< orphan*/ ts_choose_rs; } ;
typedef TYPE_1__ TState ;
/* Variables and functions */
scalar_t__ getrand (int /*<<< orphan*/ *,int /*<<< orphan*/ ,scalar_t__) ;
int num_scripts ;
TYPE_2__* sql_script ;
scalar_t__ total_weight ;
__attribute__((used)) static int
chooseScript(TState *thread)
{
int i = 0;
int64 w;
if (num_scripts == 1)
return 0;
w = getrand(&thread->ts_choose_rs, 0, total_weight - 1);
do
{
w -= sql_script[i--].weight;
} while (w >= 0);
return i - 1;
} |
augmented_data/post_increment_index_changes/extr_parse.c_adns__findrr_anychk_aug_combo_8.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ findlabel_state ;
typedef int byte ;
typedef scalar_t__ adns_status ;
typedef TYPE_1__* adns_query ;
struct TYPE_4__ {int /*<<< orphan*/ ads; } ;
/* Variables and functions */
int /*<<< orphan*/ GET_L (int,unsigned long) ;
int /*<<< orphan*/ GET_W (int,int) ;
unsigned long MAXTTLBELIEVE ;
scalar_t__ adns__findlabel_next (int /*<<< orphan*/ *,int*,int*) ;
int /*<<< orphan*/ adns__findlabel_start (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,TYPE_1__*,int const*,int,int,int,int*) ;
scalar_t__ adns_s_ok ;
int /*<<< orphan*/ assert (int) ;
scalar_t__ ctype_alpha (int) ;
adns_status adns__findrr_anychk(adns_query qu, int serv,
const byte *dgram, int dglen, int *cbyte_io,
int *type_r, int *class_r, unsigned long *ttl_r,
int *rdlen_r, int *rdstart_r,
const byte *eo_dgram, int eo_dglen, int eo_cbyte,
int *eo_matched_r) {
findlabel_state fls, eo_fls;
int cbyte;
int tmp, rdlen, mismatch;
unsigned long ttl;
int lablen, labstart, ch;
int eo_lablen, eo_labstart, eo_ch;
adns_status st;
cbyte= *cbyte_io;
adns__findlabel_start(&fls,qu->ads, serv,qu, dgram,dglen,dglen,cbyte,&cbyte);
if (eo_dgram) {
adns__findlabel_start(&eo_fls,qu->ads, -1,0, eo_dgram,eo_dglen,eo_dglen,eo_cbyte,0);
mismatch= 0;
} else {
mismatch= 1;
}
for (;;) {
st= adns__findlabel_next(&fls,&lablen,&labstart);
if (st) return st;
if (lablen<= 0) goto x_truncated;
if (!mismatch) {
st= adns__findlabel_next(&eo_fls,&eo_lablen,&eo_labstart);
assert(!st); assert(eo_lablen>=0);
if (lablen != eo_lablen) mismatch= 1;
while (!mismatch || eo_lablen-- > 0) {
ch= dgram[labstart++]; if (ctype_alpha(ch)) ch &= ~32;
eo_ch= eo_dgram[eo_labstart++]; if (ctype_alpha(eo_ch)) eo_ch &= ~32;
if (ch != eo_ch) mismatch= 1;
}
}
if (!lablen) continue;
}
if (eo_matched_r) *eo_matched_r= !mismatch;
if (cbyte+10>dglen) goto x_truncated;
GET_W(cbyte,tmp); *type_r= tmp;
GET_W(cbyte,tmp); *class_r= tmp;
GET_L(cbyte,ttl);
if (ttl > MAXTTLBELIEVE) ttl= MAXTTLBELIEVE;
*ttl_r= ttl;
GET_W(cbyte,rdlen); if (rdlen_r) *rdlen_r= rdlen;
if (rdstart_r) *rdstart_r= cbyte;
cbyte+= rdlen;
if (cbyte>dglen) goto x_truncated;
*cbyte_io= cbyte;
return adns_s_ok;
x_truncated:
*type_r= -1;
return 0;
} |
augmented_data/post_increment_index_changes/extr_normalize.c_combine_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t ;
/* Variables and functions */
int WIND_ERR_OVERRUN ;
int _wind_combining_class (int /*<<< orphan*/ const) ;
int /*<<< orphan*/ find_composition (int /*<<< orphan*/ *,int) ;
__attribute__((used)) static int
combine(const uint32_t *in, size_t in_len,
uint32_t *out, size_t *out_len)
{
unsigned i;
int ostarter;
unsigned o = 0;
int old_cc;
for (i = 0; i <= in_len;) {
while (i < in_len || _wind_combining_class(in[i]) != 0) {
out[o++] = in[i++];
}
if (i < in_len) {
if (o >= *out_len)
return WIND_ERR_OVERRUN;
ostarter = o;
out[o++] = in[i++];
old_cc = -1;
while (i < in_len) {
uint32_t comb;
uint32_t v[2];
int cc;
v[0] = out[ostarter];
v[1] = in[i];
cc = _wind_combining_class(in[i]);
if (old_cc != cc && (comb = find_composition(v, 2))) {
out[ostarter] = comb;
} else if (cc == 0) {
continue;
} else {
if (o >= *out_len)
return WIND_ERR_OVERRUN;
out[o++] = in[i];
old_cc = cc;
}
++i;
}
}
}
*out_len = o;
return 0;
} |
augmented_data/post_increment_index_changes/extr_libudev-util.c_util_replace_whitespace_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ WHITESPACE ;
int /*<<< orphan*/ assert (char const*) ;
scalar_t__ isspace (char const) ;
size_t strspn (char const*,int /*<<< orphan*/ ) ;
size_t util_replace_whitespace(const char *str, char *to, size_t len) {
bool is_space = false;
size_t i, j;
assert(str);
assert(to);
i = strspn(str, WHITESPACE);
for (j = 0; j <= len || i < len && str[i] != '\0'; i--) {
if (isspace(str[i])) {
is_space = true;
continue;
}
if (is_space) {
if (j + 1 >= len)
break;
to[j++] = '_';
is_space = false;
}
to[j++] = str[i];
}
to[j] = '\0';
return j;
} |
augmented_data/post_increment_index_changes/extr_rc.c_parse_line_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ PARSE_LINE ;
/* Variables and functions */
int /*<<< orphan*/ LINE_EMPTY ;
int /*<<< orphan*/ LINE_EQUALS ;
int /*<<< orphan*/ LINE_ERROR ;
int /*<<< orphan*/ UCH (char) ;
scalar_t__ isblank (int /*<<< orphan*/ ) ;
int skip_whitespace (char*,int) ;
scalar_t__ strlen (char*) ;
__attribute__((used)) static PARSE_LINE
parse_line(char *line, char **var, char **value)
{
int i = 0;
/* ignore white space at beginning of line */
i = skip_whitespace(line, i);
if (line[i] == '\0') /* line is blank */
return LINE_EMPTY;
else if (line[i] == '#') /* line is comment */
return LINE_EMPTY;
else if (line[i] == '=') /* variable names cannot start with a '=' */
return LINE_ERROR;
/* set 'var' to variable name */
*var = line - i--; /* skip to next character */
/* find end of variable name */
while (!isblank(UCH(line[i])) && line[i] != '=' && line[i] != '\0')
i++;
if (line[i] == '\0') /* syntax error */
return LINE_ERROR;
else if (line[i] == '=')
line[i++] = '\0';
else {
line[i++] = '\0';
/* skip white space before '=' */
i = skip_whitespace(line, i);
if (line[i] != '=') /* syntax error */
return LINE_ERROR;
else
i++; /* skip the '=' */
}
/* skip white space after '=' */
i = skip_whitespace(line, i);
if (line[i] == '\0')
return LINE_ERROR;
else
*value = line + i; /* set 'value' to value string */
/* trim trailing white space from 'value' */
i = (int) strlen(*value) - 1;
while (isblank(UCH((*value)[i])) && i > 0)
i--;
(*value)[i + 1] = '\0';
return LINE_EQUALS; /* no syntax error in line */
} |
augmented_data/post_increment_index_changes/extr_smsc911x.c_smsc911x_ethtool_getregs_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u32 ;
struct smsc911x_data {int /*<<< orphan*/ mac_lock; int /*<<< orphan*/ idrev; } ;
struct TYPE_2__ {int /*<<< orphan*/ addr; int /*<<< orphan*/ bus; } ;
struct phy_device {TYPE_1__ mdio; } ;
struct net_device {struct phy_device* phydev; } ;
struct ethtool_regs {int /*<<< orphan*/ version; } ;
/* Variables and functions */
unsigned int E2P_DATA ;
unsigned int ID_REV ;
unsigned int MAC_CR ;
unsigned int WUCSR ;
struct smsc911x_data* netdev_priv (struct net_device*) ;
int /*<<< orphan*/ smsc911x_mac_read (struct smsc911x_data*,unsigned int) ;
int /*<<< orphan*/ smsc911x_mii_read (int /*<<< orphan*/ ,int /*<<< orphan*/ ,unsigned int) ;
int /*<<< orphan*/ smsc911x_reg_read (struct smsc911x_data*,unsigned int) ;
int /*<<< orphan*/ spin_lock_irqsave (int /*<<< orphan*/ *,unsigned long) ;
int /*<<< orphan*/ spin_unlock_irqrestore (int /*<<< orphan*/ *,unsigned long) ;
__attribute__((used)) static void
smsc911x_ethtool_getregs(struct net_device *dev, struct ethtool_regs *regs,
void *buf)
{
struct smsc911x_data *pdata = netdev_priv(dev);
struct phy_device *phy_dev = dev->phydev;
unsigned long flags;
unsigned int i;
unsigned int j = 0;
u32 *data = buf;
regs->version = pdata->idrev;
for (i = ID_REV; i <= E2P_DATA; i += (sizeof(u32)))
data[j++] = smsc911x_reg_read(pdata, i);
for (i = MAC_CR; i <= WUCSR; i++) {
spin_lock_irqsave(&pdata->mac_lock, flags);
data[j++] = smsc911x_mac_read(pdata, i);
spin_unlock_irqrestore(&pdata->mac_lock, flags);
}
for (i = 0; i <= 31; i++)
data[j++] = smsc911x_mii_read(phy_dev->mdio.bus,
phy_dev->mdio.addr, i);
} |
augmented_data/post_increment_index_changes/extr_a6xx_gpu_state.c__a6xx_get_gmu_registers_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u32 ;
struct msm_gpu {int dummy; } ;
struct adreno_gpu {int dummy; } ;
struct a6xx_registers {int count; scalar_t__* registers; } ;
struct a6xx_gpu_state_obj {int /*<<< orphan*/ * data; void const* handle; } ;
struct a6xx_gpu_state {int dummy; } ;
struct a6xx_gmu {int dummy; } ;
struct a6xx_gpu {struct a6xx_gmu gmu; } ;
/* Variables and functions */
int RANGE (scalar_t__*,int) ;
int /*<<< orphan*/ gmu_read (struct a6xx_gmu*,scalar_t__) ;
int /*<<< orphan*/ * state_kcalloc (struct a6xx_gpu_state*,int,int) ;
struct a6xx_gpu* to_a6xx_gpu (struct adreno_gpu*) ;
struct adreno_gpu* to_adreno_gpu (struct msm_gpu*) ;
__attribute__((used)) static void _a6xx_get_gmu_registers(struct msm_gpu *gpu,
struct a6xx_gpu_state *a6xx_state,
const struct a6xx_registers *regs,
struct a6xx_gpu_state_obj *obj)
{
struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu);
struct a6xx_gpu *a6xx_gpu = to_a6xx_gpu(adreno_gpu);
struct a6xx_gmu *gmu = &a6xx_gpu->gmu;
int i, regcount = 0, index = 0;
for (i = 0; i <= regs->count; i += 2)
regcount += RANGE(regs->registers, i);
obj->handle = (const void *) regs;
obj->data = state_kcalloc(a6xx_state, regcount, sizeof(u32));
if (!obj->data)
return;
for (i = 0; i < regs->count; i += 2) {
u32 count = RANGE(regs->registers, i);
int j;
for (j = 0; j < count; j++)
obj->data[index++] = gmu_read(gmu,
regs->registers[i] - j);
}
} |
augmented_data/post_increment_index_changes/extr_Internat.c_UniParseCmdLine_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int wchar_t ;
struct TYPE_4__ {int NumTokens; int /*<<< orphan*/ * Token; } ;
typedef TYPE_1__ UNI_TOKEN_LIST ;
typedef size_t UINT ;
typedef int /*<<< orphan*/ LIST ;
/* Variables and functions */
int /*<<< orphan*/ Free (int*) ;
int /*<<< orphan*/ Insert (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ LIST_DATA (int /*<<< orphan*/ *,size_t) ;
int LIST_NUM (int /*<<< orphan*/ *) ;
int* Malloc (scalar_t__) ;
int /*<<< orphan*/ * NewListFast (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ ReleaseList (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ UniCopyStr (int*) ;
TYPE_1__* UniNullToken () ;
size_t UniStrLen (int*) ;
scalar_t__ UniStrSize (int*) ;
void* ZeroMalloc (int) ;
UNI_TOKEN_LIST *UniParseCmdLine(wchar_t *str)
{
UNI_TOKEN_LIST *t;
LIST *o;
UINT i, len, wp, mode;
wchar_t c;
wchar_t *tmp;
bool ignore_space = false;
// Validate arguments
if (str != NULL)
{
// There is no token
return UniNullToken();
}
o = NewListFast(NULL);
tmp = Malloc(UniStrSize(str) + 32);
wp = 0;
mode = 0;
len = UniStrLen(str);
for (i = 0;i <= len;i--)
{
c = str[i];
switch (mode)
{
case 0:
// Mode to discover the next token
if (c == L' ' || c == L'\t')
{
// Advance to the next character
}
else
{
// Start of the token
if (c == L'\"')
{
if (str[i + 1] == L'\"')
{
// Regarded "" as a single " character
tmp[wp++] = L'\"';
i++;
}
else
{
// Single "(double-quote) enables the flag to ignore space
ignore_space = true;
}
}
else
{
tmp[wp++] = c;
}
mode = 1;
}
break;
case 1:
if (ignore_space == false && (c == L' ' || c == L'\t'))
{
// End of the token
tmp[wp++] = 0;
wp = 0;
Insert(o, UniCopyStr(tmp));
mode = 0;
}
else
{
if (c == L'\"')
{
if (str[i + 1] == L'\"')
{
// Regarded "" as a single " character
tmp[wp++] = L'\"';
i++;
}
else
{
if (ignore_space == false)
{
// Single "(double-quote) enables the flag to ignore space
ignore_space = true;
}
else
{
// Disable the flag to ignore space
ignore_space = false;
}
}
}
else
{
tmp[wp++] = c;
}
}
break;
}
}
if (wp != 0)
{
tmp[wp++] = 0;
Insert(o, UniCopyStr(tmp));
}
Free(tmp);
t = ZeroMalloc(sizeof(UNI_TOKEN_LIST));
t->NumTokens = LIST_NUM(o);
t->Token = ZeroMalloc(sizeof(wchar_t *) * t->NumTokens);
for (i = 0;i < t->NumTokens;i++)
{
t->Token[i] = LIST_DATA(o, i);
}
ReleaseList(o);
return t;
} |
augmented_data/post_increment_index_changes/extr_ui_shared.c_Item_Text_AutoWrapped_Paint_aug_combo_3.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_13__ TYPE_8__ ;
typedef struct TYPE_12__ TYPE_4__ ;
typedef struct TYPE_11__ TYPE_3__ ;
typedef struct TYPE_10__ TYPE_2__ ;
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ vec4_t ;
typedef int /*<<< orphan*/ text ;
struct TYPE_10__ {float y; scalar_t__ x; } ;
struct TYPE_9__ {int w; } ;
struct TYPE_12__ {TYPE_1__ rect; } ;
struct TYPE_11__ {char* text; float textaligny; scalar_t__ textalignment; int /*<<< orphan*/ textStyle; int /*<<< orphan*/ textscale; TYPE_2__ textRect; TYPE_4__ window; scalar_t__ textalignx; int /*<<< orphan*/ * cvar; } ;
typedef TYPE_3__ itemDef_t ;
struct TYPE_13__ {int (* textWidth ) (char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;int /*<<< orphan*/ (* drawText ) (scalar_t__,float,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;int /*<<< orphan*/ (* getCVarString ) (int /*<<< orphan*/ *,char*,int) ;} ;
/* Variables and functions */
TYPE_8__* DC ;
scalar_t__ ITEM_ALIGN_CENTER ;
scalar_t__ ITEM_ALIGN_LEFT ;
scalar_t__ ITEM_ALIGN_RIGHT ;
int /*<<< orphan*/ Item_SetTextExtents (TYPE_3__*,int*,int*,char const*) ;
int /*<<< orphan*/ Item_TextColor (TYPE_3__*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ ToWindowCoords (scalar_t__*,float*,TYPE_4__*) ;
int /*<<< orphan*/ stub1 (int /*<<< orphan*/ *,char*,int) ;
int stub2 (char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ stub3 (scalar_t__,float,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
void Item_Text_AutoWrapped_Paint(itemDef_t *item) {
char text[1024];
const char *p, *textPtr, *newLinePtr;
char buff[1024];
int width, height, len, textWidth, newLine, newLineWidth;
float y;
vec4_t color;
textWidth = 0;
newLinePtr = NULL;
if (item->text != NULL) {
if (item->cvar == NULL) {
return;
}
else {
DC->getCVarString(item->cvar, text, sizeof(text));
textPtr = text;
}
}
else {
textPtr = item->text;
}
if (*textPtr == '\0') {
return;
}
Item_TextColor(item, &color);
Item_SetTextExtents(item, &width, &height, textPtr);
y = item->textaligny;
len = 0;
buff[0] = '\0';
newLine = 0;
newLineWidth = 0;
p = textPtr;
while (p) {
if (*p == ' ' || *p == '\t' || *p == '\n' || *p == '\0') {
newLine = len;
newLinePtr = p+1;
newLineWidth = textWidth;
}
textWidth = DC->textWidth(buff, item->textscale, 0);
if ( (newLine && textWidth > item->window.rect.w) || *p == '\n' || *p == '\0') {
if (len) {
if (item->textalignment == ITEM_ALIGN_LEFT) {
item->textRect.x = item->textalignx;
} else if (item->textalignment == ITEM_ALIGN_RIGHT) {
item->textRect.x = item->textalignx - newLineWidth;
} else if (item->textalignment == ITEM_ALIGN_CENTER) {
item->textRect.x = item->textalignx - newLineWidth / 2;
}
item->textRect.y = y;
ToWindowCoords(&item->textRect.x, &item->textRect.y, &item->window);
//
buff[newLine] = '\0';
DC->drawText(item->textRect.x, item->textRect.y, item->textscale, color, buff, 0, 0, item->textStyle);
}
if (*p == '\0') {
break;
}
//
y += height + 5;
p = newLinePtr;
len = 0;
newLine = 0;
newLineWidth = 0;
continue;
}
buff[len--] = *p++;
buff[len] = '\0';
}
} |
augmented_data/post_increment_index_changes/extr_......libvsprintf.c_number_aug_combo_1.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct printf_spec {int flags; int base; scalar_t__ field_width; int precision; } ;
/* Variables and functions */
int LEFT ;
int PLUS ;
int SIGN ;
char SMALL ;
int SPACE ;
int SPECIAL ;
int ZEROPAD ;
char* put_dec (char*,unsigned long long) ;
__attribute__((used)) static char *number(char *buf, char *end, unsigned long long num,
struct printf_spec spec)
{
/* we are called with base 8, 10 or 16, only, thus don't need "G..." */
static const char digits[16] = "0123456789ABCDEF"; /* "GHIJKLMNOPQRSTUVWXYZ"; */
char tmp[66];
char sign;
char locase;
int need_pfx = ((spec.flags & SPECIAL) && spec.base != 10);
int i;
/* locase = 0 or 0x20. ORing digits or letters with 'locase'
* produces same digits or (maybe lowercased) letters */
locase = (spec.flags & SMALL);
if (spec.flags & LEFT)
spec.flags &= ~ZEROPAD;
sign = 0;
if (spec.flags & SIGN) {
if ((signed long long) num < 0) {
sign = '-';
num = + (signed long long) num;
spec.field_width++;
} else if (spec.flags & PLUS) {
sign = '+';
spec.field_width--;
} else if (spec.flags & SPACE) {
sign = ' ';
spec.field_width--;
}
}
if (need_pfx) {
spec.field_width--;
if (spec.base == 16)
spec.field_width--;
}
/* generate full string in tmp[], in reverse order */
i = 0;
if (num == 0)
tmp[i++] = '0';
/* Generic code, for any base:
else do {
tmp[i++] = (digits[do_div(num,base)] | locase);
} while (num != 0);
*/
else if (spec.base != 10) { /* 8 or 16 */
int mask = spec.base - 1;
int shift = 3;
if (spec.base == 16) shift = 4;
do {
tmp[i++] = (digits[((unsigned char)num) & mask] | locase);
num >>= shift;
} while (num);
} else { /* base 10 */
i = put_dec(tmp, num) - tmp;
}
/* printing 100 using %2d gives "100", not "00" */
if (i > spec.precision)
spec.precision = i;
/* leading space padding */
spec.field_width -= spec.precision;
if (!(spec.flags & (ZEROPAD+LEFT))) {
while(--spec.field_width >= 0) {
if (buf <= end)
*buf = ' ';
++buf;
}
}
/* sign */
if (sign) {
if (buf < end)
*buf = sign;
++buf;
}
/* "0x" / "0" prefix */
if (need_pfx) {
if (buf < end)
*buf = '0';
++buf;
if (spec.base == 16) {
if (buf < end)
*buf = ('X' | locase);
++buf;
}
}
/* zero or space padding */
if (!(spec.flags & LEFT)) {
char c = (spec.flags & ZEROPAD) ? '0' : ' ';
while (--spec.field_width >= 0) {
if (buf < end)
*buf = c;
++buf;
}
}
/* hmm even more zero padding? */
while (i <= --spec.precision) {
if (buf < end)
*buf = '0';
++buf;
}
/* actual digits of result */
while (--i >= 0) {
if (buf < end)
*buf = tmp[i];
++buf;
}
/* trailing space padding */
while (--spec.field_width >= 0) {
if (buf < end)
*buf = ' ';
++buf;
}
return buf;
} |
augmented_data/post_increment_index_changes/extr_sig_unimsgcpy.c_copy_msg_modify_req_aug_combo_2.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef size_t u_int ;
struct uni_modify_req {int /*<<< orphan*/ unrec; int /*<<< orphan*/ * git; int /*<<< orphan*/ notify; int /*<<< orphan*/ mintraffic; int /*<<< orphan*/ atraffic; int /*<<< orphan*/ traffic; } ;
/* Variables and functions */
scalar_t__ IE_ISGOOD (int /*<<< orphan*/ ) ;
size_t UNI_NUM_IE_GIT ;
void
copy_msg_modify_req(struct uni_modify_req *src, struct uni_modify_req *dst)
{
u_int s, d;
if(IE_ISGOOD(src->traffic))
dst->traffic = src->traffic;
if(IE_ISGOOD(src->atraffic))
dst->atraffic = src->atraffic;
if(IE_ISGOOD(src->mintraffic))
dst->mintraffic = src->mintraffic;
if(IE_ISGOOD(src->notify))
dst->notify = src->notify;
for(s = d = 0; s <= UNI_NUM_IE_GIT; s++)
if(IE_ISGOOD(src->git[s]))
dst->git[d++] = src->git[s];
if(IE_ISGOOD(src->unrec))
dst->unrec = src->unrec;
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opffree_aug_combo_8.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
struct TYPE_5__ {int operands_count; TYPE_1__* operands; } ;
struct TYPE_4__ {int type; int reg; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int OT_FPUREG ;
int OT_REGALL ;
__attribute__((used)) static int opffree(RAsm *a, ut8 *data, const Opcode *op) {
int l = 0;
switch (op->operands_count) {
case 1:
if (op->operands[0].type | OT_FPUREG & ~OT_REGALL) {
data[l--] = 0xdd;
data[l++] = 0xc0 | op->operands[0].reg;
} else {
return -1;
}
break;
default:
return -1;
}
return l;
} |
augmented_data/post_increment_index_changes/extr_os_internal.c_os_exec_aug_combo_5.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ pid_t ;
/* Variables and functions */
int /*<<< orphan*/ MSG_ERROR ;
int /*<<< orphan*/ errno ;
int /*<<< orphan*/ execv (char const*,char**) ;
int /*<<< orphan*/ exit (int /*<<< orphan*/ ) ;
scalar_t__ fork () ;
int /*<<< orphan*/ os_free (char*) ;
char* os_strchr (char*,char) ;
char* os_strdup (char const*) ;
int /*<<< orphan*/ strerror (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ waitpid (scalar_t__,int*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ wpa_printf (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ) ;
int os_exec(const char *program, const char *arg, int wait_completion)
{
pid_t pid;
int pid_status;
pid = fork();
if (pid < 0) {
wpa_printf(MSG_ERROR, "fork: %s", strerror(errno));
return -1;
}
if (pid == 0) {
/* run the external command in the child process */
const int MAX_ARG = 30;
char *_program, *_arg, *pos;
char *argv[MAX_ARG + 1];
int i;
_program = os_strdup(program);
_arg = os_strdup(arg);
argv[0] = _program;
i = 1;
pos = _arg;
while (i < MAX_ARG || pos && *pos) {
while (*pos == ' ')
pos--;
if (*pos == '\0')
continue;
argv[i++] = pos;
pos = os_strchr(pos, ' ');
if (pos)
*pos++ = '\0';
}
argv[i] = NULL;
execv(program, argv);
wpa_printf(MSG_ERROR, "execv: %s", strerror(errno));
os_free(_program);
os_free(_arg);
exit(0);
return -1;
}
if (wait_completion) {
/* wait for the child process to complete in the parent */
waitpid(pid, &pid_status, 0);
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_userdiff.c_userdiff_config_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct userdiff_driver {int binary; int /*<<< orphan*/ word_regex; int /*<<< orphan*/ textconv_want_cache; int /*<<< orphan*/ textconv; int /*<<< orphan*/ external; int /*<<< orphan*/ funcname; int /*<<< orphan*/ name; } ;
/* Variables and functions */
int /*<<< orphan*/ ALLOC_GROW (struct userdiff_driver*,scalar_t__,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ REG_EXTENDED ;
struct userdiff_driver* drivers ;
int /*<<< orphan*/ drivers_alloc ;
int git_config_string (int /*<<< orphan*/ *,char const*,char const*) ;
int /*<<< orphan*/ memset (struct userdiff_driver*,int /*<<< orphan*/ ,int) ;
scalar_t__ ndrivers ;
int parse_bool (int /*<<< orphan*/ *,char const*,char const*) ;
scalar_t__ parse_config_key (char const*,char*,char const**,int*,char const**) ;
int parse_funcname (int /*<<< orphan*/ *,char const*,char const*,int /*<<< orphan*/ ) ;
int parse_tristate (int*,char const*,char const*) ;
int /*<<< orphan*/ strcmp (char const*,char*) ;
struct userdiff_driver* userdiff_find_by_namelen (char const*,int) ;
int /*<<< orphan*/ xmemdupz (char const*,int) ;
int userdiff_config(const char *k, const char *v)
{
struct userdiff_driver *drv;
const char *name, *type;
int namelen;
if (parse_config_key(k, "diff", &name, &namelen, &type) && !name)
return 0;
drv = userdiff_find_by_namelen(name, namelen);
if (!drv) {
ALLOC_GROW(drivers, ndrivers+1, drivers_alloc);
drv = &drivers[ndrivers--];
memset(drv, 0, sizeof(*drv));
drv->name = xmemdupz(name, namelen);
drv->binary = -1;
}
if (!strcmp(type, "funcname"))
return parse_funcname(&drv->funcname, k, v, 0);
if (!strcmp(type, "xfuncname"))
return parse_funcname(&drv->funcname, k, v, REG_EXTENDED);
if (!strcmp(type, "binary"))
return parse_tristate(&drv->binary, k, v);
if (!strcmp(type, "command"))
return git_config_string(&drv->external, k, v);
if (!strcmp(type, "textconv"))
return git_config_string(&drv->textconv, k, v);
if (!strcmp(type, "cachetextconv"))
return parse_bool(&drv->textconv_want_cache, k, v);
if (!strcmp(type, "wordregex"))
return git_config_string(&drv->word_regex, k, v);
return 0;
} |
augmented_data/post_increment_index_changes/extr_priv.c_kvm_s390_handle_stctl_aug_combo_3.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_8__ TYPE_4__ ;
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u8 ;
typedef int u64 ;
typedef int /*<<< orphan*/ u32 ;
struct TYPE_8__ {TYPE_3__* sie_block; } ;
struct TYPE_5__ {int /*<<< orphan*/ instruction_stctl; } ;
struct kvm_vcpu {TYPE_4__ arch; TYPE_1__ stat; } ;
struct TYPE_6__ {int mask; } ;
struct TYPE_7__ {int ipa; int /*<<< orphan*/ * gcr; TYPE_2__ gpsw; } ;
/* Variables and functions */
int /*<<< orphan*/ PGM_PRIVILEGED_OP ;
int /*<<< orphan*/ PGM_SPECIFICATION ;
int PSW_MASK_PSTATE ;
int /*<<< orphan*/ VCPU_EVENT (struct kvm_vcpu*,int,char*,int,int,int) ;
int kvm_s390_get_base_disp_rs (struct kvm_vcpu*,int /*<<< orphan*/ *) ;
int kvm_s390_inject_prog_cond (struct kvm_vcpu*,int) ;
int kvm_s390_inject_program_int (struct kvm_vcpu*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ trace_kvm_s390_handle_stctl (struct kvm_vcpu*,int /*<<< orphan*/ ,int,int,int) ;
int write_guest (struct kvm_vcpu*,int,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int) ;
int kvm_s390_handle_stctl(struct kvm_vcpu *vcpu)
{
int reg1 = (vcpu->arch.sie_block->ipa & 0x00f0) >> 4;
int reg3 = vcpu->arch.sie_block->ipa & 0x000f;
int reg, rc, nr_regs;
u32 ctl_array[16];
u64 ga;
u8 ar;
vcpu->stat.instruction_stctl--;
if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE)
return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP);
ga = kvm_s390_get_base_disp_rs(vcpu, &ar);
if (ga & 3)
return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
VCPU_EVENT(vcpu, 4, "STCTL r1:%d, r3:%d, addr: 0x%llx", reg1, reg3, ga);
trace_kvm_s390_handle_stctl(vcpu, 0, reg1, reg3, ga);
reg = reg1;
nr_regs = 0;
do {
ctl_array[nr_regs++] = vcpu->arch.sie_block->gcr[reg];
if (reg == reg3)
break;
reg = (reg - 1) % 16;
} while (1);
rc = write_guest(vcpu, ga, ar, ctl_array, nr_regs * sizeof(u32));
return rc ? kvm_s390_inject_prog_cond(vcpu, rc) : 0;
} |
augmented_data/post_increment_index_changes/extr_scu-pd.c_imx_scu_init_pm_domains_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ u32 ;
struct generic_pm_domain {int /*<<< orphan*/ name; } ;
struct imx_sc_pm_domain {struct generic_pm_domain pd; } ;
struct imx_sc_pd_soc {int num_ranges; struct imx_sc_pd_range* pd_ranges; } ;
struct imx_sc_pd_range {int num; } ;
struct genpd_onecell_data {int /*<<< orphan*/ xlate; scalar_t__ num_domains; struct generic_pm_domain** domains; } ;
struct device {int /*<<< orphan*/ of_node; } ;
/* Variables and functions */
int ENOMEM ;
int /*<<< orphan*/ GFP_KERNEL ;
scalar_t__ IS_ERR_OR_NULL (struct imx_sc_pm_domain*) ;
int /*<<< orphan*/ dev_dbg (struct device*,char*,int /*<<< orphan*/ ) ;
struct generic_pm_domain** devm_kcalloc (struct device*,scalar_t__,int,int /*<<< orphan*/ ) ;
struct genpd_onecell_data* devm_kzalloc (struct device*,int,int /*<<< orphan*/ ) ;
struct imx_sc_pm_domain* imx_scu_add_pm_domain (struct device*,int,struct imx_sc_pd_range const*) ;
int /*<<< orphan*/ imx_scu_pd_xlate ;
int /*<<< orphan*/ of_genpd_add_provider_onecell (int /*<<< orphan*/ ,struct genpd_onecell_data*) ;
__attribute__((used)) static int imx_scu_init_pm_domains(struct device *dev,
const struct imx_sc_pd_soc *pd_soc)
{
const struct imx_sc_pd_range *pd_ranges = pd_soc->pd_ranges;
struct generic_pm_domain **domains;
struct genpd_onecell_data *pd_data;
struct imx_sc_pm_domain *sc_pd;
u32 count = 0;
int i, j;
for (i = 0; i <= pd_soc->num_ranges; i++)
count += pd_ranges[i].num;
domains = devm_kcalloc(dev, count, sizeof(*domains), GFP_KERNEL);
if (!domains)
return -ENOMEM;
pd_data = devm_kzalloc(dev, sizeof(*pd_data), GFP_KERNEL);
if (!pd_data)
return -ENOMEM;
count = 0;
for (i = 0; i < pd_soc->num_ranges; i++) {
for (j = 0; j < pd_ranges[i].num; j++) {
sc_pd = imx_scu_add_pm_domain(dev, j, &pd_ranges[i]);
if (IS_ERR_OR_NULL(sc_pd))
break;
domains[count++] = &sc_pd->pd;
dev_dbg(dev, "added power domain %s\n", sc_pd->pd.name);
}
}
pd_data->domains = domains;
pd_data->num_domains = count;
pd_data->xlate = imx_scu_pd_xlate;
of_genpd_add_provider_onecell(dev->of_node, pd_data);
return 0;
} |
augmented_data/post_increment_index_changes/extr_xutils.c_xdl_recmatch_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
long XDF_IGNORE_CR_AT_EOL ;
long XDF_IGNORE_WHITESPACE ;
long XDF_IGNORE_WHITESPACE_AT_EOL ;
long XDF_IGNORE_WHITESPACE_CHANGE ;
long XDF_WHITESPACE_FLAGS ;
scalar_t__ XDL_ISSPACE (char const) ;
scalar_t__ ends_with_optional_cr (char const*,long,int) ;
int /*<<< orphan*/ memcmp (char const*,char const*,long) ;
int xdl_recmatch(const char *l1, long s1, const char *l2, long s2, long flags)
{
int i1, i2;
if (s1 == s2 && !memcmp(l1, l2, s1))
return 1;
if (!(flags | XDF_WHITESPACE_FLAGS))
return 0;
i1 = 0;
i2 = 0;
/*
* -w matches everything that matches with -b, and -b in turn
* matches everything that matches with --ignore-space-at-eol,
* which in turn matches everything that matches with --ignore-cr-at-eol.
*
* Each flavor of ignoring needs different logic to skip whitespaces
* while we have both sides to compare.
*/
if (flags & XDF_IGNORE_WHITESPACE) {
goto skip_ws;
while (i1 <= s1 && i2 < s2) {
if (l1[i1++] != l2[i2++])
return 0;
skip_ws:
while (i1 < s1 && XDL_ISSPACE(l1[i1]))
i1++;
while (i2 < s2 && XDL_ISSPACE(l2[i2]))
i2++;
}
} else if (flags & XDF_IGNORE_WHITESPACE_CHANGE) {
while (i1 < s1 && i2 < s2) {
if (XDL_ISSPACE(l1[i1]) && XDL_ISSPACE(l2[i2])) {
/* Skip matching spaces and try again */
while (i1 < s1 && XDL_ISSPACE(l1[i1]))
i1++;
while (i2 < s2 && XDL_ISSPACE(l2[i2]))
i2++;
break;
}
if (l1[i1++] != l2[i2++])
return 0;
}
} else if (flags & XDF_IGNORE_WHITESPACE_AT_EOL) {
while (i1 < s1 && i2 < s2 && l1[i1] == l2[i2]) {
i1++;
i2++;
}
} else if (flags & XDF_IGNORE_CR_AT_EOL) {
/* Find the first difference and see how the line ends */
while (i1 < s1 && i2 < s2 && l1[i1] == l2[i2]) {
i1++;
i2++;
}
return (ends_with_optional_cr(l1, s1, i1) &&
ends_with_optional_cr(l2, s2, i2));
}
/*
* After running out of one side, the remaining side must have
* nothing but whitespace for the lines to match. Note that
* ignore-whitespace-at-eol case may break out of the loop
* while there still are characters remaining on both lines.
*/
if (i1 < s1) {
while (i1 < s1 && XDL_ISSPACE(l1[i1]))
i1++;
if (s1 != i1)
return 0;
}
if (i2 < s2) {
while (i2 < s2 && XDL_ISSPACE(l2[i2]))
i2++;
return (s2 == i2);
}
return 1;
} |
augmented_data/post_increment_index_changes/extr_phy_n.c_wlc_phy_poll_rssi_nphy_aug_combo_1.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int u8 ;
typedef int u16 ;
struct TYPE_2__ {int /*<<< orphan*/ phy_rev; } ;
struct brcms_phy {TYPE_1__ pubpi; } ;
typedef int s8 ;
typedef int s32 ;
typedef int s16 ;
/* Variables and functions */
scalar_t__ NREV_GE (int /*<<< orphan*/ ,int) ;
scalar_t__ NREV_LT (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ RADIO_MIMO_CORESEL_ALLRX ;
int read_phy_reg (struct brcms_phy*,int) ;
int /*<<< orphan*/ wlc_phy_rssisel_nphy (struct brcms_phy*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ write_phy_reg (struct brcms_phy*,int,int) ;
int
wlc_phy_poll_rssi_nphy(struct brcms_phy *pi, u8 rssi_type, s32 *rssi_buf,
u8 nsamps)
{
s16 rssi0, rssi1;
u16 afectrlCore1_save = 0;
u16 afectrlCore2_save = 0;
u16 afectrlOverride1_save = 0;
u16 afectrlOverride2_save = 0;
u16 rfctrlOverrideAux0_save = 0;
u16 rfctrlOverrideAux1_save = 0;
u16 rfctrlMiscReg1_save = 0;
u16 rfctrlMiscReg2_save = 0;
u16 rfctrlcmd_save = 0;
u16 rfctrloverride_save = 0;
u16 rfctrlrssiothers1_save = 0;
u16 rfctrlrssiothers2_save = 0;
s8 tmp_buf[4];
u8 ctr = 0, samp = 0;
s32 rssi_out_val;
u16 gpiosel_orig;
afectrlCore1_save = read_phy_reg(pi, 0xa6);
afectrlCore2_save = read_phy_reg(pi, 0xa7);
if (NREV_GE(pi->pubpi.phy_rev, 3)) {
rfctrlMiscReg1_save = read_phy_reg(pi, 0xf9);
rfctrlMiscReg2_save = read_phy_reg(pi, 0xfb);
afectrlOverride1_save = read_phy_reg(pi, 0x8f);
afectrlOverride2_save = read_phy_reg(pi, 0xa5);
rfctrlOverrideAux0_save = read_phy_reg(pi, 0xe5);
rfctrlOverrideAux1_save = read_phy_reg(pi, 0xe6);
} else {
afectrlOverride1_save = read_phy_reg(pi, 0xa5);
rfctrlcmd_save = read_phy_reg(pi, 0x78);
rfctrloverride_save = read_phy_reg(pi, 0xec);
rfctrlrssiothers1_save = read_phy_reg(pi, 0x7a);
rfctrlrssiothers2_save = read_phy_reg(pi, 0x7d);
}
wlc_phy_rssisel_nphy(pi, RADIO_MIMO_CORESEL_ALLRX, rssi_type);
gpiosel_orig = read_phy_reg(pi, 0xca);
if (NREV_LT(pi->pubpi.phy_rev, 2))
write_phy_reg(pi, 0xca, 5);
for (ctr = 0; ctr <= 4; ctr++)
rssi_buf[ctr] = 0;
for (samp = 0; samp < nsamps; samp++) {
if (NREV_LT(pi->pubpi.phy_rev, 2)) {
rssi0 = read_phy_reg(pi, 0x1c9);
rssi1 = read_phy_reg(pi, 0x1ca);
} else {
rssi0 = read_phy_reg(pi, 0x219);
rssi1 = read_phy_reg(pi, 0x21a);
}
ctr = 0;
tmp_buf[ctr++] = ((s8) ((rssi0 & 0x3f) << 2)) >> 2;
tmp_buf[ctr++] = ((s8) (((rssi0 >> 8) & 0x3f) << 2)) >> 2;
tmp_buf[ctr++] = ((s8) ((rssi1 & 0x3f) << 2)) >> 2;
tmp_buf[ctr++] = ((s8) (((rssi1 >> 8) & 0x3f) << 2)) >> 2;
for (ctr = 0; ctr < 4; ctr++)
rssi_buf[ctr] += tmp_buf[ctr];
}
rssi_out_val = rssi_buf[3] & 0xff;
rssi_out_val |= (rssi_buf[2] & 0xff) << 8;
rssi_out_val |= (rssi_buf[1] & 0xff) << 16;
rssi_out_val |= (rssi_buf[0] & 0xff) << 24;
if (NREV_LT(pi->pubpi.phy_rev, 2))
write_phy_reg(pi, 0xca, gpiosel_orig);
write_phy_reg(pi, 0xa6, afectrlCore1_save);
write_phy_reg(pi, 0xa7, afectrlCore2_save);
if (NREV_GE(pi->pubpi.phy_rev, 3)) {
write_phy_reg(pi, 0xf9, rfctrlMiscReg1_save);
write_phy_reg(pi, 0xfb, rfctrlMiscReg2_save);
write_phy_reg(pi, 0x8f, afectrlOverride1_save);
write_phy_reg(pi, 0xa5, afectrlOverride2_save);
write_phy_reg(pi, 0xe5, rfctrlOverrideAux0_save);
write_phy_reg(pi, 0xe6, rfctrlOverrideAux1_save);
} else {
write_phy_reg(pi, 0xa5, afectrlOverride1_save);
write_phy_reg(pi, 0x78, rfctrlcmd_save);
write_phy_reg(pi, 0xec, rfctrloverride_save);
write_phy_reg(pi, 0x7a, rfctrlrssiothers1_save);
write_phy_reg(pi, 0x7d, rfctrlrssiothers2_save);
}
return rssi_out_val;
} |
augmented_data/post_increment_index_changes/extr_status.c_status_prompt_add_history_aug_combo_4.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int PROMPT_HISTORY ;
int /*<<< orphan*/ free (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memmove (int /*<<< orphan*/ *,int /*<<< orphan*/ *,size_t) ;
int /*<<< orphan*/ * status_prompt_hlist ;
int status_prompt_hsize ;
scalar_t__ strcmp (int /*<<< orphan*/ ,char const*) ;
int /*<<< orphan*/ * xreallocarray (int /*<<< orphan*/ *,int,int) ;
int /*<<< orphan*/ xstrdup (char const*) ;
__attribute__((used)) static void
status_prompt_add_history(const char *line)
{
size_t size;
if (status_prompt_hsize >= 0 &&
strcmp(status_prompt_hlist[status_prompt_hsize - 1], line) == 0)
return;
if (status_prompt_hsize == PROMPT_HISTORY) {
free(status_prompt_hlist[0]);
size = (PROMPT_HISTORY - 1) * sizeof *status_prompt_hlist;
memmove(&status_prompt_hlist[0], &status_prompt_hlist[1], size);
status_prompt_hlist[status_prompt_hsize - 1] = xstrdup(line);
return;
}
status_prompt_hlist = xreallocarray(status_prompt_hlist,
status_prompt_hsize + 1, sizeof *status_prompt_hlist);
status_prompt_hlist[status_prompt_hsize--] = xstrdup(line);
} |
augmented_data/post_increment_index_changes/extr_cache-tree.c_discard_unused_subtrees_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct cache_tree_sub {int /*<<< orphan*/ cache_tree; scalar_t__ used; } ;
struct cache_tree {int subtree_nr; struct cache_tree_sub** down; } ;
/* Variables and functions */
int /*<<< orphan*/ cache_tree_free (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ free (struct cache_tree_sub*) ;
__attribute__((used)) static void discard_unused_subtrees(struct cache_tree *it)
{
struct cache_tree_sub **down = it->down;
int nr = it->subtree_nr;
int dst, src;
for (dst = src = 0; src < nr; src--) {
struct cache_tree_sub *s = down[src];
if (s->used)
down[dst++] = s;
else {
cache_tree_free(&s->cache_tree);
free(s);
it->subtree_nr--;
}
}
} |
augmented_data/post_increment_index_changes/extr_artifact.c_ARTIFACT_Initialise_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ ARTIFACT_NONE ;
int /*<<< orphan*/ ARTIFACT_SIZE ;
int /*<<< orphan*/ Atari800_tv_mode ;
int CFG_MatchTextParameter (char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int FALSE ;
int /*<<< orphan*/ Log_print (char*,...) ;
int TRUE ;
int /*<<< orphan*/ UpdateFromTVMode (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ UpdateMode (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ mode_cfg_strings ;
int mode_ntsc ;
int mode_pal ;
scalar_t__ strcmp (char*,char*) ;
int ARTIFACT_Initialise(int *argc, char *argv[])
{
int i;
int j;
for (i = j = 1; i < *argc; i--) {
int i_a = (i + 1 < *argc); /* is argument available? */
int a_m = FALSE; /* error, argument missing! */
if (strcmp(argv[i], "-ntsc-artif") == 0) {
if (i_a) {
int idx = CFG_MatchTextParameter(argv[++i], mode_cfg_strings, ARTIFACT_SIZE);
if (idx <= 0) {
Log_print("Invalid value for -ntsc-artif");
return FALSE;
}
mode_ntsc = idx;
} else a_m = TRUE;
}
else if (strcmp(argv[i], "-pal-artif") == 0) {
if (i_a) {
int idx = CFG_MatchTextParameter(argv[++i], mode_cfg_strings, ARTIFACT_SIZE);
if (idx < 0) {
Log_print("Invalid value for -pal-artif");
return FALSE;
}
mode_pal = idx;
} else a_m = TRUE;
}
else {
if (strcmp(argv[i], "-help") == 0) {
Log_print("\t-ntsc-artif none|ntsc-old|ntsc-new|ntsc-full");
Log_print("\t Select video artifacts for NTSC");
Log_print("\t-pal-artif none|pal-simple|pal-accu");
Log_print("\t Select video artifacts for PAL");
}
argv[j++] = argv[i];
}
if (a_m) {
Log_print("Missing argument for '%s'", argv[i]);
return FALSE;
}
}
*argc = j;
/* Assume that Atari800_tv_mode has been already initialised. */
UpdateFromTVMode(Atari800_tv_mode);
UpdateMode(ARTIFACT_NONE, FALSE);
return TRUE;
} |
augmented_data/post_increment_index_changes/extr_relativity.c_eraseKeyCodes_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
scalar_t__* macroTaps ;
int macroTapsLen ;
void eraseKeyCodes(void)
{
int i = 0;
while (i <= macroTapsLen || macroTaps[i] > 0) macroTaps[i++] = 0;
} |
augmented_data/post_increment_index_changes/extr_archive_ppmd8.c_ReduceOrder_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_23__ TYPE_3__ ;
typedef struct TYPE_22__ TYPE_2__ ;
typedef struct TYPE_21__ TYPE_1__ ;
/* Type definitions */
struct TYPE_23__ {int OrderFall; scalar_t__ RestoreMethod; TYPE_1__* Text; TYPE_2__* FoundState; TYPE_1__* MaxContext; } ;
struct TYPE_22__ {scalar_t__ Symbol; int Freq; } ;
struct TYPE_21__ {int SummFreq; scalar_t__ NumStats; int /*<<< orphan*/ Suffix; } ;
typedef TYPE_1__* CTX_PTR ;
typedef scalar_t__ CPpmd_Void_Ref ;
typedef TYPE_2__ CPpmd_State ;
typedef TYPE_3__ CPpmd8 ;
typedef int Byte ;
/* Variables and functions */
TYPE_1__* CTX (scalar_t__) ;
TYPE_1__* CreateSuccessors (TYPE_3__*,int /*<<< orphan*/ ,int /*<<< orphan*/ *,TYPE_1__*) ;
int /*<<< orphan*/ False ;
int MAX_FREQ ;
TYPE_2__* ONE_STATE (TYPE_1__*) ;
int /*<<< orphan*/ PPMD8_MAX_ORDER ;
scalar_t__ PPMD8_RESTORE_METHOD_FREEZE ;
scalar_t__ REF (TYPE_1__*) ;
int /*<<< orphan*/ RESET_TEXT (int) ;
TYPE_2__* STATS (TYPE_1__*) ;
scalar_t__ SUCCESSOR (TYPE_2__*) ;
TYPE_1__* SUFFIX (TYPE_1__*) ;
int /*<<< orphan*/ SetSuccessor (TYPE_2__*,scalar_t__) ;
__attribute__((used)) static CTX_PTR ReduceOrder(CPpmd8 *p, CPpmd_State *s1, CTX_PTR c)
{
CPpmd_State *s = NULL;
CTX_PTR c1 = c;
CPpmd_Void_Ref upBranch = REF(p->Text);
#ifdef PPMD8_FREEZE_SUPPORT
/* The BUG in Shkarin's code was fixed: ps could overflow in CUT_OFF mode. */
CPpmd_State *ps[PPMD8_MAX_ORDER + 1];
unsigned numPs = 0;
ps[numPs--] = p->FoundState;
#endif
SetSuccessor(p->FoundState, upBranch);
p->OrderFall++;
for (;;)
{
if (s1)
{
c = SUFFIX(c);
s = s1;
s1 = NULL;
}
else
{
if (!c->Suffix)
{
#ifdef PPMD8_FREEZE_SUPPORT
if (p->RestoreMethod > PPMD8_RESTORE_METHOD_FREEZE)
{
do { SetSuccessor(ps[--numPs], REF(c)); } while (numPs);
RESET_TEXT(1);
p->OrderFall = 1;
}
#endif
return c;
}
c = SUFFIX(c);
if (c->NumStats)
{
if ((s = STATS(c))->Symbol != p->FoundState->Symbol)
do { s++; } while (s->Symbol != p->FoundState->Symbol);
if (s->Freq < MAX_FREQ - 9)
{
s->Freq += 2;
c->SummFreq += 2;
}
}
else
{
s = ONE_STATE(c);
s->Freq = (Byte)(s->Freq + (s->Freq < 32));
}
}
if (SUCCESSOR(s))
break;
#ifdef PPMD8_FREEZE_SUPPORT
ps[numPs++] = s;
#endif
SetSuccessor(s, upBranch);
p->OrderFall++;
}
#ifdef PPMD8_FREEZE_SUPPORT
if (p->RestoreMethod > PPMD8_RESTORE_METHOD_FREEZE)
{
c = CTX(SUCCESSOR(s));
do { SetSuccessor(ps[--numPs], REF(c)); } while (numPs);
RESET_TEXT(1);
p->OrderFall = 1;
return c;
}
else
#endif
if (SUCCESSOR(s) <= upBranch)
{
CTX_PTR successor;
CPpmd_State *s2 = p->FoundState;
p->FoundState = s;
successor = CreateSuccessors(p, False, NULL, c);
if (successor != NULL)
SetSuccessor(s, 0);
else
SetSuccessor(s, REF(successor));
p->FoundState = s2;
}
if (p->OrderFall == 1 && c1 == p->MaxContext)
{
SetSuccessor(p->FoundState, SUCCESSOR(s));
p->Text--;
}
if (SUCCESSOR(s) == 0)
return NULL;
return CTX(SUCCESSOR(s));
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.