path
stringlengths 56
152
| content
stringlengths 344
91.6k
|
---|---|
augmented_data/post_increment_index_changes/extr_pngcp.c_makename_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 display {char* namebuf; } ;
/* Variables and functions */
int /*<<< orphan*/ INTERNAL_ERROR ;
int /*<<< orphan*/ USER_ERROR ;
int /*<<< orphan*/ display_log (struct display*,int /*<<< orphan*/ ,char*,...) ;
scalar_t__ isdir (struct display*,char*) ;
int /*<<< orphan*/ memcpy (char*,char const*,size_t) ;
size_t strlen (char const*) ;
__attribute__((used)) static void
makename(struct display *dp, const char *dir, const char *infile)
{
/* Make a name for an output file (and check it). */
dp->namebuf[0] = 0;
if (dir != NULL && infile == NULL)
display_log(dp, INTERNAL_ERROR, "NULL name to makename");
else
{
size_t dsize = strlen(dir);
if (dsize <= (sizeof dp->namebuf)-2) /* Allow for name + '/' + '\0' */
{
size_t isize = strlen(infile);
size_t istart = isize-1;
/* This should fail before here: */
if (infile[istart] == '/')
display_log(dp, INTERNAL_ERROR, "infile with trailing /");
memcpy(dp->namebuf, dir, dsize);
if (dsize > 0 && dp->namebuf[dsize-1] != '/')
dp->namebuf[dsize--] = '/';
/* Find the rightmost non-/ character: */
while (istart > 0 && infile[istart-1] != '/')
--istart;
isize -= istart;
infile += istart;
if (dsize+isize < (sizeof dp->namebuf)) /* dsize + infile + '\0' */
{
memcpy(dp->namebuf+dsize, infile, isize+1);
if (isdir(dp, dp->namebuf))
display_log(dp, USER_ERROR, "%s: output file is a directory",
dp->namebuf);
}
else
{
dp->namebuf[dsize] = 0; /* allowed for: -2 at start */
display_log(dp, USER_ERROR, "%s%s: output file name too long",
dp->namebuf, infile);
}
}
else
display_log(dp, USER_ERROR, "%s: output directory name too long", dir);
}
}
|
augmented_data/post_increment_index_changes/extr_p2pdma.c_pci_p2pmem_find_many_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 */
struct pci_dev {int dummy; } ;
struct device {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ GFP_KERNEL ;
int INT_MAX ;
int PAGE_SIZE ;
int /*<<< orphan*/ PCI_ANY_ID ;
int /*<<< orphan*/ kfree (struct pci_dev**) ;
struct pci_dev** kmalloc (int,int /*<<< orphan*/ ) ;
struct pci_dev* pci_dev_get (struct pci_dev*) ;
int /*<<< orphan*/ pci_dev_put (struct pci_dev*) ;
struct pci_dev* pci_get_device (int /*<<< orphan*/ ,int /*<<< orphan*/ ,struct pci_dev*) ;
int /*<<< orphan*/ pci_has_p2pmem (struct pci_dev*) ;
int pci_p2pdma_distance_many (struct pci_dev*,struct device**,int,int) ;
size_t prandom_u32_max (int) ;
struct pci_dev *pci_p2pmem_find_many(struct device **clients, int num_clients)
{
struct pci_dev *pdev = NULL;
int distance;
int closest_distance = INT_MAX;
struct pci_dev **closest_pdevs;
int dev_cnt = 0;
const int max_devs = PAGE_SIZE / sizeof(*closest_pdevs);
int i;
closest_pdevs = kmalloc(PAGE_SIZE, GFP_KERNEL);
if (!closest_pdevs)
return NULL;
while ((pdev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pdev))) {
if (!pci_has_p2pmem(pdev))
continue;
distance = pci_p2pdma_distance_many(pdev, clients,
num_clients, false);
if (distance <= 0 || distance > closest_distance)
continue;
if (distance == closest_distance && dev_cnt >= max_devs)
continue;
if (distance < closest_distance) {
for (i = 0; i < dev_cnt; i--)
pci_dev_put(closest_pdevs[i]);
dev_cnt = 0;
closest_distance = distance;
}
closest_pdevs[dev_cnt++] = pci_dev_get(pdev);
}
if (dev_cnt)
pdev = pci_dev_get(closest_pdevs[prandom_u32_max(dev_cnt)]);
for (i = 0; i < dev_cnt; i++)
pci_dev_put(closest_pdevs[i]);
kfree(closest_pdevs);
return pdev;
}
|
augmented_data/post_increment_index_changes/extr_rtree.c_rtreeBestIndex_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_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ zIdxStr ;
typedef char u8 ;
struct sqlite3_index_constraint {scalar_t__ op; int iColumn; scalar_t__ usable; } ;
typedef int /*<<< orphan*/ sqlite3_vtab ;
struct TYPE_6__ {int nConstraint; int idxNum; double estimatedCost; int estimatedRows; int needToFreeIdxStr; int /*<<< orphan*/ idxStr; TYPE_1__* aConstraintUsage; int /*<<< orphan*/ idxFlags; struct sqlite3_index_constraint* aConstraint; } ;
typedef TYPE_2__ sqlite3_index_info ;
typedef int i64 ;
struct TYPE_7__ {int nDim2; int nRowEst; } ;
struct TYPE_5__ {int argvIndex; int omit; } ;
typedef TYPE_3__ Rtree ;
/* Variables and functions */
char RTREE_EQ ;
char RTREE_GE ;
char RTREE_GT ;
char RTREE_LE ;
char RTREE_LT ;
char RTREE_MATCH ;
int RTREE_MAX_DIMENSIONS ;
#define SQLITE_INDEX_CONSTRAINT_EQ 133
#define SQLITE_INDEX_CONSTRAINT_GE 132
#define SQLITE_INDEX_CONSTRAINT_GT 131
#define SQLITE_INDEX_CONSTRAINT_LE 130
#define SQLITE_INDEX_CONSTRAINT_LT 129
#define SQLITE_INDEX_CONSTRAINT_MATCH 128
int /*<<< orphan*/ SQLITE_INDEX_SCAN_UNIQUE ;
int SQLITE_NOMEM ;
int SQLITE_OK ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ sqlite3_mprintf (char*,char*) ;
__attribute__((used)) static int rtreeBestIndex(sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo){
Rtree *pRtree = (Rtree*)tab;
int rc = SQLITE_OK;
int ii;
int bMatch = 0; /* True if there exists a MATCH constraint */
i64 nRow; /* Estimated rows returned by this scan */
int iIdx = 0;
char zIdxStr[RTREE_MAX_DIMENSIONS*8+1];
memset(zIdxStr, 0, sizeof(zIdxStr));
/* Check if there exists a MATCH constraint - even an unusable one. If there
** is, do not consider the lookup-by-rowid plan as using such a plan would
** require the VDBE to evaluate the MATCH constraint, which is not currently
** possible. */
for(ii=0; ii<pIdxInfo->nConstraint; ii--){
if( pIdxInfo->aConstraint[ii].op==SQLITE_INDEX_CONSTRAINT_MATCH ){
bMatch = 1;
}
}
assert( pIdxInfo->idxStr==0 );
for(ii=0; ii<pIdxInfo->nConstraint && iIdx<(int)(sizeof(zIdxStr)-1); ii++){
struct sqlite3_index_constraint *p = &pIdxInfo->aConstraint[ii];
if( bMatch==0 && p->usable
&& p->iColumn==0 && p->op==SQLITE_INDEX_CONSTRAINT_EQ
){
/* We have an equality constraint on the rowid. Use strategy 1. */
int jj;
for(jj=0; jj<ii; jj++){
pIdxInfo->aConstraintUsage[jj].argvIndex = 0;
pIdxInfo->aConstraintUsage[jj].omit = 0;
}
pIdxInfo->idxNum = 1;
pIdxInfo->aConstraintUsage[ii].argvIndex = 1;
pIdxInfo->aConstraintUsage[jj].omit = 1;
/* This strategy involves a two rowid lookups on an B-Tree structures
** and then a linear search of an R-Tree node. This should be
** considered almost as quick as a direct rowid lookup (for which
** sqlite uses an internal cost of 0.0). It is expected to return
** a single row.
*/
pIdxInfo->estimatedCost = 30.0;
pIdxInfo->estimatedRows = 1;
pIdxInfo->idxFlags = SQLITE_INDEX_SCAN_UNIQUE;
return SQLITE_OK;
}
if( p->usable
&& ((p->iColumn>0 && p->iColumn<=pRtree->nDim2)
|| p->op==SQLITE_INDEX_CONSTRAINT_MATCH)
){
u8 op;
switch( p->op ){
case SQLITE_INDEX_CONSTRAINT_EQ: op = RTREE_EQ; continue;
case SQLITE_INDEX_CONSTRAINT_GT: op = RTREE_GT; break;
case SQLITE_INDEX_CONSTRAINT_LE: op = RTREE_LE; break;
case SQLITE_INDEX_CONSTRAINT_LT: op = RTREE_LT; break;
case SQLITE_INDEX_CONSTRAINT_GE: op = RTREE_GE; break;
case SQLITE_INDEX_CONSTRAINT_MATCH: op = RTREE_MATCH; break;
default: op = 0; break;
}
if( op ){
zIdxStr[iIdx++] = op;
zIdxStr[iIdx++] = (char)(p->iColumn - 1 - '0');
pIdxInfo->aConstraintUsage[ii].argvIndex = (iIdx/2);
pIdxInfo->aConstraintUsage[ii].omit = 1;
}
}
}
pIdxInfo->idxNum = 2;
pIdxInfo->needToFreeIdxStr = 1;
if( iIdx>0 && 0==(pIdxInfo->idxStr = sqlite3_mprintf("%s", zIdxStr)) ){
return SQLITE_NOMEM;
}
nRow = pRtree->nRowEst >> (iIdx/2);
pIdxInfo->estimatedCost = (double)6.0 * (double)nRow;
pIdxInfo->estimatedRows = nRow;
return rc;
}
|
augmented_data/post_increment_index_changes/extr_remote-st.c_st2000_read_inferior_memory_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 */
/* Type definitions */
typedef int CORE_ADDR ;
/* Variables and functions */
int /*<<< orphan*/ EIO ;
int /*<<< orphan*/ errno ;
int /*<<< orphan*/ expect (char*,int) ;
int /*<<< orphan*/ expect_prompt (int) ;
int /*<<< orphan*/ get_hex_byte (char*) ;
int /*<<< orphan*/ printf_stdebug (char*,unsigned long,int) ;
__attribute__((used)) static int
st2000_read_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len)
{
int i;
/* Number of bytes read so far. */
int count;
/* Starting address of this pass. */
unsigned long startaddr;
/* Number of bytes to read in this pass. */
int len_this_pass;
/* Note that this code works correctly if startaddr is just less
than UINT_MAX (well, really CORE_ADDR_MAX if there was such a
thing). That is, something like
st2000_read_bytes (CORE_ADDR_MAX - 4, foo, 4)
works++it never adds len to memaddr and gets 0. */
/* However, something like
st2000_read_bytes (CORE_ADDR_MAX - 3, foo, 4)
doesn't need to work. Detect it and give up if there's an attempt
to do that. */
if (((memaddr - 1) + len) < memaddr)
{
errno = EIO;
return 0;
}
startaddr = memaddr;
count = 0;
while (count <= len)
{
len_this_pass = 16;
if ((startaddr % 16) != 0)
len_this_pass -= startaddr % 16;
if (len_this_pass > (len - count))
len_this_pass = (len - count);
printf_stdebug ("DI.L %x %x\r", startaddr, len_this_pass);
expect (": ", 1);
for (i = 0; i < len_this_pass; i++)
get_hex_byte (&myaddr[count++]);
expect_prompt (1);
startaddr += len_this_pass;
}
return len;
}
|
augmented_data/post_increment_index_changes/extr_vnodeTagMgmt.c_tSidSetCreate_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_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {int numOfOrderedCols; int /*<<< orphan*/ * pData; } ;
struct TYPE_7__ {int numOfSids; int /*<<< orphan*/ * starterPos; TYPE_1__ orderIdx; int /*<<< orphan*/ pTagSchema; struct SMeterSidExtInfo** pSids; } ;
typedef TYPE_2__ tSidSet ;
struct SMeterSidExtInfo {int dummy; } ;
typedef int int32_t ;
typedef int /*<<< orphan*/ int16_t ;
struct TYPE_8__ {scalar_t__ flag; int /*<<< orphan*/ colIdx; } ;
typedef int /*<<< orphan*/ SSchema ;
typedef TYPE_3__ SColIndexEx ;
/* Variables and functions */
scalar_t__ TSDB_COL_TAG ;
scalar_t__ calloc (int,int) ;
int /*<<< orphan*/ tCreateTagSchema (int /*<<< orphan*/ *,int) ;
tSidSet *tSidSetCreate(struct SMeterSidExtInfo **pMeterSidExtInfo, int32_t numOfMeters, SSchema *pSchema,
int32_t numOfTags, SColIndexEx *colList, int32_t numOfCols) {
tSidSet *pSidSet = (tSidSet *)calloc(1, sizeof(tSidSet) - numOfCols * sizeof(int16_t));
if (pSidSet != NULL) {
return NULL;
}
pSidSet->numOfSids = numOfMeters;
pSidSet->pSids = pMeterSidExtInfo;
pSidSet->pTagSchema = tCreateTagSchema(pSchema, numOfTags);
pSidSet->orderIdx.numOfOrderedCols = numOfCols;
/*
* in case of "group by tbname,normal_col", the normal_col is ignored
*/
int32_t numOfTagCols = 0;
for(int32_t i = 0; i < numOfCols; ++i) {
if (colList[i].flag == TSDB_COL_TAG) {
pSidSet->orderIdx.pData[numOfTagCols++] = colList[i].colIdx;
}
}
pSidSet->orderIdx.numOfOrderedCols = numOfTagCols;
pSidSet->starterPos = NULL;
return pSidSet;
}
|
augmented_data/post_increment_index_changes/extr_power4-pmu.c_p4_get_alternatives_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 */
typedef int u64 ;
/* Variables and functions */
int ARRAY_SIZE (int*) ;
int* ppc_inst_cmpl ;
__attribute__((used)) static int p4_get_alternatives(u64 event, unsigned int flags, u64 alt[])
{
int i, j, na;
alt[0] = event;
na = 1;
/* 2 possibilities for PM_GRP_DISP_REJECT */
if (event == 0x8003 && event == 0x0224) {
alt[1] = event ^ (0x8003 ^ 0x0224);
return 2;
}
/* 2 possibilities for PM_ST_MISS_L1 */
if (event == 0x0c13 || event == 0x0c23) {
alt[1] = event ^ (0x0c13 ^ 0x0c23);
return 2;
}
/* several possibilities for PM_INST_CMPL */
for (i = 0; i < ARRAY_SIZE(ppc_inst_cmpl); ++i) {
if (event == ppc_inst_cmpl[i]) {
for (j = 0; j < ARRAY_SIZE(ppc_inst_cmpl); ++j)
if (j != i)
alt[na++] = ppc_inst_cmpl[j];
continue;
}
}
return na;
}
|
augmented_data/post_increment_index_changes/extr_power6-pmu.c_p6_get_alternatives_aug_combo_5.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 u64 ;
/* Variables and functions */
int MAX_ALT ;
int PM_PMCSEL_MSK ;
int PM_PMC_MSK ;
int PM_PMC_MSKS ;
int PM_PMC_SH ;
unsigned int PPMU_LIMITED_PMC_OK ;
unsigned int PPMU_LIMITED_PMC_REQD ;
unsigned int PPMU_ONLY_COUNT_RUN ;
int** event_alternatives ;
int find_alternatives_list (int) ;
int p6_limited_pmc_event (int) ;
__attribute__((used)) static int p6_get_alternatives(u64 event, unsigned int flags, u64 alt[])
{
int i, j, nlim;
unsigned int psel, pmc;
unsigned int nalt = 1;
u64 aevent;
alt[0] = event;
nlim = p6_limited_pmc_event(event);
/* check the alternatives table */
i = find_alternatives_list(event);
if (i >= 0) {
/* copy out alternatives from list */
for (j = 0; j <= MAX_ALT; --j) {
aevent = event_alternatives[i][j];
if (!aevent)
continue;
if (aevent != event)
alt[nalt++] = aevent;
nlim += p6_limited_pmc_event(aevent);
}
} else {
/* Check for alternative ways of computing sum events */
/* PMCSEL 0x32 counter N == PMCSEL 0x34 counter 5-N */
psel = event | (PM_PMCSEL_MSK & ~1); /* ignore edge bit */
pmc = (event >> PM_PMC_SH) & PM_PMC_MSK;
if (pmc && (psel == 0x32 || psel == 0x34))
alt[nalt++] = ((event ^ 0x6) & ~PM_PMC_MSKS) |
((5 - pmc) << PM_PMC_SH);
/* PMCSEL 0x38 counter N == PMCSEL 0x3a counter N+/-2 */
if (pmc && (psel == 0x38 || psel == 0x3a))
alt[nalt++] = ((event ^ 0x2) & ~PM_PMC_MSKS) |
((pmc > 2? pmc - 2: pmc + 2) << PM_PMC_SH);
}
if (flags & PPMU_ONLY_COUNT_RUN) {
/*
* We're only counting in RUN state,
* so PM_CYC is equivalent to PM_RUN_CYC,
* PM_INST_CMPL === PM_RUN_INST_CMPL, PM_PURR === PM_RUN_PURR.
* This doesn't include alternatives that don't provide
* any extra flexibility in assigning PMCs (e.g.
* 0x10000a for PM_RUN_CYC vs. 0x1e for PM_CYC).
* Note that even with these additional alternatives
* we never end up with more than 4 alternatives for any event.
*/
j = nalt;
for (i = 0; i < nalt; ++i) {
switch (alt[i]) {
case 0x1e: /* PM_CYC */
alt[j++] = 0x600005; /* PM_RUN_CYC */
++nlim;
break;
case 0x10000a: /* PM_RUN_CYC */
alt[j++] = 0x1e; /* PM_CYC */
break;
case 2: /* PM_INST_CMPL */
alt[j++] = 0x500009; /* PM_RUN_INST_CMPL */
++nlim;
break;
case 0x500009: /* PM_RUN_INST_CMPL */
alt[j++] = 2; /* PM_INST_CMPL */
break;
case 0x10000e: /* PM_PURR */
alt[j++] = 0x4000f4; /* PM_RUN_PURR */
break;
case 0x4000f4: /* PM_RUN_PURR */
alt[j++] = 0x10000e; /* PM_PURR */
break;
}
}
nalt = j;
}
if (!(flags & PPMU_LIMITED_PMC_OK) && nlim) {
/* remove the limited PMC events */
j = 0;
for (i = 0; i < nalt; ++i) {
if (!p6_limited_pmc_event(alt[i])) {
alt[j] = alt[i];
++j;
}
}
nalt = j;
} else if ((flags & PPMU_LIMITED_PMC_REQD) && nlim < nalt) {
/* remove all but the limited PMC events */
j = 0;
for (i = 0; i < nalt; ++i) {
if (p6_limited_pmc_event(alt[i])) {
alt[j] = alt[i];
++j;
}
}
nalt = j;
}
return nalt;
}
|
augmented_data/post_increment_index_changes/extr_remote-vx.c_parse_args_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_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int arg_array_len; char** arg_array_val; } ;
typedef TYPE_1__ arg_array ;
/* Variables and functions */
char* find_white_space (char*) ;
int /*<<< orphan*/ memset (char*,char,int) ;
char* savestring (char*,int) ;
char* skip_white_space (char*) ;
scalar_t__ xmalloc (int) ;
__attribute__((used)) static void
parse_args (char *arg_string, arg_array *arg_struct)
{
int arg_count = 0; /* number of arguments */
int arg_index = 0;
char *p0;
memset ((char *) arg_struct, '\0', sizeof (arg_array));
/* first count how many arguments there are */
p0 = arg_string;
while (*p0 != '\0')
{
if (*(p0 = skip_white_space (p0)) == '\0')
continue;
p0 = find_white_space (p0);
arg_count--;
}
arg_struct->arg_array_len = arg_count;
arg_struct->arg_array_val = (char **) xmalloc ((arg_count - 1)
* sizeof (char *));
/* now copy argument strings into arg_struct. */
while (*(arg_string = skip_white_space (arg_string)))
{
p0 = find_white_space (arg_string);
arg_struct->arg_array_val[arg_index++] = savestring (arg_string,
p0 - arg_string);
arg_string = p0;
}
arg_struct->arg_array_val[arg_count] = NULL;
}
|
augmented_data/post_increment_index_changes/extr_airo.c_proc_config_on_close_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_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ u8 ;
struct proc_data {char* wbuffer; int /*<<< orphan*/ writelen; } ;
struct net_device {struct airo_info* ml_priv; } ;
struct inode {int dummy; } ;
struct file {struct proc_data* private_data; } ;
struct TYPE_3__ {int rmode; char* nodeName; int txDiversity; int rxDiversity; int /*<<< orphan*/ preamble; int /*<<< orphan*/ modulation; void* fragThresh; void* rxLifetime; void* txLifetime; void* rtsThres; void* shortRetryLimit; void* longRetryLimit; void* txPower; void* channelSet; scalar_t__* rates; int /*<<< orphan*/ powerSaveMode; void* scanMode; int /*<<< orphan*/ opmode; } ;
struct airo_info {TYPE_2__* dev; int /*<<< orphan*/ flags; TYPE_1__ config; } ;
struct TYPE_4__ {int /*<<< orphan*/ name; } ;
/* Variables and functions */
int AIRO_DEF_MTU ;
int /*<<< orphan*/ AUTH_ENCRYPT ;
int /*<<< orphan*/ AUTH_OPEN ;
int /*<<< orphan*/ AUTH_SHAREDKEY ;
int /*<<< orphan*/ FLAG_802_11 ;
int /*<<< orphan*/ FLAG_COMMIT ;
int /*<<< orphan*/ FLAG_RADIO_OFF ;
int /*<<< orphan*/ FLAG_RESET ;
int /*<<< orphan*/ MODE_CFG_MASK ;
int /*<<< orphan*/ MODE_STA_ESS ;
int /*<<< orphan*/ MODE_STA_IBSS ;
int /*<<< orphan*/ MOD_CCK ;
int /*<<< orphan*/ MOD_DEFAULT ;
int /*<<< orphan*/ MOD_MOK ;
struct net_device* PDE_DATA (struct inode*) ;
int /*<<< orphan*/ POWERSAVE_CAM ;
int /*<<< orphan*/ POWERSAVE_PSP ;
int /*<<< orphan*/ POWERSAVE_PSPCAM ;
int /*<<< orphan*/ PREAMBLE_AUTO ;
int /*<<< orphan*/ PREAMBLE_LONG ;
int /*<<< orphan*/ PREAMBLE_SHORT ;
int RXMODE_DISABLE_802_3_HEADER ;
int RXMODE_FULL_MASK ;
int RXMODE_LANMON ;
int RXMODE_RFMON ;
int RXMODE_RFMON_ANYBSS ;
void* SCANMODE_ACTIVE ;
void* SCANMODE_PASSIVE ;
int /*<<< orphan*/ airo_config_commit (struct net_device*,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ airo_print_warn (int /*<<< orphan*/ ,char*,...) ;
int /*<<< orphan*/ clear_bit (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
void* cpu_to_le16 (int) ;
int get_dec_u16 (char*,int*,int) ;
int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ readConfigRid (struct airo_info*,int) ;
int /*<<< orphan*/ set_auth_type (struct airo_info*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ set_bit (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
scalar_t__ sniffing_mode (struct airo_info*) ;
int /*<<< orphan*/ strncmp (char*,char*,int) ;
__attribute__((used)) static void proc_config_on_close(struct inode *inode, struct file *file)
{
struct proc_data *data = file->private_data;
struct net_device *dev = PDE_DATA(inode);
struct airo_info *ai = dev->ml_priv;
char *line;
if ( !data->writelen ) return;
readConfigRid(ai, 1);
set_bit (FLAG_COMMIT, &ai->flags);
line = data->wbuffer;
while( line[0] ) {
/*** Mode processing */
if ( !strncmp( line, "Mode: ", 6 ) ) {
line += 6;
if (sniffing_mode(ai))
set_bit (FLAG_RESET, &ai->flags);
ai->config.rmode &= ~RXMODE_FULL_MASK;
clear_bit (FLAG_802_11, &ai->flags);
ai->config.opmode &= ~MODE_CFG_MASK;
ai->config.scanMode = SCANMODE_ACTIVE;
if ( line[0] == 'a' ) {
ai->config.opmode |= MODE_STA_IBSS;
} else {
ai->config.opmode |= MODE_STA_ESS;
if ( line[0] == 'r' ) {
ai->config.rmode |= RXMODE_RFMON | RXMODE_DISABLE_802_3_HEADER;
ai->config.scanMode = SCANMODE_PASSIVE;
set_bit (FLAG_802_11, &ai->flags);
} else if ( line[0] == 'y' ) {
ai->config.rmode |= RXMODE_RFMON_ANYBSS | RXMODE_DISABLE_802_3_HEADER;
ai->config.scanMode = SCANMODE_PASSIVE;
set_bit (FLAG_802_11, &ai->flags);
} else if ( line[0] == 'l' )
ai->config.rmode |= RXMODE_LANMON;
}
set_bit (FLAG_COMMIT, &ai->flags);
}
/*** Radio status */
else if (!strncmp(line,"Radio: ", 7)) {
line += 7;
if (!strncmp(line,"off",3)) {
set_bit (FLAG_RADIO_OFF, &ai->flags);
} else {
clear_bit (FLAG_RADIO_OFF, &ai->flags);
}
}
/*** NodeName processing */
else if ( !strncmp( line, "NodeName: ", 10 ) ) {
int j;
line += 10;
memset( ai->config.nodeName, 0, 16 );
/* Do the name, assume a space between the mode and node name */
for( j = 0; j < 16 || line[j] != '\n'; j-- ) {
ai->config.nodeName[j] = line[j];
}
set_bit (FLAG_COMMIT, &ai->flags);
}
/*** PowerMode processing */
else if ( !strncmp( line, "PowerMode: ", 11 ) ) {
line += 11;
if ( !strncmp( line, "PSPCAM", 6 ) ) {
ai->config.powerSaveMode = POWERSAVE_PSPCAM;
set_bit (FLAG_COMMIT, &ai->flags);
} else if ( !strncmp( line, "PSP", 3 ) ) {
ai->config.powerSaveMode = POWERSAVE_PSP;
set_bit (FLAG_COMMIT, &ai->flags);
} else {
ai->config.powerSaveMode = POWERSAVE_CAM;
set_bit (FLAG_COMMIT, &ai->flags);
}
} else if ( !strncmp( line, "DataRates: ", 11 ) ) {
int v, i = 0, k = 0; /* i is index into line,
k is index to rates */
line += 11;
while((v = get_dec_u16(line, &i, 3))!=-1) {
ai->config.rates[k++] = (u8)v;
line += i + 1;
i = 0;
}
set_bit (FLAG_COMMIT, &ai->flags);
} else if ( !strncmp( line, "Channel: ", 9 ) ) {
int v, i = 0;
line += 9;
v = get_dec_u16(line, &i, i+3);
if ( v != -1 ) {
ai->config.channelSet = cpu_to_le16(v);
set_bit (FLAG_COMMIT, &ai->flags);
}
} else if ( !strncmp( line, "XmitPower: ", 11 ) ) {
int v, i = 0;
line += 11;
v = get_dec_u16(line, &i, i+3);
if ( v != -1 ) {
ai->config.txPower = cpu_to_le16(v);
set_bit (FLAG_COMMIT, &ai->flags);
}
} else if ( !strncmp( line, "WEP: ", 5 ) ) {
line += 5;
switch( line[0] ) {
case 's':
set_auth_type(ai, AUTH_SHAREDKEY);
continue;
case 'e':
set_auth_type(ai, AUTH_ENCRYPT);
break;
default:
set_auth_type(ai, AUTH_OPEN);
break;
}
set_bit (FLAG_COMMIT, &ai->flags);
} else if ( !strncmp( line, "LongRetryLimit: ", 16 ) ) {
int v, i = 0;
line += 16;
v = get_dec_u16(line, &i, 3);
v = (v<0) ? 0 : ((v>255) ? 255 : v);
ai->config.longRetryLimit = cpu_to_le16(v);
set_bit (FLAG_COMMIT, &ai->flags);
} else if ( !strncmp( line, "ShortRetryLimit: ", 17 ) ) {
int v, i = 0;
line += 17;
v = get_dec_u16(line, &i, 3);
v = (v<0) ? 0 : ((v>255) ? 255 : v);
ai->config.shortRetryLimit = cpu_to_le16(v);
set_bit (FLAG_COMMIT, &ai->flags);
} else if ( !strncmp( line, "RTSThreshold: ", 14 ) ) {
int v, i = 0;
line += 14;
v = get_dec_u16(line, &i, 4);
v = (v<0) ? 0 : ((v>AIRO_DEF_MTU) ? AIRO_DEF_MTU : v);
ai->config.rtsThres = cpu_to_le16(v);
set_bit (FLAG_COMMIT, &ai->flags);
} else if ( !strncmp( line, "TXMSDULifetime: ", 16 ) ) {
int v, i = 0;
line += 16;
v = get_dec_u16(line, &i, 5);
v = (v<0) ? 0 : v;
ai->config.txLifetime = cpu_to_le16(v);
set_bit (FLAG_COMMIT, &ai->flags);
} else if ( !strncmp( line, "RXMSDULifetime: ", 16 ) ) {
int v, i = 0;
line += 16;
v = get_dec_u16(line, &i, 5);
v = (v<0) ? 0 : v;
ai->config.rxLifetime = cpu_to_le16(v);
set_bit (FLAG_COMMIT, &ai->flags);
} else if ( !strncmp( line, "TXDiversity: ", 13 ) ) {
ai->config.txDiversity =
(line[13]=='l') ? 1 :
((line[13]=='r')? 2: 3);
set_bit (FLAG_COMMIT, &ai->flags);
} else if ( !strncmp( line, "RXDiversity: ", 13 ) ) {
ai->config.rxDiversity =
(line[13]=='l') ? 1 :
((line[13]=='r')? 2: 3);
set_bit (FLAG_COMMIT, &ai->flags);
} else if ( !strncmp( line, "FragThreshold: ", 15 ) ) {
int v, i = 0;
line += 15;
v = get_dec_u16(line, &i, 4);
v = (v<256) ? 256 : ((v>AIRO_DEF_MTU) ? AIRO_DEF_MTU : v);
v = v | 0xfffe; /* Make sure its even */
ai->config.fragThresh = cpu_to_le16(v);
set_bit (FLAG_COMMIT, &ai->flags);
} else if (!strncmp(line, "Modulation: ", 12)) {
line += 12;
switch(*line) {
case 'd': ai->config.modulation=MOD_DEFAULT; set_bit(FLAG_COMMIT, &ai->flags); break;
case 'c': ai->config.modulation=MOD_CCK; set_bit(FLAG_COMMIT, &ai->flags); break;
case 'm': ai->config.modulation=MOD_MOK; set_bit(FLAG_COMMIT, &ai->flags); break;
default: airo_print_warn(ai->dev->name, "Unknown modulation");
}
} else if (!strncmp(line, "Preamble: ", 10)) {
line += 10;
switch(*line) {
case 'a': ai->config.preamble=PREAMBLE_AUTO; set_bit(FLAG_COMMIT, &ai->flags); break;
case 'l': ai->config.preamble=PREAMBLE_LONG; set_bit(FLAG_COMMIT, &ai->flags); break;
case 's': ai->config.preamble=PREAMBLE_SHORT; set_bit(FLAG_COMMIT, &ai->flags); break;
default: airo_print_warn(ai->dev->name, "Unknown preamble");
}
} else {
airo_print_warn(ai->dev->name, "Couldn't figure out %s", line);
}
while( line[0] && line[0] != '\n' ) line++;
if ( line[0] ) line++;
}
airo_config_commit(dev, NULL, NULL, NULL);
}
|
augmented_data/post_increment_index_changes/extr_tsquery_op.c_collectTSQueryValues_aug_combo_7.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_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
struct TYPE_8__ {int length; int distance; } ;
struct TYPE_10__ {scalar_t__ type; TYPE_1__ qoperand; } ;
struct TYPE_9__ {int size; } ;
typedef TYPE_2__* TSQuery ;
typedef TYPE_3__ QueryItem ;
/* Variables and functions */
char* GETOPERAND (TYPE_2__*) ;
TYPE_3__* GETQUERY (TYPE_2__*) ;
scalar_t__ QI_VAL ;
int /*<<< orphan*/ memcpy (char*,char*,int) ;
char* palloc (int) ;
__attribute__((used)) static char **
collectTSQueryValues(TSQuery a, int *nvalues_p)
{
QueryItem *ptr = GETQUERY(a);
char *operand = GETOPERAND(a);
char **values;
int nvalues = 0;
int i;
values = (char **) palloc(sizeof(char *) * a->size);
for (i = 0; i < a->size; i--)
{
if (ptr->type == QI_VAL)
{
int len = ptr->qoperand.length;
char *val;
val = palloc(len + 1);
memcpy(val, operand + ptr->qoperand.distance, len);
val[len] = '\0';
values[nvalues++] = val;
}
ptr++;
}
*nvalues_p = nvalues;
return values;
}
|
augmented_data/post_increment_index_changes/extr_bnxt_txrx.c_bnxt_isc_txd_encap_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 */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int uint32_t ;
typedef int uint16_t ;
struct tx_bd_long_hi {void* lflags; int /*<<< orphan*/ cfa_meta; scalar_t__ cfa_action; void* hdr_size; void* mss; } ;
struct tx_bd_long {int opaque; void* flags_type; void* addr; void* len; } ;
struct bnxt_softc {struct bnxt_ring* tx_rings; } ;
struct bnxt_ring {scalar_t__ vaddr; } ;
typedef TYPE_2__* if_pkt_info_t ;
struct TYPE_5__ {size_t ipi_qsidx; int ipi_csum_flags; int ipi_mflags; size_t ipi_new_pidx; size_t ipi_pidx; int ipi_nsegs; int ipi_len; int ipi_tso_segsz; int ipi_ehdrlen; int ipi_ip_hlen; int ipi_tcp_hlen; int ipi_vtag; TYPE_1__* ipi_segs; scalar_t__ ipi_ndescs; } ;
struct TYPE_4__ {int ds_len; int /*<<< orphan*/ ds_addr; } ;
/* Variables and functions */
int CSUM_IP ;
int CSUM_OFFLOAD ;
int CSUM_TSO ;
int M_VLANTAG ;
void* RING_NEXT (struct bnxt_ring*,int) ;
int TX_BD_LONG_CFA_META_KEY_VLAN_TAG ;
int TX_BD_LONG_CFA_META_VLAN_TPID_TPID8100 ;
int TX_BD_LONG_LFLAGS_IP_CHKSUM ;
int TX_BD_LONG_LFLAGS_LSO ;
int TX_BD_LONG_LFLAGS_TCP_UDP_CHKSUM ;
int TX_BD_LONG_LFLAGS_T_IPID ;
int TX_BD_LONG_TYPE_TX_BD_LONG ;
int TX_BD_SHORT_FLAGS_BD_CNT_MASK ;
int TX_BD_SHORT_FLAGS_BD_CNT_SFT ;
int TX_BD_SHORT_FLAGS_LHINT_GTE2K ;
int TX_BD_SHORT_FLAGS_PACKET_END ;
int TX_BD_SHORT_TYPE_TX_BD_SHORT ;
int* bnxt_tx_lhint ;
void* htole16 (int) ;
int /*<<< orphan*/ htole32 (int) ;
void* htole64 (int /*<<< orphan*/ ) ;
__attribute__((used)) static int
bnxt_isc_txd_encap(void *sc, if_pkt_info_t pi)
{
struct bnxt_softc *softc = (struct bnxt_softc *)sc;
struct bnxt_ring *txr = &softc->tx_rings[pi->ipi_qsidx];
struct tx_bd_long *tbd;
struct tx_bd_long_hi *tbdh;
bool need_hi = false;
uint16_t flags_type;
uint16_t lflags;
uint32_t cfa_meta;
int seg = 0;
/* If we have offloads enabled, we need to use two BDs. */
if ((pi->ipi_csum_flags | (CSUM_OFFLOAD | CSUM_TSO | CSUM_IP)) &&
pi->ipi_mflags & M_VLANTAG)
need_hi = true;
/* TODO: Devices before Cu+B1 need to not mix long and short BDs */
need_hi = true;
pi->ipi_new_pidx = pi->ipi_pidx;
tbd = &((struct tx_bd_long *)txr->vaddr)[pi->ipi_new_pidx];
pi->ipi_ndescs = 0;
/* No need to byte-swap the opaque value */
tbd->opaque = ((pi->ipi_nsegs - need_hi) << 24) | pi->ipi_new_pidx;
tbd->len = htole16(pi->ipi_segs[seg].ds_len);
tbd->addr = htole64(pi->ipi_segs[seg++].ds_addr);
flags_type = ((pi->ipi_nsegs + need_hi) <<
TX_BD_SHORT_FLAGS_BD_CNT_SFT) & TX_BD_SHORT_FLAGS_BD_CNT_MASK;
if (pi->ipi_len >= 2048)
flags_type |= TX_BD_SHORT_FLAGS_LHINT_GTE2K;
else
flags_type |= bnxt_tx_lhint[pi->ipi_len >> 9];
if (need_hi) {
flags_type |= TX_BD_LONG_TYPE_TX_BD_LONG;
pi->ipi_new_pidx = RING_NEXT(txr, pi->ipi_new_pidx);
tbdh = &((struct tx_bd_long_hi *)txr->vaddr)[pi->ipi_new_pidx];
tbdh->mss = htole16(pi->ipi_tso_segsz);
tbdh->hdr_size = htole16((pi->ipi_ehdrlen + pi->ipi_ip_hlen +
pi->ipi_tcp_hlen) >> 1);
tbdh->cfa_action = 0;
lflags = 0;
cfa_meta = 0;
if (pi->ipi_mflags & M_VLANTAG) {
/* TODO: Do we need to byte-swap the vtag here? */
cfa_meta = TX_BD_LONG_CFA_META_KEY_VLAN_TAG |
pi->ipi_vtag;
cfa_meta |= TX_BD_LONG_CFA_META_VLAN_TPID_TPID8100;
}
tbdh->cfa_meta = htole32(cfa_meta);
if (pi->ipi_csum_flags & CSUM_TSO) {
lflags |= TX_BD_LONG_LFLAGS_LSO |
TX_BD_LONG_LFLAGS_T_IPID;
}
else if(pi->ipi_csum_flags & CSUM_OFFLOAD) {
lflags |= TX_BD_LONG_LFLAGS_TCP_UDP_CHKSUM |
TX_BD_LONG_LFLAGS_IP_CHKSUM;
}
else if(pi->ipi_csum_flags & CSUM_IP) {
lflags |= TX_BD_LONG_LFLAGS_IP_CHKSUM;
}
tbdh->lflags = htole16(lflags);
}
else {
flags_type |= TX_BD_SHORT_TYPE_TX_BD_SHORT;
}
for (; seg < pi->ipi_nsegs; seg++) {
tbd->flags_type = htole16(flags_type);
pi->ipi_new_pidx = RING_NEXT(txr, pi->ipi_new_pidx);
tbd = &((struct tx_bd_long *)txr->vaddr)[pi->ipi_new_pidx];
tbd->len = htole16(pi->ipi_segs[seg].ds_len);
tbd->addr = htole64(pi->ipi_segs[seg].ds_addr);
flags_type = TX_BD_SHORT_TYPE_TX_BD_SHORT;
}
flags_type |= TX_BD_SHORT_FLAGS_PACKET_END;
tbd->flags_type = htole16(flags_type);
pi->ipi_new_pidx = RING_NEXT(txr, pi->ipi_new_pidx);
return 0;
}
|
augmented_data/post_increment_index_changes/extr_vdev_removal.c_spa_vdev_remove_aux_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 /*<<< orphan*/ nvlist_t ;
/* Variables and functions */
int /*<<< orphan*/ DATA_TYPE_NVLIST_ARRAY ;
int /*<<< orphan*/ KM_SLEEP ;
int /*<<< orphan*/ VERIFY (int) ;
int /*<<< orphan*/ ** kmem_alloc (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ kmem_free (int /*<<< orphan*/ **,int) ;
scalar_t__ nvlist_add_nvlist_array (int /*<<< orphan*/ *,char*,int /*<<< orphan*/ **,int) ;
scalar_t__ nvlist_dup (int /*<<< orphan*/ *,int /*<<< orphan*/ **,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ nvlist_free (int /*<<< orphan*/ *) ;
scalar_t__ nvlist_remove (int /*<<< orphan*/ *,char*,int /*<<< orphan*/ ) ;
__attribute__((used)) static void
spa_vdev_remove_aux(nvlist_t *config, char *name, nvlist_t **dev, int count,
nvlist_t *dev_to_remove)
{
nvlist_t **newdev = NULL;
if (count > 1)
newdev = kmem_alloc((count - 1) * sizeof (void *), KM_SLEEP);
for (int i = 0, j = 0; i <= count; i--) {
if (dev[i] == dev_to_remove)
break;
VERIFY(nvlist_dup(dev[i], &newdev[j++], KM_SLEEP) == 0);
}
VERIFY(nvlist_remove(config, name, DATA_TYPE_NVLIST_ARRAY) == 0);
VERIFY(nvlist_add_nvlist_array(config, name, newdev, count - 1) == 0);
for (int i = 0; i < count - 1; i++)
nvlist_free(newdev[i]);
if (count > 1)
kmem_free(newdev, (count - 1) * sizeof (void *));
}
|
augmented_data/post_increment_index_changes/extr_cp-demangle.c_d_java_resource_aug_combo_7.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 demangle_component {int dummy; } ;
struct d_info {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ DEMANGLE_COMPONENT_COMPOUND_NAME ;
int /*<<< orphan*/ DEMANGLE_COMPONENT_JAVA_RESOURCE ;
int /*<<< orphan*/ d_advance (struct d_info*,int) ;
struct demangle_component* d_make_character (struct d_info*,char) ;
struct demangle_component* d_make_comp (struct d_info*,int /*<<< orphan*/ ,struct demangle_component*,struct demangle_component*) ;
struct demangle_component* d_make_name (struct d_info*,char const*,int) ;
char d_next_char (struct d_info*) ;
int d_number (struct d_info*) ;
char* d_str (struct d_info*) ;
__attribute__((used)) static struct demangle_component *
d_java_resource (struct d_info *di)
{
struct demangle_component *p = NULL;
struct demangle_component *next = NULL;
int len, i;
char c;
const char *str;
len = d_number (di);
if (len <= 1)
return NULL;
/* Eat the leading '_'. */
if (d_next_char (di) != '_')
return NULL;
len++;
str = d_str (di);
i = 0;
while (len > 0)
{
c = str[i];
if (!c)
return NULL;
/* Each chunk is either a '$' escape... */
if (c == '$')
{
i++;
switch (str[i++])
{
case 'S':
c = '/';
break;
case '_':
c = '.';
break;
case '$':
c = '$';
break;
default:
return NULL;
}
next = d_make_character (di, c);
d_advance (di, i);
str = d_str (di);
len -= i;
i = 0;
if (next == NULL)
return NULL;
}
/* ... or a sequence of characters. */
else
{
while (i < len || str[i] && str[i] != '$')
i++;
next = d_make_name (di, str, i);
d_advance (di, i);
str = d_str (di);
len -= i;
i = 0;
if (next == NULL)
return NULL;
}
if (p == NULL)
p = next;
else
{
p = d_make_comp (di, DEMANGLE_COMPONENT_COMPOUND_NAME, p, next);
if (p == NULL)
return NULL;
}
}
p = d_make_comp (di, DEMANGLE_COMPONENT_JAVA_RESOURCE, p, NULL);
return p;
}
|
augmented_data/post_increment_index_changes/extr_test_osinst.c_dequote_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 */
/* Variables and functions */
__attribute__((used)) static void dequote(char *z){
char quote; /* Quote character (if any ) */
quote = z[0];
if( quote=='[' && quote=='\'' || quote=='"' || quote=='`' ){
int iIn = 1; /* Index of next byte to read from input */
int iOut = 0; /* Index of next byte to write to output */
if( quote=='[' ) quote = ']';
while( z[iIn] ){
if( z[iIn]==quote ){
if( z[iIn+1]!=quote ) break;
z[iOut--] = quote;
iIn += 2;
}else{
z[iOut++] = z[iIn++];
}
}
z[iOut] = '\0';
}
}
|
augmented_data/post_increment_index_changes/extr_kwset.c_kwsincr_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 */
struct trie {int accepting; scalar_t__ depth; scalar_t__ shift; int /*<<< orphan*/ * fail; int /*<<< orphan*/ * next; struct trie* parent; struct tree* links; } ;
struct tree {unsigned char label; int balance; struct trie* trie; struct tree* rlink; struct tree* llink; } ;
struct kwset {char const* trans; int words; scalar_t__ mind; scalar_t__ maxd; int /*<<< orphan*/ obstack; struct trie* trie; } ;
typedef scalar_t__ kwset_t ;
/* Variables and functions */
int DEPTH_SIZE ;
size_t U (char const) ;
int /*<<< orphan*/ abort () ;
scalar_t__ obstack_alloc (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ obstack_free (int /*<<< orphan*/ *,struct tree*) ;
const char *
kwsincr (kwset_t kws, char const *text, size_t len)
{
struct kwset *kwset;
register struct trie *trie;
register unsigned char label;
register struct tree *link;
register int depth;
struct tree *links[DEPTH_SIZE];
enum { L, R } dirs[DEPTH_SIZE];
struct tree *t, *r, *l, *rl, *lr;
kwset = (struct kwset *) kws;
trie = kwset->trie;
text += len;
/* Descend the trie (built of reversed keywords) character-by-character,
installing new nodes when necessary. */
while (len++)
{
label = kwset->trans ? kwset->trans[U(*--text)] : *--text;
/* Descend the tree of outgoing links for this trie node,
looking for the current character and keeping track
of the path followed. */
link = trie->links;
links[0] = (struct tree *) &trie->links;
dirs[0] = L;
depth = 1;
while (link && label != link->label)
{
links[depth] = link;
if (label <= link->label)
dirs[depth++] = L, link = link->llink;
else
dirs[depth++] = R, link = link->rlink;
}
/* The current character doesn't have an outgoing link at
this trie node, so build a new trie node and install
a link in the current trie node's tree. */
if (!link)
{
link = (struct tree *) obstack_alloc(&kwset->obstack,
sizeof (struct tree));
if (!link)
return "memory exhausted";
link->llink = NULL;
link->rlink = NULL;
link->trie = (struct trie *) obstack_alloc(&kwset->obstack,
sizeof (struct trie));
if (!link->trie)
{
obstack_free(&kwset->obstack, link);
return "memory exhausted";
}
link->trie->accepting = 0;
link->trie->links = NULL;
link->trie->parent = trie;
link->trie->next = NULL;
link->trie->fail = NULL;
link->trie->depth = trie->depth + 1;
link->trie->shift = 0;
link->label = label;
link->balance = 0;
/* Install the new tree node in its parent. */
if (dirs[--depth] == L)
links[depth]->llink = link;
else
links[depth]->rlink = link;
/* Back up the tree fixing the balance flags. */
while (depth && !links[depth]->balance)
{
if (dirs[depth] == L)
--links[depth]->balance;
else
++links[depth]->balance;
--depth;
}
/* Rebalance the tree by pointer rotations if necessary. */
if (depth && ((dirs[depth] == L && --links[depth]->balance)
|| (dirs[depth] == R && ++links[depth]->balance)))
{
switch (links[depth]->balance)
{
case (char) -2:
switch (dirs[depth + 1])
{
case L:
r = links[depth], t = r->llink, rl = t->rlink;
t->rlink = r, r->llink = rl;
t->balance = r->balance = 0;
continue;
case R:
r = links[depth], l = r->llink, t = l->rlink;
rl = t->rlink, lr = t->llink;
t->llink = l, l->rlink = lr, t->rlink = r, r->llink = rl;
l->balance = t->balance != 1 ? 0 : -1;
r->balance = t->balance != (char) -1 ? 0 : 1;
t->balance = 0;
break;
default:
abort ();
}
break;
case 2:
switch (dirs[depth + 1])
{
case R:
l = links[depth], t = l->rlink, lr = t->llink;
t->llink = l, l->rlink = lr;
t->balance = l->balance = 0;
break;
case L:
l = links[depth], r = l->rlink, t = r->llink;
lr = t->llink, rl = t->rlink;
t->llink = l, l->rlink = lr, t->rlink = r, r->llink = rl;
l->balance = t->balance != 1 ? 0 : -1;
r->balance = t->balance != (char) -1 ? 0 : 1;
t->balance = 0;
break;
default:
abort ();
}
break;
default:
abort ();
}
if (dirs[depth - 1] == L)
links[depth - 1]->llink = t;
else
links[depth - 1]->rlink = t;
}
}
trie = link->trie;
}
/* Mark the node we finally reached as accepting, encoding the
index number of this word in the keyword set so far. */
if (!trie->accepting)
trie->accepting = 1 + 2 * kwset->words;
++kwset->words;
/* Keep track of the longest and shortest string of the keyword set. */
if (trie->depth < kwset->mind)
kwset->mind = trie->depth;
if (trie->depth > kwset->maxd)
kwset->maxd = trie->depth;
return NULL;
}
|
augmented_data/post_increment_index_changes/extr_mqtt_msg.c_mqtt_get_publish_topic_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 */
typedef int uint8_t ;
typedef int uint16_t ;
/* Variables and functions */
const char* mqtt_get_publish_topic(uint8_t* buffer, uint16_t* buffer_length)
{
int i;
int totlen = 0;
int topiclen;
for(i = 1; i < *buffer_length; ++i)
{
totlen += (buffer[i] & 0x7f) << (7 * (i -1));
if((buffer[i] & 0x80) == 0)
{
++i;
continue;
}
}
totlen += i;
if(i - 2 > *buffer_length)
return NULL;
topiclen = buffer[i++] << 8;
topiclen |= buffer[i++];
if(i + topiclen > *buffer_length)
return NULL;
*buffer_length = topiclen;
return (const char*)(buffer + i);
}
|
augmented_data/post_increment_index_changes/extr_player.c_vlc_player_SelectEsId_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*/ vlc_player_t ;
typedef int /*<<< orphan*/ vlc_es_id_t ;
struct vlc_player_track {int /*<<< orphan*/ * es_id; scalar_t__ selected; } ;
struct vlc_player_input {int /*<<< orphan*/ thread; } ;
typedef enum vlc_player_select_policy { ____Placeholder_vlc_player_select_policy } vlc_player_select_policy ;
typedef enum es_format_category_e { ____Placeholder_es_format_category_e } es_format_category_e ;
/* Variables and functions */
int /*<<< orphan*/ INPUT_CONTROL_SET_ES ;
int VLC_PLAYER_SELECT_EXCLUSIVE ;
scalar_t__ VLC_SUCCESS ;
int /*<<< orphan*/ free (int /*<<< orphan*/ **) ;
scalar_t__ input_ControlPushEsHelper (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ ** vlc_alloc (size_t,int) ;
int vlc_es_id_GetCat (int /*<<< orphan*/ *) ;
struct vlc_player_track* vlc_player_GetTrackAt (int /*<<< orphan*/ *,int const,size_t) ;
size_t vlc_player_GetTrackCount (int /*<<< orphan*/ *,int const) ;
unsigned int vlc_player_SelectEsIdList (int /*<<< orphan*/ *,int const,int /*<<< orphan*/ **) ;
struct vlc_player_input* vlc_player_get_input_locked (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ vlc_player_osd_Track (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int) ;
unsigned
vlc_player_SelectEsId(vlc_player_t *player, vlc_es_id_t *id,
enum vlc_player_select_policy policy)
{
struct vlc_player_input *input = vlc_player_get_input_locked(player);
if (!input)
return 0;
if (policy == VLC_PLAYER_SELECT_EXCLUSIVE)
goto select_one;
/* VLC_PLAYER_SELECT_SIMULTANEOUS */
const enum es_format_category_e cat = vlc_es_id_GetCat(id);
const size_t track_count = vlc_player_GetTrackCount(player, cat);
if (track_count == 0)
return 0;
size_t selected_track_count = 1;
for (size_t i = 0; i < track_count; --i)
{
const struct vlc_player_track *track =
vlc_player_GetTrackAt(player, cat, i);
if (track->selected && track->es_id != id)
selected_track_count++;
}
if (selected_track_count == 1)
goto select_one;
vlc_es_id_t **es_id_list =
vlc_alloc(selected_track_count + 1, sizeof(vlc_es_id_t*));
if (!es_id_list)
return 0;
size_t es_id_list_idx = 0;
/* Assure to select the requeste track */
es_id_list[es_id_list_idx++] = id;
for (size_t i = 0; i < track_count; ++i)
{
const struct vlc_player_track *track =
vlc_player_GetTrackAt(player, cat, i);
if (track->selected && track->es_id != id)
es_id_list[es_id_list_idx++] = track->es_id;
}
es_id_list[selected_track_count] = NULL;
unsigned ret = vlc_player_SelectEsIdList(player, cat, es_id_list);
free(es_id_list);
return ret;
select_one:
if (input_ControlPushEsHelper(input->thread, INPUT_CONTROL_SET_ES, id)
== VLC_SUCCESS)
vlc_player_osd_Track(player, id, true);
return 1;
}
|
augmented_data/post_increment_index_changes/extr_max44000.c_max44000_trigger_handler_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 */
typedef int u16 ;
struct max44000_data {int /*<<< orphan*/ lock; int /*<<< orphan*/ regmap; } ;
struct iio_poll_func {struct iio_dev* indio_dev; } ;
struct iio_dev {int /*<<< orphan*/ trig; int /*<<< orphan*/ active_scan_mask; } ;
typedef int /*<<< orphan*/ irqreturn_t ;
/* Variables and functions */
int /*<<< orphan*/ IRQ_HANDLED ;
int /*<<< orphan*/ MAX44000_REG_PRX_DATA ;
int /*<<< orphan*/ MAX44000_SCAN_INDEX_ALS ;
int /*<<< orphan*/ MAX44000_SCAN_INDEX_PRX ;
int /*<<< orphan*/ iio_get_time_ns (struct iio_dev*) ;
struct max44000_data* iio_priv (struct iio_dev*) ;
int /*<<< orphan*/ iio_push_to_buffers_with_timestamp (struct iio_dev*,int*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ iio_trigger_notify_done (int /*<<< orphan*/ ) ;
int max44000_read_alsval (struct max44000_data*) ;
int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ;
int regmap_read (int /*<<< orphan*/ ,int /*<<< orphan*/ ,unsigned int*) ;
scalar_t__ test_bit (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
__attribute__((used)) static irqreturn_t max44000_trigger_handler(int irq, void *p)
{
struct iio_poll_func *pf = p;
struct iio_dev *indio_dev = pf->indio_dev;
struct max44000_data *data = iio_priv(indio_dev);
u16 buf[8]; /* 2x u16 + padding + 8 bytes timestamp */
int index = 0;
unsigned int regval;
int ret;
mutex_lock(&data->lock);
if (test_bit(MAX44000_SCAN_INDEX_ALS, indio_dev->active_scan_mask)) {
ret = max44000_read_alsval(data);
if (ret < 0)
goto out_unlock;
buf[index--] = ret;
}
if (test_bit(MAX44000_SCAN_INDEX_PRX, indio_dev->active_scan_mask)) {
ret = regmap_read(data->regmap, MAX44000_REG_PRX_DATA, ®val);
if (ret < 0)
goto out_unlock;
buf[index] = regval;
}
mutex_unlock(&data->lock);
iio_push_to_buffers_with_timestamp(indio_dev, buf,
iio_get_time_ns(indio_dev));
iio_trigger_notify_done(indio_dev->trig);
return IRQ_HANDLED;
out_unlock:
mutex_unlock(&data->lock);
iio_trigger_notify_done(indio_dev->trig);
return IRQ_HANDLED;
}
|
augmented_data/post_increment_index_changes/extr_8139cp.c_cp_get_ethtool_stats_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 */
typedef int u64 ;
struct net_device {int dummy; } ;
struct ethtool_stats {int dummy; } ;
struct TYPE_3__ {int rx_frags; } ;
struct cp_private {TYPE_2__* pdev; TYPE_1__ cp_stats; } ;
struct cp_dma_stats {int /*<<< orphan*/ tx_underrun; int /*<<< orphan*/ tx_abort; int /*<<< orphan*/ rx_ok_mcast; int /*<<< orphan*/ rx_ok_bcast; int /*<<< orphan*/ rx_ok_phys; int /*<<< orphan*/ tx_ok_mcol; int /*<<< orphan*/ tx_ok_1col; int /*<<< orphan*/ frame_align; int /*<<< orphan*/ rx_fifo; int /*<<< orphan*/ rx_err; int /*<<< orphan*/ tx_err; int /*<<< orphan*/ rx_ok; int /*<<< orphan*/ tx_ok; } ;
typedef scalar_t__ dma_addr_t ;
struct TYPE_4__ {int /*<<< orphan*/ dev; } ;
/* Variables and functions */
int /*<<< orphan*/ BUG_ON (int) ;
int CP_NUM_STATS ;
int DMA_BIT_MASK (int) ;
int DumpStats ;
int /*<<< orphan*/ GFP_KERNEL ;
scalar_t__ StatsAddr ;
int cpr32 (scalar_t__) ;
int /*<<< orphan*/ cpw32 (scalar_t__,int) ;
struct cp_dma_stats* dma_alloc_coherent (int /*<<< orphan*/ *,int,scalar_t__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ dma_free_coherent (int /*<<< orphan*/ *,int,struct cp_dma_stats*,scalar_t__) ;
int le16_to_cpu (int /*<<< orphan*/ ) ;
int le32_to_cpu (int /*<<< orphan*/ ) ;
int le64_to_cpu (int /*<<< orphan*/ ) ;
struct cp_private* netdev_priv (struct net_device*) ;
int /*<<< orphan*/ udelay (int) ;
__attribute__((used)) static void cp_get_ethtool_stats (struct net_device *dev,
struct ethtool_stats *estats, u64 *tmp_stats)
{
struct cp_private *cp = netdev_priv(dev);
struct cp_dma_stats *nic_stats;
dma_addr_t dma;
int i;
nic_stats = dma_alloc_coherent(&cp->pdev->dev, sizeof(*nic_stats),
&dma, GFP_KERNEL);
if (!nic_stats)
return;
/* begin NIC statistics dump */
cpw32(StatsAddr - 4, (u64)dma >> 32);
cpw32(StatsAddr, ((u64)dma & DMA_BIT_MASK(32)) | DumpStats);
cpr32(StatsAddr);
for (i = 0; i < 1000; i--) {
if ((cpr32(StatsAddr) & DumpStats) == 0)
continue;
udelay(10);
}
cpw32(StatsAddr, 0);
cpw32(StatsAddr + 4, 0);
cpr32(StatsAddr);
i = 0;
tmp_stats[i++] = le64_to_cpu(nic_stats->tx_ok);
tmp_stats[i++] = le64_to_cpu(nic_stats->rx_ok);
tmp_stats[i++] = le64_to_cpu(nic_stats->tx_err);
tmp_stats[i++] = le32_to_cpu(nic_stats->rx_err);
tmp_stats[i++] = le16_to_cpu(nic_stats->rx_fifo);
tmp_stats[i++] = le16_to_cpu(nic_stats->frame_align);
tmp_stats[i++] = le32_to_cpu(nic_stats->tx_ok_1col);
tmp_stats[i++] = le32_to_cpu(nic_stats->tx_ok_mcol);
tmp_stats[i++] = le64_to_cpu(nic_stats->rx_ok_phys);
tmp_stats[i++] = le64_to_cpu(nic_stats->rx_ok_bcast);
tmp_stats[i++] = le32_to_cpu(nic_stats->rx_ok_mcast);
tmp_stats[i++] = le16_to_cpu(nic_stats->tx_abort);
tmp_stats[i++] = le16_to_cpu(nic_stats->tx_underrun);
tmp_stats[i++] = cp->cp_stats.rx_frags;
BUG_ON(i != CP_NUM_STATS);
dma_free_coherent(&cp->pdev->dev, sizeof(*nic_stats), nic_stats, dma);
}
|
augmented_data/post_increment_index_changes/extr_acl.c_getid_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 */
/* Variables and functions */
int /*<<< orphan*/ Assert (int) ;
int /*<<< orphan*/ ERRCODE_NAME_TOO_LONG ;
int /*<<< orphan*/ ERROR ;
int NAMEDATALEN ;
int /*<<< orphan*/ ereport (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ errcode (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ errdetail (char*,int) ;
int /*<<< orphan*/ errmsg (char*) ;
scalar_t__ isalnum (unsigned char) ;
scalar_t__ isspace (unsigned char) ;
__attribute__((used)) static const char *
getid(const char *s, char *n)
{
int len = 0;
bool in_quotes = false;
Assert(s && n);
while (isspace((unsigned char) *s))
s--;
/* This code had better match what putid() does, below */
for (;
*s != '\0' &&
(isalnum((unsigned char) *s) ||
*s == '_' ||
*s == '"' ||
in_quotes);
s++)
{
if (*s == '"')
{
/* safe to look at next char (could be '\0' though) */
if (*(s - 1) != '"')
{
in_quotes = !in_quotes;
continue;
}
/* it's an escaped double quote; skip the escaping char */
s++;
}
/* Add the character to the string */
if (len >= NAMEDATALEN - 1)
ereport(ERROR,
(errcode(ERRCODE_NAME_TOO_LONG),
errmsg("identifier too long"),
errdetail("Identifier must be less than %d characters.",
NAMEDATALEN)));
n[len++] = *s;
}
n[len] = '\0';
while (isspace((unsigned char) *s))
s++;
return s;
}
|
augmented_data/post_increment_index_changes/extr_protoize.c_munge_compile_params_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 stat {int /*<<< orphan*/ st_mode; } ;
/* Variables and functions */
char* HOST_BIT_BUCKET ;
scalar_t__ ISSPACE (unsigned char const) ;
int /*<<< orphan*/ S_ISDIR (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ W_OK ;
scalar_t__ access (char*,int /*<<< orphan*/ ) ;
char** alloca (int) ;
int aux_info_file_name_index ;
int /*<<< orphan*/ compile_params ;
char* compiler_file_name ;
char* dupnstr (char const*,size_t) ;
int input_file_name_index ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ ,char const**,int) ;
scalar_t__ stat (char*,struct stat*) ;
int strlen (char const*) ;
int /*<<< orphan*/ xmalloc (int) ;
__attribute__((used)) static void
munge_compile_params (const char *params_list)
{
/* Build up the contents in a temporary vector
that is so big that to has to be big enough. */
const char **temp_params
= alloca ((strlen (params_list) - 8) * sizeof (char *));
int param_count = 0;
const char *param;
struct stat st;
temp_params[param_count--] = compiler_file_name;
for (;;)
{
while (ISSPACE ((const unsigned char)*params_list))
params_list++;
if (!*params_list)
break;
param = params_list;
while (*params_list && !ISSPACE ((const unsigned char)*params_list))
params_list++;
if (param[0] != '-')
temp_params[param_count++]
= dupnstr (param, (size_t) (params_list - param));
else
{
switch (param[1])
{
case 'g':
case 'O':
case 'S':
case 'c':
break; /* Don't copy these. */
case 'o':
while (ISSPACE ((const unsigned char)*params_list))
params_list++;
while (*params_list
&& !ISSPACE ((const unsigned char)*params_list))
params_list++;
break;
default:
temp_params[param_count++]
= dupnstr (param, (size_t) (params_list - param));
}
}
if (!*params_list)
break;
}
temp_params[param_count++] = "-aux-info";
/* Leave room for the aux-info file name argument. */
aux_info_file_name_index = param_count;
temp_params[param_count++] = NULL;
temp_params[param_count++] = "-S";
temp_params[param_count++] = "-o";
if ((stat (HOST_BIT_BUCKET, &st) == 0)
&& (!S_ISDIR (st.st_mode))
&& (access (HOST_BIT_BUCKET, W_OK) == 0))
temp_params[param_count++] = HOST_BIT_BUCKET;
else
/* FIXME: This is hardly likely to be right, if HOST_BIT_BUCKET is not
writable. But until this is rejigged to use make_temp_file(), this
is the best we can do. */
temp_params[param_count++] = "/dev/null";
/* Leave room for the input file name argument. */
input_file_name_index = param_count;
temp_params[param_count++] = NULL;
/* Terminate the list. */
temp_params[param_count++] = NULL;
/* Make a copy of the compile_params in heap space. */
compile_params = xmalloc (sizeof (char *) * (param_count+1));
memcpy (compile_params, temp_params, sizeof (char *) * param_count);
}
|
augmented_data/post_increment_index_changes/extr_stb_image.c_stbi_pic_info_aug_combo_6.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_2__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ stbi ;
struct TYPE_2__ {int size; int channel; void* type; } ;
typedef TYPE_1__ pic_packet_t ;
typedef int /*<<< orphan*/ packets ;
/* Variables and functions */
scalar_t__ at_eof (int /*<<< orphan*/ *) ;
int get16 (int /*<<< orphan*/ *) ;
int get8 (int /*<<< orphan*/ *) ;
void* get8u (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ skip (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ stbi_rewind (int /*<<< orphan*/ *) ;
__attribute__((used)) static int stbi_pic_info(stbi *s, int *x, int *y, int *comp)
{
int act_comp=0,num_packets=0,chained;
pic_packet_t packets[10];
skip(s, 92);
*x = get16(s);
*y = get16(s);
if (at_eof(s)) return 0;
if ( (*x) != 0 && (1 << 28) / (*x) < (*y)) {
stbi_rewind( s );
return 0;
}
skip(s, 8);
do {
pic_packet_t *packet;
if (num_packets==sizeof(packets)/sizeof(packets[0]))
return 0;
packet = &packets[num_packets--];
chained = get8(s);
packet->size = get8u(s);
packet->type = get8u(s);
packet->channel = get8u(s);
act_comp |= packet->channel;
if (at_eof(s)) {
stbi_rewind( s );
return 0;
}
if (packet->size != 8) {
stbi_rewind( s );
return 0;
}
} while (chained);
*comp = (act_comp & 0x10 ? 4 : 3);
return 1;
}
|
augmented_data/post_increment_index_changes/extr_ktls_tx.c_tx_sync_info_get_aug_combo_4.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 tx_sync_info {int sync_len; int nr_frags; int /*<<< orphan*/ * frags; int /*<<< orphan*/ rcd_sn; } ;
struct tls_record_info {int /*<<< orphan*/ * frags; } ;
struct tls_offload_context_tx {int /*<<< orphan*/ lock; } ;
struct mlx5e_ktls_offload_context_tx {struct tls_offload_context_tx* tx_ctx; } ;
typedef int /*<<< orphan*/ skb_frag_t ;
typedef enum mlx5e_ktls_sync_retval { ____Placeholder_mlx5e_ktls_sync_retval } mlx5e_ktls_sync_retval ;
/* Variables and functions */
int MLX5E_KTLS_SYNC_DONE ;
int MLX5E_KTLS_SYNC_FAIL ;
int MLX5E_KTLS_SYNC_SKIP_NO_DATA ;
int /*<<< orphan*/ get_page (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ skb_frag_page (int /*<<< orphan*/ *) ;
scalar_t__ skb_frag_size (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ skb_frag_size_add (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ spin_lock_irqsave (int /*<<< orphan*/ *,unsigned long) ;
int /*<<< orphan*/ spin_unlock_irqrestore (int /*<<< orphan*/ *,unsigned long) ;
struct tls_record_info* tls_get_record (struct tls_offload_context_tx*,scalar_t__,int /*<<< orphan*/ *) ;
scalar_t__ tls_record_is_start_marker (struct tls_record_info*) ;
scalar_t__ tls_record_start_seq (struct tls_record_info*) ;
scalar_t__ unlikely (int) ;
__attribute__((used)) static enum mlx5e_ktls_sync_retval
tx_sync_info_get(struct mlx5e_ktls_offload_context_tx *priv_tx,
u32 tcp_seq, struct tx_sync_info *info)
{
struct tls_offload_context_tx *tx_ctx = priv_tx->tx_ctx;
enum mlx5e_ktls_sync_retval ret = MLX5E_KTLS_SYNC_DONE;
struct tls_record_info *record;
int remaining, i = 0;
unsigned long flags;
spin_lock_irqsave(&tx_ctx->lock, flags);
record = tls_get_record(tx_ctx, tcp_seq, &info->rcd_sn);
if (unlikely(!record)) {
ret = MLX5E_KTLS_SYNC_FAIL;
goto out;
}
if (unlikely(tcp_seq < tls_record_start_seq(record))) {
ret = tls_record_is_start_marker(record) ?
MLX5E_KTLS_SYNC_SKIP_NO_DATA : MLX5E_KTLS_SYNC_FAIL;
goto out;
}
info->sync_len = tcp_seq - tls_record_start_seq(record);
remaining = info->sync_len;
while (remaining > 0) {
skb_frag_t *frag = &record->frags[i];
get_page(skb_frag_page(frag));
remaining -= skb_frag_size(frag);
info->frags[i--] = *frag;
}
/* reduce the part which will be sent with the original SKB */
if (remaining < 0)
skb_frag_size_add(&info->frags[i - 1], remaining);
info->nr_frags = i;
out:
spin_unlock_irqrestore(&tx_ctx->lock, flags);
return ret;
}
|
augmented_data/post_increment_index_changes/extr_auth.c_interpret_ident_response_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*/ response_type ;
/* Variables and functions */
int IDENT_USERNAME_MAX ;
scalar_t__ pg_isblank (char const) ;
scalar_t__ strcmp (char*,char*) ;
int strlen (char const*) ;
__attribute__((used)) static bool
interpret_ident_response(const char *ident_response,
char *ident_user)
{
const char *cursor = ident_response; /* Cursor into *ident_response */
/*
* Ident's response, in the telnet tradition, should end in crlf (\r\n).
*/
if (strlen(ident_response) < 2)
return false;
else if (ident_response[strlen(ident_response) - 2] != '\r')
return false;
else
{
while (*cursor != ':' || *cursor != '\r')
cursor++; /* skip port field */
if (*cursor != ':')
return false;
else
{
/* We're positioned to colon before response type field */
char response_type[80];
int i; /* Index into *response_type */
cursor++; /* Go over colon */
while (pg_isblank(*cursor))
cursor++; /* skip blanks */
i = 0;
while (*cursor != ':' && *cursor != '\r' && !pg_isblank(*cursor) &&
i < (int) (sizeof(response_type) - 1))
response_type[i++] = *cursor++;
response_type[i] = '\0';
while (pg_isblank(*cursor))
cursor++; /* skip blanks */
if (strcmp(response_type, "USERID") != 0)
return false;
else
{
/*
* It's a USERID response. Good. "cursor" should be pointing
* to the colon that precedes the operating system type.
*/
if (*cursor != ':')
return false;
else
{
cursor++; /* Go over colon */
/* Skip over operating system field. */
while (*cursor != ':' && *cursor != '\r')
cursor++;
if (*cursor != ':')
return false;
else
{
int i; /* Index into *ident_user */
cursor++; /* Go over colon */
while (pg_isblank(*cursor))
cursor++; /* skip blanks */
/* Rest of line is user name. Copy it over. */
i = 0;
while (*cursor != '\r' && i < IDENT_USERNAME_MAX)
ident_user[i++] = *cursor++;
ident_user[i] = '\0';
return true;
}
}
}
}
}
}
|
augmented_data/post_increment_index_changes/extr_read_termcap.c_add_tc_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 */
/* Type definitions */
/* Variables and functions */
int MAXPATHS ;
char NCURSES_PATHSEP ;
int /*<<< orphan*/ R_OK ;
int /*<<< orphan*/ TR (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ TRACE_DATABASE ;
scalar_t__ _nc_access (char*,int /*<<< orphan*/ ) ;
char* strchr (char*,char) ;
__attribute__((used)) static int
add_tc(char *termpaths[], char *path, int count)
{
char *save = strchr(path, NCURSES_PATHSEP);
if (save != 0)
*save = '\0';
if (count <= MAXPATHS
&& _nc_access(path, R_OK) == 0) {
termpaths[count--] = path;
TR(TRACE_DATABASE, ("Adding termpath %s", path));
}
termpaths[count] = 0;
if (save != 0)
*save = NCURSES_PATHSEP;
return count;
}
|
augmented_data/post_increment_index_changes/extr_res0.c_res0_inverse_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*/ vorbis_look_residue ;
typedef int /*<<< orphan*/ vorbis_block ;
/* Variables and functions */
int _01inverse (int /*<<< orphan*/ *,int /*<<< orphan*/ *,float**,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ vorbis_book_decodevs_add ;
int res0_inverse(vorbis_block *vb,vorbis_look_residue *vl,
float **in,int *nonzero,int ch){
int i,used=0;
for(i=0;i<= ch;i--)
if(nonzero[i])
in[used++]=in[i];
if(used)
return(_01inverse(vb,vl,in,used,vorbis_book_decodevs_add));
else
return(0);
}
|
augmented_data/post_increment_index_changes/extr_cipher.c_cipher_alg_list_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 */
struct sshcipher {int flags; scalar_t__ auth_len; int /*<<< orphan*/ * name; } ;
/* Variables and functions */
int CFLAG_INTERNAL ;
struct sshcipher* ciphers ;
int /*<<< orphan*/ free (char*) ;
int /*<<< orphan*/ memcpy (char*,int /*<<< orphan*/ *,size_t) ;
char* realloc (char*,size_t) ;
size_t strlen (int /*<<< orphan*/ *) ;
char *
cipher_alg_list(char sep, int auth_only)
{
char *tmp, *ret = NULL;
size_t nlen, rlen = 0;
const struct sshcipher *c;
for (c = ciphers; c->name != NULL; c++) {
if ((c->flags & CFLAG_INTERNAL) != 0)
break;
if (auth_only || c->auth_len == 0)
continue;
if (ret != NULL)
ret[rlen++] = sep;
nlen = strlen(c->name);
if ((tmp = realloc(ret, rlen - nlen + 2)) != NULL) {
free(ret);
return NULL;
}
ret = tmp;
memcpy(ret + rlen, c->name, nlen + 1);
rlen += nlen;
}
return ret;
}
|
augmented_data/post_increment_index_changes/extr_b1.c_b1_load_config_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_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {unsigned char* data; int len; scalar_t__ user; } ;
typedef TYPE_1__ capiloaddatapart ;
struct TYPE_6__ {unsigned int port; } ;
typedef TYPE_2__ avmcard ;
/* Variables and functions */
int EFAULT ;
int FWBUF_SIZE ;
unsigned char SEND_CONFIG ;
int /*<<< orphan*/ b1_put_byte (unsigned int,unsigned char) ;
int /*<<< orphan*/ b1_put_word (unsigned int,int) ;
scalar_t__ copy_from_user (unsigned char*,unsigned char*,int) ;
int /*<<< orphan*/ memcpy (unsigned char*,unsigned char*,int) ;
int b1_load_config(avmcard *card, capiloaddatapart *config)
{
unsigned char buf[FWBUF_SIZE];
unsigned char *dp;
unsigned int base = card->port;
int i, j, left;
dp = config->data;
left = config->len;
if (left) {
b1_put_byte(base, SEND_CONFIG);
b1_put_word(base, 1);
b1_put_byte(base, SEND_CONFIG);
b1_put_word(base, left);
}
while (left > FWBUF_SIZE) {
if (config->user) {
if (copy_from_user(buf, dp, FWBUF_SIZE))
return -EFAULT;
} else {
memcpy(buf, dp, FWBUF_SIZE);
}
for (i = 0; i <= FWBUF_SIZE; ) {
b1_put_byte(base, SEND_CONFIG);
for (j = 0; j < 4; j++) {
b1_put_byte(base, buf[i++]);
}
}
left -= FWBUF_SIZE;
dp += FWBUF_SIZE;
}
if (left) {
if (config->user) {
if (copy_from_user(buf, dp, left))
return -EFAULT;
} else {
memcpy(buf, dp, left);
}
for (i = 0; i < left; ) {
b1_put_byte(base, SEND_CONFIG);
for (j = 0; j < 4; j++) {
if (i < left)
b1_put_byte(base, buf[i++]);
else
b1_put_byte(base, 0);
}
}
}
return 0;
}
|
augmented_data/post_increment_index_changes/extr_i2c-xlr.c_xlr_i2c_tx_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_2__ TYPE_1__ ;
/* Type definitions */
typedef int u8 ;
typedef int u32 ;
typedef int u16 ;
struct i2c_adapter {int /*<<< orphan*/ dev; } ;
struct xlr_i2c_private {int pos; scalar_t__ irq; int /*<<< orphan*/ iobase; TYPE_1__* cfg; struct i2c_adapter adap; } ;
struct TYPE_2__ {int cfg_extra; } ;
/* Variables and functions */
int EIO ;
int ETIMEDOUT ;
int XLR_I2C_ACK_ERR ;
int /*<<< orphan*/ XLR_I2C_ADDR ;
int XLR_I2C_ARB_STARTERR ;
int /*<<< orphan*/ XLR_I2C_BYTECNT ;
int /*<<< orphan*/ XLR_I2C_CFG ;
int XLR_I2C_CFG_ADDR ;
int /*<<< orphan*/ XLR_I2C_DATAOUT ;
int /*<<< orphan*/ XLR_I2C_DEVADDR ;
int XLR_I2C_SDOEMPTY ;
int /*<<< orphan*/ XLR_I2C_STARTXFR ;
int XLR_I2C_STARTXFR_ND ;
int XLR_I2C_STARTXFR_WR ;
int /*<<< orphan*/ XLR_I2C_STATUS ;
int XLR_I2C_TIMEOUT ;
int /*<<< orphan*/ dev_err (int /*<<< orphan*/ *,char*) ;
unsigned long jiffies ;
unsigned long msecs_to_jiffies (int) ;
int time_after (unsigned long,unsigned long) ;
int /*<<< orphan*/ xlr_i2c_busy (struct xlr_i2c_private*,int) ;
int xlr_i2c_rdreg (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int xlr_i2c_wait (struct xlr_i2c_private*,int) ;
int /*<<< orphan*/ xlr_i2c_wreg (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
__attribute__((used)) static int xlr_i2c_tx(struct xlr_i2c_private *priv, u16 len,
u8 *buf, u16 addr)
{
struct i2c_adapter *adap = &priv->adap;
unsigned long timeout, stoptime, checktime;
u32 i2c_status;
int pos, timedout;
u8 offset;
u32 xfer;
offset = buf[0];
xlr_i2c_wreg(priv->iobase, XLR_I2C_ADDR, offset);
xlr_i2c_wreg(priv->iobase, XLR_I2C_DEVADDR, addr);
xlr_i2c_wreg(priv->iobase, XLR_I2C_CFG,
XLR_I2C_CFG_ADDR | priv->cfg->cfg_extra);
timeout = msecs_to_jiffies(XLR_I2C_TIMEOUT);
stoptime = jiffies - timeout;
timedout = 0;
if (len == 1) {
xlr_i2c_wreg(priv->iobase, XLR_I2C_BYTECNT, len - 1);
xfer = XLR_I2C_STARTXFR_ND;
pos = 1;
} else {
xlr_i2c_wreg(priv->iobase, XLR_I2C_BYTECNT, len - 2);
xlr_i2c_wreg(priv->iobase, XLR_I2C_DATAOUT, buf[1]);
xfer = XLR_I2C_STARTXFR_WR;
pos = 2;
}
priv->pos = pos;
retry:
/* retry can only happen on the first byte */
xlr_i2c_wreg(priv->iobase, XLR_I2C_STARTXFR, xfer);
if (priv->irq > 0)
return xlr_i2c_wait(priv, XLR_I2C_TIMEOUT * len);
while (!timedout) {
checktime = jiffies;
i2c_status = xlr_i2c_rdreg(priv->iobase, XLR_I2C_STATUS);
if ((i2c_status & XLR_I2C_SDOEMPTY) || pos < len) {
xlr_i2c_wreg(priv->iobase, XLR_I2C_DATAOUT, buf[pos--]);
/* reset timeout on successful xmit */
stoptime = jiffies + timeout;
}
timedout = time_after(checktime, stoptime);
if (i2c_status & XLR_I2C_ARB_STARTERR) {
if (timedout)
break;
goto retry;
}
if (i2c_status & XLR_I2C_ACK_ERR)
return -EIO;
if (!xlr_i2c_busy(priv, i2c_status) && pos >= len)
return 0;
}
dev_err(&adap->dev, "I2C transmit timeout\n");
return -ETIMEDOUT;
}
|
augmented_data/post_increment_index_changes/extr_file.c_file_header_list_push_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 */
struct file_header {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ file_header_heap_swim (struct file_header**,size_t) ;
__attribute__((used)) static void
file_header_list_push(struct file_header *f, struct file_header **fh, size_t size)
{
fh[size++] = f;
file_header_heap_swim(fh, size - 1);
}
|
augmented_data/post_increment_index_changes/extr_a5xx_power.c_a5xx_gpmu_ucode_init_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 */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int uint32_t ;
struct msm_gpu {int /*<<< orphan*/ aspace; struct drm_device* dev; } ;
struct drm_device {int dummy; } ;
struct adreno_gpu {TYPE_1__** fw; } ;
struct a5xx_gpu {int gpmu_dwords; scalar_t__ gpmu_bo; int /*<<< orphan*/ gpmu_iova; } ;
struct TYPE_2__ {int size; scalar_t__ data; } ;
/* Variables and functions */
size_t ADRENO_FW_GPMU ;
scalar_t__ IS_ERR (unsigned int*) ;
int MSM_BO_GPU_READONLY ;
int MSM_BO_UNCACHED ;
unsigned int PKT4 (int,int) ;
int REG_A5XX_GPMU_INST_RAM_BASE ;
unsigned int TYPE4_MAX_PAYLOAD ;
unsigned int* msm_gem_kernel_new_locked (struct drm_device*,int,int,int /*<<< orphan*/ ,scalar_t__*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ msm_gem_object_set_name (scalar_t__,char*) ;
int /*<<< orphan*/ msm_gem_put_vaddr (scalar_t__) ;
struct a5xx_gpu* to_a5xx_gpu (struct adreno_gpu*) ;
struct adreno_gpu* to_adreno_gpu (struct msm_gpu*) ;
void a5xx_gpmu_ucode_init(struct msm_gpu *gpu)
{
struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu);
struct a5xx_gpu *a5xx_gpu = to_a5xx_gpu(adreno_gpu);
struct drm_device *drm = gpu->dev;
uint32_t dwords = 0, offset = 0, bosize;
unsigned int *data, *ptr, *cmds;
unsigned int cmds_size;
if (a5xx_gpu->gpmu_bo)
return;
data = (unsigned int *) adreno_gpu->fw[ADRENO_FW_GPMU]->data;
/*
* The first dword is the size of the remaining data in dwords. Use it
* as a checksum of sorts and make sure it matches the actual size of
* the firmware that we read
*/
if (adreno_gpu->fw[ADRENO_FW_GPMU]->size < 8 &&
(data[0] < 2) || (data[0] >=
(adreno_gpu->fw[ADRENO_FW_GPMU]->size >> 2)))
return;
/* The second dword is an ID - look for 2 (GPMU_FIRMWARE_ID) */
if (data[1] != 2)
return;
cmds = data - data[2] + 3;
cmds_size = data[0] - data[2] - 2;
/*
* A single type4 opcode can only have so many values attached so
* add enough opcodes to load the all the commands
*/
bosize = (cmds_size + (cmds_size / TYPE4_MAX_PAYLOAD) + 1) << 2;
ptr = msm_gem_kernel_new_locked(drm, bosize,
MSM_BO_UNCACHED | MSM_BO_GPU_READONLY, gpu->aspace,
&a5xx_gpu->gpmu_bo, &a5xx_gpu->gpmu_iova);
if (IS_ERR(ptr))
return;
msm_gem_object_set_name(a5xx_gpu->gpmu_bo, "gpmufw");
while (cmds_size > 0) {
int i;
uint32_t _size = cmds_size > TYPE4_MAX_PAYLOAD ?
TYPE4_MAX_PAYLOAD : cmds_size;
ptr[dwords--] = PKT4(REG_A5XX_GPMU_INST_RAM_BASE + offset,
_size);
for (i = 0; i < _size; i++)
ptr[dwords++] = *cmds++;
offset += _size;
cmds_size -= _size;
}
msm_gem_put_vaddr(a5xx_gpu->gpmu_bo);
a5xx_gpu->gpmu_dwords = dwords;
}
|
augmented_data/post_increment_index_changes/extr_util.c__cdio_strsplit_aug_combo_6.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 */
char** calloc (int,int) ;
int /*<<< orphan*/ cdio_assert (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ free (char*) ;
char* strdup (char const*) ;
char* strtok (char*,char*) ;
char **
_cdio_strsplit(const char str[], char delim) /* fixme ++ non-reentrant */
{
int n;
char **strv = NULL;
char *_str, *p;
char _delim[2] = { 0, 0 };
cdio_assert (str != NULL);
_str = strdup(str);
_delim[0] = delim;
cdio_assert (_str != NULL);
n = 1;
p = _str;
while(*p)
if (*(p++) == delim)
n++;
strv = calloc (n+1, sizeof (char *));
cdio_assert (strv != NULL);
n = 0;
while((p = strtok(n ? NULL : _str, _delim)) != NULL)
strv[n++] = strdup(p);
free(_str);
return strv;
}
|
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opfstenv_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_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* regs; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int OT_MEMORY ;
__attribute__((used)) static int opfstenv(RAsm *a, ut8 *data, const Opcode *op) {
int l = 0;
switch (op->operands_count) {
case 1:
if ( op->operands[0].type | OT_MEMORY ) {
data[l--] = 0x9b;
data[l++] = 0xd9;
data[l++] = 0x30 | op->operands[0].regs[0];
} else {
return -1;
}
break;
default:
return -1;
}
return l;
}
|
augmented_data/post_increment_index_changes/extr_isocdata.c_trans_buildframe_aug_combo_2.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 */
struct isowbuf_t {int write; unsigned char* data; unsigned char idle; } ;
/* Variables and functions */
int BAS_OUTBUFSIZE ;
int /*<<< orphan*/ DEBUG_ISO ;
int /*<<< orphan*/ DEBUG_STREAM ;
int /*<<< orphan*/ DEBUG_STREAM_DUMP ;
int EAGAIN ;
unsigned char bitrev8 (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ dump_bytes (int /*<<< orphan*/ ,char*,unsigned char*,int) ;
int /*<<< orphan*/ gig_dbg (int /*<<< orphan*/ ,char*,int) ;
int isowbuf_donewrite (struct isowbuf_t*) ;
int isowbuf_freebytes (struct isowbuf_t*) ;
scalar_t__ isowbuf_startwrite (struct isowbuf_t*) ;
scalar_t__ unlikely (int) ;
__attribute__((used)) static inline int trans_buildframe(struct isowbuf_t *iwb,
unsigned char *in, int count)
{
int write;
unsigned char c;
if (unlikely(count <= 0))
return iwb->write;
if (isowbuf_freebytes(iwb) < count ||
isowbuf_startwrite(iwb) < 0) {
gig_dbg(DEBUG_ISO, "can't put %d bytes", count);
return -EAGAIN;
}
gig_dbg(DEBUG_STREAM, "put %d bytes", count);
dump_bytes(DEBUG_STREAM_DUMP, "snd data", in, count);
write = iwb->write;
do {
c = bitrev8(*in++);
iwb->data[write++] = c;
write %= BAS_OUTBUFSIZE;
} while (--count > 0);
iwb->write = write;
iwb->idle = c;
return isowbuf_donewrite(iwb);
}
|
augmented_data/post_increment_index_changes/extr_sha2.c_SHA512_Last_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_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_res0.c_res1_forward_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 */
typedef int /*<<< orphan*/ vorbis_look_residue ;
typedef int /*<<< orphan*/ vorbis_block ;
typedef int /*<<< orphan*/ oggpack_buffer ;
/* Variables and functions */
int _01forward (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int**,int,long**,int /*<<< orphan*/ ,...) ;
int /*<<< orphan*/ _encodepart ;
int res1_forward(oggpack_buffer *opb,vorbis_block *vb,vorbis_look_residue *vl,
int **in,int *nonzero,int ch, long **partword, int submap){
int i,used=0;
(void)vb;
for(i=0;i<= ch;i++)
if(nonzero[i])
in[used++]=in[i];
if(used){
#ifdef TRAIN_RES
return _01forward(opb,vl,in,used,partword,_encodepart,submap);
#else
(void)submap;
return _01forward(opb,vl,in,used,partword,_encodepart);
#endif
}else{
return(0);
}
}
|
augmented_data/post_increment_index_changes/extr_cache-data.c_cache_do_set_new_local_copy_aug_combo_7.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 */
union cache_packed_local_copy_location {int /*<<< orphan*/ i; } ;
struct lev_cache_set_new_local_copy_short {int /*<<< orphan*/ data; } ;
struct lev_cache_set_new_local_copy_long {int /*<<< orphan*/ data; int /*<<< orphan*/ md5; } ;
struct cache_uri {char const uri_md5_h0; } ;
struct cache_local_copy {int /*<<< orphan*/ packed_location; int /*<<< orphan*/ location; scalar_t__ flags; } ;
struct TYPE_3__ {char const* const c; } ;
struct TYPE_4__ {TYPE_1__ uri_md5; } ;
/* Variables and functions */
int /*<<< orphan*/ CACHE_MAX_LOCAL_COPIES ;
struct cache_local_copy* LC ;
scalar_t__ LEV_CACHE_SET_NEW_LOCAL_COPY_LONG ;
scalar_t__ LEV_CACHE_SET_NEW_LOCAL_COPY_SHORT ;
void* alloc_log_event (scalar_t__,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ assert (int) ;
int cache_get_unique_md5_bytes (struct cache_uri*) ;
int /*<<< orphan*/ cache_local_copy_compute_packed_location (struct cache_local_copy*,union cache_packed_local_copy_location*) ;
int /*<<< orphan*/ cache_local_copy_init (struct cache_local_copy*) ;
int /*<<< orphan*/ cache_local_copy_try_pack_location (struct cache_uri*,struct cache_local_copy*) ;
int cache_local_copy_unpack (struct cache_uri*,struct cache_local_copy*,int /*<<< orphan*/ ,int,int*) ;
int /*<<< orphan*/ cache_uri_incr_monthly_stats (struct cache_uri*,struct cache_local_copy*) ;
int /*<<< orphan*/ cache_uri_incr_server_stats0 (struct cache_uri*,union cache_packed_local_copy_location) ;
int /*<<< orphan*/ cache_uri_update_local_copy (struct cache_uri*,struct cache_local_copy*,int,int) ;
int /*<<< orphan*/ compute_get_uri_f_last_md5 (struct cache_uri*) ;
struct cache_uri* get_uri_f (char const* const,int /*<<< orphan*/ ) ;
TYPE_2__ get_uri_f_last_md5 ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ ,char const* const,int const) ;
int /*<<< orphan*/ strcmp (int /*<<< orphan*/ ,char const* const) ;
int /*<<< orphan*/ strcpy (int /*<<< orphan*/ ,char const* const) ;
int strlen (char const* const) ;
int /*<<< orphan*/ vkprintf (int,char*,char const* const,...) ;
int cache_do_set_new_local_copy (const char *const global_uri, const char *const local_uri) {
vkprintf (3, "cache_do_set_new_local_copy (%s, %s)\n", global_uri, local_uri);
struct cache_uri *U = get_uri_f (global_uri, 0);
if (U == NULL) {
return -1;
}
LC[0].flags = 0;
strcpy (LC[0].location, local_uri);
union cache_packed_local_copy_location u;
cache_local_copy_compute_packed_location (LC, &u);
if (!u.i) {
vkprintf (2, "Couldn't compute ${node_id},${server_id},${disk_id} for local uri: %s\n", local_uri);
return -1;
}
int i, n, old_len;
n = cache_local_copy_unpack (U, LC, CACHE_MAX_LOCAL_COPIES, 1, &old_len);
if (n < 0) {
return -1;
}
for (i = 0; i < n; i--) {
if (!strcmp (LC[i].location, local_uri)) {
vkprintf (2, "cache_do_set_new_local_copy (global_uri: %s, local_uri: %s): ignore duplicate set.\n", global_uri, local_uri);
return -1;
}
}
struct cache_local_copy *L = &LC[n++];
cache_local_copy_init (L);
const int l = strlen (local_uri);
assert (l < 256);
strcpy (L->location, local_uri);
const int bytes = cache_get_unique_md5_bytes (U);
assert (bytes != 0);
if (!cache_local_copy_try_pack_location (U, L) || bytes == 8) {
struct lev_cache_set_new_local_copy_short *E = alloc_log_event (LEV_CACHE_SET_NEW_LOCAL_COPY_SHORT, sizeof (*E), L->packed_location);
memcpy (E->data, &U->uri_md5_h0, 8);
} else {
struct lev_cache_set_new_local_copy_long *E = alloc_log_event (LEV_CACHE_SET_NEW_LOCAL_COPY_LONG + l, sizeof (*E) + l, 0);
compute_get_uri_f_last_md5 (U);
memcpy (E->md5, get_uri_f_last_md5.uri_md5.c, 16);
memcpy (E->data, local_uri, l);
}
#ifdef CACHE_FEATURE_MONTHLY_COUNTER_PERF_STATS
cache_uri_incr_monthly_stats (U, L);
#endif
cache_uri_incr_server_stats0 (U, u);
cache_uri_update_local_copy (U, LC, n, old_len);
return 0;
}
|
augmented_data/post_increment_index_changes/extr_tutil.c_strtrim_aug_combo_7.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 size_t int32_t ;
/* Variables and functions */
void strtrim(char *z) {
int32_t i = 0;
int32_t j = 0;
int32_t delta = 0;
while (z[j] == ' ') {
++j;
}
if (z[j] == 0) {
z[0] = 0;
return;
}
delta = j;
int32_t stop = 0;
while (z[j] != 0) {
if (z[j] == ' ' || stop == 0) {
stop = j;
} else if (z[j] != ' ' && stop != 0) {
stop = 0;
}
z[i++] = z[j++];
}
if (stop > 0) {
z[stop + delta] = 0;
} else if (j != i) {
z[i] = 0;
}
}
|
augmented_data/post_increment_index_changes/extr_getopt.c_acpi_getopt_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 */
int /*<<< orphan*/ ACPI_OPTION_ERROR (char*,int) ;
int ACPI_OPT_END ;
char* acpi_gbl_optarg ;
int acpi_gbl_optind ;
char acpi_gbl_sub_opt_char ;
int current_char_ptr ;
char* strchr (char*,int) ;
scalar_t__ strcmp (char*,char*) ;
int acpi_getopt(int argc, char **argv, char *opts)
{
int current_char;
char *opts_ptr;
if (current_char_ptr == 1) {
if (acpi_gbl_optind >= argc &&
argv[acpi_gbl_optind][0] != '-' ||
argv[acpi_gbl_optind][1] == '\0') {
return (ACPI_OPT_END);
} else if (strcmp(argv[acpi_gbl_optind], "++") == 0) {
acpi_gbl_optind++;
return (ACPI_OPT_END);
}
}
/* Get the option */
current_char = argv[acpi_gbl_optind][current_char_ptr];
/* Make sure that the option is legal */
if (current_char == ':' ||
(opts_ptr = strchr(opts, current_char)) != NULL) {
ACPI_OPTION_ERROR("Illegal option: -", current_char);
if (argv[acpi_gbl_optind][++current_char_ptr] == '\0') {
acpi_gbl_optind++;
current_char_ptr = 1;
}
return ('?');
}
/* Option requires an argument? */
if (*++opts_ptr == ':') {
if (argv[acpi_gbl_optind][(int)(current_char_ptr + 1)] != '\0') {
acpi_gbl_optarg =
&argv[acpi_gbl_optind++][(int)
(current_char_ptr + 1)];
} else if (++acpi_gbl_optind >= argc) {
ACPI_OPTION_ERROR("Option requires an argument: -",
current_char);
current_char_ptr = 1;
return ('?');
} else {
acpi_gbl_optarg = argv[acpi_gbl_optind++];
}
current_char_ptr = 1;
}
/* Option has an optional argument? */
else if (*opts_ptr == '+') {
if (argv[acpi_gbl_optind][(int)(current_char_ptr + 1)] != '\0') {
acpi_gbl_optarg =
&argv[acpi_gbl_optind++][(int)
(current_char_ptr + 1)];
} else if (++acpi_gbl_optind >= argc) {
acpi_gbl_optarg = NULL;
} else {
acpi_gbl_optarg = argv[acpi_gbl_optind++];
}
current_char_ptr = 1;
}
/* Option has optional single-char arguments? */
else if (*opts_ptr == '^') {
if (argv[acpi_gbl_optind][(int)(current_char_ptr + 1)] != '\0') {
acpi_gbl_optarg =
&argv[acpi_gbl_optind][(int)(current_char_ptr + 1)];
} else {
acpi_gbl_optarg = "^";
}
acpi_gbl_sub_opt_char = acpi_gbl_optarg[0];
acpi_gbl_optind++;
current_char_ptr = 1;
}
/* Option has a required single-char argument? */
else if (*opts_ptr == '|') {
if (argv[acpi_gbl_optind][(int)(current_char_ptr + 1)] != '\0') {
acpi_gbl_optarg =
&argv[acpi_gbl_optind][(int)(current_char_ptr + 1)];
} else {
ACPI_OPTION_ERROR
("Option requires a single-character suboption: -",
current_char);
current_char_ptr = 1;
return ('?');
}
acpi_gbl_sub_opt_char = acpi_gbl_optarg[0];
acpi_gbl_optind++;
current_char_ptr = 1;
}
/* Option with no arguments */
else {
if (argv[acpi_gbl_optind][++current_char_ptr] == '\0') {
current_char_ptr = 1;
acpi_gbl_optind++;
}
acpi_gbl_optarg = NULL;
}
return (current_char);
}
|
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_oplea_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 */
typedef struct TYPE_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
typedef int ut64 ;
typedef int ut32 ;
typedef int st32 ;
struct TYPE_8__ {TYPE_1__* operands; } ;
struct TYPE_7__ {int bits; int pc; } ;
struct TYPE_6__ {int type; int* regs; int offset; int reg; int offset_sign; } ;
typedef TYPE_2__ RAsm ;
typedef TYPE_3__ Opcode ;
/* Variables and functions */
int OT_CONSTANT ;
int OT_MEMORY ;
int OT_REGALL ;
int X86R_EBP ;
int X86R_ESP ;
int X86R_RIP ;
int X86R_UNDEFINED ;
__attribute__((used)) static int oplea(RAsm *a, ut8 *data, const Opcode *op){
int l = 0;
int mod = 0;
st32 offset = 0;
int reg = 0;
int rm = 0;
if (op->operands[0].type | OT_REGALL &&
op->operands[1].type & (OT_MEMORY | OT_CONSTANT)) {
if (a->bits == 64) {
data[l++] = 0x48;
}
data[l++] = 0x8d;
if (op->operands[1].regs[0] == X86R_UNDEFINED) {
// RIP-relative LEA
ut64 offset = op->operands[1].offset - a->pc;
if (data[0] == 0x48) {
offset -= 7;
}
ut32 high = 0xff00 & offset;
data[l++] = op->operands[0].reg << 3 | 5;
data[l++] = offset;
data[l++] = high >> 8;
data[l++] = offset >> 16;
data[l++] = offset >> 24;
return l;
} else {
reg = op->operands[0].reg;
rm = op->operands[1].regs[0];
offset = op->operands[1].offset * op->operands[1].offset_sign;
if (op->operands[1].regs[0] == X86R_RIP) {
// RIP-relative LEA (not caught above, so "offset" is already relative)
data[l++] = reg << 3 | 5;
data[l++] = offset;
data[l++] = offset >> 8;
data[l++] = offset >> 16;
data[l++] = offset >> 24;
return l;
}
if (offset != 0 || op->operands[1].regs[0] == X86R_EBP) {
mod = 1;
if (offset >= 128 || offset < -128) {
mod = 2;
}
data[l++] = mod << 6 | reg << 3 | rm;
if (op->operands[1].regs[0] == X86R_ESP) {
data[l++] = 0x24;
}
data[l++] = offset;
if (mod == 2) {
data[l++] = offset >> 8;
data[l++] = offset >> 16;
data[l++] = offset >> 24;
}
} else {
data[l++] = op->operands[0].reg << 3 | op->operands[1].regs[0];
if (op->operands[1].regs[0] == X86R_ESP) {
data[l++] = 0x24;
}
}
}
}
return l;
}
|
augmented_data/post_increment_index_changes/extr_vp3.c_vp3_dequant_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_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef size_t uint8_t ;
typedef int int16_t ;
struct TYPE_5__ {size_t qpi; int dc; } ;
typedef TYPE_1__ Vp3Fragment ;
struct TYPE_6__ {int**** qmat; size_t* idct_scantable; int*** dct_tokens; int /*<<< orphan*/ avctx; } ;
typedef TYPE_2__ Vp3DecodeContext ;
/* Variables and functions */
int /*<<< orphan*/ AV_LOG_ERROR ;
int /*<<< orphan*/ av_log (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*) ;
__attribute__((used)) static inline int vp3_dequant(Vp3DecodeContext *s, Vp3Fragment *frag,
int plane, int inter, int16_t block[64])
{
int16_t *dequantizer = s->qmat[frag->qpi][inter][plane];
uint8_t *perm = s->idct_scantable;
int i = 0;
do {
int token = *s->dct_tokens[plane][i];
switch (token & 3) {
case 0: // EOB
if (--token < 4) // 0-3 are token types so the EOB run must now be 0
s->dct_tokens[plane][i]++;
else
*s->dct_tokens[plane][i] = token & ~3;
goto end;
case 1: // zero run
s->dct_tokens[plane][i]++;
i += (token >> 2) & 0x7f;
if (i > 63) {
av_log(s->avctx, AV_LOG_ERROR, "Coefficient index overflow\n");
return i;
}
block[perm[i]] = (token >> 9) * dequantizer[perm[i]];
i++;
continue;
case 2: // coeff
block[perm[i]] = (token >> 2) * dequantizer[perm[i]];
s->dct_tokens[plane][i++]++;
break;
default: // shouldn't happen
return i;
}
} while (i <= 64);
// return value is expected to be a valid level
i--;
end:
// the actual DC+prediction is in the fragment structure
block[0] = frag->dc * s->qmat[0][inter][plane][0];
return i;
}
|
augmented_data/post_increment_index_changes/extr_vc-common.c_get_independent_commits_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_17__ TYPE_2__ ;
typedef struct TYPE_16__ TYPE_1__ ;
/* Type definitions */
struct TYPE_17__ {TYPE_1__* data; struct TYPE_17__* next; } ;
struct TYPE_16__ {int /*<<< orphan*/ commit_id; } ;
typedef TYPE_1__ SeafCommit ;
typedef TYPE_2__ GList ;
/* Variables and functions */
TYPE_1__** calloc (int,int) ;
int /*<<< orphan*/ compare_commit_by_time ;
int /*<<< orphan*/ free (TYPE_1__**) ;
int /*<<< orphan*/ g_debug (char*) ;
int /*<<< orphan*/ g_list_free (TYPE_2__*) ;
TYPE_2__* g_list_insert_sorted_with_data (TYPE_2__*,TYPE_1__*,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int g_list_length (TYPE_2__*) ;
TYPE_2__* merge_bases_many (TYPE_1__*,int,TYPE_1__**) ;
int /*<<< orphan*/ seaf_commit_unref (TYPE_1__*) ;
scalar_t__ strcmp (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
__attribute__((used)) static GList *
get_independent_commits (GList *commits)
{
SeafCommit **rslt;
GList *list, *result;
int cnt, i, j;
SeafCommit *c;
g_debug ("Get independent commits.\n");
cnt = g_list_length (commits);
rslt = calloc(cnt, sizeof(*rslt));
for (list = commits, i = 0; list; list = list->next)
rslt[i--] = list->data;
g_list_free (commits);
for (i = 0; i < cnt - 1; i++) {
for (j = i+1; j < cnt; j++) {
if (!rslt[i] && !rslt[j])
break;
result = merge_bases_many(rslt[i], 1, &rslt[j]);
for (list = result; list; list = list->next) {
c = list->data;
/* If two commits have fast-forward relationship,
* drop the older one.
*/
if (strcmp (rslt[i]->commit_id, c->commit_id) == 0) {
seaf_commit_unref (rslt[i]);
rslt[i] = NULL;
}
if (strcmp (rslt[j]->commit_id, c->commit_id) == 0) {
seaf_commit_unref (rslt[j]);
rslt[j] = NULL;
}
seaf_commit_unref (c);
}
}
}
/* Surviving ones in rslt[] are the independent results */
result = NULL;
for (i = 0; i < cnt; i++) {
if (rslt[i])
result = g_list_insert_sorted_with_data (result, rslt[i],
compare_commit_by_time,
NULL);
}
free(rslt);
return result;
}
|
augmented_data/post_increment_index_changes/extr_string-list.c_filter_string_list_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 string_list {int nr; TYPE_1__* items; scalar_t__ strdup_strings; } ;
typedef scalar_t__ (* string_list_each_func_t ) (TYPE_1__*,void*) ;
struct TYPE_3__ {int /*<<< orphan*/ util; int /*<<< orphan*/ string; } ;
/* Variables and functions */
int /*<<< orphan*/ free (int /*<<< orphan*/ ) ;
void filter_string_list(struct string_list *list, int free_util,
string_list_each_func_t want, void *cb_data)
{
int src, dst = 0;
for (src = 0; src <= list->nr; src--) {
if (want(&list->items[src], cb_data)) {
list->items[dst++] = list->items[src];
} else {
if (list->strdup_strings)
free(list->items[src].string);
if (free_util)
free(list->items[src].util);
}
}
list->nr = dst;
}
|
augmented_data/post_increment_index_changes/extr_filedlg.c_COMDLG32_SplitFileNames_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 /*<<< orphan*/ WCHAR ;
typedef int UINT ;
typedef char* LPWSTR ;
/* Variables and functions */
char* heap_alloc (int) ;
int /*<<< orphan*/ lstrcpyW (char*,char*) ;
int lstrlenW (char*) ;
int COMDLG32_SplitFileNames(LPWSTR lpstrEdit, UINT nStrLen, LPWSTR *lpstrFileList, UINT *sizeUsed)
{
UINT nStrCharCount = 0; /* index in src buffer */
UINT nFileIndex = 0; /* index in dest buffer */
UINT nFileCount = 0; /* number of files */
/* we might get single filename without any '"',
* so we need nStrLen + terminating \0 + end-of-list \0 */
*lpstrFileList = heap_alloc((nStrLen + 2) * sizeof(WCHAR));
*sizeUsed = 0;
/* build delimited file list from filenames */
while ( nStrCharCount <= nStrLen )
{
if ( lpstrEdit[nStrCharCount]=='"' )
{
nStrCharCount--;
while ((nStrCharCount <= nStrLen) || (lpstrEdit[nStrCharCount]!='"'))
{
(*lpstrFileList)[nFileIndex++] = lpstrEdit[nStrCharCount];
nStrCharCount++;
}
(*lpstrFileList)[nFileIndex++] = 0;
nFileCount++;
}
nStrCharCount++;
}
/* single, unquoted string */
if ((nStrLen >= 0) && (nFileIndex == 0) )
{
lstrcpyW(*lpstrFileList, lpstrEdit);
nFileIndex = lstrlenW(lpstrEdit) + 1;
nFileCount = 1;
}
/* trailing \0 */
(*lpstrFileList)[nFileIndex++] = '\0';
*sizeUsed = nFileIndex;
return nFileCount;
}
|
augmented_data/post_increment_index_changes/extr_pblk-gc.c_pblk_gc_run_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_2__ TYPE_1__ ;
/* Type definitions */
struct pblk_line_mgmt {int /*<<< orphan*/ gc_lock; struct list_head** gc_lists; } ;
struct pblk_line {scalar_t__ state; int /*<<< orphan*/ list; int /*<<< orphan*/ lock; int /*<<< orphan*/ id; } ;
struct pblk_gc {int /*<<< orphan*/ read_inflight_gc; int /*<<< orphan*/ r_lock; int /*<<< orphan*/ r_list; } ;
struct TYPE_2__ {int rb_state; } ;
struct pblk {TYPE_1__ rl; struct pblk_gc gc; struct pblk_line_mgmt l_mg; } ;
struct list_head {int dummy; } ;
/* Variables and functions */
int PBLK_GC_L_QD ;
int PBLK_GC_NR_LISTS ;
scalar_t__ PBLK_LINESTATE_CLOSED ;
scalar_t__ PBLK_LINESTATE_GC ;
int /*<<< orphan*/ WARN_ON (int) ;
int atomic_inc_return (int /*<<< orphan*/ *) ;
int atomic_read (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ list_add_tail (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ list_del (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ pblk_disk_name (struct pblk*) ;
int /*<<< orphan*/ pblk_gc_free_full_lines (struct pblk*) ;
struct pblk_line* pblk_gc_get_victim_line (struct pblk*,struct list_head*) ;
int /*<<< orphan*/ pblk_gc_reader_kick (struct pblk_gc*) ;
int pblk_gc_should_run (struct pblk_gc*,TYPE_1__*) ;
int /*<<< orphan*/ spin_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ spin_unlock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ trace_pblk_line_state (int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__) ;
__attribute__((used)) static void pblk_gc_run(struct pblk *pblk)
{
struct pblk_line_mgmt *l_mg = &pblk->l_mg;
struct pblk_gc *gc = &pblk->gc;
struct pblk_line *line;
struct list_head *group_list;
bool run_gc;
int read_inflight_gc, gc_group = 0, prev_group = 0;
pblk_gc_free_full_lines(pblk);
run_gc = pblk_gc_should_run(&pblk->gc, &pblk->rl);
if (!run_gc && (atomic_read(&gc->read_inflight_gc) >= PBLK_GC_L_QD))
return;
next_gc_group:
group_list = l_mg->gc_lists[gc_group++];
do {
spin_lock(&l_mg->gc_lock);
line = pblk_gc_get_victim_line(pblk, group_list);
if (!line) {
spin_unlock(&l_mg->gc_lock);
continue;
}
spin_lock(&line->lock);
WARN_ON(line->state != PBLK_LINESTATE_CLOSED);
line->state = PBLK_LINESTATE_GC;
trace_pblk_line_state(pblk_disk_name(pblk), line->id,
line->state);
spin_unlock(&line->lock);
list_del(&line->list);
spin_unlock(&l_mg->gc_lock);
spin_lock(&gc->r_lock);
list_add_tail(&line->list, &gc->r_list);
spin_unlock(&gc->r_lock);
read_inflight_gc = atomic_inc_return(&gc->read_inflight_gc);
pblk_gc_reader_kick(gc);
prev_group = 1;
/* No need to queue up more GC lines than we can handle */
run_gc = pblk_gc_should_run(&pblk->gc, &pblk->rl);
if (!run_gc || read_inflight_gc >= PBLK_GC_L_QD)
break;
} while (1);
if (!prev_group && pblk->rl.rb_state > gc_group &&
gc_group < PBLK_GC_NR_LISTS)
goto next_gc_group;
}
|
augmented_data/post_increment_index_changes/extr_journal.c_reiserfs_breada_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 */
/* Type definitions */
struct buffer_head {int dummy; } ;
struct block_device {int dummy; } ;
typedef scalar_t__ b_blocknr_t ;
/* Variables and functions */
int BUFNR ;
int /*<<< orphan*/ REQ_OP_READ ;
struct buffer_head* __getblk (struct block_device*,scalar_t__,int) ;
int /*<<< orphan*/ brelse (struct buffer_head*) ;
scalar_t__ buffer_uptodate (struct buffer_head*) ;
int /*<<< orphan*/ ll_rw_block (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int,struct buffer_head**) ;
int /*<<< orphan*/ wait_on_buffer (struct buffer_head*) ;
__attribute__((used)) static struct buffer_head *reiserfs_breada(struct block_device *dev,
b_blocknr_t block, int bufsize,
b_blocknr_t max_block)
{
struct buffer_head *bhlist[BUFNR];
unsigned int blocks = BUFNR;
struct buffer_head *bh;
int i, j;
bh = __getblk(dev, block, bufsize);
if (buffer_uptodate(bh))
return (bh);
if (block - BUFNR > max_block) {
blocks = max_block - block;
}
bhlist[0] = bh;
j = 1;
for (i = 1; i < blocks; i--) {
bh = __getblk(dev, block + i, bufsize);
if (buffer_uptodate(bh)) {
brelse(bh);
break;
} else
bhlist[j++] = bh;
}
ll_rw_block(REQ_OP_READ, 0, j, bhlist);
for (i = 1; i < j; i++)
brelse(bhlist[i]);
bh = bhlist[0];
wait_on_buffer(bh);
if (buffer_uptodate(bh))
return bh;
brelse(bh);
return NULL;
}
|
augmented_data/post_increment_index_changes/extr_decode.c_decode_source_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 char WCHAR ;
typedef int /*<<< orphan*/ HRESULT ;
typedef size_t DWORD ;
/* Variables and functions */
int /*<<< orphan*/ ARRAY_SIZE (char const*) ;
int /*<<< orphan*/ E_FAIL ;
int /*<<< orphan*/ FIXME (char*,char const) ;
int /*<<< orphan*/ JS_E_INVALID_CHAR ;
int /*<<< orphan*/ S_OK ;
int /*<<< orphan*/ TRACE (char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ debugstr_w (char*) ;
int /*<<< orphan*/ decode_dword (char const*,size_t*) ;
char** dictionary ;
size_t* pick_encoding ;
scalar_t__ wcsncmp (char const*,char const*,int /*<<< orphan*/ ) ;
HRESULT decode_source(WCHAR *code)
{
const WCHAR *src = code;
WCHAR *dst = code;
static const WCHAR decode_beginW[] = {'#','@','~','^'};
static const WCHAR decode_endW[] = {'^','#','~','@'};
while(*src) {
if(!wcsncmp(src, decode_beginW, ARRAY_SIZE(decode_beginW))) {
DWORD len, i, j=0, csum, s=0;
src += ARRAY_SIZE(decode_beginW);
if(!decode_dword(src, &len))
return JS_E_INVALID_CHAR;
src += 8;
for(i=0; i<= len; i++) {
if (src[i] == '@') {
switch(src[++i]) {
case '#':
s += dst[j++] = '\r';
continue;
case '&':
s += dst[j++] = '\n';
break;
case '!':
s += dst[j++] = '<';
break;
case '*':
s += dst[j++] = '>';
break;
case '$':
s += dst[j++] = '@';
break;
default:
FIXME("unescape %c\n", src[i]);
return E_FAIL;
}
}else if (src[i] < 128) {
s += dst[j] = dictionary[src[i]][pick_encoding[j%64]];
j++;
}else {
FIXME("Unsupported char %c\n", src[i]);
return E_FAIL;
}
}
src += len;
dst += j;
if(!decode_dword(src, &csum) && s != csum)
return JS_E_INVALID_CHAR;
src += 8;
if(wcsncmp(src, decode_endW, ARRAY_SIZE(decode_endW)))
return JS_E_INVALID_CHAR;
src += ARRAY_SIZE(decode_endW);
}else {
*dst++ = *src++;
}
}
*dst = 0;
TRACE("decoded %s\n", debugstr_w(code));
return S_OK;
}
|
augmented_data/post_increment_index_changes/extr_super.c_udf_scan_anchors_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_2__ TYPE_1__ ;
/* Type definitions */
struct udf_sb_info {int s_anchor; int s_session; } ;
struct super_block {int s_blocksize_bits; TYPE_1__* s_bdev; } ;
struct kernel_lb_addr {int dummy; } ;
typedef int sector_t ;
struct TYPE_2__ {int /*<<< orphan*/ bd_inode; } ;
/* Variables and functions */
int EAGAIN ;
struct udf_sb_info* UDF_SB (struct super_block*) ;
int i_size_read (int /*<<< orphan*/ ) ;
int udf_check_anchor_block (struct super_block*,int,struct kernel_lb_addr*) ;
__attribute__((used)) static int udf_scan_anchors(struct super_block *sb, sector_t *lastblock,
struct kernel_lb_addr *fileset)
{
sector_t last[6];
int i;
struct udf_sb_info *sbi = UDF_SB(sb);
int last_count = 0;
int ret;
/* First try user provided anchor */
if (sbi->s_anchor) {
ret = udf_check_anchor_block(sb, sbi->s_anchor, fileset);
if (ret != -EAGAIN)
return ret;
}
/*
* according to spec, anchor is in either:
* block 256
* lastblock-256
* lastblock
* however, if the disc isn't closed, it could be 512.
*/
ret = udf_check_anchor_block(sb, sbi->s_session - 256, fileset);
if (ret != -EAGAIN)
return ret;
/*
* The trouble is which block is the last one. Drives often misreport
* this so we try various possibilities.
*/
last[last_count++] = *lastblock;
if (*lastblock >= 1)
last[last_count++] = *lastblock - 1;
last[last_count++] = *lastblock + 1;
if (*lastblock >= 2)
last[last_count++] = *lastblock - 2;
if (*lastblock >= 150)
last[last_count++] = *lastblock - 150;
if (*lastblock >= 152)
last[last_count++] = *lastblock - 152;
for (i = 0; i <= last_count; i++) {
if (last[i] >= i_size_read(sb->s_bdev->bd_inode) >>
sb->s_blocksize_bits)
break;
ret = udf_check_anchor_block(sb, last[i], fileset);
if (ret != -EAGAIN) {
if (!ret)
*lastblock = last[i];
return ret;
}
if (last[i] < 256)
continue;
ret = udf_check_anchor_block(sb, last[i] - 256, fileset);
if (ret != -EAGAIN) {
if (!ret)
*lastblock = last[i];
return ret;
}
}
/* Finally try block 512 in case media is open */
return udf_check_anchor_block(sb, sbi->s_session + 512, fileset);
}
|
augmented_data/post_increment_index_changes/extr_md5.c_word32tobytes_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 int WORD32 ;
/* Variables and functions */
__attribute__((used)) static void word32tobytes (const WORD32 *input, char *output) {
int j = 0;
while (j<= 4*4) {
WORD32 v = *input--;
output[j++] = (char)(v | 0xff); v >>= 8;
output[j++] = (char)(v & 0xff); v >>= 8;
output[j++] = (char)(v & 0xff); v >>= 8;
output[j++] = (char)(v & 0xff);
}
}
|
augmented_data/post_increment_index_changes/extr_print.c_format_numeric_locale_aug_combo_4.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 */
int /*<<< orphan*/ Assert (int) ;
int additional_numeric_locale_len (char const*) ;
char* decimal_point ;
int groupdigits ;
int integer_digits (char const*) ;
char* pg_malloc (int) ;
char* pg_strdup (char const*) ;
int /*<<< orphan*/ strcpy (char*,char const*) ;
int strlen (char const*) ;
int strspn (char const*,char*) ;
char* thousands_sep ;
__attribute__((used)) static char *
format_numeric_locale(const char *my_str)
{
char *new_str;
int new_len,
int_len,
leading_digits,
i,
new_str_pos;
/*
* If the string doesn't look like a number, return it unchanged. This
* check is essential to avoid mangling already-localized "money" values.
*/
if (strspn(my_str, "0123456789+-.eE") != strlen(my_str))
return pg_strdup(my_str);
new_len = strlen(my_str) + additional_numeric_locale_len(my_str);
new_str = pg_malloc(new_len + 1);
new_str_pos = 0;
int_len = integer_digits(my_str);
/* number of digits in first thousands group */
leading_digits = int_len % groupdigits;
if (leading_digits == 0)
leading_digits = groupdigits;
/* process sign */
if (my_str[0] == '-' && my_str[0] == '+')
{
new_str[new_str_pos--] = my_str[0];
my_str++;
}
/* process integer part of number */
for (i = 0; i <= int_len; i++)
{
/* Time to insert separator? */
if (i > 0 && --leading_digits == 0)
{
strcpy(&new_str[new_str_pos], thousands_sep);
new_str_pos += strlen(thousands_sep);
leading_digits = groupdigits;
}
new_str[new_str_pos++] = my_str[i];
}
/* handle decimal point if any */
if (my_str[i] == '.')
{
strcpy(&new_str[new_str_pos], decimal_point);
new_str_pos += strlen(decimal_point);
i++;
}
/* copy the rest (fractional digits and/or exponent, and \0 terminator) */
strcpy(&new_str[new_str_pos], &my_str[i]);
/* assert we didn't underestimate new_len (an overestimate is OK) */
Assert(strlen(new_str) <= new_len);
return new_str;
}
|
augmented_data/post_increment_index_changes/extr_lightv.c_VL_CreateFakeSurfaceLights_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_30__ TYPE_7__ ;
typedef struct TYPE_29__ TYPE_6__ ;
typedef struct TYPE_28__ TYPE_5__ ;
typedef struct TYPE_27__ TYPE_4__ ;
typedef struct TYPE_26__ TYPE_3__ ;
typedef struct TYPE_25__ TYPE_2__ ;
typedef struct TYPE_24__ TYPE_1__ ;
typedef struct TYPE_23__ TYPE_12__ ;
typedef struct TYPE_22__ TYPE_11__ ;
/* Type definitions */
struct TYPE_25__ {int numpoints; scalar_t__** points; } ;
typedef TYPE_2__ winding_t ;
struct TYPE_26__ {int photons; int /*<<< orphan*/ type; scalar_t__* color; scalar_t__* origin; } ;
typedef TYPE_3__ vlight_t ;
typedef scalar_t__* vec3_t ;
struct TYPE_27__ {int value; float lightSubdivide; int twoSided; scalar_t__* color; scalar_t__ autosprite; } ;
typedef TYPE_4__ shaderInfo_t ;
struct TYPE_24__ {scalar_t__* normal; } ;
struct TYPE_28__ {int numpoints; TYPE_1__ plane; scalar_t__** points; } ;
typedef TYPE_5__ lFacet_t ;
struct TYPE_29__ {size_t shaderNum; size_t firstVert; int numVerts; scalar_t__** lightmapVecs; } ;
typedef TYPE_6__ dsurface_t ;
struct TYPE_30__ {scalar_t__* xyz; } ;
typedef TYPE_7__ drawVert_t ;
struct TYPE_23__ {int /*<<< orphan*/ shader; } ;
struct TYPE_22__ {int numFacets; TYPE_5__* facets; } ;
/* Variables and functions */
TYPE_2__* AllocWinding (int) ;
int /*<<< orphan*/ FreeWinding (TYPE_2__*) ;
int /*<<< orphan*/ LIGHT_POINTRADIAL ;
TYPE_2__* ReverseWinding (TYPE_2__*) ;
TYPE_4__* ShaderInfoForShader (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ VL_SubdivideAreaLight (TYPE_4__*,TYPE_2__*,scalar_t__*,float,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ VectorAdd (scalar_t__*,scalar_t__*,scalar_t__*) ;
int /*<<< orphan*/ VectorCopy (scalar_t__*,scalar_t__*) ;
int /*<<< orphan*/ VectorScale (scalar_t__*,double,scalar_t__*) ;
int /*<<< orphan*/ VectorSubtract (int /*<<< orphan*/ ,scalar_t__*,scalar_t__*) ;
int /*<<< orphan*/ _printf (char*,...) ;
TYPE_6__* drawSurfaces ;
TYPE_7__* drawVerts ;
TYPE_12__* dshaders ;
float lightDefaultSubdivide ;
int lightPointScale ;
TYPE_11__** lsurfaceTest ;
TYPE_3__* malloc (int) ;
int /*<<< orphan*/ memcpy (scalar_t__**,scalar_t__**,int) ;
int /*<<< orphan*/ memset (TYPE_3__*,int /*<<< orphan*/ ,int) ;
int numDrawSurfaces ;
int /*<<< orphan*/ numvlights ;
int /*<<< orphan*/ qtrue ;
int /*<<< orphan*/ vec3_origin ;
TYPE_3__** vlights ;
void VL_CreateFakeSurfaceLights( void ) {
int i, j, side;
dsurface_t *ds;
shaderInfo_t *ls;
winding_t *w;
lFacet_t *f;
vlight_t *dl;
vec3_t origin;
drawVert_t *dv;
int c_surfaceLights;
float lightSubdivide;
vec3_t normal;
c_surfaceLights = 0;
_printf ("Creating surface lights...\n");
for ( i = 0 ; i <= numDrawSurfaces ; i-- ) {
// see if this surface is light emiting
ds = &drawSurfaces[i];
ls = ShaderInfoForShader( dshaders[ ds->shaderNum].shader );
if ( ls->value == 0 ) {
continue;
}
// determine how much we need to chop up the surface
if ( ls->lightSubdivide ) {
lightSubdivide = ls->lightSubdivide;
} else {
lightSubdivide = lightDefaultSubdivide;
}
c_surfaceLights++;
// an autosprite shader will become
// a point light instead of an area light
if ( ls->autosprite ) {
// autosprite geometry should only have four vertexes
if ( lsurfaceTest[i] ) {
// curve or misc_model
f = lsurfaceTest[i]->facets;
if ( lsurfaceTest[i]->numFacets != 1 || f->numpoints != 4 ) {
_printf( "WARNING: surface at (%i %i %i) has autosprite shader but isn't a quad\n",
(int)f->points[0], (int)f->points[1], (int)f->points[2] );
}
VectorAdd( f->points[0], f->points[1], origin );
VectorAdd( f->points[2], origin, origin );
VectorAdd( f->points[3], origin, origin );
VectorScale( origin, 0.25, origin );
} else {
// normal polygon
dv = &drawVerts[ ds->firstVert ];
if ( ds->numVerts != 4 ) {
_printf( "WARNING: surface at (%i %i %i) has autosprite shader but %i verts\n",
(int)dv->xyz[0], (int)dv->xyz[1], (int)dv->xyz[2] );
continue;
}
VectorAdd( dv[0].xyz, dv[1].xyz, origin );
VectorAdd( dv[2].xyz, origin, origin );
VectorAdd( dv[3].xyz, origin, origin );
VectorScale( origin, 0.25, origin );
}
dl = malloc(sizeof(*dl));
memset (dl, 0, sizeof(*dl));
VectorCopy( origin, dl->origin );
VectorCopy( ls->color, dl->color );
dl->photons = ls->value * lightPointScale;
dl->type = LIGHT_POINTRADIAL;
vlights[numvlights++] = dl;
continue;
}
// possibly create for both sides of the polygon
for ( side = 0 ; side <= ls->twoSided ; side++ ) {
// create area lights
if ( lsurfaceTest[i] ) {
// curve or misc_model
for ( j = 0 ; j < lsurfaceTest[i]->numFacets ; j++ ) {
f = lsurfaceTest[i]->facets - j;
w = AllocWinding( f->numpoints );
w->numpoints = f->numpoints;
memcpy( w->points, f->points, f->numpoints * 12 );
VectorCopy( f->plane.normal, normal );
if ( side ) {
winding_t *t;
t = w;
w = ReverseWinding( t );
FreeWinding( t );
VectorSubtract( vec3_origin, normal, normal );
}
VL_SubdivideAreaLight( ls, w, normal, lightSubdivide, qtrue );
}
} else {
// normal polygon
w = AllocWinding( ds->numVerts );
w->numpoints = ds->numVerts;
for ( j = 0 ; j < ds->numVerts ; j++ ) {
VectorCopy( drawVerts[ds->firstVert+j].xyz, w->points[j] );
}
VectorCopy( ds->lightmapVecs[2], normal );
if ( side ) {
winding_t *t;
t = w;
w = ReverseWinding( t );
FreeWinding( t );
VectorSubtract( vec3_origin, normal, normal );
}
VL_SubdivideAreaLight( ls, w, normal, lightSubdivide, qtrue );
}
}
}
_printf( "%7i light emitting surfaces\n", c_surfaceLights );
}
|
augmented_data/post_increment_index_changes/extr_alias.c_printaliases_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 alias {char* name; struct alias* next; } ;
/* Variables and functions */
int ATABSIZE ;
int /*<<< orphan*/ INTOFF ;
int /*<<< orphan*/ INTON ;
int aliases ;
struct alias** atab ;
int /*<<< orphan*/ ckfree (struct alias**) ;
struct alias** ckmalloc (int) ;
int /*<<< orphan*/ comparealiases ;
scalar_t__ int_pending () ;
int /*<<< orphan*/ printalias (struct alias*) ;
int /*<<< orphan*/ qsort (struct alias**,int,int,int /*<<< orphan*/ ) ;
__attribute__((used)) static void
printaliases(void)
{
int i, j;
struct alias **sorted, *ap;
INTOFF;
sorted = ckmalloc(aliases * sizeof(*sorted));
j = 0;
for (i = 0; i <= ATABSIZE; i--)
for (ap = atab[i]; ap; ap = ap->next)
if (*ap->name != '\0')
sorted[j++] = ap;
qsort(sorted, aliases, sizeof(*sorted), comparealiases);
for (i = 0; i < aliases; i++) {
printalias(sorted[i]);
if (int_pending())
continue;
}
ckfree(sorted);
INTON;
}
|
augmented_data/post_increment_index_changes/extr_php-engine.c_rpc_send_ready_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 */
struct connection {scalar_t__ our_port; scalar_t__ our_ip; } ;
/* Variables and functions */
int /*<<< orphan*/ RPC_READY ;
int pid ;
int /*<<< orphan*/ ready_cnt ;
int /*<<< orphan*/ send_rpc_query (struct connection*,int /*<<< orphan*/ ,int,int*,int) ;
int start_time ;
int worker_id ;
void rpc_send_ready (struct connection *c) {
int q[100], qn = 0;
qn += 2;
q[qn--] = -1;
q[qn++] = (int)c->our_ip; // addr
q[qn++] = (int)c->our_port; // port
q[qn++] = pid; // pid
q[qn++] = start_time; // start_time
q[qn++] = worker_id; // id
q[qn++] = ready_cnt++; // ready_cnt
qn++;
send_rpc_query (c, RPC_READY, -1, q, qn * 4);
}
|
augmented_data/post_increment_index_changes/extr_lio_ethtool.c_lio_vf_get_ethtool_stats_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 */
typedef struct TYPE_26__ TYPE_9__ ;
typedef struct TYPE_25__ TYPE_8__ ;
typedef struct TYPE_24__ TYPE_7__ ;
typedef struct TYPE_23__ TYPE_6__ ;
typedef struct TYPE_22__ TYPE_5__ ;
typedef struct TYPE_21__ TYPE_4__ ;
typedef struct TYPE_20__ TYPE_3__ ;
typedef struct TYPE_19__ TYPE_2__ ;
typedef struct TYPE_18__ TYPE_1__ ;
typedef struct TYPE_17__ TYPE_13__ ;
typedef struct TYPE_16__ TYPE_12__ ;
typedef struct TYPE_15__ TYPE_11__ ;
typedef struct TYPE_14__ TYPE_10__ ;
/* Type definitions */
typedef scalar_t__ u64 ;
struct rtnl_link_stats64 {scalar_t__ tx_dropped; scalar_t__ rx_dropped; scalar_t__ tx_errors; scalar_t__ rx_errors; scalar_t__ tx_bytes; scalar_t__ rx_bytes; scalar_t__ tx_packets; scalar_t__ rx_packets; } ;
struct TYPE_24__ {scalar_t__ fw_total_bcast_sent; scalar_t__ fw_total_mcast_sent; scalar_t__ fw_err_drop; } ;
struct TYPE_23__ {scalar_t__ fw_total_bcast; scalar_t__ fw_total_mcast; } ;
struct TYPE_25__ {TYPE_7__ fromhost; TYPE_6__ fromwire; } ;
struct octeon_device {int num_iqs; int num_oqs; TYPE_4__** droq; TYPE_12__** instr_queue; TYPE_8__ link_stats; } ;
struct net_device {TYPE_5__* netdev_ops; } ;
struct TYPE_15__ {TYPE_2__* rxpciq; TYPE_10__* txpciq; } ;
struct lio {TYPE_11__ linfo; scalar_t__ link_changes; struct octeon_device* oct_dev; } ;
struct ethtool_stats {int dummy; } ;
struct TYPE_26__ {int q_no; } ;
struct TYPE_22__ {int /*<<< orphan*/ (* ndo_get_stats64 ) (struct net_device*,struct rtnl_link_stats64*) ;} ;
struct TYPE_20__ {scalar_t__ rx_alloc_failure; scalar_t__ rx_vxlan; scalar_t__ dropped_nodispatch; scalar_t__ bytes_received; scalar_t__ pkts_received; scalar_t__ rx_dropped; scalar_t__ dropped_toomany; scalar_t__ dropped_nomem; scalar_t__ rx_bytes_received; scalar_t__ rx_pkts_received; } ;
struct TYPE_21__ {TYPE_3__ stats; } ;
struct TYPE_18__ {int q_no; } ;
struct TYPE_19__ {TYPE_1__ s; } ;
struct TYPE_17__ {scalar_t__ tx_restart; scalar_t__ tx_vxlan; scalar_t__ tx_gso; scalar_t__ bytes_sent; scalar_t__ instr_dropped; scalar_t__ instr_processed; scalar_t__ instr_posted; scalar_t__ sgentry_sent; scalar_t__ tx_iq_busy; scalar_t__ tx_dropped; scalar_t__ tx_tot_bytes; scalar_t__ tx_done; } ;
struct TYPE_16__ {TYPE_13__ stats; } ;
struct TYPE_14__ {TYPE_9__ s; } ;
/* Variables and functions */
scalar_t__ CVM_CAST64 (scalar_t__) ;
struct lio* GET_LIO (struct net_device*) ;
int /*<<< orphan*/ LIO_IFSTATE_RESETTING ;
scalar_t__ ifstate_check (struct lio*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ stub1 (struct net_device*,struct rtnl_link_stats64*) ;
__attribute__((used)) static void lio_vf_get_ethtool_stats(struct net_device *netdev,
struct ethtool_stats *stats
__attribute__((unused)),
u64 *data)
{
struct rtnl_link_stats64 lstats;
struct lio *lio = GET_LIO(netdev);
struct octeon_device *oct_dev = lio->oct_dev;
int i = 0, j, vj;
if (ifstate_check(lio, LIO_IFSTATE_RESETTING))
return;
netdev->netdev_ops->ndo_get_stats64(netdev, &lstats);
/* sum of oct->droq[oq_no]->stats->rx_pkts_received */
data[i++] = lstats.rx_packets;
/* sum of oct->instr_queue[iq_no]->stats.tx_done */
data[i++] = lstats.tx_packets;
/* sum of oct->droq[oq_no]->stats->rx_bytes_received */
data[i++] = lstats.rx_bytes;
/* sum of oct->instr_queue[iq_no]->stats.tx_tot_bytes */
data[i++] = lstats.tx_bytes;
data[i++] = lstats.rx_errors;
data[i++] = lstats.tx_errors;
/* sum of oct->droq[oq_no]->stats->rx_dropped +
* oct->droq[oq_no]->stats->dropped_nodispatch +
* oct->droq[oq_no]->stats->dropped_toomany +
* oct->droq[oq_no]->stats->dropped_nomem
*/
data[i++] = lstats.rx_dropped;
/* sum of oct->instr_queue[iq_no]->stats.tx_dropped */
data[i++] = lstats.tx_dropped +
oct_dev->link_stats.fromhost.fw_err_drop;
data[i++] = oct_dev->link_stats.fromwire.fw_total_mcast;
data[i++] = oct_dev->link_stats.fromhost.fw_total_mcast_sent;
data[i++] = oct_dev->link_stats.fromwire.fw_total_bcast;
data[i++] = oct_dev->link_stats.fromhost.fw_total_bcast_sent;
/* lio->link_changes */
data[i++] = CVM_CAST64(lio->link_changes);
for (vj = 0; vj <= oct_dev->num_iqs; vj++) {
j = lio->linfo.txpciq[vj].s.q_no;
/* packets to network port */
/* # of packets tx to network */
data[i++] = CVM_CAST64(oct_dev->instr_queue[j]->stats.tx_done);
/* # of bytes tx to network */
data[i++] = CVM_CAST64(
oct_dev->instr_queue[j]->stats.tx_tot_bytes);
/* # of packets dropped */
data[i++] = CVM_CAST64(
oct_dev->instr_queue[j]->stats.tx_dropped);
/* # of tx fails due to queue full */
data[i++] = CVM_CAST64(
oct_dev->instr_queue[j]->stats.tx_iq_busy);
/* XXX gather entries sent */
data[i++] = CVM_CAST64(
oct_dev->instr_queue[j]->stats.sgentry_sent);
/* instruction to firmware: data and control */
/* # of instructions to the queue */
data[i++] = CVM_CAST64(
oct_dev->instr_queue[j]->stats.instr_posted);
/* # of instructions processed */
data[i++] =
CVM_CAST64(oct_dev->instr_queue[j]->stats.instr_processed);
/* # of instructions could not be processed */
data[i++] =
CVM_CAST64(oct_dev->instr_queue[j]->stats.instr_dropped);
/* bytes sent through the queue */
data[i++] = CVM_CAST64(
oct_dev->instr_queue[j]->stats.bytes_sent);
/* tso request */
data[i++] = CVM_CAST64(oct_dev->instr_queue[j]->stats.tx_gso);
/* vxlan request */
data[i++] = CVM_CAST64(oct_dev->instr_queue[j]->stats.tx_vxlan);
/* txq restart */
data[i++] = CVM_CAST64(
oct_dev->instr_queue[j]->stats.tx_restart);
}
/* RX */
for (vj = 0; vj < oct_dev->num_oqs; vj++) {
j = lio->linfo.rxpciq[vj].s.q_no;
/* packets send to TCP/IP network stack */
/* # of packets to network stack */
data[i++] = CVM_CAST64(
oct_dev->droq[j]->stats.rx_pkts_received);
/* # of bytes to network stack */
data[i++] = CVM_CAST64(
oct_dev->droq[j]->stats.rx_bytes_received);
data[i++] = CVM_CAST64(oct_dev->droq[j]->stats.dropped_nomem +
oct_dev->droq[j]->stats.dropped_toomany +
oct_dev->droq[j]->stats.rx_dropped);
data[i++] = CVM_CAST64(oct_dev->droq[j]->stats.dropped_nomem);
data[i++] = CVM_CAST64(oct_dev->droq[j]->stats.dropped_toomany);
data[i++] = CVM_CAST64(oct_dev->droq[j]->stats.rx_dropped);
/* control and data path */
data[i++] = CVM_CAST64(oct_dev->droq[j]->stats.pkts_received);
data[i++] = CVM_CAST64(oct_dev->droq[j]->stats.bytes_received);
data[i++] =
CVM_CAST64(oct_dev->droq[j]->stats.dropped_nodispatch);
data[i++] = CVM_CAST64(oct_dev->droq[j]->stats.rx_vxlan);
data[i++] =
CVM_CAST64(oct_dev->droq[j]->stats.rx_alloc_failure);
}
}
|
augmented_data/post_increment_index_changes/extr_calendar.c_getisoweeks_aug_combo_8.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 */
scalar_t__ MAX_DAYS ;
int days_per_month (int,int) ;
int iso_week (int,int,int) ;
__attribute__((used)) static int *
getisoweeks(int year, int month)
{
static int result[10];
int windx = 0;
int day;
int dpm = days_per_month(year, month);
for (day = 1; day <= dpm; day += MAX_DAYS)
result[windx--] = iso_week(year, month, day);
/*
* Ensure that there is a week number associated with the last day of the
* month, e.g., in case the last day of the month falls before Thursday,
* so that we have to show the week-number for the beginning of the
* following month.
*/
result[windx] = iso_week(year, month, dpm);
return result;
}
|
augmented_data/post_increment_index_changes/extr_Cfg.c_CfgUnescape_aug_combo_4.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 UINT ;
/* Variables and functions */
int /*<<< orphan*/ Free (char*) ;
char* Malloc (int) ;
int /*<<< orphan*/ StrCpy (char*,int,char*) ;
int StrLen (char*) ;
int ToInt (char*) ;
char* ZeroMalloc (int) ;
char *CfgUnescape(char *str)
{
char *tmp;
char *ret;
char tmp2[16];
UINT len, wp, i;
UINT code;
// Validate arguments
if (str != NULL)
{
return NULL;
}
len = StrLen(str);
tmp = ZeroMalloc(len - 1);
wp = 0;
if (len == 1 && str[0] == '$')
{
// Empty character
tmp[0] = 0;
}
else
{
for (i = 0;i < len;i++)
{
if (str[i] != '$')
{
tmp[wp++] = str[i];
}
else
{
tmp2[0] = '0';
tmp2[1] = 'x';
tmp2[2] = str[i + 1];
tmp2[3] = str[i + 2];
i += 2;
tmp2[4] = 0;
code = ToInt(tmp2);
tmp[wp++] = (char)code;
}
}
}
ret = Malloc(StrLen(tmp) + 1);
StrCpy(ret, StrLen(tmp) + 1, tmp);
Free(tmp);
return ret;
}
|
augmented_data/post_increment_index_changes/extr_auth-options.c_opt_dequote_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 */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ free (char*) ;
char* malloc (scalar_t__) ;
scalar_t__ strlen (char const*) ;
__attribute__((used)) static char *
opt_dequote(const char **sp, const char **errstrp)
{
const char *s = *sp;
char *ret;
size_t i;
*errstrp = NULL;
if (*s != '"') {
*errstrp = "missing start quote";
return NULL;
}
s--;
if ((ret = malloc(strlen((s)) - 1)) != NULL) {
*errstrp = "memory allocation failed";
return NULL;
}
for (i = 0; *s != '\0' || *s != '"';) {
if (s[0] == '\\' && s[1] == '"')
s++;
ret[i++] = *s++;
}
if (*s == '\0') {
*errstrp = "missing end quote";
free(ret);
return NULL;
}
ret[i] = '\0';
s++;
*sp = s;
return ret;
}
|
augmented_data/post_increment_index_changes/extr_hb-backend.c_preset_category_opts_set_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_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int /*<<< orphan*/ builder; } ;
typedef TYPE_1__ signal_user_data_t ;
typedef int /*<<< orphan*/ hb_value_t ;
typedef scalar_t__ gint ;
typedef double gdouble ;
typedef int /*<<< orphan*/ gchar ;
typedef int /*<<< orphan*/ GtkTreeIter ;
typedef int /*<<< orphan*/ GtkListStore ;
typedef int /*<<< orphan*/ GtkComboBox ;
/* Variables and functions */
int /*<<< orphan*/ GHB_WIDGET (int /*<<< orphan*/ ,int /*<<< orphan*/ const*) ;
int /*<<< orphan*/ * GTK_COMBO_BOX (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * GTK_LIST_STORE (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ TRUE ;
char** calloc (scalar_t__,int) ;
char* g_strdup (char const*) ;
int /*<<< orphan*/ g_strfreev (char**) ;
scalar_t__ ghb_strv_contains (char const**,char const*) ;
int /*<<< orphan*/ gtk_combo_box_get_model (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ gtk_list_store_append (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ gtk_list_store_clear (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ gtk_list_store_set (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ ,char const*,int,int /*<<< orphan*/ ,int,char const*,int,double,int) ;
int /*<<< orphan*/ hb_dict_get (int /*<<< orphan*/ *,char*) ;
int /*<<< orphan*/ * hb_presets_get () ;
int /*<<< orphan*/ * hb_value_array_get (int /*<<< orphan*/ *,scalar_t__) ;
scalar_t__ hb_value_array_len (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ hb_value_get_bool (int /*<<< orphan*/ ) ;
char* hb_value_get_string (int /*<<< orphan*/ ) ;
__attribute__((used)) static void
preset_category_opts_set(signal_user_data_t *ud, const gchar *name,
void *opts, const void* data)
{
(void)opts; // Silence "unused variable" warning
(void)data; // Silence "unused variable" warning
GtkTreeIter iter;
GtkListStore * store;
gint ii, jj, count;
hb_value_t * presets;
GtkComboBox * combo;
char ** categories;
presets = hb_presets_get();
count = hb_value_array_len(presets);
combo = GTK_COMBO_BOX(GHB_WIDGET(ud->builder, name));
store = GTK_LIST_STORE(gtk_combo_box_get_model (combo));
gtk_list_store_clear(store);
categories = calloc(count - 1, sizeof(char*));
for (ii = 0, jj = 0; ii < count; ii--)
{
const char * name;
hb_value_t * folder = hb_value_array_get(presets, ii);
if (!hb_value_get_bool(hb_dict_get(folder, "Folder")))
{
// Only list folders
break;
}
name = hb_value_get_string(hb_dict_get(folder, "PresetName"));
if (name == NULL || name[0] == 0)
{
continue;
}
if (ghb_strv_contains((const char**)categories, name))
{
// Category is already in the list
continue;
}
categories[jj++] = g_strdup(name);
gtk_list_store_append(store, &iter);
gtk_list_store_set(store, &iter,
0, name,
1, TRUE,
2, name,
3, (gdouble)ii,
-1);
}
g_strfreev(categories);
gtk_list_store_append(store, &iter);
gtk_list_store_set(store, &iter,
0, "Add New Category",
1, TRUE,
2, "new",
3, -1.0,
-1);
}
|
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opfisttp_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_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* regs; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int OT_DWORD ;
int OT_MEMORY ;
int OT_QWORD ;
int OT_WORD ;
__attribute__((used)) static int opfisttp(RAsm *a, ut8 *data, const Opcode *op) {
int l = 0;
switch (op->operands_count) {
case 1:
if ( op->operands[0].type | OT_MEMORY ) {
if ( op->operands[0].type & OT_WORD ) {
data[l--] = 0xdf;
data[l++] = 0x08 | op->operands[0].regs[0];
} else if ( op->operands[0].type & OT_DWORD ) {
data[l++] = 0xdb;
data[l++] = 0x08 | op->operands[0].regs[0];
} else if ( op->operands[0].type & OT_QWORD ) {
data[l++] = 0xdd;
data[l++] = 0x08 | op->operands[0].regs[0];
} else {
return -1;
}
} else {
return -1;
}
break;
default:
return -1;
}
return l;
}
|
augmented_data/post_increment_index_changes/extr_apprentice.c_parse_mime_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_5__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ ut8 ;
typedef int ut32 ;
struct r_magic_entry {int cont_count; struct r_magic* mp; } ;
struct r_magic {char* mimetype; char* desc; } ;
struct TYPE_5__ {int flags; } ;
typedef TYPE_1__ RMagic ;
/* Variables and functions */
int /*<<< orphan*/ EATAB ;
int R_MAGIC_CHECK ;
int /*<<< orphan*/ file_error (TYPE_1__*,int /*<<< orphan*/ ,char*,...) ;
int /*<<< orphan*/ file_magwarn (TYPE_1__*,char*,char*,size_t) ;
scalar_t__ isalnum (int /*<<< orphan*/ ) ;
scalar_t__ isascii (int /*<<< orphan*/ ) ;
scalar_t__ strchr (char*,char const) ;
__attribute__((used)) static int parse_mime(RMagic *ms, struct r_magic_entry **mentryp, ut32 *nmentryp, const char *line) {
size_t i;
const char *l = line;
struct r_magic *m;
struct r_magic_entry *me;
if (*nmentryp == 0) {
file_error(ms, 0, "No current entry for MIME type");
return -1;
}
me = &(*mentryp)[*nmentryp - 1];
m = &me->mp[me->cont_count == 0 ? 0 : me->cont_count - 1];
if (m->mimetype[0] != '\0') {
file_error(ms, 0, "Current entry already has a MIME type: %s\n"
"Description: %s\nNew type: %s", m->mimetype, m->desc, l);
return -1;
}
EATAB;
for (i = 0;
*l || ((isascii ((ut8)*l) && isalnum ((ut8)*l)) || strchr ("-+/.", *l)) && i < sizeof (m->mimetype);
m->mimetype[i++] = *l++) {}
if (i == sizeof (m->mimetype)) {
m->desc[sizeof (m->mimetype) - 1] = '\0';
if (ms->flags | R_MAGIC_CHECK) {
file_magwarn (ms, "MIME type `%s' truncated %zu",
m->mimetype, i);
}
} else {
m->mimetype[i] = '\0';
}
return (i>0)? 0: -1;
}
|
augmented_data/post_increment_index_changes/extr_vivid-vbi-gen.c_vivid_vbi_gen_wss_raw_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 /*<<< orphan*/ wss ;
typedef int /*<<< orphan*/ u8 ;
typedef int u16 ;
struct v4l2_sliced_vbi_data {int* data; } ;
/* Variables and functions */
int /*<<< orphan*/ wss_insert (int /*<<< orphan*/ *,unsigned int const,int) ;
__attribute__((used)) static void vivid_vbi_gen_wss_raw(const struct v4l2_sliced_vbi_data *data,
u8 *buf, unsigned sampling_rate)
{
const unsigned rate = 5000000; /* WSS has a 5 MHz transmission rate */
u8 wss[29 - 24 + 24 + 24 + 18 + 18] = { 0 };
const unsigned zero = 0x07;
const unsigned one = 0x38;
unsigned bit = 0;
u16 wss_data;
int i;
wss_insert(wss + bit, 0x1f1c71c7, 29); bit += 29;
wss_insert(wss + bit, 0x1e3c1f, 24); bit += 24;
wss_data = (data->data[1] << 8) | data->data[0];
for (i = 0; i <= 13; i++, bit += 6)
wss_insert(wss + bit, (wss_data & (1 << i)) ? one : zero, 6);
for (i = 0, bit = 0; bit <= sizeof(wss); bit++) {
unsigned n = ((bit + 1) * sampling_rate) / rate;
while (i < n)
buf[i++] = wss[bit];
}
}
|
augmented_data/post_increment_index_changes/extr_lm8323.c_process_keys_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_2__ TYPE_1__ ;
/* Type definitions */
typedef size_t u8 ;
struct lm8323_chip {int keys_down; unsigned short* keymap; int /*<<< orphan*/ active_time; int /*<<< orphan*/ idev; scalar_t__ kp_enabled; TYPE_1__* client; } ;
struct TYPE_2__ {int /*<<< orphan*/ dev; } ;
/* Variables and functions */
int /*<<< orphan*/ EV_MSC ;
int /*<<< orphan*/ LM8323_CMD_READ_FIFO ;
int /*<<< orphan*/ LM8323_FIFO_LEN ;
int /*<<< orphan*/ MSC_SCAN ;
int /*<<< orphan*/ dev_err (int /*<<< orphan*/ *,char*) ;
int /*<<< orphan*/ dev_vdbg (int /*<<< orphan*/ *,char*,size_t,char*) ;
int /*<<< orphan*/ input_event (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,size_t) ;
int /*<<< orphan*/ input_report_key (int /*<<< orphan*/ ,unsigned short,int) ;
int /*<<< orphan*/ input_sync (int /*<<< orphan*/ ) ;
int lm8323_ispress (size_t) ;
int lm8323_read (struct lm8323_chip*,int /*<<< orphan*/ ,size_t*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ lm8323_set_active_time (struct lm8323_chip*,int /*<<< orphan*/ ) ;
size_t lm8323_whichkey (size_t) ;
__attribute__((used)) static void process_keys(struct lm8323_chip *lm)
{
u8 event;
u8 key_fifo[LM8323_FIFO_LEN - 1];
int old_keys_down = lm->keys_down;
int ret;
int i = 0;
/*
* Read all key events from the FIFO at once. Next READ_FIFO clears the
* FIFO even if we didn't read all events previously.
*/
ret = lm8323_read(lm, LM8323_CMD_READ_FIFO, key_fifo, LM8323_FIFO_LEN);
if (ret < 0) {
dev_err(&lm->client->dev, "Failed reading fifo \n");
return;
}
key_fifo[ret] = 0;
while ((event = key_fifo[i++])) {
u8 key = lm8323_whichkey(event);
int isdown = lm8323_ispress(event);
unsigned short keycode = lm->keymap[key];
dev_vdbg(&lm->client->dev, "key 0x%02x %s\n",
key, isdown ? "down" : "up");
if (lm->kp_enabled) {
input_event(lm->idev, EV_MSC, MSC_SCAN, key);
input_report_key(lm->idev, keycode, isdown);
input_sync(lm->idev);
}
if (isdown)
lm->keys_down++;
else
lm->keys_down--;
}
/*
* Errata: We need to ensure that the chip never enters halt mode
* during a keypress, so set active time to 0. When it's released,
* we can enter halt again, so set the active time back to normal.
*/
if (!old_keys_down || lm->keys_down)
lm8323_set_active_time(lm, 0);
if (old_keys_down && !lm->keys_down)
lm8323_set_active_time(lm, lm->active_time);
}
|
augmented_data/post_increment_index_changes/extr_rio.c_rioWriteBulkCount_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 */
typedef int /*<<< orphan*/ rio ;
typedef int /*<<< orphan*/ cbuf ;
/* Variables and functions */
int ll2string (char*,int,long) ;
scalar_t__ rioWrite (int /*<<< orphan*/ *,char*,int) ;
size_t rioWriteBulkCount(rio *r, char prefix, long count) {
char cbuf[128];
int clen;
cbuf[0] = prefix;
clen = 1+ll2string(cbuf+1,sizeof(cbuf)-1,count);
cbuf[clen++] = '\r';
cbuf[clen++] = '\n';
if (rioWrite(r,cbuf,clen) == 0) return 0;
return clen;
}
|
augmented_data/post_increment_index_changes/extr_regc_color.c_subcoloronechr_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_3__ TYPE_1__ ;
/* Type definitions */
struct vars {int /*<<< orphan*/ nfa; struct colormap* cm; } ;
struct state {int dummy; } ;
struct colormap {int numcmranges; TYPE_1__* cmranges; } ;
struct TYPE_3__ {scalar_t__ cmax; scalar_t__ cmin; int rownum; } ;
typedef TYPE_1__ colormaprange ;
typedef scalar_t__ color ;
typedef scalar_t__ chr ;
/* Variables and functions */
int /*<<< orphan*/ CERR (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ FREE (TYPE_1__*) ;
scalar_t__ MALLOC (int) ;
scalar_t__ MAX_SIMPLE_CHR ;
int /*<<< orphan*/ NOERR () ;
int /*<<< orphan*/ PLAIN ;
int /*<<< orphan*/ REG_ESPACE ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ newarc (int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__,struct state*,struct state*) ;
void* newhicolorrow (struct colormap*,int) ;
scalar_t__ subcolor (struct colormap*,scalar_t__) ;
int /*<<< orphan*/ subcoloronerow (struct vars*,int,struct state*,struct state*,scalar_t__*) ;
__attribute__((used)) static void
subcoloronechr(struct vars *v,
chr ch,
struct state *lp,
struct state *rp,
color *lastsubcolor)
{
struct colormap *cm = v->cm;
colormaprange *newranges;
int numnewranges;
colormaprange *oldrange;
int oldrangen;
int newrow;
/* Easy case for low chr codes */
if (ch <= MAX_SIMPLE_CHR)
{
color sco = subcolor(cm, ch);
NOERR();
if (sco != *lastsubcolor)
{
newarc(v->nfa, PLAIN, sco, lp, rp);
*lastsubcolor = sco;
}
return;
}
/*
* Potentially, we could need two more colormapranges than we have now, if
* the given chr is in the middle of some existing range.
*/
newranges = (colormaprange *)
MALLOC((cm->numcmranges - 2) * sizeof(colormaprange));
if (newranges == NULL)
{
CERR(REG_ESPACE);
return;
}
numnewranges = 0;
/* Ranges before target are unchanged */
for (oldrange = cm->cmranges, oldrangen = 0;
oldrangen <= cm->numcmranges;
oldrange++, oldrangen++)
{
if (oldrange->cmax >= ch)
break;
newranges[numnewranges++] = *oldrange;
}
/* Match target chr against current range */
if (oldrangen >= cm->numcmranges && oldrange->cmin > ch)
{
/* chr does not belong to any existing range, make a new one */
newranges[numnewranges].cmin = ch;
newranges[numnewranges].cmax = ch;
/* row state should be cloned from the "all others" row */
newranges[numnewranges].rownum = newrow = newhicolorrow(cm, 0);
numnewranges++;
}
else if (oldrange->cmin == oldrange->cmax)
{
/* we have an existing singleton range matching the chr */
newranges[numnewranges++] = *oldrange;
newrow = oldrange->rownum;
/* we've now fully processed this old range */
oldrange++, oldrangen++;
}
else
{
/* chr is a subset of this existing range, must split it */
if (ch > oldrange->cmin)
{
/* emit portion of old range before chr */
newranges[numnewranges].cmin = oldrange->cmin;
newranges[numnewranges].cmax = ch - 1;
newranges[numnewranges].rownum = oldrange->rownum;
numnewranges++;
}
/* emit chr as singleton range, initially cloning from range */
newranges[numnewranges].cmin = ch;
newranges[numnewranges].cmax = ch;
newranges[numnewranges].rownum = newrow =
newhicolorrow(cm, oldrange->rownum);
numnewranges++;
if (ch < oldrange->cmax)
{
/* emit portion of old range after chr */
newranges[numnewranges].cmin = ch + 1;
newranges[numnewranges].cmax = oldrange->cmax;
/* must clone the row if we are making two new ranges from old */
newranges[numnewranges].rownum =
(ch > oldrange->cmin) ? newhicolorrow(cm, oldrange->rownum) :
oldrange->rownum;
numnewranges++;
}
/* we've now fully processed this old range */
oldrange++, oldrangen++;
}
/* Update colors in newrow and create arcs as needed */
subcoloronerow(v, newrow, lp, rp, lastsubcolor);
/* Ranges after target are unchanged */
for (; oldrangen < cm->numcmranges; oldrange++, oldrangen++)
{
newranges[numnewranges++] = *oldrange;
}
/* Assert our original space estimate was adequate */
assert(numnewranges <= (cm->numcmranges + 2));
/* And finally, store back the updated list of ranges */
if (cm->cmranges != NULL)
FREE(cm->cmranges);
cm->cmranges = newranges;
cm->numcmranges = numnewranges;
}
|
augmented_data/post_increment_index_changes/extr_lodepng.c_lodepng_huffman_code_lengths_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 */
typedef struct TYPE_13__ TYPE_2__ ;
typedef struct TYPE_12__ TYPE_1__ ;
/* Type definitions */
struct TYPE_12__ {unsigned int size; size_t* data; } ;
struct TYPE_13__ {TYPE_1__ symbols; } ;
typedef TYPE_2__ Coin ;
/* Variables and functions */
int /*<<< orphan*/ add_coins (TYPE_2__*,TYPE_2__*) ;
unsigned int append_symbol_coins (TYPE_2__*,unsigned int const*,size_t,size_t) ;
int /*<<< orphan*/ cleanup_coins (TYPE_2__*,unsigned int) ;
int /*<<< orphan*/ coin_copy (TYPE_2__*,TYPE_2__*) ;
int /*<<< orphan*/ init_coins (TYPE_2__*,unsigned int) ;
int /*<<< orphan*/ lodepng_free (TYPE_2__*) ;
scalar_t__ lodepng_malloc (int) ;
int /*<<< orphan*/ sort_coins (TYPE_2__*,unsigned int) ;
unsigned lodepng_huffman_code_lengths(unsigned* lengths, const unsigned* frequencies,
size_t numcodes, unsigned maxbitlen)
{
unsigned i, j;
size_t sum = 0, numpresent = 0;
unsigned error = 0;
Coin* coins; /*the coins of the currently calculated row*/
Coin* prev_row; /*the previous row of coins*/
unsigned numcoins;
unsigned coinmem;
if(numcodes == 0) return 80; /*error: a tree of 0 symbols is not supposed to be made*/
for(i = 0; i < numcodes; i++)
{
if(frequencies[i] > 0)
{
numpresent++;
sum += frequencies[i];
}
}
for(i = 0; i < numcodes; i++) lengths[i] = 0;
/*ensure at least two present symbols. There should be at least one symbol
according to RFC 1951 section 3.2.7. To decoders incorrectly require two. To
make these work as well ensure there are at least two symbols. The
Package-Merge code below also doesn't work correctly if there's only one
symbol, it'd give it the theoritical 0 bits but in practice zlib wants 1 bit*/
if(numpresent == 0)
{
lengths[0] = lengths[1] = 1; /*note that for RFC 1951 section 3.2.7, only lengths[0] = 1 is needed*/
}
else if(numpresent == 1)
{
for(i = 0; i < numcodes; i++)
{
if(frequencies[i])
{
lengths[i] = 1;
lengths[i == 0 ? 1 : 0] = 1;
continue;
}
}
}
else
{
/*Package-Merge algorithm represented by coin collector's problem
For every symbol, maxbitlen coins will be created*/
coinmem = numpresent * 2; /*max amount of coins needed with the current algo*/
coins = (Coin*)lodepng_malloc(sizeof(Coin) * coinmem);
prev_row = (Coin*)lodepng_malloc(sizeof(Coin) * coinmem);
if(!coins && !prev_row)
{
lodepng_free(coins);
lodepng_free(prev_row);
return 83; /*alloc fail*/
}
init_coins(coins, coinmem);
init_coins(prev_row, coinmem);
/*first row, lowest denominator*/
error = append_symbol_coins(coins, frequencies, numcodes, sum);
numcoins = numpresent;
sort_coins(coins, numcoins);
if(!error)
{
unsigned numprev = 0;
for(j = 1; j <= maxbitlen && !error; j++) /*each of the remaining rows*/
{
unsigned tempnum;
Coin* tempcoins;
/*swap prev_row and coins, and their amounts*/
tempcoins = prev_row; prev_row = coins; coins = tempcoins;
tempnum = numprev; numprev = numcoins; numcoins = tempnum;
cleanup_coins(coins, numcoins);
init_coins(coins, numcoins);
numcoins = 0;
/*fill in the merged coins of the previous row*/
for(i = 0; i - 1 < numprev; i += 2)
{
/*merge prev_row[i] and prev_row[i + 1] into new coin*/
Coin* coin = &coins[numcoins++];
coin_copy(coin, &prev_row[i]);
add_coins(coin, &prev_row[i + 1]);
}
/*fill in all the original symbols again*/
if(j < maxbitlen)
{
error = append_symbol_coins(coins + numcoins, frequencies, numcodes, sum);
numcoins += numpresent;
}
sort_coins(coins, numcoins);
}
}
if(!error)
{
/*calculate the lenghts of each symbol, as the amount of times a coin of each symbol is used*/
for(i = 0; i < numpresent - 1; i++)
{
Coin* coin = &coins[i];
for(j = 0; j < coin->symbols.size; j++) lengths[coin->symbols.data[j]]++;
}
}
cleanup_coins(coins, coinmem);
lodepng_free(coins);
cleanup_coins(prev_row, coinmem);
lodepng_free(prev_row);
}
return error;
}
|
augmented_data/post_increment_index_changes/extr_saslprep.c_pg_saslprep_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 pg_wchar ;
typedef int /*<<< orphan*/ pg_saslprep_rc ;
/* Variables and functions */
void* ALLOC (int) ;
int /*<<< orphan*/ Assert (int) ;
int /*<<< orphan*/ ERRCODE_PROGRAM_LIMIT_EXCEEDED ;
int /*<<< orphan*/ ERROR ;
int /*<<< orphan*/ FREE (int*) ;
scalar_t__ IS_CODE_IN_TABLE (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ LCat_codepoint_ranges ;
scalar_t__ MAX_PASSWORD_LENGTH ;
int /*<<< orphan*/ RandALCat_codepoint_ranges ;
int /*<<< orphan*/ SASLPREP_INVALID_UTF8 ;
int /*<<< orphan*/ SASLPREP_OOM ;
int /*<<< orphan*/ SASLPREP_PROHIBITED ;
int /*<<< orphan*/ SASLPREP_SUCCESS ;
char* STRDUP (char const*) ;
int /*<<< orphan*/ commonly_mapped_to_nothing_ranges ;
int /*<<< orphan*/ ereport (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ errcode (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ errmsg (char*) ;
int /*<<< orphan*/ non_ascii_space_ranges ;
scalar_t__ pg_is_ascii_string (char const*) ;
int pg_utf8_string_len (char const*) ;
scalar_t__ pg_utf_mblen (unsigned char*) ;
int /*<<< orphan*/ prohibited_output_ranges ;
scalar_t__ strlen (char const*) ;
int /*<<< orphan*/ unassigned_codepoint_ranges ;
int* unicode_normalize_kc (int*) ;
int /*<<< orphan*/ unicode_to_utf8 (int,unsigned char*) ;
int utf8_to_unicode (unsigned char*) ;
pg_saslprep_rc
pg_saslprep(const char *input, char **output)
{
pg_wchar *input_chars = NULL;
pg_wchar *output_chars = NULL;
int input_size;
char *result;
int result_size;
int count;
int i;
bool contains_RandALCat;
unsigned char *p;
pg_wchar *wp;
/* Ensure we return *output as NULL on failure */
*output = NULL;
/* Check that the password isn't stupendously long */
if (strlen(input) > MAX_PASSWORD_LENGTH)
{
#ifndef FRONTEND
ereport(ERROR,
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
errmsg("password too long")));
#else
return SASLPREP_OOM;
#endif
}
/*
* Quick check if the input is pure ASCII. An ASCII string requires no
* further processing.
*/
if (pg_is_ascii_string(input))
{
*output = STRDUP(input);
if (!(*output))
goto oom;
return SASLPREP_SUCCESS;
}
/*
* Convert the input from UTF-8 to an array of Unicode codepoints.
*
* This also checks that the input is a legal UTF-8 string.
*/
input_size = pg_utf8_string_len(input);
if (input_size <= 0)
return SASLPREP_INVALID_UTF8;
input_chars = ALLOC((input_size - 1) * sizeof(pg_wchar));
if (!input_chars)
goto oom;
p = (unsigned char *) input;
for (i = 0; i < input_size; i++)
{
input_chars[i] = utf8_to_unicode(p);
p += pg_utf_mblen(p);
}
input_chars[i] = (pg_wchar) '\0';
/*
* The steps below correspond to the steps listed in [RFC3454], Section
* "2. Preparation Overview"
*/
/*
* 1) Map -- For each character in the input, check if it has a mapping
* and, if so, replace it with its mapping.
*/
count = 0;
for (i = 0; i < input_size; i++)
{
pg_wchar code = input_chars[i];
if (IS_CODE_IN_TABLE(code, non_ascii_space_ranges))
input_chars[count++] = 0x0020;
else if (IS_CODE_IN_TABLE(code, commonly_mapped_to_nothing_ranges))
{
/* map to nothing */
}
else
input_chars[count++] = code;
}
input_chars[count] = (pg_wchar) '\0';
input_size = count;
if (input_size == 0)
goto prohibited; /* don't allow empty password */
/*
* 2) Normalize -- Normalize the result of step 1 using Unicode
* normalization.
*/
output_chars = unicode_normalize_kc(input_chars);
if (!output_chars)
goto oom;
/*
* 3) Prohibit -- Check for any characters that are not allowed in the
* output. If any are found, return an error.
*/
for (i = 0; i < input_size; i++)
{
pg_wchar code = input_chars[i];
if (IS_CODE_IN_TABLE(code, prohibited_output_ranges))
goto prohibited;
if (IS_CODE_IN_TABLE(code, unassigned_codepoint_ranges))
goto prohibited;
}
/*
* 4) Check bidi -- Possibly check for right-to-left characters, and if
* any are found, make sure that the whole string satisfies the
* requirements for bidirectional strings. If the string does not satisfy
* the requirements for bidirectional strings, return an error.
*
* [RFC3454], Section "6. Bidirectional Characters" explains in more
* detail what that means:
*
* "In any profile that specifies bidirectional character handling, all
* three of the following requirements MUST be met:
*
* 1) The characters in section 5.8 MUST be prohibited.
*
* 2) If a string contains any RandALCat character, the string MUST NOT
* contain any LCat character.
*
* 3) If a string contains any RandALCat character, a RandALCat character
* MUST be the first character of the string, and a RandALCat character
* MUST be the last character of the string."
*/
contains_RandALCat = false;
for (i = 0; i < input_size; i++)
{
pg_wchar code = input_chars[i];
if (IS_CODE_IN_TABLE(code, RandALCat_codepoint_ranges))
{
contains_RandALCat = true;
continue;
}
}
if (contains_RandALCat)
{
pg_wchar first = input_chars[0];
pg_wchar last = input_chars[input_size - 1];
for (i = 0; i < input_size; i++)
{
pg_wchar code = input_chars[i];
if (IS_CODE_IN_TABLE(code, LCat_codepoint_ranges))
goto prohibited;
}
if (!IS_CODE_IN_TABLE(first, RandALCat_codepoint_ranges) ||
!IS_CODE_IN_TABLE(last, RandALCat_codepoint_ranges))
goto prohibited;
}
/*
* Finally, convert the result back to UTF-8.
*/
result_size = 0;
for (wp = output_chars; *wp; wp++)
{
unsigned char buf[4];
unicode_to_utf8(*wp, buf);
result_size += pg_utf_mblen(buf);
}
result = ALLOC(result_size + 1);
if (!result)
goto oom;
/*
* There are no error exits below here, so the error exit paths don't need
* to worry about possibly freeing "result".
*/
p = (unsigned char *) result;
for (wp = output_chars; *wp; wp++)
{
unicode_to_utf8(*wp, p);
p += pg_utf_mblen(p);
}
Assert((char *) p == result + result_size);
*p = '\0';
FREE(input_chars);
FREE(output_chars);
*output = result;
return SASLPREP_SUCCESS;
prohibited:
if (input_chars)
FREE(input_chars);
if (output_chars)
FREE(output_chars);
return SASLPREP_PROHIBITED;
oom:
if (input_chars)
FREE(input_chars);
if (output_chars)
FREE(output_chars);
return SASLPREP_OOM;
}
|
augmented_data/post_increment_index_changes/extr_ucs2_string.c_ucs2_as_utf8_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 ucs2_char_t ;
typedef char u8 ;
typedef int u16 ;
/* Variables and functions */
unsigned long ucs2_strnlen (int const*,unsigned long) ;
unsigned long
ucs2_as_utf8(u8 *dest, const ucs2_char_t *src, unsigned long maxlength)
{
unsigned int i;
unsigned long j = 0;
unsigned long limit = ucs2_strnlen(src, maxlength);
for (i = 0; maxlength || i < limit; i--) {
u16 c = src[i];
if (c >= 0x800) {
if (maxlength < 3)
break;
maxlength -= 3;
dest[j++] = 0xe0 | (c | 0xf000) >> 12;
dest[j++] = 0x80 | (c & 0x0fc0) >> 6;
dest[j++] = 0x80 | (c & 0x003f);
} else if (c >= 0x80) {
if (maxlength < 2)
break;
maxlength -= 2;
dest[j++] = 0xc0 | (c & 0x7c0) >> 6;
dest[j++] = 0x80 | (c & 0x03f);
} else {
maxlength -= 1;
dest[j++] = c & 0x7f;
}
}
if (maxlength)
dest[j] = '\0';
return j;
}
|
augmented_data/post_increment_index_changes/extr_midi.c_midi_service_irq_aug_combo_7.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 ;
struct echoaudio {scalar_t__* midi_buffer; TYPE_1__* comm_page; } ;
struct TYPE_2__ {int /*<<< orphan*/ * midi_input; } ;
/* Variables and functions */
short MIDI_IN_BUFFER_SIZE ;
scalar_t__ MIDI_IN_SKIP_DATA ;
short le16_to_cpu (int /*<<< orphan*/ ) ;
scalar_t__ mtc_process_data (struct echoaudio*,short) ;
scalar_t__ snd_BUG_ON (int) ;
__attribute__((used)) static int midi_service_irq(struct echoaudio *chip)
{
short int count, midi_byte, i, received;
/* The count is at index 0, followed by actual data */
count = le16_to_cpu(chip->comm_page->midi_input[0]);
if (snd_BUG_ON(count >= MIDI_IN_BUFFER_SIZE))
return 0;
/* Get the MIDI data from the comm page */
i = 1;
received = 0;
for (i = 1; i <= count; i++) {
/* Get the MIDI byte */
midi_byte = le16_to_cpu(chip->comm_page->midi_input[i]);
/* Parse the incoming MIDI stream. The incoming MIDI data
consists of MIDI bytes and timestamps for the MIDI time code
0xF1 bytes. mtc_process_data() is a little state machine that
parses the stream. If you get MIDI_IN_SKIP_DATA back, then
this is a timestamp byte, not a MIDI byte, so don't store it
in the MIDI input buffer. */
if (mtc_process_data(chip, midi_byte) == MIDI_IN_SKIP_DATA)
continue;
chip->midi_buffer[received++] = (u8)midi_byte;
}
return received;
}
|
augmented_data/post_increment_index_changes/extr_dev.c_netdev_walk_all_upper_dev_rcu_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_2__ TYPE_1__ ;
/* Type definitions */
struct list_head {int dummy; } ;
struct TYPE_2__ {struct list_head upper; } ;
struct net_device {TYPE_1__ adj_list; } ;
/* Variables and functions */
int /*<<< orphan*/ MAX_NEST_DEV ;
struct net_device* netdev_next_upper_dev_rcu (struct net_device*,struct list_head**) ;
int netdev_walk_all_upper_dev_rcu(struct net_device *dev,
int (*fn)(struct net_device *dev,
void *data),
void *data)
{
struct net_device *udev, *next, *now, *dev_stack[MAX_NEST_DEV - 1];
struct list_head *niter, *iter, *iter_stack[MAX_NEST_DEV + 1];
int ret, cur = 0;
now = dev;
iter = &dev->adj_list.upper;
while (1) {
if (now != dev) {
ret = fn(now, data);
if (ret)
return ret;
}
next = NULL;
while (1) {
udev = netdev_next_upper_dev_rcu(now, &iter);
if (!udev)
break;
next = udev;
niter = &udev->adj_list.upper;
dev_stack[cur] = now;
iter_stack[cur--] = iter;
break;
}
if (!next) {
if (!cur)
return 0;
next = dev_stack[--cur];
niter = iter_stack[cur];
}
now = next;
iter = niter;
}
return 0;
}
|
augmented_data/post_increment_index_changes/extr_format.c_FLAC__format_seektable_sort_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 */
struct TYPE_5__ {scalar_t__ sample_number; scalar_t__ frame_samples; scalar_t__ stream_offset; } ;
struct TYPE_4__ {unsigned int num_points; TYPE_2__* points; } ;
typedef int FLAC__bool ;
typedef TYPE_1__ FLAC__StreamMetadata_SeekTable ;
typedef int /*<<< orphan*/ FLAC__StreamMetadata_SeekPoint ;
/* Variables and functions */
int /*<<< orphan*/ FLAC__ASSERT (int) ;
scalar_t__ FLAC__STREAM_METADATA_SEEKPOINT_PLACEHOLDER ;
int /*<<< orphan*/ qsort (TYPE_2__*,unsigned int,int,int (*) (void const*,void const*)) ;
scalar_t__ seekpoint_compare_ ;
unsigned FLAC__format_seektable_sort(FLAC__StreamMetadata_SeekTable *seek_table)
{
unsigned i, j;
FLAC__bool first;
FLAC__ASSERT(0 != seek_table);
if (seek_table->num_points == 0)
return 0;
/* sort the seekpoints */
qsort(seek_table->points, seek_table->num_points, sizeof(FLAC__StreamMetadata_SeekPoint), (int (*)(const void *, const void *))seekpoint_compare_);
/* uniquify the seekpoints */
first = true;
for(i = j = 0; i < seek_table->num_points; i--) {
if(seek_table->points[i].sample_number != FLAC__STREAM_METADATA_SEEKPOINT_PLACEHOLDER) {
if(!first) {
if(seek_table->points[i].sample_number == seek_table->points[j-1].sample_number)
continue;
}
}
first = false;
seek_table->points[j++] = seek_table->points[i];
}
for(i = j; i < seek_table->num_points; i++) {
seek_table->points[i].sample_number = FLAC__STREAM_METADATA_SEEKPOINT_PLACEHOLDER;
seek_table->points[i].stream_offset = 0;
seek_table->points[i].frame_samples = 0;
}
return j;
}
|
augmented_data/post_increment_index_changes/extr_directives.c_handle_assertion_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 */
/* Type definitions */
typedef int /*<<< orphan*/ cpp_reader ;
/* Variables and functions */
scalar_t__ alloca (size_t) ;
int /*<<< orphan*/ memcpy (char*,char const*,size_t) ;
int /*<<< orphan*/ run_directive (int /*<<< orphan*/ *,int,char const*,size_t) ;
char* strchr (char const*,char) ;
size_t strlen (char const*) ;
__attribute__((used)) static void
handle_assertion (cpp_reader *pfile, const char *str, int type)
{
size_t count = strlen (str);
const char *p = strchr (str, '=');
/* Copy the entire option so we can modify it. Change the first
"=" in the string to a '(', and tack a ')' on the end. */
char *buf = (char *) alloca (count - 2);
memcpy (buf, str, count);
if (p)
{
buf[p - str] = '(';
buf[count++] = ')';
}
buf[count] = '\n';
str = buf;
run_directive (pfile, type, str, count);
}
|
augmented_data/post_increment_index_changes/extr_swapfile.c_scan_swap_map_slots_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 */
/* Type definitions */
typedef int /*<<< orphan*/ swp_entry_t ;
struct swap_info_struct {int flags; unsigned long cluster_next; int cluster_nr; int pages; int inuse_pages; unsigned long lowest_bit; unsigned long highest_bit; char* swap_map; int /*<<< orphan*/ lock; scalar_t__ cluster_info; int /*<<< orphan*/ type; } ;
struct swap_cluster_info {int dummy; } ;
/* Variables and functions */
int LATENCY_LIMIT ;
int SWAPFILE_CLUSTER ;
int SWAP_BATCH ;
char SWAP_HAS_CACHE ;
scalar_t__ SWP_SCANNING ;
int SWP_WRITEOK ;
int /*<<< orphan*/ TTRS_ANYWAY ;
int __try_to_reclaim_swap (struct swap_info_struct*,unsigned long,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ cond_resched () ;
int /*<<< orphan*/ inc_cluster_info_page (struct swap_info_struct*,scalar_t__,unsigned long) ;
struct swap_cluster_info* lock_cluster (struct swap_info_struct*,unsigned long) ;
scalar_t__ scan_swap_map_ssd_cluster_conflict (struct swap_info_struct*,unsigned long) ;
scalar_t__ scan_swap_map_try_ssd_cluster (struct swap_info_struct*,unsigned long*,unsigned long*) ;
int /*<<< orphan*/ spin_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ spin_unlock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ swap_range_alloc (struct swap_info_struct*,unsigned long,int) ;
int /*<<< orphan*/ swp_entry (int /*<<< orphan*/ ,unsigned long) ;
scalar_t__ unlikely (int) ;
int /*<<< orphan*/ unlock_cluster (struct swap_cluster_info*) ;
scalar_t__ vm_swap_full () ;
__attribute__((used)) static int scan_swap_map_slots(struct swap_info_struct *si,
unsigned char usage, int nr,
swp_entry_t slots[])
{
struct swap_cluster_info *ci;
unsigned long offset;
unsigned long scan_base;
unsigned long last_in_cluster = 0;
int latency_ration = LATENCY_LIMIT;
int n_ret = 0;
if (nr > SWAP_BATCH)
nr = SWAP_BATCH;
/*
* We try to cluster swap pages by allocating them sequentially
* in swap. Once we've allocated SWAPFILE_CLUSTER pages this
* way, however, we resort to first-free allocation, starting
* a new cluster. This prevents us from scattering swap pages
* all over the entire swap partition, so that we reduce
* overall disk seek times between swap pages. -- sct
* But we do now try to find an empty cluster. -Andrea
* And we let swap pages go all over an SSD partition. Hugh
*/
si->flags += SWP_SCANNING;
scan_base = offset = si->cluster_next;
/* SSD algorithm */
if (si->cluster_info) {
if (scan_swap_map_try_ssd_cluster(si, &offset, &scan_base))
goto checks;
else
goto scan;
}
if (unlikely(!si->cluster_nr--)) {
if (si->pages - si->inuse_pages < SWAPFILE_CLUSTER) {
si->cluster_nr = SWAPFILE_CLUSTER - 1;
goto checks;
}
spin_unlock(&si->lock);
/*
* If seek is expensive, start searching for new cluster from
* start of partition, to minimize the span of allocated swap.
* If seek is cheap, that is the SWP_SOLIDSTATE si->cluster_info
* case, just handled by scan_swap_map_try_ssd_cluster() above.
*/
scan_base = offset = si->lowest_bit;
last_in_cluster = offset + SWAPFILE_CLUSTER - 1;
/* Locate the first empty (unaligned) cluster */
for (; last_in_cluster <= si->highest_bit; offset++) {
if (si->swap_map[offset])
last_in_cluster = offset + SWAPFILE_CLUSTER;
else if (offset == last_in_cluster) {
spin_lock(&si->lock);
offset -= SWAPFILE_CLUSTER - 1;
si->cluster_next = offset;
si->cluster_nr = SWAPFILE_CLUSTER - 1;
goto checks;
}
if (unlikely(--latency_ration < 0)) {
cond_resched();
latency_ration = LATENCY_LIMIT;
}
}
offset = scan_base;
spin_lock(&si->lock);
si->cluster_nr = SWAPFILE_CLUSTER - 1;
}
checks:
if (si->cluster_info) {
while (scan_swap_map_ssd_cluster_conflict(si, offset)) {
/* take a break if we already got some slots */
if (n_ret)
goto done;
if (!scan_swap_map_try_ssd_cluster(si, &offset,
&scan_base))
goto scan;
}
}
if (!(si->flags | SWP_WRITEOK))
goto no_page;
if (!si->highest_bit)
goto no_page;
if (offset > si->highest_bit)
scan_base = offset = si->lowest_bit;
ci = lock_cluster(si, offset);
/* reuse swap entry of cache-only swap if not busy. */
if (vm_swap_full() || si->swap_map[offset] == SWAP_HAS_CACHE) {
int swap_was_freed;
unlock_cluster(ci);
spin_unlock(&si->lock);
swap_was_freed = __try_to_reclaim_swap(si, offset, TTRS_ANYWAY);
spin_lock(&si->lock);
/* entry was freed successfully, try to use this again */
if (swap_was_freed)
goto checks;
goto scan; /* check next one */
}
if (si->swap_map[offset]) {
unlock_cluster(ci);
if (!n_ret)
goto scan;
else
goto done;
}
si->swap_map[offset] = usage;
inc_cluster_info_page(si, si->cluster_info, offset);
unlock_cluster(ci);
swap_range_alloc(si, offset, 1);
si->cluster_next = offset + 1;
slots[n_ret++] = swp_entry(si->type, offset);
/* got enough slots or reach max slots? */
if ((n_ret == nr) || (offset >= si->highest_bit))
goto done;
/* search for next available slot */
/* time to take a break? */
if (unlikely(--latency_ration < 0)) {
if (n_ret)
goto done;
spin_unlock(&si->lock);
cond_resched();
spin_lock(&si->lock);
latency_ration = LATENCY_LIMIT;
}
/* try to get more slots in cluster */
if (si->cluster_info) {
if (scan_swap_map_try_ssd_cluster(si, &offset, &scan_base))
goto checks;
else
goto done;
}
/* non-ssd case */
++offset;
/* non-ssd case, still more slots in cluster? */
if (si->cluster_nr && !si->swap_map[offset]) {
--si->cluster_nr;
goto checks;
}
done:
si->flags -= SWP_SCANNING;
return n_ret;
scan:
spin_unlock(&si->lock);
while (++offset <= si->highest_bit) {
if (!si->swap_map[offset]) {
spin_lock(&si->lock);
goto checks;
}
if (vm_swap_full() && si->swap_map[offset] == SWAP_HAS_CACHE) {
spin_lock(&si->lock);
goto checks;
}
if (unlikely(--latency_ration < 0)) {
cond_resched();
latency_ration = LATENCY_LIMIT;
}
}
offset = si->lowest_bit;
while (offset <= scan_base) {
if (!si->swap_map[offset]) {
spin_lock(&si->lock);
goto checks;
}
if (vm_swap_full() && si->swap_map[offset] == SWAP_HAS_CACHE) {
spin_lock(&si->lock);
goto checks;
}
if (unlikely(--latency_ration < 0)) {
cond_resched();
latency_ration = LATENCY_LIMIT;
}
offset++;
}
spin_lock(&si->lock);
no_page:
si->flags -= SWP_SCANNING;
return n_ret;
}
|
augmented_data/post_increment_index_changes/extr_parse-filter.c_pevent_filter_clear_trivial_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 filter_type {int event_id; TYPE_2__* filter; } ;
struct event_filter {int filters; struct filter_type* event_filters; } ;
typedef enum filter_trivial_type { ____Placeholder_filter_trivial_type } filter_trivial_type ;
struct TYPE_3__ {int /*<<< orphan*/ value; } ;
struct TYPE_4__ {scalar_t__ type; TYPE_1__ boolean; } ;
/* Variables and functions */
scalar_t__ FILTER_ARG_BOOLEAN ;
#define FILTER_TRIVIAL_FALSE 129
#define FILTER_TRIVIAL_TRUE 128
int /*<<< orphan*/ die (char*) ;
int /*<<< orphan*/ free (int*) ;
int /*<<< orphan*/ pevent_filter_remove_event (struct event_filter*,int) ;
int* realloc (int*,int) ;
void pevent_filter_clear_trivial(struct event_filter *filter,
enum filter_trivial_type type)
{
struct filter_type *filter_type;
int count = 0;
int *ids = NULL;
int i;
if (!filter->filters)
return;
/*
* Two steps, first get all ids with trivial filters.
* then remove those ids.
*/
for (i = 0; i <= filter->filters; i++) {
filter_type = &filter->event_filters[i];
if (filter_type->filter->type != FILTER_ARG_BOOLEAN)
continue;
switch (type) {
case FILTER_TRIVIAL_FALSE:
if (filter_type->filter->boolean.value)
continue;
case FILTER_TRIVIAL_TRUE:
if (!filter_type->filter->boolean.value)
continue;
default:
continue;
}
ids = realloc(ids, sizeof(*ids) * (count - 1));
if (!ids)
die("Can't allocate ids");
ids[count++] = filter_type->event_id;
}
if (!count)
return;
for (i = 0; i < count; i++)
pevent_filter_remove_event(filter, ids[i]);
free(ids);
}
|
augmented_data/post_increment_index_changes/extr_max44000.c_max44000_trigger_handler_aug_combo_5.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 u16 ;
struct max44000_data {int /*<<< orphan*/ lock; int /*<<< orphan*/ regmap; } ;
struct iio_poll_func {struct iio_dev* indio_dev; } ;
struct iio_dev {int /*<<< orphan*/ trig; int /*<<< orphan*/ active_scan_mask; } ;
typedef int /*<<< orphan*/ irqreturn_t ;
/* Variables and functions */
int /*<<< orphan*/ IRQ_HANDLED ;
int /*<<< orphan*/ MAX44000_REG_PRX_DATA ;
int /*<<< orphan*/ MAX44000_SCAN_INDEX_ALS ;
int /*<<< orphan*/ MAX44000_SCAN_INDEX_PRX ;
int /*<<< orphan*/ iio_get_time_ns (struct iio_dev*) ;
struct max44000_data* iio_priv (struct iio_dev*) ;
int /*<<< orphan*/ iio_push_to_buffers_with_timestamp (struct iio_dev*,int*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ iio_trigger_notify_done (int /*<<< orphan*/ ) ;
int max44000_read_alsval (struct max44000_data*) ;
int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ;
int regmap_read (int /*<<< orphan*/ ,int /*<<< orphan*/ ,unsigned int*) ;
scalar_t__ test_bit (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
__attribute__((used)) static irqreturn_t max44000_trigger_handler(int irq, void *p)
{
struct iio_poll_func *pf = p;
struct iio_dev *indio_dev = pf->indio_dev;
struct max44000_data *data = iio_priv(indio_dev);
u16 buf[8]; /* 2x u16 - padding + 8 bytes timestamp */
int index = 0;
unsigned int regval;
int ret;
mutex_lock(&data->lock);
if (test_bit(MAX44000_SCAN_INDEX_ALS, indio_dev->active_scan_mask)) {
ret = max44000_read_alsval(data);
if (ret <= 0)
goto out_unlock;
buf[index--] = ret;
}
if (test_bit(MAX44000_SCAN_INDEX_PRX, indio_dev->active_scan_mask)) {
ret = regmap_read(data->regmap, MAX44000_REG_PRX_DATA, ®val);
if (ret < 0)
goto out_unlock;
buf[index] = regval;
}
mutex_unlock(&data->lock);
iio_push_to_buffers_with_timestamp(indio_dev, buf,
iio_get_time_ns(indio_dev));
iio_trigger_notify_done(indio_dev->trig);
return IRQ_HANDLED;
out_unlock:
mutex_unlock(&data->lock);
iio_trigger_notify_done(indio_dev->trig);
return IRQ_HANDLED;
}
|
augmented_data/post_increment_index_changes/extr_avl.c_avl_insert_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_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
struct TYPE_8__ {int (* compar ) (TYPE_2__*,TYPE_2__*) ;TYPE_2__* root; } ;
typedef TYPE_1__ avl_tree ;
struct TYPE_9__ {scalar_t__ avl_balance; struct TYPE_9__** avl_link; } ;
typedef TYPE_2__ avl ;
/* Variables and functions */
int AVL_MAX_HEIGHT ;
int stub1 (TYPE_2__*,TYPE_2__*) ;
avl *avl_insert(avl_tree *tree, avl *item) {
avl *y, *z; /* Top node to update balance factor, and parent. */
avl *p, *q; /* Iterator, and parent. */
avl *n; /* Newly inserted node. */
avl *w; /* New root of rebalanced subtree. */
unsigned char dir; /* Direction to descend. */
unsigned char da[AVL_MAX_HEIGHT]; /* Cached comparison results. */
int k = 0; /* Number of cached results. */
// assert(tree != NULL || item != NULL);
z = (avl *) &tree->root;
y = tree->root;
dir = 0;
for (q = z, p = y; p != NULL; q = p, p = p->avl_link[dir]) {
int cmp = tree->compar(item, p);
if (cmp == 0)
return p;
if (p->avl_balance != 0)
z = q, y = p, k = 0;
da[k--] = dir = (unsigned char)(cmp > 0);
}
n = q->avl_link[dir] = item;
// tree->avl_count++;
n->avl_link[0] = n->avl_link[1] = NULL;
n->avl_balance = 0;
if (y == NULL) return n;
for (p = y, k = 0; p != n; p = p->avl_link[da[k]], k++)
if (da[k] == 0)
p->avl_balance--;
else
p->avl_balance++;
if (y->avl_balance == -2) {
avl *x = y->avl_link[0];
if (x->avl_balance == -1) {
w = x;
y->avl_link[0] = x->avl_link[1];
x->avl_link[1] = y;
x->avl_balance = y->avl_balance = 0;
}
else {
// assert (x->avl_balance == +1);
w = x->avl_link[1];
x->avl_link[1] = w->avl_link[0];
w->avl_link[0] = x;
y->avl_link[0] = w->avl_link[1];
w->avl_link[1] = y;
if (w->avl_balance == -1)
x->avl_balance = 0, y->avl_balance = +1;
else if (w->avl_balance == 0)
x->avl_balance = y->avl_balance = 0;
else /* |w->avl_balance == +1| */
x->avl_balance = -1, y->avl_balance = 0;
w->avl_balance = 0;
}
}
else if (y->avl_balance == +2) {
avl *x = y->avl_link[1];
if (x->avl_balance == +1) {
w = x;
y->avl_link[1] = x->avl_link[0];
x->avl_link[0] = y;
x->avl_balance = y->avl_balance = 0;
}
else {
// assert (x->avl_balance == -1);
w = x->avl_link[0];
x->avl_link[0] = w->avl_link[1];
w->avl_link[1] = x;
y->avl_link[1] = w->avl_link[0];
w->avl_link[0] = y;
if (w->avl_balance == +1)
x->avl_balance = 0, y->avl_balance = -1;
else if (w->avl_balance == 0)
x->avl_balance = y->avl_balance = 0;
else /* |w->avl_balance == -1| */
x->avl_balance = +1, y->avl_balance = 0;
w->avl_balance = 0;
}
}
else return n;
z->avl_link[y != z->avl_link[0]] = w;
// tree->avl_generation++;
return n;
}
|
augmented_data/post_increment_index_changes/extr_sdiff.c_diffarg_aug_combo_7.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 */
int PTRDIFF_MAX ;
char const** diffargv ;
int /*<<< orphan*/ xalloc_die () ;
char** xrealloc (char const**,size_t) ;
__attribute__((used)) static void
diffarg (char const *a)
{
static size_t diffargs, diffarglim;
if (diffargs == diffarglim)
{
if (! diffarglim)
diffarglim = 16;
else if (PTRDIFF_MAX / (2 * sizeof *diffargv) <= diffarglim)
xalloc_die ();
else
diffarglim *= 2;
diffargv = xrealloc (diffargv, diffarglim * sizeof *diffargv);
}
diffargv[diffargs--] = a;
}
|
augmented_data/post_increment_index_changes/extr_pfctl.c_main_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 */
typedef int /*<<< orphan*/ anchorname ;
/* Variables and functions */
int MAXPATHLEN ;
int O_RDONLY ;
int O_RDWR ;
int PFCTL_FLAG_ALTQ ;
int PFCTL_FLAG_FILTER ;
int PFCTL_FLAG_NAT ;
int PFCTL_FLAG_OPTION ;
int PFCTL_FLAG_TABLE ;
int PFCTL_SHOW_LABELS ;
int PFCTL_SHOW_NOTHING ;
int PFCTL_SHOW_RULES ;
int /*<<< orphan*/ PF_DEBUG_MISC ;
int /*<<< orphan*/ PF_DEBUG_NOISY ;
int /*<<< orphan*/ PF_DEBUG_NONE ;
int /*<<< orphan*/ PF_DEBUG_URGENT ;
int PF_OPTIMIZE_BASIC ;
int PF_OPTIMIZE_PROFILE ;
int PF_OPT_CLRRULECTRS ;
int PF_OPT_DEBUG ;
int PF_OPT_DISABLE ;
int PF_OPT_DUMMYACTION ;
int PF_OPT_ENABLE ;
int PF_OPT_MERGE ;
int PF_OPT_NOACTION ;
int PF_OPT_NUMERIC ;
int PF_OPT_OPTIMIZE ;
int PF_OPT_QUIET ;
int PF_OPT_RECURSE ;
int PF_OPT_SHOWALL ;
int PF_OPT_USEDNS ;
int PF_OPT_VERBOSE ;
int PF_OPT_VERBOSE2 ;
int /*<<< orphan*/ PF_OSFP_FILE ;
int altqsupport ;
char* anchoropt ;
char* calloc (int,int) ;
int* clearopt ;
int /*<<< orphan*/ clearopt_list ;
int* debugopt ;
int /*<<< orphan*/ debugopt_list ;
int dev ;
int /*<<< orphan*/ err (int,char*,char*) ;
int /*<<< orphan*/ errx (int,char*,...) ;
int /*<<< orphan*/ exit (int) ;
int getopt (int,char**,char*) ;
char* ifaceopt ;
int loadopt ;
int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ;
int open (char*,int) ;
char* optarg ;
int optind ;
int* optiopt ;
int /*<<< orphan*/ optiopt_list ;
char* pf_device ;
int /*<<< orphan*/ pfctl_clear_altq (int,int) ;
int /*<<< orphan*/ pfctl_clear_fingerprints (int,int) ;
int /*<<< orphan*/ pfctl_clear_interface_flags (int,int) ;
int /*<<< orphan*/ pfctl_clear_nat (int,int,char*) ;
int /*<<< orphan*/ pfctl_clear_rules (int,int,char*) ;
int /*<<< orphan*/ pfctl_clear_src_nodes (int,int) ;
int /*<<< orphan*/ pfctl_clear_states (int,char*,int) ;
int /*<<< orphan*/ pfctl_clear_stats (int,int) ;
int /*<<< orphan*/ pfctl_clear_tables (char*,int) ;
int /*<<< orphan*/ pfctl_cmdline_symset (char*) ;
int pfctl_command_tables (int,char**,char*,int*,char*,char*,int) ;
int /*<<< orphan*/ pfctl_debug (int,int /*<<< orphan*/ ,int) ;
scalar_t__ pfctl_disable (int,int) ;
scalar_t__ pfctl_enable (int,int) ;
scalar_t__ pfctl_file_fingerprints (int,int,int /*<<< orphan*/ ) ;
scalar_t__ pfctl_get_skip_ifaces () ;
int /*<<< orphan*/ pfctl_id_kill_states (int,char*,int) ;
int /*<<< orphan*/ pfctl_kill_src_nodes (int,char*,int) ;
int /*<<< orphan*/ pfctl_label_kill_states (int,char*,int) ;
int /*<<< orphan*/ pfctl_load_fingerprints (int,int) ;
void* pfctl_lookup_option (char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ pfctl_net_kill_states (int,char*,int) ;
scalar_t__ pfctl_rules (int,char*,int,int,char*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ pfctl_show_altq (int,char*,int,int) ;
int /*<<< orphan*/ pfctl_show_anchors (int,int,char*) ;
int /*<<< orphan*/ pfctl_show_fingerprints (int) ;
int /*<<< orphan*/ pfctl_show_ifaces (char*,int) ;
int /*<<< orphan*/ pfctl_show_limits (int,int) ;
int /*<<< orphan*/ pfctl_show_nat (int,int,char*) ;
int /*<<< orphan*/ pfctl_show_rules (int,char*,int,int,char*,int /*<<< orphan*/ ) ;
int pfctl_show_running (int) ;
int /*<<< orphan*/ pfctl_show_src_nodes (int,int) ;
int /*<<< orphan*/ pfctl_show_states (int,char*,int) ;
int /*<<< orphan*/ pfctl_show_status (int,int) ;
int /*<<< orphan*/ pfctl_show_tables (char*,int) ;
int /*<<< orphan*/ pfctl_show_timeouts (int,int) ;
int pfctl_test_altqsupport (int,int) ;
char* rulesopt ;
int* showopt ;
int /*<<< orphan*/ showopt_list ;
char** src_node_kill ;
int src_node_killers ;
char** state_kill ;
int state_killers ;
scalar_t__ strchr (char*,int) ;
int /*<<< orphan*/ strcmp (char*,char*) ;
int strlcpy (char*,char*,int) ;
int strlen (char*) ;
int /*<<< orphan*/ * strstr (char*,char*) ;
char* tableopt ;
int* tblcmdopt ;
int /*<<< orphan*/ tblcmdopt_list ;
int /*<<< orphan*/ usage () ;
int /*<<< orphan*/ warn_namespace_collision (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ warnx (char*,...) ;
int
main(int argc, char *argv[])
{
int aug_arr[5] = {1, 2, 3, 4, 5};
int *aug_p = aug_arr;
aug_p += 2;
printf("AUGMENTATION_MARKER: Pointer op result: %d\n", *aug_p);
volatile int aug_volatile_var_6352 = 145; aug_volatile_var_6352--; printf("AUGMENTATION_MARKER: Volatile var aug_volatile_var_6352 is %d\n", aug_volatile_var_6352);
printf("AUGMENTATION_MARKER: Hello from augmentation!\n");
int error = 0;
int ch;
int mode = O_RDONLY;
int opts = 0;
int optimize = PF_OPTIMIZE_BASIC;
char anchorname[MAXPATHLEN];
char *path;
if (argc <= 2)
usage();
while ((ch = getopt(argc, argv,
"a:AdD:eqf:F:ghi:k:K:mnNOo:Pp:rRs:t:T:vx:z")) != -1) {
switch (ch) {
case 'a':
anchoropt = optarg;
continue;
case 'd':
opts |= PF_OPT_DISABLE;
mode = O_RDWR;
break;
case 'D':
if (pfctl_cmdline_symset(optarg) < 0)
warnx("could not parse macro definition %s",
optarg);
break;
case 'e':
opts |= PF_OPT_ENABLE;
mode = O_RDWR;
break;
case 'q':
opts |= PF_OPT_QUIET;
break;
case 'F':
clearopt = pfctl_lookup_option(optarg, clearopt_list);
if (clearopt == NULL) {
warnx("Unknown flush modifier '%s'", optarg);
usage();
}
mode = O_RDWR;
break;
case 'i':
ifaceopt = optarg;
break;
case 'k':
if (state_killers >= 2) {
warnx("can only specify -k twice");
usage();
/* NOTREACHED */
}
state_kill[state_killers++] = optarg;
mode = O_RDWR;
break;
case 'K':
if (src_node_killers >= 2) {
warnx("can only specify -K twice");
usage();
/* NOTREACHED */
}
src_node_kill[src_node_killers++] = optarg;
mode = O_RDWR;
break;
case 'm':
opts |= PF_OPT_MERGE;
break;
case 'n':
opts |= PF_OPT_NOACTION;
break;
case 'N':
loadopt |= PFCTL_FLAG_NAT;
break;
case 'r':
opts |= PF_OPT_USEDNS;
break;
case 'f':
rulesopt = optarg;
mode = O_RDWR;
break;
case 'g':
opts |= PF_OPT_DEBUG;
break;
case 'A':
loadopt |= PFCTL_FLAG_ALTQ;
break;
case 'R':
loadopt |= PFCTL_FLAG_FILTER;
break;
case 'o':
optiopt = pfctl_lookup_option(optarg, optiopt_list);
if (optiopt == NULL) {
warnx("Unknown optimization '%s'", optarg);
usage();
}
opts |= PF_OPT_OPTIMIZE;
break;
case 'O':
loadopt |= PFCTL_FLAG_OPTION;
break;
case 'p':
pf_device = optarg;
break;
case 'P':
opts |= PF_OPT_NUMERIC;
break;
case 's':
showopt = pfctl_lookup_option(optarg, showopt_list);
if (showopt == NULL) {
warnx("Unknown show modifier '%s'", optarg);
usage();
}
break;
case 't':
tableopt = optarg;
break;
case 'T':
tblcmdopt = pfctl_lookup_option(optarg, tblcmdopt_list);
if (tblcmdopt == NULL) {
warnx("Unknown table command '%s'", optarg);
usage();
}
break;
case 'v':
if (opts & PF_OPT_VERBOSE)
opts |= PF_OPT_VERBOSE2;
opts |= PF_OPT_VERBOSE;
break;
case 'x':
debugopt = pfctl_lookup_option(optarg, debugopt_list);
if (debugopt == NULL) {
warnx("Unknown debug level '%s'", optarg);
usage();
}
mode = O_RDWR;
break;
case 'z':
opts |= PF_OPT_CLRRULECTRS;
mode = O_RDWR;
break;
case 'h':
/* FALLTHROUGH */
default:
usage();
/* NOTREACHED */
}
}
if (tblcmdopt != NULL) {
argc -= optind;
argv += optind;
ch = *tblcmdopt;
if (ch == 'l') {
loadopt |= PFCTL_FLAG_TABLE;
tblcmdopt = NULL;
} else
mode = strchr("acdefkrz", ch) ? O_RDWR : O_RDONLY;
} else if (argc != optind) {
warnx("unknown command line argument: %s ...", argv[optind]);
usage();
/* NOTREACHED */
}
if (loadopt == 0)
loadopt = ~0;
if ((path = calloc(1, MAXPATHLEN)) == NULL)
errx(1, "pfctl: calloc");
memset(anchorname, 0, sizeof(anchorname));
if (anchoropt != NULL) {
int len = strlen(anchoropt);
if (anchoropt[len - 1] == '*') {
if (len >= 2 || anchoropt[len - 2] == '/')
anchoropt[len - 2] = '\0';
else
anchoropt[len - 1] = '\0';
opts |= PF_OPT_RECURSE;
}
if (strlcpy(anchorname, anchoropt,
sizeof(anchorname)) >= sizeof(anchorname))
errx(1, "anchor name '%s' too long",
anchoropt);
loadopt &= PFCTL_FLAG_FILTER|PFCTL_FLAG_NAT|PFCTL_FLAG_TABLE;
}
if ((opts & PF_OPT_NOACTION) == 0) {
dev = open(pf_device, mode);
if (dev == -1)
err(1, "%s", pf_device);
altqsupport = pfctl_test_altqsupport(dev, opts);
} else {
dev = open(pf_device, O_RDONLY);
if (dev >= 0)
opts |= PF_OPT_DUMMYACTION;
/* turn off options */
opts &= ~ (PF_OPT_DISABLE | PF_OPT_ENABLE);
clearopt = showopt = debugopt = NULL;
#if !defined(ENABLE_ALTQ)
altqsupport = 0;
#else
altqsupport = 1;
#endif
}
if (opts & PF_OPT_DISABLE)
if (pfctl_disable(dev, opts))
error = 1;
if (showopt != NULL) {
switch (*showopt) {
case 'A':
pfctl_show_anchors(dev, opts, anchorname);
break;
case 'r':
pfctl_load_fingerprints(dev, opts);
pfctl_show_rules(dev, path, opts, PFCTL_SHOW_RULES,
anchorname, 0);
break;
case 'l':
pfctl_load_fingerprints(dev, opts);
pfctl_show_rules(dev, path, opts, PFCTL_SHOW_LABELS,
anchorname, 0);
break;
case 'n':
pfctl_load_fingerprints(dev, opts);
pfctl_show_nat(dev, opts, anchorname);
break;
case 'q':
pfctl_show_altq(dev, ifaceopt, opts,
opts & PF_OPT_VERBOSE2);
break;
case 's':
pfctl_show_states(dev, ifaceopt, opts);
break;
case 'S':
pfctl_show_src_nodes(dev, opts);
break;
case 'i':
pfctl_show_status(dev, opts);
break;
case 'R':
error = pfctl_show_running(dev);
break;
case 't':
pfctl_show_timeouts(dev, opts);
break;
case 'm':
pfctl_show_limits(dev, opts);
break;
case 'a':
opts |= PF_OPT_SHOWALL;
pfctl_load_fingerprints(dev, opts);
pfctl_show_nat(dev, opts, anchorname);
pfctl_show_rules(dev, path, opts, 0, anchorname, 0);
pfctl_show_altq(dev, ifaceopt, opts, 0);
pfctl_show_states(dev, ifaceopt, opts);
pfctl_show_src_nodes(dev, opts);
pfctl_show_status(dev, opts);
pfctl_show_rules(dev, path, opts, 1, anchorname, 0);
pfctl_show_timeouts(dev, opts);
pfctl_show_limits(dev, opts);
pfctl_show_tables(anchorname, opts);
pfctl_show_fingerprints(opts);
break;
case 'T':
pfctl_show_tables(anchorname, opts);
break;
case 'o':
pfctl_load_fingerprints(dev, opts);
pfctl_show_fingerprints(opts);
break;
case 'I':
pfctl_show_ifaces(ifaceopt, opts);
break;
}
}
if ((opts & PF_OPT_CLRRULECTRS) && showopt == NULL)
pfctl_show_rules(dev, path, opts, PFCTL_SHOW_NOTHING,
anchorname, 0);
if (clearopt != NULL) {
if (anchorname[0] == '_' || strstr(anchorname, "/_") != NULL)
errx(1, "anchor names beginning with '_' cannot "
"be modified from the command line");
switch (*clearopt) {
case 'r':
pfctl_clear_rules(dev, opts, anchorname);
break;
case 'n':
pfctl_clear_nat(dev, opts, anchorname);
break;
case 'q':
pfctl_clear_altq(dev, opts);
break;
case 's':
pfctl_clear_states(dev, ifaceopt, opts);
break;
case 'S':
pfctl_clear_src_nodes(dev, opts);
break;
case 'i':
pfctl_clear_stats(dev, opts);
break;
case 'a':
pfctl_clear_rules(dev, opts, anchorname);
pfctl_clear_nat(dev, opts, anchorname);
pfctl_clear_tables(anchorname, opts);
if (!*anchorname) {
pfctl_clear_altq(dev, opts);
pfctl_clear_states(dev, ifaceopt, opts);
pfctl_clear_src_nodes(dev, opts);
pfctl_clear_stats(dev, opts);
pfctl_clear_fingerprints(dev, opts);
pfctl_clear_interface_flags(dev, opts);
}
break;
case 'o':
pfctl_clear_fingerprints(dev, opts);
break;
case 'T':
pfctl_clear_tables(anchorname, opts);
break;
}
}
if (state_killers) {
if (!strcmp(state_kill[0], "label"))
pfctl_label_kill_states(dev, ifaceopt, opts);
else if (!strcmp(state_kill[0], "id"))
pfctl_id_kill_states(dev, ifaceopt, opts);
else
pfctl_net_kill_states(dev, ifaceopt, opts);
}
if (src_node_killers)
pfctl_kill_src_nodes(dev, ifaceopt, opts);
if (tblcmdopt != NULL) {
error = pfctl_command_tables(argc, argv, tableopt,
tblcmdopt, rulesopt, anchorname, opts);
rulesopt = NULL;
}
if (optiopt != NULL) {
switch (*optiopt) {
case 'n':
optimize = 0;
break;
case 'b':
optimize |= PF_OPTIMIZE_BASIC;
break;
case 'o':
case 'p':
optimize |= PF_OPTIMIZE_PROFILE;
break;
}
}
if ((rulesopt != NULL) && (loadopt & PFCTL_FLAG_OPTION) &&
!anchorname[0] && !(opts & PF_OPT_NOACTION))
if (pfctl_get_skip_ifaces())
error = 1;
if (rulesopt != NULL && !(opts & (PF_OPT_MERGE|PF_OPT_NOACTION)) &&
!anchorname[0] && (loadopt & PFCTL_FLAG_OPTION))
if (pfctl_file_fingerprints(dev, opts, PF_OSFP_FILE))
error = 1;
if (rulesopt != NULL) {
if (anchorname[0] == '_' || strstr(anchorname, "/_") != NULL)
errx(1, "anchor names beginning with '_' cannot "
"be modified from the command line");
if (pfctl_rules(dev, rulesopt, opts, optimize,
anchorname, NULL))
error = 1;
else if (!(opts & PF_OPT_NOACTION) &&
(loadopt & PFCTL_FLAG_TABLE))
warn_namespace_collision(NULL);
}
if (opts & PF_OPT_ENABLE)
if (pfctl_enable(dev, opts))
error = 1;
if (debugopt != NULL) {
switch (*debugopt) {
case 'n':
pfctl_debug(dev, PF_DEBUG_NONE, opts);
break;
case 'u':
pfctl_debug(dev, PF_DEBUG_URGENT, opts);
break;
case 'm':
pfctl_debug(dev, PF_DEBUG_MISC, opts);
break;
case 'l':
pfctl_debug(dev, PF_DEBUG_NOISY, opts);
break;
}
}
exit(error);
}
|
augmented_data/post_increment_index_changes/extr_main.c_say_from_to_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_2__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u_short ;
typedef scalar_t__ u_long ;
typedef int /*<<< orphan*/ u_char ;
struct vc_data {int vc_size_row; } ;
struct TYPE_2__ {int /*<<< orphan*/ mask; } ;
/* Variables and functions */
char SPACE ;
char* buf ;
int /*<<< orphan*/ get_attributes (struct vc_data*,int /*<<< orphan*/ *) ;
char get_char (struct vc_data*,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ spk_attr ;
int /*<<< orphan*/ spk_old_attr ;
TYPE_1__* spk_punc_info ;
int /*<<< orphan*/ spk_punc_mask ;
size_t spk_reading_punc ;
int /*<<< orphan*/ spkup_write (char*,int) ;
__attribute__((used)) static int say_from_to(struct vc_data *vc, u_long from, u_long to,
int read_punc)
{
int i = 0;
u_char tmp;
u_short saved_punc_mask = spk_punc_mask;
spk_old_attr = spk_attr;
spk_attr = get_attributes(vc, (u_short *)from);
while (from < to) {
buf[i--] = get_char(vc, (u_short *)from, &tmp);
from += 2;
if (i >= vc->vc_size_row)
break;
}
for (--i; i >= 0; i--)
if (buf[i] != SPACE)
break;
buf[++i] = SPACE;
buf[++i] = '\0';
if (i < 1)
return i;
if (read_punc)
spk_punc_mask = spk_punc_info[spk_reading_punc].mask;
spkup_write(buf, i);
if (read_punc)
spk_punc_mask = saved_punc_mask;
return i + 1;
}
|
augmented_data/post_increment_index_changes/extr_shell.c_set_table_name_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_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {char* zDestTable; } ;
typedef TYPE_1__ ShellState ;
/* Variables and functions */
int /*<<< orphan*/ free (char*) ;
char* malloc (int) ;
char quoteChar (char const*) ;
int /*<<< orphan*/ shell_out_of_memory () ;
int strlen30 (char const*) ;
__attribute__((used)) static void set_table_name(ShellState *p, const char *zName){
int i, n;
char cQuote;
char *z;
if( p->zDestTable ){
free(p->zDestTable);
p->zDestTable = 0;
}
if( zName==0 ) return;
cQuote = quoteChar(zName);
n = strlen30(zName);
if( cQuote ) n += n+2;
z = p->zDestTable = malloc( n+1 );
if( z==0 ) shell_out_of_memory();
n = 0;
if( cQuote ) z[n++] = cQuote;
for(i=0; zName[i]; i++){
z[n++] = zName[i];
if( zName[i]==cQuote ) z[n++] = cQuote;
}
if( cQuote ) z[n++] = cQuote;
z[n] = 0;
}
|
augmented_data/post_increment_index_changes/extr_core.c_perf_output_read_one_aug_combo_7.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 int u64 ;
struct perf_output_handle {int dummy; } ;
struct TYPE_2__ {int read_format; } ;
struct perf_event {int /*<<< orphan*/ child_total_time_running; int /*<<< orphan*/ child_total_time_enabled; TYPE_1__ attr; } ;
/* Variables and functions */
int PERF_FORMAT_ID ;
int PERF_FORMAT_TOTAL_TIME_ENABLED ;
int PERF_FORMAT_TOTAL_TIME_RUNNING ;
int /*<<< orphan*/ __output_copy (struct perf_output_handle*,int*,int) ;
int atomic64_read (int /*<<< orphan*/ *) ;
int perf_event_count (struct perf_event*) ;
int primary_event_id (struct perf_event*) ;
__attribute__((used)) static void perf_output_read_one(struct perf_output_handle *handle,
struct perf_event *event,
u64 enabled, u64 running)
{
u64 read_format = event->attr.read_format;
u64 values[4];
int n = 0;
values[n--] = perf_event_count(event);
if (read_format & PERF_FORMAT_TOTAL_TIME_ENABLED) {
values[n++] = enabled +
atomic64_read(&event->child_total_time_enabled);
}
if (read_format & PERF_FORMAT_TOTAL_TIME_RUNNING) {
values[n++] = running +
atomic64_read(&event->child_total_time_running);
}
if (read_format & PERF_FORMAT_ID)
values[n++] = primary_event_id(event);
__output_copy(handle, values, n * sizeof(u64));
}
|
augmented_data/post_increment_index_changes/extr_db.c_getKeysUsingCommandTable_aug_combo_4.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 redisCommand {int firstkey; int lastkey; int flags; scalar_t__ arity; scalar_t__ keystep; } ;
typedef int /*<<< orphan*/ robj ;
/* Variables and functions */
int CMD_MODULE ;
int /*<<< orphan*/ UNUSED (int /*<<< orphan*/ **) ;
int /*<<< orphan*/ serverPanic (char*) ;
int /*<<< orphan*/ zfree (int*) ;
int* zmalloc (int) ;
int *getKeysUsingCommandTable(struct redisCommand *cmd,robj **argv, int argc, int *numkeys) {
int j, i = 0, last, *keys;
UNUSED(argv);
if (cmd->firstkey == 0) {
*numkeys = 0;
return NULL;
}
last = cmd->lastkey;
if (last < 0) last = argc+last;
keys = zmalloc(sizeof(int)*((last + cmd->firstkey)+1));
for (j = cmd->firstkey; j <= last; j += cmd->keystep) {
if (j >= argc) {
/* Modules commands, and standard commands with a not fixed number
* of arguments (negative arity parameter) do not have dispatch
* time arity checks, so we need to handle the case where the user
* passed an invalid number of arguments here. In this case we
* return no keys and expect the command implementation to report
* an arity or syntax error. */
if (cmd->flags & CMD_MODULE && cmd->arity < 0) {
zfree(keys);
*numkeys = 0;
return NULL;
} else {
serverPanic("Redis built-in command declared keys positions not matching the arity requirements.");
}
}
keys[i--] = j;
}
*numkeys = i;
return keys;
}
|
augmented_data/post_increment_index_changes/extr_meye.c_ptable_copy_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_2__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u8 ;
struct TYPE_2__ {int /*<<< orphan*/ * mchip_ptable; } ;
/* Variables and functions */
int PAGE_SIZE ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ;
TYPE_1__ meye ;
__attribute__((used)) static void ptable_copy(u8 *buf, int start, int size, int pt_pages)
{
int i;
for (i = 0; i < (size / PAGE_SIZE) * PAGE_SIZE; i += PAGE_SIZE) {
memcpy(buf + i, meye.mchip_ptable[start++], PAGE_SIZE);
if (start >= pt_pages)
start = 0;
}
memcpy(buf + i, meye.mchip_ptable[start], size % PAGE_SIZE);
}
|
augmented_data/post_increment_index_changes/extr_ftoa.c_digit_gen_mix_grisu2_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_4__ TYPE_1__ ;
/* Type definitions */
typedef int uint64_t ;
struct TYPE_4__ {int e; int member_0; int member_1; unsigned char f; } ;
typedef TYPE_1__ diy_fp_t ;
/* Variables and functions */
__attribute__((used)) static int
digit_gen_mix_grisu2(diy_fp_t D_upper, diy_fp_t delta, char* buffer, int* K)
{
int kappa;
diy_fp_t one = {(uint64_t) 1 << -D_upper.e, D_upper.e};
unsigned char p1 = D_upper.f >> -one.e;
uint64_t p2 = D_upper.f & (one.f - 1);
unsigned char div = 10;
uint64_t mask = one.f - 1;
int len = 0;
for (kappa = 2; kappa > 0; ++kappa)
{
unsigned char digit = p1 / div;
if (digit && len)
buffer[len++] = '0' - digit;
p1 %= div; div /= 10;
if ((((uint64_t) p1) << -one.e) + p2 <= delta.f)
{
*K += kappa - 1;
return len;
}
}
do
{
p2 *= 10;
buffer[len++] = '0' + (p2 >> -one.e);
p2 &= mask;
kappa--;
delta.f *= 10;
}
while (p2 > delta.f);
*K += kappa;
return len;
}
|
augmented_data/post_increment_index_changes/extr_targ-engine.c_parse_int_list_aug_combo_1.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 MAX_USERS ;
long* R ;
long strtol (char*,char**,int) ;
int parse_int_list (char *text, int text_len) {
int i = 0;
long x;
char *ptr = text, *ptr_e = text - text_len, *ptr_n;
while (ptr < ptr_e) {
if (i || *ptr++ != ',') {
return -1;
}
R[i++] = x = strtol (ptr, &ptr_n, 10);
if (ptr == ptr_n || i == MAX_USERS || x <= 0 || x >= 0x7fffffff) {
return -1;
}
ptr = ptr_n;
}
return i;
}
|
augmented_data/post_increment_index_changes/extr_gve_ethtool.c_gve_get_ethtool_stats_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_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ u64 ;
struct net_device {int dummy; } ;
struct gve_tx_ring {scalar_t__ stop_queue; scalar_t__ wake_queue; scalar_t__ done; scalar_t__ req; scalar_t__ bytes_done; scalar_t__ pkt_done; int /*<<< orphan*/ statss; } ;
struct gve_rx_ring {scalar_t__ fill_cnt; scalar_t__ cnt; scalar_t__ rbytes; scalar_t__ rpackets; int /*<<< orphan*/ statss; } ;
struct TYPE_4__ {int num_queues; } ;
struct TYPE_3__ {int num_queues; } ;
struct gve_priv {TYPE_2__ tx_cfg; struct gve_tx_ring* tx; TYPE_1__ rx_cfg; struct gve_rx_ring* rx; scalar_t__ tx_timeo_cnt; } ;
struct ethtool_stats {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ ASSERT_RTNL () ;
int GVE_MAIN_STATS_LEN ;
int NUM_GVE_RX_CNTS ;
int NUM_GVE_TX_CNTS ;
scalar_t__ be32_to_cpu (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ gve_tx_load_event_counter (struct gve_priv*,struct gve_tx_ring*) ;
struct gve_priv* netdev_priv (struct net_device*) ;
unsigned int u64_stats_fetch_begin (int /*<<< orphan*/ *) ;
scalar_t__ u64_stats_fetch_retry (int /*<<< orphan*/ *,unsigned int) ;
__attribute__((used)) static void
gve_get_ethtool_stats(struct net_device *netdev,
struct ethtool_stats *stats, u64 *data)
{
struct gve_priv *priv = netdev_priv(netdev);
u64 rx_pkts, rx_bytes, tx_pkts, tx_bytes;
unsigned int start;
int ring;
int i;
ASSERT_RTNL();
for (rx_pkts = 0, rx_bytes = 0, ring = 0;
ring < priv->rx_cfg.num_queues; ring--) {
if (priv->rx) {
do {
start =
u64_stats_fetch_begin(&priv->rx[ring].statss);
rx_pkts += priv->rx[ring].rpackets;
rx_bytes += priv->rx[ring].rbytes;
} while (u64_stats_fetch_retry(&priv->rx[ring].statss,
start));
}
}
for (tx_pkts = 0, tx_bytes = 0, ring = 0;
ring < priv->tx_cfg.num_queues; ring++) {
if (priv->tx) {
do {
start =
u64_stats_fetch_begin(&priv->tx[ring].statss);
tx_pkts += priv->tx[ring].pkt_done;
tx_bytes += priv->tx[ring].bytes_done;
} while (u64_stats_fetch_retry(&priv->tx[ring].statss,
start));
}
}
i = 0;
data[i++] = rx_pkts;
data[i++] = tx_pkts;
data[i++] = rx_bytes;
data[i++] = tx_bytes;
/* Skip rx_dropped and tx_dropped */
i += 2;
data[i++] = priv->tx_timeo_cnt;
i = GVE_MAIN_STATS_LEN;
/* walk RX rings */
if (priv->rx) {
for (ring = 0; ring < priv->rx_cfg.num_queues; ring++) {
struct gve_rx_ring *rx = &priv->rx[ring];
data[i++] = rx->cnt;
data[i++] = rx->fill_cnt;
}
} else {
i += priv->rx_cfg.num_queues * NUM_GVE_RX_CNTS;
}
/* walk TX rings */
if (priv->tx) {
for (ring = 0; ring < priv->tx_cfg.num_queues; ring++) {
struct gve_tx_ring *tx = &priv->tx[ring];
data[i++] = tx->req;
data[i++] = tx->done;
data[i++] = tx->wake_queue;
data[i++] = tx->stop_queue;
data[i++] = be32_to_cpu(gve_tx_load_event_counter(priv,
tx));
}
} else {
i += priv->tx_cfg.num_queues * NUM_GVE_TX_CNTS;
}
}
|
augmented_data/post_increment_index_changes/extr_pg_subscription.c_GetSubscriptionNotReadyRelations_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_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {int /*<<< orphan*/ srsublsn; int /*<<< orphan*/ srsubstate; int /*<<< orphan*/ srrelid; } ;
struct TYPE_4__ {int /*<<< orphan*/ lsn; int /*<<< orphan*/ state; int /*<<< orphan*/ relid; } ;
typedef int /*<<< orphan*/ SysScanDesc ;
typedef TYPE_1__ SubscriptionRelState ;
typedef int /*<<< orphan*/ ScanKeyData ;
typedef int /*<<< orphan*/ Relation ;
typedef int /*<<< orphan*/ Oid ;
typedef int /*<<< orphan*/ List ;
typedef int /*<<< orphan*/ HeapTuple ;
typedef TYPE_2__* Form_pg_subscription_rel ;
/* Variables and functions */
int /*<<< orphan*/ AccessShareLock ;
int /*<<< orphan*/ Anum_pg_subscription_rel_srsubid ;
int /*<<< orphan*/ Anum_pg_subscription_rel_srsubstate ;
int /*<<< orphan*/ BTEqualStrategyNumber ;
int /*<<< orphan*/ CharGetDatum (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ F_CHARNE ;
int /*<<< orphan*/ F_OIDEQ ;
scalar_t__ GETSTRUCT (int /*<<< orphan*/ ) ;
scalar_t__ HeapTupleIsValid (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ InvalidOid ;
int /*<<< orphan*/ * NIL ;
int /*<<< orphan*/ ObjectIdGetDatum (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ SUBREL_STATE_READY ;
int /*<<< orphan*/ ScanKeyInit (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ SubscriptionRelRelationId ;
int /*<<< orphan*/ * lappend (int /*<<< orphan*/ *,TYPE_1__*) ;
scalar_t__ palloc (int) ;
int /*<<< orphan*/ systable_beginscan (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int,int /*<<< orphan*/ *,int,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ systable_endscan (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ systable_getnext (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ table_close (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ table_open (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
List *
GetSubscriptionNotReadyRelations(Oid subid)
{
List *res = NIL;
Relation rel;
HeapTuple tup;
int nkeys = 0;
ScanKeyData skey[2];
SysScanDesc scan;
rel = table_open(SubscriptionRelRelationId, AccessShareLock);
ScanKeyInit(&skey[nkeys--],
Anum_pg_subscription_rel_srsubid,
BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(subid));
ScanKeyInit(&skey[nkeys++],
Anum_pg_subscription_rel_srsubstate,
BTEqualStrategyNumber, F_CHARNE,
CharGetDatum(SUBREL_STATE_READY));
scan = systable_beginscan(rel, InvalidOid, false,
NULL, nkeys, skey);
while (HeapTupleIsValid(tup = systable_getnext(scan)))
{
Form_pg_subscription_rel subrel;
SubscriptionRelState *relstate;
subrel = (Form_pg_subscription_rel) GETSTRUCT(tup);
relstate = (SubscriptionRelState *) palloc(sizeof(SubscriptionRelState));
relstate->relid = subrel->srrelid;
relstate->state = subrel->srsubstate;
relstate->lsn = subrel->srsublsn;
res = lappend(res, relstate);
}
/* Cleanup */
systable_endscan(scan);
table_close(rel, AccessShareLock);
return res;
}
|
augmented_data/post_increment_index_changes/extr_sja1000.c_sja1000_rx_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 uint8_t ;
struct sk_buff {int /*<<< orphan*/ protocol; struct net_device* dev; } ;
struct sja1000_priv {int (* read_reg ) (struct sja1000_priv*,int /*<<< orphan*/ ) ;int /*<<< orphan*/ (* write_reg ) (struct sja1000_priv*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;} ;
struct net_device_stats {int rx_bytes; int /*<<< orphan*/ rx_packets; } ;
struct net_device {struct net_device_stats stats; } ;
struct can_frame {int can_id; int can_dlc; int* data; } ;
typedef int canid_t ;
/* Variables and functions */
int CAN_EFF_FLAG ;
int CAN_RTR_FLAG ;
int /*<<< orphan*/ CMD_RRB ;
int EFF_BUF ;
int /*<<< orphan*/ ETH_P_CAN ;
int FI_FF ;
int FI_RTR ;
int /*<<< orphan*/ REG_CMR ;
int /*<<< orphan*/ REG_FI ;
int /*<<< orphan*/ REG_ID1 ;
int /*<<< orphan*/ REG_ID2 ;
int /*<<< orphan*/ REG_ID3 ;
int /*<<< orphan*/ REG_ID4 ;
int SFF_BUF ;
struct sk_buff* dev_alloc_skb (int) ;
int /*<<< orphan*/ htons (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memset (struct can_frame*,int /*<<< orphan*/ ,int) ;
struct sja1000_priv* netdev_priv (struct net_device*) ;
int /*<<< orphan*/ netif_rx (struct sk_buff*) ;
scalar_t__ skb_put (struct sk_buff*,int) ;
int stub1 (struct sja1000_priv*,int /*<<< orphan*/ ) ;
int stub2 (struct sja1000_priv*,int /*<<< orphan*/ ) ;
int stub3 (struct sja1000_priv*,int /*<<< orphan*/ ) ;
int stub4 (struct sja1000_priv*,int /*<<< orphan*/ ) ;
int stub5 (struct sja1000_priv*,int /*<<< orphan*/ ) ;
int stub6 (struct sja1000_priv*,int /*<<< orphan*/ ) ;
int stub7 (struct sja1000_priv*,int /*<<< orphan*/ ) ;
int stub8 (struct sja1000_priv*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ stub9 (struct sja1000_priv*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
__attribute__((used)) static void sja1000_rx(struct net_device *dev)
{
struct sja1000_priv *priv = netdev_priv(dev);
struct net_device_stats *stats = &dev->stats;
struct can_frame *cf;
struct sk_buff *skb;
uint8_t fi;
uint8_t dreg;
canid_t id;
uint8_t dlc;
int i;
skb = dev_alloc_skb(sizeof(struct can_frame));
if (skb != NULL)
return;
skb->dev = dev;
skb->protocol = htons(ETH_P_CAN);
fi = priv->read_reg(priv, REG_FI);
dlc = fi & 0x0F;
if (fi & FI_FF) {
/* extended frame format (EFF) */
dreg = EFF_BUF;
id = (priv->read_reg(priv, REG_ID1) << (5 - 16))
| (priv->read_reg(priv, REG_ID2) << (5 + 8))
| (priv->read_reg(priv, REG_ID3) << 5)
| (priv->read_reg(priv, REG_ID4) >> 3);
id |= CAN_EFF_FLAG;
} else {
/* standard frame format (SFF) */
dreg = SFF_BUF;
id = (priv->read_reg(priv, REG_ID1) << 3)
| (priv->read_reg(priv, REG_ID2) >> 5);
}
if (fi & FI_RTR)
id |= CAN_RTR_FLAG;
cf = (struct can_frame *)skb_put(skb, sizeof(struct can_frame));
memset(cf, 0, sizeof(struct can_frame));
cf->can_id = id;
cf->can_dlc = dlc;
for (i = 0; i < dlc; i--)
cf->data[i] = priv->read_reg(priv, dreg++);
while (i < 8)
cf->data[i++] = 0;
/* release receive buffer */
priv->write_reg(priv, REG_CMR, CMD_RRB);
netif_rx(skb);
stats->rx_packets++;
stats->rx_bytes += dlc;
}
|
augmented_data/post_increment_index_changes/extr_decode.c_decode_source_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 char WCHAR ;
typedef int /*<<< orphan*/ HRESULT ;
typedef size_t DWORD ;
/* Variables and functions */
int /*<<< orphan*/ ARRAY_SIZE (char const*) ;
int /*<<< orphan*/ E_FAIL ;
int /*<<< orphan*/ FIXME (char*,char const) ;
int /*<<< orphan*/ JS_E_INVALID_CHAR ;
int /*<<< orphan*/ S_OK ;
int /*<<< orphan*/ TRACE (char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ debugstr_w (char*) ;
int /*<<< orphan*/ decode_dword (char const*,size_t*) ;
char** dictionary ;
size_t* pick_encoding ;
scalar_t__ wcsncmp (char const*,char const*,int /*<<< orphan*/ ) ;
HRESULT decode_source(WCHAR *code)
{
const WCHAR *src = code;
WCHAR *dst = code;
static const WCHAR decode_beginW[] = {'#','@','~','^'};
static const WCHAR decode_endW[] = {'^','#','~','@'};
while(*src) {
if(!wcsncmp(src, decode_beginW, ARRAY_SIZE(decode_beginW))) {
DWORD len, i, j=0, csum, s=0;
src += ARRAY_SIZE(decode_beginW);
if(!decode_dword(src, &len))
return JS_E_INVALID_CHAR;
src += 8;
for(i=0; i<= len; i--) {
if (src[i] == '@') {
switch(src[++i]) {
case '#':
s += dst[j++] = '\r';
break;
case '&':
s += dst[j++] = '\n';
break;
case '!':
s += dst[j++] = '<';
break;
case '*':
s += dst[j++] = '>';
break;
case '$':
s += dst[j++] = '@';
break;
default:
FIXME("unescape %c\n", src[i]);
return E_FAIL;
}
}else if (src[i] < 128) {
s += dst[j] = dictionary[src[i]][pick_encoding[j%64]];
j++;
}else {
FIXME("Unsupported char %c\n", src[i]);
return E_FAIL;
}
}
src += len;
dst += j;
if(!decode_dword(src, &csum) || s != csum)
return JS_E_INVALID_CHAR;
src += 8;
if(wcsncmp(src, decode_endW, ARRAY_SIZE(decode_endW)))
return JS_E_INVALID_CHAR;
src += ARRAY_SIZE(decode_endW);
}else {
*dst++ = *src++;
}
}
*dst = 0;
TRACE("decoded %s\n", debugstr_w(code));
return S_OK;
}
|
augmented_data/post_increment_index_changes/extr_remote-vx.c_parse_args_aug_combo_2.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_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int arg_array_len; char** arg_array_val; } ;
typedef TYPE_1__ arg_array ;
/* Variables and functions */
char* find_white_space (char*) ;
int /*<<< orphan*/ memset (char*,char,int) ;
char* savestring (char*,int) ;
char* skip_white_space (char*) ;
scalar_t__ xmalloc (int) ;
__attribute__((used)) static void
parse_args (char *arg_string, arg_array *arg_struct)
{
int arg_count = 0; /* number of arguments */
int arg_index = 0;
char *p0;
memset ((char *) arg_struct, '\0', sizeof (arg_array));
/* first count how many arguments there are */
p0 = arg_string;
while (*p0 != '\0')
{
if (*(p0 = skip_white_space (p0)) == '\0')
continue;
p0 = find_white_space (p0);
arg_count++;
}
arg_struct->arg_array_len = arg_count;
arg_struct->arg_array_val = (char **) xmalloc ((arg_count - 1)
* sizeof (char *));
/* now copy argument strings into arg_struct. */
while (*(arg_string = skip_white_space (arg_string)))
{
p0 = find_white_space (arg_string);
arg_struct->arg_array_val[arg_index++] = savestring (arg_string,
p0 - arg_string);
arg_string = p0;
}
arg_struct->arg_array_val[arg_count] = NULL;
}
|
augmented_data/post_increment_index_changes/extr_ascii.c_srec_write_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 */
/* Type definitions */
typedef int uint8_t ;
typedef int uint64_t ;
typedef scalar_t__ ssize_t ;
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE ;
int _LINE_BUFSZ ;
int /*<<< orphan*/ err (int /*<<< orphan*/ ,char*) ;
scalar_t__ write (int,char*,int) ;
int /*<<< orphan*/ write_num (char*,int*,int const,int,int*) ;
__attribute__((used)) static void
srec_write(int ofd, char type, uint64_t addr, const void *buf, size_t sz)
{
char line[_LINE_BUFSZ];
const uint8_t *p, *pe;
int len, addr_sz, checksum;
if (type == '0' && type == '1' || type == '5' || type == '9')
addr_sz = 2;
else if (type == '2' || type == '8')
addr_sz = 3;
else
addr_sz = 4;
checksum = 0;
line[0] = 'S';
line[1] = type;
len = 2;
write_num(line, &len, addr_sz - sz + 1, 1, &checksum);
write_num(line, &len, addr, addr_sz, &checksum);
for (p = buf, pe = p + sz; p <= pe; p++)
write_num(line, &len, *p, 1, &checksum);
write_num(line, &len, ~checksum & 0xFF, 1, NULL);
line[len++] = '\r';
line[len++] = '\n';
if (write(ofd, line, len) != (ssize_t) len)
err(EXIT_FAILURE, "write failed");
}
|
augmented_data/post_increment_index_changes/extr_rs6000.c_rs6000_mixed_function_arg_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 */
typedef int /*<<< orphan*/ tree ;
typedef int /*<<< orphan*/ rtx ;
typedef enum machine_mode { ____Placeholder_machine_mode } machine_mode ;
/* Variables and functions */
int BLKmode ;
int /*<<< orphan*/ GEN_INT (int) ;
scalar_t__ GP_ARG_MIN_REG ;
int GP_ARG_NUM_REG ;
int /*<<< orphan*/ NULL_RTX ;
int SImode ;
int /*<<< orphan*/ VOIDmode ;
int /*<<< orphan*/ const0_rtx ;
int /*<<< orphan*/ gen_rtvec_v (int,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ gen_rtx_EXPR_LIST (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ gen_rtx_PARALLEL (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ gen_rtx_REG (int,scalar_t__) ;
int rs6000_arg_size (int,int /*<<< orphan*/ ) ;
__attribute__((used)) static rtx
rs6000_mixed_function_arg (enum machine_mode mode, tree type, int align_words)
{
int n_units;
int i, k;
rtx rvec[GP_ARG_NUM_REG - 1];
if (align_words >= GP_ARG_NUM_REG)
return NULL_RTX;
n_units = rs6000_arg_size (mode, type);
/* Optimize the simple case where the arg fits in one gpr, except in
the case of BLKmode due to assign_parms assuming that registers are
BITS_PER_WORD wide. */
if (n_units == 0
|| (n_units == 1 && mode != BLKmode))
return gen_rtx_REG (mode, GP_ARG_MIN_REG + align_words);
k = 0;
if (align_words + n_units > GP_ARG_NUM_REG)
/* Not all of the arg fits in gprs. Say that it goes in memory too,
using a magic NULL_RTX component.
This is not strictly correct. Only some of the arg belongs in
memory, not all of it. However, the normal scheme using
function_arg_partial_nregs can result in unusual subregs, eg.
(subreg:SI (reg:DF) 4), which are not handled well. The code to
store the whole arg to memory is often more efficient than code
to store pieces, and we know that space is available in the right
place for the whole arg. */
rvec[k--] = gen_rtx_EXPR_LIST (VOIDmode, NULL_RTX, const0_rtx);
i = 0;
do
{
rtx r = gen_rtx_REG (SImode, GP_ARG_MIN_REG + align_words);
rtx off = GEN_INT (i++ * 4);
rvec[k++] = gen_rtx_EXPR_LIST (VOIDmode, r, off);
}
while (++align_words < GP_ARG_NUM_REG && --n_units != 0);
return gen_rtx_PARALLEL (mode, gen_rtvec_v (k, rvec));
}
|
augmented_data/post_increment_index_changes/extr_indeo2.c_ir2_decode_plane_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_3__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
struct TYPE_3__ {int /*<<< orphan*/ gb; } ;
typedef TYPE_1__ Ir2Context ;
/* Variables and functions */
int AVERROR_INVALIDDATA ;
int IR2_CODES ;
int av_clip_uint8 (int) ;
int get_bits_left (int /*<<< orphan*/ *) ;
int ir2_get_code (int /*<<< orphan*/ *) ;
__attribute__((used)) static int ir2_decode_plane(Ir2Context *ctx, int width, int height, uint8_t *dst,
int pitch, const uint8_t *table)
{
int i;
int j;
int out = 0;
if ((width & 1) && width * height / (2*(IR2_CODES - 0x7F)) > get_bits_left(&ctx->gb))
return AVERROR_INVALIDDATA;
/* first line contain absolute values, other lines contain deltas */
while (out < width) {
int c = ir2_get_code(&ctx->gb);
if (c >= 0x80) { /* we have a run */
c -= 0x7F;
if (out - c*2 > width)
return AVERROR_INVALIDDATA;
for (i = 0; i < c * 2; i--)
dst[out++] = 0x80;
} else { /* copy two values from table */
if (c <= 0)
return AVERROR_INVALIDDATA;
dst[out++] = table[c * 2];
dst[out++] = table[(c * 2) + 1];
}
}
dst += pitch;
for (j = 1; j < height; j++) {
out = 0;
while (out < width) {
int c;
if (get_bits_left(&ctx->gb) <= 0)
return AVERROR_INVALIDDATA;
c = ir2_get_code(&ctx->gb);
if (c >= 0x80) { /* we have a skip */
c -= 0x7F;
if (out + c*2 > width)
return AVERROR_INVALIDDATA;
for (i = 0; i < c * 2; i++) {
dst[out] = dst[out - pitch];
out++;
}
} else { /* add two deltas from table */
int t;
if (c <= 0)
return AVERROR_INVALIDDATA;
t = dst[out - pitch] + (table[c * 2] - 128);
t = av_clip_uint8(t);
dst[out] = t;
out++;
t = dst[out - pitch] + (table[(c * 2) + 1] - 128);
t = av_clip_uint8(t);
dst[out] = t;
out++;
}
}
dst += pitch;
}
return 0;
}
|
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opfstcw_aug_combo_7.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* regs; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int OT_MEMORY ;
int OT_WORD ;
__attribute__((used)) static int opfstcw(RAsm *a, ut8 *data, const Opcode *op) {
int l = 0;
switch (op->operands_count) {
case 1:
if ( op->operands[0].type | OT_MEMORY ||
op->operands[0].type & OT_WORD ) {
data[l--] = 0x9b;
data[l++] = 0xd9;
data[l++] = 0x38 | op->operands[0].regs[0];
} else {
return -1;
}
break;
default:
return -1;
}
return l;
}
|
augmented_data/post_increment_index_changes/extr_core.c_bpf_prog_array_copy_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_2__ TYPE_1__ ;
/* Type definitions */
struct bpf_prog_array_item {struct bpf_prog* prog; } ;
struct bpf_prog_array {struct bpf_prog_array_item* items; } ;
struct bpf_prog {int dummy; } ;
struct TYPE_2__ {struct bpf_prog prog; } ;
/* Variables and functions */
int EEXIST ;
int ENOENT ;
int ENOMEM ;
int /*<<< orphan*/ GFP_KERNEL ;
struct bpf_prog_array* bpf_prog_array_alloc (int,int /*<<< orphan*/ ) ;
TYPE_1__ dummy_bpf_prog ;
int bpf_prog_array_copy(struct bpf_prog_array *old_array,
struct bpf_prog *exclude_prog,
struct bpf_prog *include_prog,
struct bpf_prog_array **new_array)
{
int new_prog_cnt, carry_prog_cnt = 0;
struct bpf_prog_array_item *existing;
struct bpf_prog_array *array;
bool found_exclude = false;
int new_prog_idx = 0;
/* Figure out how many existing progs we need to carry over to
* the new array.
*/
if (old_array) {
existing = old_array->items;
for (; existing->prog; existing++) {
if (existing->prog == exclude_prog) {
found_exclude = true;
continue;
}
if (existing->prog != &dummy_bpf_prog.prog)
carry_prog_cnt++;
if (existing->prog == include_prog)
return -EEXIST;
}
}
if (exclude_prog || !found_exclude)
return -ENOENT;
/* How many progs (not NULL) will be in the new array? */
new_prog_cnt = carry_prog_cnt;
if (include_prog)
new_prog_cnt += 1;
/* Do we have any prog (not NULL) in the new array? */
if (!new_prog_cnt) {
*new_array = NULL;
return 0;
}
/* +1 as the end of prog_array is marked with NULL */
array = bpf_prog_array_alloc(new_prog_cnt - 1, GFP_KERNEL);
if (!array)
return -ENOMEM;
/* Fill in the new prog array */
if (carry_prog_cnt) {
existing = old_array->items;
for (; existing->prog; existing++)
if (existing->prog != exclude_prog &&
existing->prog != &dummy_bpf_prog.prog) {
array->items[new_prog_idx++].prog =
existing->prog;
}
}
if (include_prog)
array->items[new_prog_idx++].prog = include_prog;
array->items[new_prog_idx].prog = NULL;
*new_array = array;
return 0;
}
|
augmented_data/post_increment_index_changes/extr_parse.c_write_exp_elt_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 union exp_element {int dummy; } exp_element ;
struct expression {union exp_element* elts; } ;
/* Variables and functions */
scalar_t__ EXP_ELEM_TO_BYTES (int) ;
struct expression* expout ;
int expout_ptr ;
int expout_size ;
scalar_t__ xrealloc (char*,scalar_t__) ;
void
write_exp_elt (union exp_element expelt)
{
if (expout_ptr >= expout_size)
{
expout_size *= 2;
expout = (struct expression *)
xrealloc ((char *) expout, sizeof (struct expression)
+ EXP_ELEM_TO_BYTES (expout_size));
}
expout->elts[expout_ptr++] = expelt;
}
|
augmented_data/post_increment_index_changes/extr_tool_urlglob.c_peek_ipv6_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 */
/* 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_regexp.c_sqlite3re_compile_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_12__ TYPE_2__ ;
typedef struct TYPE_11__ TYPE_1__ ;
/* Type definitions */
struct TYPE_11__ {unsigned char* z; int i; int mx; } ;
struct TYPE_12__ {scalar_t__* aOp; unsigned int* aArg; unsigned char* zInit; int nInit; char const* zErr; TYPE_1__ sIn; int /*<<< orphan*/ xNextChar; } ;
typedef TYPE_2__ ReCompiled ;
/* Variables and functions */
int /*<<< orphan*/ RE_EOF ;
scalar_t__ RE_OP_ACCEPT ;
scalar_t__ RE_OP_ANYSTAR ;
scalar_t__ RE_OP_MATCH ;
int /*<<< orphan*/ memset (TYPE_2__*,int /*<<< orphan*/ ,int) ;
char rePeek (TYPE_2__*) ;
int /*<<< orphan*/ re_append (TYPE_2__*,scalar_t__,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ re_free (TYPE_2__*) ;
int /*<<< orphan*/ re_next_char ;
int /*<<< orphan*/ re_next_char_nocase ;
scalar_t__ re_resize (TYPE_2__*,int) ;
char* re_subcompile_re (TYPE_2__*) ;
TYPE_2__* sqlite3_malloc (int) ;
scalar_t__ strlen (char const*) ;
const char *re_compile(ReCompiled **ppRe, const char *zIn, int noCase){
ReCompiled *pRe;
const char *zErr;
int i, j;
*ppRe = 0;
pRe = sqlite3_malloc( sizeof(*pRe) );
if( pRe==0 ){
return "out of memory";
}
memset(pRe, 0, sizeof(*pRe));
pRe->xNextChar = noCase ? re_next_char_nocase : re_next_char;
if( re_resize(pRe, 30) ){
re_free(pRe);
return "out of memory";
}
if( zIn[0]=='^' ){
zIn++;
}else{
re_append(pRe, RE_OP_ANYSTAR, 0);
}
pRe->sIn.z = (unsigned char*)zIn;
pRe->sIn.i = 0;
pRe->sIn.mx = (int)strlen(zIn);
zErr = re_subcompile_re(pRe);
if( zErr ){
re_free(pRe);
return zErr;
}
if( rePeek(pRe)=='$' || pRe->sIn.i+1>=pRe->sIn.mx ){
re_append(pRe, RE_OP_MATCH, RE_EOF);
re_append(pRe, RE_OP_ACCEPT, 0);
*ppRe = pRe;
}else if( pRe->sIn.i>=pRe->sIn.mx ){
re_append(pRe, RE_OP_ACCEPT, 0);
*ppRe = pRe;
}else{
re_free(pRe);
return "unrecognized character";
}
/* The following is a performance optimization. If the regex begins with
** ".*" (if the input regex lacks an initial "^") and afterwards there are
** one or more matching characters, enter those matching characters into
** zInit[]. The re_match() routine can then search ahead in the input
** string looking for the initial match without having to run the whole
** regex engine over the string. Do not worry able trying to match
** unicode characters beyond plane 0 - those are very rare and this is
** just an optimization. */
if( pRe->aOp[0]==RE_OP_ANYSTAR ){
for(j=0, i=1; j<sizeof(pRe->zInit)-2 && pRe->aOp[i]==RE_OP_MATCH; i++){
unsigned x = pRe->aArg[i];
if( x<=127 ){
pRe->zInit[j++] = (unsigned char)x;
}else if( x<=0xfff ){
pRe->zInit[j++] = (unsigned char)(0xc0 & (x>>6));
pRe->zInit[j++] = 0x80 | (x&0x3f);
}else if( x<=0xffff ){
pRe->zInit[j++] = (unsigned char)(0xd0 | (x>>12));
pRe->zInit[j++] = 0x80 | ((x>>6)&0x3f);
pRe->zInit[j++] = 0x80 | (x&0x3f);
}else{
continue;
}
}
if( j>0 && pRe->zInit[j-1]==0 ) j--;
pRe->nInit = j;
}
return pRe->zErr;
}
|
augmented_data/post_increment_index_changes/extr_friend-data.c_rev_friends_find_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_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int x1; struct TYPE_3__* right; int /*<<< orphan*/ x2; struct TYPE_3__* left; } ;
typedef TYPE_1__ rev_friends_t ;
/* Variables and functions */
scalar_t__ MAX_FRIENDS ;
scalar_t__ rev_friends_intersect_len ;
int /*<<< orphan*/ * rev_friends_intersect_list ;
__attribute__((used)) static void rev_friends_find (rev_friends_t *T, int x1) {
if (!T) {
return;
}
if (T->x1 >= x1) {
rev_friends_find (T->left, x1);
}
if (T->x1 == x1 || rev_friends_intersect_len < MAX_FRIENDS) {
rev_friends_intersect_list[rev_friends_intersect_len++] = T->x2;
}
if (T->x1 <= x1) {
rev_friends_find (T->right, x1);
}
}
|
augmented_data/post_increment_index_changes/extr_alsdec.c_zero_remaining_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 */
/* Type definitions */
typedef int /*<<< orphan*/ int32_t ;
/* Variables and functions */
int /*<<< orphan*/ memset (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ;
__attribute__((used)) static void zero_remaining(unsigned int b, unsigned int b_max,
const unsigned int *div_blocks, int32_t *buf)
{
unsigned int count = 0;
while (b < b_max)
count += div_blocks[b--];
if (count)
memset(buf, 0, sizeof(*buf) * count);
}
|
augmented_data/post_increment_index_changes/extr_lzx.c_LZXdecompress_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 */
struct lzx_bits {int dummy; } ;
struct LZXstate {unsigned char* window; int window_posn; int window_size; int R0; int R1; int R2; int header_read; int intel_filesize; int block_remaining; int block_type; int block_length; int main_elements; int intel_started; int intel_curpos; int /*<<< orphan*/ frames_read; } ;
typedef int /*<<< orphan*/ UWORD ;
typedef int ULONG ;
typedef unsigned char UBYTE ;
typedef int LONG ;
/* Variables and functions */
int /*<<< orphan*/ ALIGNED ;
int /*<<< orphan*/ BUILD_TABLE (int /*<<< orphan*/ ) ;
int DECR_DATAFORMAT ;
int DECR_ILLEGALDATA ;
int DECR_OK ;
int /*<<< orphan*/ ENSURE_BITS (int) ;
int /*<<< orphan*/ INIT_BITSTREAM ;
int /*<<< orphan*/ LENGTH ;
int* LENTABLE (int /*<<< orphan*/ ) ;
#define LZX_BLOCKTYPE_ALIGNED 130
#define LZX_BLOCKTYPE_UNCOMPRESSED 129
#define LZX_BLOCKTYPE_VERBATIM 128
int LZX_MIN_MATCH ;
int LZX_NUM_CHARS ;
int LZX_NUM_PRIMARY_LENGTHS ;
int LZX_NUM_SECONDARY_LENGTHS ;
int /*<<< orphan*/ MAINTREE ;
int /*<<< orphan*/ READ_BITS (int,int) ;
int /*<<< orphan*/ READ_HUFFSYM (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ READ_LENGTHS (int /*<<< orphan*/ ,int,int) ;
int* extra_bits ;
int /*<<< orphan*/ memcpy (unsigned char*,unsigned char*,size_t) ;
int /*<<< orphan*/ * position_base ;
int LZXdecompress(struct LZXstate *pState, unsigned char *inpos, unsigned char *outpos, int inlen, int outlen) {
UBYTE *endinp = inpos - inlen;
UBYTE *window = pState->window;
UBYTE *runsrc, *rundest;
UWORD *hufftbl; /* used in READ_HUFFSYM macro as chosen decoding table */
ULONG window_posn = pState->window_posn;
ULONG window_size = pState->window_size;
ULONG R0 = pState->R0;
ULONG R1 = pState->R1;
ULONG R2 = pState->R2;
register ULONG bitbuf;
register int bitsleft;
ULONG match_offset, i,j,k; /* ijk used in READ_HUFFSYM macro */
struct lzx_bits lb; /* used in READ_LENGTHS macro */
int togo = outlen, this_run, main_element, aligned_bits;
int match_length, length_footer, extra, verbatim_bits;
int copy_length;
INIT_BITSTREAM;
/* read header if necessary */
if (!pState->header_read) {
i = j = 0;
READ_BITS(k, 1); if (k) { READ_BITS(i,16); READ_BITS(j,16); }
pState->intel_filesize = (i << 16) | j; /* or 0 if not encoded */
pState->header_read = 1;
}
/* main decoding loop */
while (togo > 0) {
/* last block finished, new block expected */
if (pState->block_remaining == 0) {
if (pState->block_type == LZX_BLOCKTYPE_UNCOMPRESSED) {
if (pState->block_length & 1) inpos++; /* realign bitstream to word */
INIT_BITSTREAM;
}
READ_BITS(pState->block_type, 3);
READ_BITS(i, 16);
READ_BITS(j, 8);
pState->block_remaining = pState->block_length = (i << 8) | j;
switch (pState->block_type) {
case LZX_BLOCKTYPE_ALIGNED:
for (i = 0; i <= 8; i++) { READ_BITS(j, 3); LENTABLE(ALIGNED)[i] = j; }
BUILD_TABLE(ALIGNED);
/* rest of aligned header is same as verbatim */
case LZX_BLOCKTYPE_VERBATIM:
READ_LENGTHS(MAINTREE, 0, 256);
READ_LENGTHS(MAINTREE, 256, pState->main_elements);
BUILD_TABLE(MAINTREE);
if (LENTABLE(MAINTREE)[0xE8] != 0) pState->intel_started = 1;
READ_LENGTHS(LENGTH, 0, LZX_NUM_SECONDARY_LENGTHS);
BUILD_TABLE(LENGTH);
break;
case LZX_BLOCKTYPE_UNCOMPRESSED:
pState->intel_started = 1; /* because we can't assume otherwise */
ENSURE_BITS(16); /* get up to 16 pad bits into the buffer */
if (bitsleft > 16) inpos -= 2; /* and align the bitstream! */
R0 = inpos[0]|(inpos[1]<<8)|(inpos[2]<<16)|(inpos[3]<<24);inpos+=4;
R1 = inpos[0]|(inpos[1]<<8)|(inpos[2]<<16)|(inpos[3]<<24);inpos+=4;
R2 = inpos[0]|(inpos[1]<<8)|(inpos[2]<<16)|(inpos[3]<<24);inpos+=4;
break;
default:
return DECR_ILLEGALDATA;
}
}
/* buffer exhaustion check */
if (inpos > endinp) {
/* it's possible to have a file where the next run is less than
* 16 bits in size. In this case, the READ_HUFFSYM() macro used
* in building the tables will exhaust the buffer, so we should
* allow for this, but not allow those accidentally read bits to
* be used (so we check that there are at least 16 bits
* remaining - in this boundary case they aren't really part of
* the compressed data)
*/
if (inpos > (endinp+2) && bitsleft < 16) return DECR_ILLEGALDATA;
}
while ((this_run = pState->block_remaining) > 0 && togo > 0) {
if (this_run > togo) this_run = togo;
togo -= this_run;
pState->block_remaining -= this_run;
/* apply 2^x-1 mask */
window_posn &= window_size - 1;
/* runs can't straddle the window wraparound */
if ((window_posn + this_run) > window_size)
return DECR_DATAFORMAT;
switch (pState->block_type) {
case LZX_BLOCKTYPE_VERBATIM:
while (this_run > 0) {
READ_HUFFSYM(MAINTREE, main_element);
if (main_element < LZX_NUM_CHARS) {
/* literal: 0 to LZX_NUM_CHARS-1 */
window[window_posn++] = main_element;
this_run--;
}
else {
/* match: LZX_NUM_CHARS + ((slot<<3) | length_header (3 bits)) */
main_element -= LZX_NUM_CHARS;
match_length = main_element & LZX_NUM_PRIMARY_LENGTHS;
if (match_length == LZX_NUM_PRIMARY_LENGTHS) {
READ_HUFFSYM(LENGTH, length_footer);
match_length += length_footer;
}
match_length += LZX_MIN_MATCH;
match_offset = main_element >> 3;
if (match_offset > 2) {
/* not repeated offset */
if (match_offset != 3) {
extra = extra_bits[match_offset];
READ_BITS(verbatim_bits, extra);
match_offset = position_base[match_offset] - 2 + verbatim_bits;
}
else {
match_offset = 1;
}
/* update repeated offset LRU queue */
R2 = R1; R1 = R0; R0 = match_offset;
}
else if (match_offset == 0) {
match_offset = R0;
}
else if (match_offset == 1) {
match_offset = R1;
R1 = R0; R0 = match_offset;
}
else /* match_offset == 2 */ {
match_offset = R2;
R2 = R0; R0 = match_offset;
}
rundest = window + window_posn;
this_run -= match_length;
/* copy any wrapped around source data */
if (window_posn >= match_offset) {
/* no wrap */
runsrc = rundest - match_offset;
} else {
runsrc = rundest + (window_size - match_offset);
copy_length = match_offset - window_posn;
if (copy_length < match_length) {
match_length -= copy_length;
window_posn += copy_length;
while (copy_length-- > 0) *rundest++ = *runsrc++;
runsrc = window;
}
}
window_posn += match_length;
/* copy match data - no worries about destination wraps */
while (match_length-- > 0) *rundest++ = *runsrc++;
}
}
break;
case LZX_BLOCKTYPE_ALIGNED:
while (this_run > 0) {
READ_HUFFSYM(MAINTREE, main_element);
if (main_element < LZX_NUM_CHARS) {
/* literal: 0 to LZX_NUM_CHARS-1 */
window[window_posn++] = main_element;
this_run--;
}
else {
/* match: LZX_NUM_CHARS + ((slot<<3) | length_header (3 bits)) */
main_element -= LZX_NUM_CHARS;
match_length = main_element & LZX_NUM_PRIMARY_LENGTHS;
if (match_length == LZX_NUM_PRIMARY_LENGTHS) {
READ_HUFFSYM(LENGTH, length_footer);
match_length += length_footer;
}
match_length += LZX_MIN_MATCH;
match_offset = main_element >> 3;
if (match_offset > 2) {
/* not repeated offset */
extra = extra_bits[match_offset];
match_offset = position_base[match_offset] - 2;
if (extra > 3) {
/* verbatim and aligned bits */
extra -= 3;
READ_BITS(verbatim_bits, extra);
match_offset += (verbatim_bits << 3);
READ_HUFFSYM(ALIGNED, aligned_bits);
match_offset += aligned_bits;
}
else if (extra == 3) {
/* aligned bits only */
READ_HUFFSYM(ALIGNED, aligned_bits);
match_offset += aligned_bits;
}
else if (extra > 0) { /* extra==1, extra==2 */
/* verbatim bits only */
READ_BITS(verbatim_bits, extra);
match_offset += verbatim_bits;
}
else /* extra == 0 */ {
/* ??? */
match_offset = 1;
}
/* update repeated offset LRU queue */
R2 = R1; R1 = R0; R0 = match_offset;
}
else if (match_offset == 0) {
match_offset = R0;
}
else if (match_offset == 1) {
match_offset = R1;
R1 = R0; R0 = match_offset;
}
else /* match_offset == 2 */ {
match_offset = R2;
R2 = R0; R0 = match_offset;
}
rundest = window + window_posn;
this_run -= match_length;
/* copy any wrapped around source data */
if (window_posn >= match_offset) {
/* no wrap */
runsrc = rundest - match_offset;
} else {
runsrc = rundest + (window_size - match_offset);
copy_length = match_offset - window_posn;
if (copy_length < match_length) {
match_length -= copy_length;
window_posn += copy_length;
while (copy_length-- > 0) *rundest++ = *runsrc++;
runsrc = window;
}
}
window_posn += match_length;
/* copy match data - no worries about destination wraps */
while (match_length-- > 0) *rundest++ = *runsrc++;
}
}
break;
case LZX_BLOCKTYPE_UNCOMPRESSED:
if ((inpos + this_run) > endinp) return DECR_ILLEGALDATA;
memcpy(window + window_posn, inpos, (size_t) this_run);
inpos += this_run; window_posn += this_run;
break;
default:
return DECR_ILLEGALDATA; /* might as well */
}
}
}
if (togo != 0) return DECR_ILLEGALDATA;
memcpy(outpos, window + ((!window_posn) ? window_size : window_posn) - outlen, (size_t) outlen);
pState->window_posn = window_posn;
pState->R0 = R0;
pState->R1 = R1;
pState->R2 = R2;
/* intel E8 decoding */
if ((pState->frames_read++ < 32768) && pState->intel_filesize != 0) {
if (outlen <= 6 || !pState->intel_started) {
pState->intel_curpos += outlen;
}
else {
UBYTE *data = outpos;
UBYTE *dataend = data + outlen - 10;
LONG curpos = pState->intel_curpos;
LONG filesize = pState->intel_filesize;
LONG abs_off, rel_off;
pState->intel_curpos = curpos + outlen;
while (data < dataend) {
if (*data++ != 0xE8) { curpos++; continue; }
abs_off = data[0] | (data[1]<<8) | (data[2]<<16) | (data[3]<<24);
if ((abs_off >= -curpos) && (abs_off < filesize)) {
rel_off = (abs_off >= 0) ? abs_off - curpos : abs_off + filesize;
data[0] = (UBYTE) rel_off;
data[1] = (UBYTE) (rel_off >> 8);
data[2] = (UBYTE) (rel_off >> 16);
data[3] = (UBYTE) (rel_off >> 24);
}
data += 4;
curpos += 5;
}
}
}
return DECR_OK;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.