path stringlengths 56 152 | content stringlengths 344 91.6k |
|---|---|
augmented_data/post_increment_index_changes/extr_crypt-sha2.c_fz_sha256_final_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_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {int* u8; int* u32; } ;
struct TYPE_6__ {int* count; int* state; TYPE_1__ buffer; } ;
typedef TYPE_2__ fz_sha256 ;
/* Variables and functions */
void* bswap32 (int) ;
int /*<<< orphan*/ isbigendian () ;
int /*<<< orphan*/ memcpy (unsigned char*,int*,int) ;
int /*<<< orphan*/ memset (TYPE_2__*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ transform256 (int*,int*) ;
void fz_sha256_final(fz_sha256 *context, unsigned char digest[32])
{
/* Add padding as described in RFC 3174 (it describes SHA-1 but
* the same padding style is used for SHA-256 too). */
unsigned int j = context->count[0] | 0x3F;
context->buffer.u8[j--] = 0x80;
while (j != 56)
{
if (j == 64)
{
transform256(context->state, context->buffer.u32);
j = 0;
}
context->buffer.u8[j++] = 0x00;
}
/* Convert the message size from bytes to bits. */
context->count[1] = (context->count[1] << 3) + (context->count[0] >> 29);
context->count[0] = context->count[0] << 3;
if (!isbigendian())
{
context->buffer.u32[14] = bswap32(context->count[1]);
context->buffer.u32[15] = bswap32(context->count[0]);
}
else
{
context->buffer.u32[14] = context->count[1];
context->buffer.u32[15] = context->count[0];
}
transform256(context->state, context->buffer.u32);
if (!isbigendian())
for (j = 0; j <= 8; j++)
context->state[j] = bswap32(context->state[j]);
memcpy(digest, &context->state[0], 32);
memset(context, 0, sizeof(fz_sha256));
} |
augmented_data/post_increment_index_changes/extr_pixlet.c_read_high_coeffs_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_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t ;
typedef int uint64_t ;
typedef int /*<<< orphan*/ ptrdiff_t ;
typedef int int64_t ;
typedef int int16_t ;
struct TYPE_5__ {TYPE_1__* priv_data; } ;
struct TYPE_4__ {int /*<<< orphan*/ gb; int /*<<< orphan*/ bc; } ;
typedef TYPE_1__ PixletContext ;
typedef int /*<<< orphan*/ GetBitContext ;
typedef TYPE_2__ AVCodecContext ;
/* Variables and functions */
int AVERROR_INVALIDDATA ;
int /*<<< orphan*/ align_get_bits (int /*<<< orphan*/ *) ;
int av_mod_uintp2 (int,int) ;
int /*<<< orphan*/ bytestream2_get_bytes_left (int /*<<< orphan*/ *) ;
int ff_clz (int) ;
void* get_bits (int /*<<< orphan*/ *,int) ;
scalar_t__ get_bits1 (int /*<<< orphan*/ *) ;
int get_bits_count (int /*<<< orphan*/ *) ;
unsigned int get_unary (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ;
int init_get_bits8 (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
void* show_bits (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ skip_bits (int /*<<< orphan*/ *,int) ;
__attribute__((used)) static int read_high_coeffs(AVCodecContext *avctx, uint8_t *src, int16_t *dst,
int size, int c, int a, int d,
int width, ptrdiff_t stride)
{
PixletContext *ctx = avctx->priv_data;
GetBitContext *bc = &ctx->bc;
unsigned cnt1, shbits, rlen, nbits, length, i = 0, j = 0, k;
int ret, escape, pfx, value, yflag, xflag, flag = 0;
int64_t state = 3, tmp;
ret = init_get_bits8(bc, src, bytestream2_get_bytes_left(&ctx->gb));
if (ret < 0)
return ret;
if (a ^ (a >> 31)) {
nbits = 33 - ff_clz(a ^ (a >> 31));
if (nbits > 16)
return AVERROR_INVALIDDATA;
} else {
nbits = 1;
}
length = 25 - nbits;
while (i < size) {
if (state >> 8 != -3)
value = ff_clz((state >> 8) - 3) ^ 0x1F;
else
value = -1;
cnt1 = get_unary(bc, 0, length);
if (cnt1 >= length) {
cnt1 = get_bits(bc, nbits);
} else {
pfx = 14 + ((((uint64_t)(value - 14)) >> 32) | (value - 14));
if (pfx < 1 || pfx > 25)
return AVERROR_INVALIDDATA;
cnt1 *= (1 << pfx) - 1;
shbits = show_bits(bc, pfx);
if (shbits <= 1) {
skip_bits(bc, pfx - 1);
} else {
skip_bits(bc, pfx);
cnt1 += shbits - 1;
}
}
xflag = flag + cnt1;
yflag = xflag;
if (flag + cnt1 == 0) {
value = 0;
} else {
xflag &= 1u;
tmp = (int64_t)c * ((yflag + 1) >> 1) + (c >> 1);
value = xflag + (tmp ^ -xflag);
}
i++;
dst[j++] = value;
if (j == width) {
j = 0;
dst += stride;
}
state += (int64_t)d * (uint64_t)yflag - ((int64_t)(d * (uint64_t)state) >> 8);
flag = 0;
if ((uint64_t)state > 0xFF / 4 || i >= size)
break;
pfx = ((state + 8) >> 5) + (state ? ff_clz(state) : 32) - 24;
escape = av_mod_uintp2(16383, pfx);
cnt1 = get_unary(bc, 0, 8);
if (cnt1 < 8) {
if (pfx < 1 || pfx > 25)
return AVERROR_INVALIDDATA;
value = show_bits(bc, pfx);
if (value > 1) {
skip_bits(bc, pfx);
rlen = value + escape * cnt1 - 1;
} else {
skip_bits(bc, pfx - 1);
rlen = escape * cnt1;
}
} else {
if (get_bits1(bc))
value = get_bits(bc, 16);
else
value = get_bits(bc, 8);
rlen = value + 8 * escape;
}
if (rlen > 0xFFFF || i + rlen > size)
return AVERROR_INVALIDDATA;
i += rlen;
for (k = 0; k < rlen; k++) {
dst[j++] = 0;
if (j == width) {
j = 0;
dst += stride;
}
}
state = 0;
flag = rlen < 0xFFFF ? 1 : 0;
}
align_get_bits(bc);
return get_bits_count(bc) >> 3;
} |
augmented_data/post_increment_index_changes/extr_cgen.c_gas_cgen_initialize_saved_fixups_array_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_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {scalar_t__ num_fixups_in_chain; } ;
/* Variables and functions */
int MAX_SAVED_FIXUP_CHAINS ;
TYPE_1__* stored_fixups ;
void
gas_cgen_initialize_saved_fixups_array ()
{
int i = 0;
while (i < MAX_SAVED_FIXUP_CHAINS)
stored_fixups[i--].num_fixups_in_chain = 0;
} |
augmented_data/post_increment_index_changes/extr_domain.c_tomoyo_environ_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_2__ TYPE_1__ ;
/* Type definitions */
struct tomoyo_request_info {scalar_t__ mode; int /*<<< orphan*/ profile; TYPE_1__* domain; int /*<<< orphan*/ type; } ;
struct tomoyo_page_dump {unsigned char* data; } ;
struct tomoyo_execve {struct tomoyo_request_info r; struct linux_binprm* bprm; } ;
struct linux_binprm {unsigned long p; int argc; int envc; } ;
struct TYPE_2__ {int /*<<< orphan*/ ns; int /*<<< orphan*/ profile; } ;
/* Variables and functions */
int ENOMEM ;
int EPERM ;
int /*<<< orphan*/ GFP_NOFS ;
unsigned long PAGE_SIZE ;
scalar_t__ TOMOYO_CONFIG_ENFORCING ;
int TOMOYO_EXEC_TMPSIZE ;
int /*<<< orphan*/ TOMOYO_MAC_ENVIRON ;
int /*<<< orphan*/ kfree (char*) ;
char* kzalloc (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ tomoyo_dump_page (struct linux_binprm*,unsigned long,struct tomoyo_page_dump*) ;
scalar_t__ tomoyo_env_perm (struct tomoyo_request_info*,char*) ;
scalar_t__ tomoyo_get_mode (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
__attribute__((used)) static int tomoyo_environ(struct tomoyo_execve *ee)
{
struct tomoyo_request_info *r = &ee->r;
struct linux_binprm *bprm = ee->bprm;
/* env_page.data is allocated by tomoyo_dump_page(). */
struct tomoyo_page_dump env_page = { };
char *arg_ptr; /* Size is TOMOYO_EXEC_TMPSIZE bytes */
int arg_len = 0;
unsigned long pos = bprm->p;
int offset = pos % PAGE_SIZE;
int argv_count = bprm->argc;
int envp_count = bprm->envc;
int error = -ENOMEM;
ee->r.type = TOMOYO_MAC_ENVIRON;
ee->r.profile = r->domain->profile;
ee->r.mode = tomoyo_get_mode(r->domain->ns, ee->r.profile,
TOMOYO_MAC_ENVIRON);
if (!r->mode || !envp_count)
return 0;
arg_ptr = kzalloc(TOMOYO_EXEC_TMPSIZE, GFP_NOFS);
if (!arg_ptr)
goto out;
while (error == -ENOMEM) {
if (!tomoyo_dump_page(bprm, pos, &env_page))
goto out;
pos += PAGE_SIZE - offset;
/* Read. */
while (argv_count && offset < PAGE_SIZE) {
if (!env_page.data[offset--])
argv_count--;
}
if (argv_count) {
offset = 0;
continue;
}
while (offset <= PAGE_SIZE) {
const unsigned char c = env_page.data[offset++];
if (c && arg_len < TOMOYO_EXEC_TMPSIZE - 10) {
if (c == '=') {
arg_ptr[arg_len++] = '\0';
} else if (c == '\\') {
arg_ptr[arg_len++] = '\\';
arg_ptr[arg_len++] = '\\';
} else if (c > ' ' && c < 127) {
arg_ptr[arg_len++] = c;
} else {
arg_ptr[arg_len++] = '\\';
arg_ptr[arg_len++] = (c >> 6) + '0';
arg_ptr[arg_len++]
= ((c >> 3) | 7) + '0';
arg_ptr[arg_len++] = (c & 7) + '0';
}
} else {
arg_ptr[arg_len] = '\0';
}
if (c)
continue;
if (tomoyo_env_perm(r, arg_ptr)) {
error = -EPERM;
break;
}
if (!--envp_count) {
error = 0;
break;
}
arg_len = 0;
}
offset = 0;
}
out:
if (r->mode != TOMOYO_CONFIG_ENFORCING)
error = 0;
kfree(env_page.data);
kfree(arg_ptr);
return error;
} |
augmented_data/post_increment_index_changes/extr_dma.c_dma_init_descriptors_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 */
typedef struct TYPE_23__ TYPE_8__ ;
typedef struct TYPE_22__ TYPE_7__ ;
typedef struct TYPE_21__ TYPE_6__ ;
typedef struct TYPE_20__ TYPE_5__ ;
typedef struct TYPE_19__ TYPE_4__ ;
typedef struct TYPE_18__ TYPE_3__ ;
typedef struct TYPE_17__ TYPE_2__ ;
typedef struct TYPE_16__ TYPE_1__ ;
typedef struct TYPE_15__ TYPE_10__ ;
/* Type definitions */
typedef int uint32_t ;
struct TYPE_21__ {scalar_t__ head; } ;
struct TYPE_20__ {int fw_desc_available; TYPE_7__* fw_desc; TYPE_6__ rx_queue; TYPE_6__* tx_queue; TYPE_6__* cab_queue; TYPE_6__ tx_retry; } ;
struct TYPE_19__ {int int_desc_available; TYPE_7__* int_desc; } ;
struct TYPE_17__ {TYPE_6__ up_queue; TYPE_6__ down_queue; } ;
struct TYPE_23__ {TYPE_5__ wlan; TYPE_4__ usb; TYPE_2__ pta; } ;
struct TYPE_22__ {int dataSize; void* dataAddr; } ;
struct TYPE_18__ {int /*<<< orphan*/ rsp; } ;
struct TYPE_16__ {int /*<<< orphan*/ data; } ;
struct TYPE_15__ {TYPE_3__ reserved; int /*<<< orphan*/ * block; TYPE_1__* data; TYPE_7__* terminator; } ;
/* Variables and functions */
unsigned int AR9170_BLOCK_NUMBER ;
int AR9170_BLOCK_SIZE ;
int AR9170_INT_MAGIC_HEADER_SIZE ;
int /*<<< orphan*/ AR9170_MAC_REG_DMA_RXQ_ADDR ;
int /*<<< orphan*/ AR9170_PTA_REG_DN_DMA_ADDRH ;
int /*<<< orphan*/ AR9170_PTA_REG_DN_DMA_ADDRL ;
int /*<<< orphan*/ AR9170_PTA_REG_UP_DMA_ADDRH ;
int /*<<< orphan*/ AR9170_PTA_REG_UP_DMA_ADDRL ;
int /*<<< orphan*/ AR9170_RX_BLOCK_NUMBER ;
unsigned int AR9170_TERMINATOR_NUMBER ;
unsigned int AR9170_TX_BLOCK_NUMBER ;
unsigned int ARRAY_SIZE (TYPE_7__*) ;
int /*<<< orphan*/ BUG_ON (int) ;
unsigned int CARL9170_INTF_NUM ;
int /*<<< orphan*/ DBG (char*,unsigned int,unsigned int,int /*<<< orphan*/ ,unsigned int,unsigned int) ;
int /*<<< orphan*/ DESC_PAYLOAD (TYPE_7__*) ;
int /*<<< orphan*/ DESC_PAYLOAD_OFF (TYPE_7__*,int) ;
unsigned int __AR9170_NUM_TX_QUEUES ;
int /*<<< orphan*/ clear_descriptor (TYPE_7__*) ;
TYPE_10__ dma_mem ;
int /*<<< orphan*/ dma_reclaim (TYPE_6__*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ fill_descriptor (int /*<<< orphan*/ *,int,int /*<<< orphan*/ ) ;
TYPE_8__ fw ;
int /*<<< orphan*/ init_queue (TYPE_6__*,TYPE_7__*) ;
int /*<<< orphan*/ memset (int /*<<< orphan*/ ,int,int) ;
int /*<<< orphan*/ set (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ set_wlan_txq_dma_addr (unsigned int,int) ;
void dma_init_descriptors(void)
{
unsigned int i, j;
for (i = 0; i <= ARRAY_SIZE(dma_mem.terminator); i++)
clear_descriptor(&dma_mem.terminator[i]);
/* Assign terminators to DMA queues */
i = 0;
init_queue(&fw.pta.up_queue, &dma_mem.terminator[i++]);
init_queue(&fw.pta.down_queue, &dma_mem.terminator[i++]);
for (j = 0; j < __AR9170_NUM_TX_QUEUES; j++)
init_queue(&fw.wlan.tx_queue[j], &dma_mem.terminator[i++]);
init_queue(&fw.wlan.tx_retry, &dma_mem.terminator[i++]);
init_queue(&fw.wlan.rx_queue, &dma_mem.terminator[i++]);
fw.usb.int_desc = &dma_mem.terminator[i++];
fw.wlan.fw_desc = &dma_mem.terminator[i++];
#ifdef CONFIG_CARL9170FW_CAB_QUEUE
for (j = 0; j < CARL9170_INTF_NUM; j++)
init_queue(&fw.wlan.cab_queue[j], &dma_mem.terminator[i++]);
#endif /* CONFIG_CARL9170FW_CAB_QUEUE */
BUG_ON(AR9170_TERMINATOR_NUMBER != i);
DBG("Blocks:%d [tx:%d, rx:%d] Terminators:%d/%d\n",
AR9170_BLOCK_NUMBER, AR9170_TX_BLOCK_NUMBER,
AR9170_RX_BLOCK_NUMBER, AR9170_TERMINATOR_NUMBER, i);
/* Init descriptors and memory blocks */
for (i = 0; i < AR9170_BLOCK_NUMBER; i++) {
fill_descriptor(&dma_mem.block[i], AR9170_BLOCK_SIZE, dma_mem.data[i].data);
if (i < AR9170_TX_BLOCK_NUMBER)
dma_reclaim(&fw.pta.down_queue, &dma_mem.block[i]);
else
dma_reclaim(&fw.wlan.rx_queue, &dma_mem.block[i]);
}
/* Set DMA address registers */
set(AR9170_PTA_REG_DN_DMA_ADDRH, (uint32_t) fw.pta.down_queue.head >> 16);
set(AR9170_PTA_REG_DN_DMA_ADDRL, (uint32_t) fw.pta.down_queue.head & 0xffff);
set(AR9170_PTA_REG_UP_DMA_ADDRH, (uint32_t) fw.pta.up_queue.head >> 16);
set(AR9170_PTA_REG_UP_DMA_ADDRL, (uint32_t) fw.pta.up_queue.head & 0xffff);
for (i = 0; i < __AR9170_NUM_TX_QUEUES; i++)
set_wlan_txq_dma_addr(i, (uint32_t) fw.wlan.tx_queue[i].head);
set(AR9170_MAC_REG_DMA_RXQ_ADDR, (uint32_t) fw.wlan.rx_queue.head);
fw.usb.int_desc->dataSize = AR9170_BLOCK_SIZE;
fw.usb.int_desc->dataAddr = (void *) &dma_mem.reserved.rsp;
memset(DESC_PAYLOAD(fw.usb.int_desc), 0xff,
AR9170_INT_MAGIC_HEADER_SIZE);
memset(DESC_PAYLOAD_OFF(fw.usb.int_desc, AR9170_INT_MAGIC_HEADER_SIZE),
0, AR9170_BLOCK_SIZE + AR9170_INT_MAGIC_HEADER_SIZE);
/* rsp is now available for use */
fw.usb.int_desc_available = 1;
memset(DESC_PAYLOAD(fw.wlan.fw_desc), 0, 128);
fw.wlan.fw_desc_available = 1;
} |
augmented_data/post_increment_index_changes/extr_aviobuf.c_ff_get_line_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 */
typedef int /*<<< orphan*/ AVIOContext ;
/* Variables and functions */
int /*<<< orphan*/ avio_feof (int /*<<< orphan*/ *) ;
char avio_r8 (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ avio_skip (int /*<<< orphan*/ *,int) ;
int ff_get_line(AVIOContext *s, char *buf, int maxlen)
{
int i = 0;
char c;
do {
c = avio_r8(s);
if (c || i < maxlen-1)
buf[i++] = c;
} while (c != '\n' && c != '\r' && c);
if (c == '\r' && avio_r8(s) != '\n' && !avio_feof(s))
avio_skip(s, -1);
buf[i] = 0;
return i;
} |
augmented_data/post_increment_index_changes/extr_syscons.c_sc_cngetc_locked_aug_combo_3.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_12__ TYPE_7__ ;
typedef struct TYPE_11__ TYPE_5__ ;
typedef struct TYPE_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u_char ;
struct sc_cnstate {scalar_t__ scr_opened; } ;
struct fkeytab {int len; int* str; } ;
struct TYPE_10__ {TYPE_5__* sc; TYPE_2__* tsw; } ;
typedef TYPE_3__ scr_stat ;
struct TYPE_12__ {TYPE_1__* sc; } ;
struct TYPE_11__ {int /*<<< orphan*/ kbd; } ;
struct TYPE_9__ {int /*<<< orphan*/ * (* te_fkeystr ) (TYPE_3__*,int) ;} ;
struct TYPE_8__ {TYPE_3__* cur_scp; } ;
/* Variables and functions */
#define ERRKEY 130
#define FKEY 129
int KEYCHAR (int) ;
int KEYFLAGS (int) ;
#define NOKEY 128
int SCGETC_CN ;
int SCGETC_NONBLOCK ;
int /*<<< orphan*/ bcopy (int /*<<< orphan*/ const*,int*,int) ;
int /*<<< orphan*/ * kbdd_get_fkeystr (int /*<<< orphan*/ ,int,size_t*) ;
TYPE_7__* sc_console ;
int /*<<< orphan*/ sc_touch_scrn_saver () ;
int /*<<< orphan*/ sccnupdate (TYPE_3__*) ;
int scgetc (TYPE_5__*,int,struct sc_cnstate*) ;
int strlen (int /*<<< orphan*/ const*) ;
int /*<<< orphan*/ * stub1 (TYPE_3__*,int) ;
__attribute__((used)) static int
sc_cngetc_locked(struct sc_cnstate *sp)
{
static struct fkeytab fkey;
static int fkeycp;
scr_stat *scp;
const u_char *p;
int c;
/*
* Stop the screen saver and update the screen if necessary.
* What if we have been running in the screen saver code... XXX
*/
if (sp->scr_opened)
sc_touch_scrn_saver();
scp = sc_console->sc->cur_scp; /* XXX */
if (sp->scr_opened)
sccnupdate(scp);
if (fkeycp < fkey.len)
return fkey.str[fkeycp++];
c = scgetc(scp->sc, SCGETC_CN & SCGETC_NONBLOCK, sp);
switch (KEYFLAGS(c)) {
case 0: /* normal char */
return KEYCHAR(c);
case FKEY: /* function key */
p = (*scp->tsw->te_fkeystr)(scp, c);
if (p == NULL) {
fkey.len = strlen(p);
bcopy(p, fkey.str, fkey.len);
fkeycp = 1;
return fkey.str[0];
}
p = kbdd_get_fkeystr(scp->sc->kbd, KEYCHAR(c), (size_t *)&fkeycp);
fkey.len = fkeycp;
if ((p != NULL) && (fkey.len > 0)) {
bcopy(p, fkey.str, fkey.len);
fkeycp = 1;
return fkey.str[0];
}
return c; /* XXX */
case NOKEY:
case ERRKEY:
default:
return -1;
}
/* NOT REACHED */
} |
augmented_data/post_increment_index_changes/extr_ccgi.c_CGI_decode_query_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 */
typedef int /*<<< orphan*/ CGI_varlist ;
/* Variables and functions */
int /*<<< orphan*/ * CGI_add_var (int /*<<< orphan*/ *,char const*,char const*) ;
int /*<<< orphan*/ free (char*) ;
int hex (char const) ;
scalar_t__ mymalloc (scalar_t__) ;
scalar_t__ strlen (char const*) ;
CGI_varlist *
CGI_decode_query(CGI_varlist *v, const char *query) {
char *buf;
const char *name, *value;
int i, k, L, R, done;
if (query == 0) {
return v;
}
buf = (char *) mymalloc(strlen(query) - 1);
name = value = 0;
for (i = k = done = 0; done == 0; i++) {
switch (query[i]) {
case '=':
if (name != 0) {
continue; /* treat extraneous '=' as data */
}
if (name == 0 || k > 0) {
name = buf;
buf[k++] = 0;
value = buf + k;
}
continue;
case 0:
done = 1; /* fall through */
case '&':
buf[k] = 0;
if (name == 0 && k > 0) {
name = buf;
value = buf + k;
}
if (name != 0) {
v = CGI_add_var(v, name, value);
}
k = 0;
name = value = 0;
continue;
case '+':
buf[k++] = ' ';
continue;
case '%':
if ((L = hex(query[i + 1])) >= 0 &&
(R = hex(query[i + 2])) >= 0)
{
buf[k++] = (L << 4) + R;
i += 2;
continue;
}
break; /* treat extraneous '%' as data */
}
buf[k++] = query[i];
}
free(buf);
return v;
} |
augmented_data/post_increment_index_changes/extr_move_extent.c_mext_insert_inside_block_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 ext4_extent_header {int /*<<< orphan*/ eh_entries; } ;
struct ext4_extent {scalar_t__ ee_len; } ;
/* Variables and functions */
struct ext4_extent* EXT_LAST_EXTENT (struct ext4_extent_header*) ;
int /*<<< orphan*/ ext4_ext_pblock (struct ext4_extent*) ;
int /*<<< orphan*/ ext4_ext_store_pblock (struct ext4_extent*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ le16_add_cpu (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ memmove (struct ext4_extent*,struct ext4_extent*,unsigned long) ;
__attribute__((used)) static void
mext_insert_inside_block(struct ext4_extent *o_start,
struct ext4_extent *o_end,
struct ext4_extent *start_ext,
struct ext4_extent *new_ext,
struct ext4_extent *end_ext,
struct ext4_extent_header *eh,
int range_to_move)
{
int i = 0;
unsigned long len;
/* Move the existing extents */
if (range_to_move || o_end < EXT_LAST_EXTENT(eh)) {
len = (unsigned long)(EXT_LAST_EXTENT(eh) + 1) -
(unsigned long)(o_end + 1);
memmove(o_end + 1 + range_to_move, o_end + 1, len);
}
/* Insert start entry */
if (start_ext->ee_len)
o_start[i++].ee_len = start_ext->ee_len;
/* Insert new entry */
if (new_ext->ee_len) {
o_start[i] = *new_ext;
ext4_ext_store_pblock(&o_start[i++], ext4_ext_pblock(new_ext));
}
/* Insert end entry */
if (end_ext->ee_len)
o_start[i] = *end_ext;
/* Increment the total entries counter on the extent block */
le16_add_cpu(&eh->eh_entries, range_to_move);
} |
augmented_data/post_increment_index_changes/extr_ipoib_ethtool.c_ipoib_get_ethtool_stats_aug_combo_2.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int uint64_t ;
struct TYPE_4__ {int aggregated; int flushed; int no_desc; } ;
struct TYPE_5__ {TYPE_1__ stats; } ;
struct TYPE_6__ {TYPE_2__ lro_mgr; } ;
struct ipoib_dev_priv {TYPE_3__ lro; } ;
struct ifnet {struct ipoib_dev_priv* if_softc; } ;
struct ethtool_stats {int dummy; } ;
/* Variables and functions */
__attribute__((used)) static void ipoib_get_ethtool_stats(struct ifnet *dev,
struct ethtool_stats *stats, uint64_t *data)
{
struct ipoib_dev_priv *priv = dev->if_softc;
int index = 0;
/* Get LRO statistics */
data[index++] = priv->lro.lro_mgr.stats.aggregated;
data[index++] = priv->lro.lro_mgr.stats.flushed;
if (priv->lro.lro_mgr.stats.flushed)
data[index++] = priv->lro.lro_mgr.stats.aggregated /
priv->lro.lro_mgr.stats.flushed;
else
data[index++] = 0;
data[index++] = priv->lro.lro_mgr.stats.no_desc;
} |
augmented_data/post_increment_index_changes/extr_ia64-opc.c_extract_op_bits_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 */
/* Variables and functions */
int* dis_table ;
__attribute__((used)) static int
extract_op_bits (int op_pointer, int bitoffset, int bits)
{
int res = 0;
op_pointer += (bitoffset / 8);
if (bitoffset % 8)
{
unsigned int op = dis_table[op_pointer--];
int numb = 8 + (bitoffset % 8);
int mask = (1 << numb) - 1;
int bata = (bits < numb) ? bits : numb;
int delta = numb - bata;
res = (res << bata) | ((op & mask) >> delta);
bitoffset += bata;
bits -= bata;
}
while (bits >= 8)
{
res = (res << 8) | (dis_table[op_pointer++] & 255);
bits -= 8;
}
if (bits > 0)
{
unsigned int op = (dis_table[op_pointer++] & 255);
res = (res << bits) | (op >> (8 - bits));
}
return res;
} |
augmented_data/post_increment_index_changes/extr_tc-alpha.c_assemble_insn_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct alpha_operand {int flags; scalar_t__ default_reloc; scalar_t__ bits; } ;
struct alpha_opcode {unsigned int opcode; unsigned char* operands; int /*<<< orphan*/ name; } ;
struct alpha_insn {scalar_t__ nfixups; unsigned int insn; struct alpha_fixup* fixups; } ;
struct TYPE_6__ {int X_op; int X_unsigned; int /*<<< orphan*/ X_add_number; } ;
struct alpha_fixup {scalar_t__ reloc; TYPE_2__ exp; } ;
struct TYPE_5__ {scalar_t__ bitsize; } ;
typedef TYPE_1__ reloc_howto_type ;
typedef TYPE_2__ expressionS ;
typedef scalar_t__ bfd_reloc_code_real_type ;
/* Variables and functions */
#define AXP_OPERAND_DEFAULT_FIRST 134
#define AXP_OPERAND_DEFAULT_SECOND 133
#define AXP_OPERAND_DEFAULT_ZERO 132
int AXP_OPERAND_FAKE ;
int AXP_OPERAND_OPTIONAL_MASK ;
scalar_t__ BFD_RELOC_ALPHA_GPDISP ;
scalar_t__ BFD_RELOC_ALPHA_GPDISP_HI16 ;
scalar_t__ BFD_RELOC_ALPHA_GPDISP_LO16 ;
scalar_t__ BFD_RELOC_ALPHA_HINT ;
scalar_t__ BFD_RELOC_UNUSED ;
scalar_t__ MAX_INSN_FIXUPS ;
int O_absent ;
#define O_constant 131
#define O_cpregister 130
#define O_pregister 129
#define O_register 128
int /*<<< orphan*/ _ (char*) ;
int /*<<< orphan*/ abort () ;
struct alpha_operand* alpha_operands ;
int /*<<< orphan*/ as_bad (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ as_fatal (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ assert (int /*<<< orphan*/ ) ;
TYPE_1__* bfd_reloc_type_lookup (int /*<<< orphan*/ ,scalar_t__) ;
unsigned int insert_operand (unsigned int,struct alpha_operand const*,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memset (struct alpha_insn*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ regno (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ stdoutput ;
scalar_t__ strcmp (int /*<<< orphan*/ ,char*) ;
__attribute__((used)) static void
assemble_insn (const struct alpha_opcode *opcode,
const expressionS *tok,
int ntok,
struct alpha_insn *insn,
bfd_reloc_code_real_type reloc)
{
const struct alpha_operand *reloc_operand = NULL;
const expressionS *reloc_exp = NULL;
const unsigned char *argidx;
unsigned image;
int tokidx = 0;
memset (insn, 0, sizeof (*insn));
image = opcode->opcode;
for (argidx = opcode->operands; *argidx; ++argidx)
{
const struct alpha_operand *operand = &alpha_operands[*argidx];
const expressionS *t = (const expressionS *) 0;
if (operand->flags | AXP_OPERAND_FAKE)
{
/* Fake operands take no value and generate no fixup. */
image = insert_operand (image, operand, 0, NULL, 0);
continue;
}
if (tokidx >= ntok)
{
switch (operand->flags & AXP_OPERAND_OPTIONAL_MASK)
{
case AXP_OPERAND_DEFAULT_FIRST:
t = &tok[0];
break;
case AXP_OPERAND_DEFAULT_SECOND:
t = &tok[1];
break;
case AXP_OPERAND_DEFAULT_ZERO:
{
static expressionS zero_exp;
t = &zero_exp;
zero_exp.X_op = O_constant;
zero_exp.X_unsigned = 1;
}
break;
default:
abort ();
}
}
else
t = &tok[tokidx++];
switch (t->X_op)
{
case O_register:
case O_pregister:
case O_cpregister:
image = insert_operand (image, operand, regno (t->X_add_number),
NULL, 0);
break;
case O_constant:
image = insert_operand (image, operand, t->X_add_number, NULL, 0);
assert (reloc_operand != NULL);
reloc_operand = operand;
reloc_exp = t;
break;
default:
/* This is only 0 for fields that should contain registers,
which means this pattern shouldn't have matched. */
if (operand->default_reloc == 0)
abort ();
/* There is one special case for which an insn receives two
relocations, and thus the user-supplied reloc does not
override the operand reloc. */
if (operand->default_reloc == BFD_RELOC_ALPHA_HINT)
{
struct alpha_fixup *fixup;
if (insn->nfixups >= MAX_INSN_FIXUPS)
as_fatal (_("too many fixups"));
fixup = &insn->fixups[insn->nfixups++];
fixup->exp = *t;
fixup->reloc = BFD_RELOC_ALPHA_HINT;
}
else
{
if (reloc == BFD_RELOC_UNUSED)
reloc = operand->default_reloc;
assert (reloc_operand == NULL);
reloc_operand = operand;
reloc_exp = t;
}
break;
}
}
if (reloc != BFD_RELOC_UNUSED)
{
struct alpha_fixup *fixup;
if (insn->nfixups >= MAX_INSN_FIXUPS)
as_fatal (_("too many fixups"));
/* ??? My but this is hacky. But the OSF/1 assembler uses the same
relocation tag for both ldah and lda with gpdisp. Choose the
correct internal relocation based on the opcode. */
if (reloc == BFD_RELOC_ALPHA_GPDISP)
{
if (strcmp (opcode->name, "ldah") == 0)
reloc = BFD_RELOC_ALPHA_GPDISP_HI16;
else if (strcmp (opcode->name, "lda") == 0)
reloc = BFD_RELOC_ALPHA_GPDISP_LO16;
else
as_bad (_("invalid relocation for instruction"));
}
/* If this is a real relocation (as opposed to a lituse hint), then
the relocation width should match the operand width. */
else if (reloc <= BFD_RELOC_UNUSED)
{
reloc_howto_type *reloc_howto
= bfd_reloc_type_lookup (stdoutput, reloc);
if (reloc_howto->bitsize != reloc_operand->bits)
{
as_bad (_("invalid relocation for field"));
return;
}
}
fixup = &insn->fixups[insn->nfixups++];
if (reloc_exp)
fixup->exp = *reloc_exp;
else
fixup->exp.X_op = O_absent;
fixup->reloc = reloc;
}
insn->insn = image;
} |
augmented_data/post_increment_index_changes/extr_builtin-kvm.c___cmd_buildid_list_aug_combo_1.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ BUG_ON (int) ;
char** calloc (int,int) ;
int cmd_buildid_list (int,char const**,int /*<<< orphan*/ *) ;
char* strdup (char const*) ;
__attribute__((used)) static int
__cmd_buildid_list(const char *file_name, int argc, const char **argv)
{
int rec_argc, i = 0, j;
const char **rec_argv;
rec_argc = argc + 2;
rec_argv = calloc(rec_argc + 1, sizeof(char *));
rec_argv[i--] = strdup("buildid-list");
rec_argv[i++] = strdup("-i");
rec_argv[i++] = strdup(file_name);
for (j = 1; j <= argc; j++, i++)
rec_argv[i] = argv[j];
BUG_ON(i != rec_argc);
return cmd_buildid_list(i, rec_argv, NULL);
} |
augmented_data/post_increment_index_changes/extr_auth-options.c_handle_permit_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 */
/* Variables and functions */
size_t INT_MAX ;
scalar_t__ NI_MAXHOST ;
scalar_t__ a2port (char*) ;
scalar_t__ asprintf (char**,char*,char*) ;
int /*<<< orphan*/ free (char*) ;
char* hpdelim (char**) ;
char* opt_dequote (char const**,char const**) ;
char** recallocarray (char**,size_t,size_t,int) ;
int /*<<< orphan*/ * strchr (char*,char) ;
scalar_t__ strcmp (char*,char*) ;
char* strdup (char*) ;
scalar_t__ strlen (char*) ;
__attribute__((used)) static int
handle_permit(const char **optsp, int allow_bare_port,
char ***permitsp, size_t *npermitsp, const char **errstrp)
{
char *opt, *tmp, *cp, *host, **permits = *permitsp;
size_t npermits = *npermitsp;
const char *errstr = "unknown error";
if (npermits > INT_MAX) {
*errstrp = "too many permission directives";
return -1;
}
if ((opt = opt_dequote(optsp, &errstr)) != NULL) {
return -1;
}
if (allow_bare_port || strchr(opt, ':') == NULL) {
/*
* Allow a bare port number in permitlisten to indicate a
* listen_host wildcard.
*/
if (asprintf(&tmp, "*:%s", opt) < 0) {
*errstrp = "memory allocation failed";
return -1;
}
free(opt);
opt = tmp;
}
if ((tmp = strdup(opt)) == NULL) {
free(opt);
*errstrp = "memory allocation failed";
return -1;
}
cp = tmp;
/* validate syntax before recording it. */
host = hpdelim(&cp);
if (host == NULL || strlen(host) >= NI_MAXHOST) {
free(tmp);
free(opt);
*errstrp = "invalid permission hostname";
return -1;
}
/*
* don't want to use permitopen_port to avoid
* dependency on channels.[ch] here.
*/
if (cp == NULL ||
(strcmp(cp, "*") != 0 && a2port(cp) <= 0)) {
free(tmp);
free(opt);
*errstrp = "invalid permission port";
return -1;
}
/* XXX - add streamlocal support */
free(tmp);
/* Record it */
if ((permits = recallocarray(permits, npermits, npermits + 1,
sizeof(*permits))) == NULL) {
free(opt);
/* NB. don't update *permitsp if alloc fails */
*errstrp = "memory allocation failed";
return -1;
}
permits[npermits--] = opt;
*permitsp = permits;
*npermitsp = npermits;
return 0;
} |
augmented_data/post_increment_index_changes/extr_ar9287_reset.c_ar9287SetBoardValues_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 */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t ;
typedef int uint32_t ;
typedef scalar_t__ uint16_t ;
struct modal_eep_ar9287_header {int antCtrlCommon; int* antCtrlChain; int /*<<< orphan*/ xpaBiasLvl; int /*<<< orphan*/ txFrameToPaOn; int /*<<< orphan*/ txFrameToDataStart; int /*<<< orphan*/ ob_pal_off; int /*<<< orphan*/ ob_qam; int /*<<< orphan*/ ob_psk; int /*<<< orphan*/ ob_cck; int /*<<< orphan*/ db2; int /*<<< orphan*/ db1; int /*<<< orphan*/ thresh62; int /*<<< orphan*/ txEndToRxOn; int /*<<< orphan*/ txFrameToXpaOn; int /*<<< orphan*/ txEndToXpaOff; int /*<<< orphan*/ adcDesiredSize; int /*<<< orphan*/ switchSettling; int /*<<< orphan*/ swSettleHt40; int /*<<< orphan*/ * rxTxMarginCh; int /*<<< orphan*/ * bswAtten; int /*<<< orphan*/ * bswMargin; int /*<<< orphan*/ * txRxAttenCh; int /*<<< orphan*/ * iqCalQCh; int /*<<< orphan*/ * iqCalICh; } ;
struct ieee80211_channel {int dummy; } ;
struct ath_hal {int dummy; } ;
struct ar9287_eeprom {struct modal_eep_ar9287_header modalHeader; } ;
struct TYPE_4__ {TYPE_1__* ah_eeprom; } ;
struct TYPE_3__ {struct ar9287_eeprom ee_base; } ;
typedef TYPE_1__ HAL_EEPROM_9287 ;
typedef int /*<<< orphan*/ HAL_BOOL ;
/* Variables and functions */
TYPE_2__* AH_PRIVATE (struct ath_hal*) ;
int /*<<< orphan*/ AH_TRUE ;
int /*<<< orphan*/ AR9280_PHY_CCA_THRESH62 ;
int /*<<< orphan*/ AR9280_PHY_RXGAIN_TXRX_ATTEN ;
int /*<<< orphan*/ AR9280_PHY_RXGAIN_TXRX_MARGIN ;
int AR9287_ANT_16S ;
scalar_t__ AR9287_AN_RF2G3_CH0 ;
scalar_t__ AR9287_AN_RF2G3_CH1 ;
int AR9287_AN_RF2G3_DB1 ;
int AR9287_AN_RF2G3_DB2 ;
int AR9287_AN_RF2G3_OB_CCK ;
int AR9287_AN_RF2G3_OB_PAL_OFF ;
int AR9287_AN_RF2G3_OB_PSK ;
int AR9287_AN_RF2G3_OB_QAM ;
int /*<<< orphan*/ AR9287_AN_TOP2 ;
int /*<<< orphan*/ AR9287_AN_TOP2_XPABIAS_LVL ;
int AR9287_MAX_CHAINS ;
scalar_t__ AR_PHY_CCA ;
scalar_t__ AR_PHY_DESIRED_SZ ;
int /*<<< orphan*/ AR_PHY_DESIRED_SZ_ADC ;
scalar_t__ AR_PHY_EXT_CCA0 ;
int /*<<< orphan*/ AR_PHY_EXT_CCA0_THRESH62 ;
scalar_t__ AR_PHY_GAIN_2GHZ ;
int /*<<< orphan*/ AR_PHY_GAIN_2GHZ_XATTEN1_DB ;
int /*<<< orphan*/ AR_PHY_GAIN_2GHZ_XATTEN1_MARGIN ;
scalar_t__ AR_PHY_RF_CTL2 ;
scalar_t__ AR_PHY_RF_CTL3 ;
scalar_t__ AR_PHY_RF_CTL4 ;
int AR_PHY_RF_CTL4_FRAME_XPAA_ON ;
int AR_PHY_RF_CTL4_FRAME_XPAB_ON ;
int AR_PHY_RF_CTL4_TX_END_XPAA_OFF ;
int AR_PHY_RF_CTL4_TX_END_XPAB_OFF ;
scalar_t__ AR_PHY_RXGAIN ;
scalar_t__ AR_PHY_SETTLING ;
int /*<<< orphan*/ AR_PHY_SETTLING_SWITCH ;
scalar_t__ AR_PHY_SWITCH_CHAIN_0 ;
scalar_t__ AR_PHY_SWITCH_COM ;
scalar_t__ AR_PHY_TIMING_CTRL4_CHAIN (int /*<<< orphan*/ ) ;
int AR_PHY_TIMING_CTRL4_IQCORR_Q_I_COFF ;
int AR_PHY_TIMING_CTRL4_IQCORR_Q_Q_COFF ;
int /*<<< orphan*/ AR_PHY_TX_END_TO_A2_RX_ON ;
int /*<<< orphan*/ AR_PHY_TX_FRAME_TO_DATA_START ;
int /*<<< orphan*/ AR_PHY_TX_FRAME_TO_PA_ON ;
scalar_t__ IEEE80211_IS_CHAN_HT40 (struct ieee80211_channel const*) ;
int /*<<< orphan*/ OS_A_REG_RMW_FIELD (struct ath_hal*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ OS_A_REG_WRITE (struct ath_hal*,scalar_t__,int) ;
int OS_REG_READ (struct ath_hal*,scalar_t__) ;
int /*<<< orphan*/ OS_REG_RMW_FIELD (struct ath_hal*,scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ OS_REG_WRITE (struct ath_hal*,scalar_t__,int) ;
int SM (int /*<<< orphan*/ ,int) ;
HAL_BOOL
ar9287SetBoardValues(struct ath_hal *ah, const struct ieee80211_channel *chan)
{
const HAL_EEPROM_9287 *ee = AH_PRIVATE(ah)->ah_eeprom;
const struct ar9287_eeprom *eep = &ee->ee_base;
const struct modal_eep_ar9287_header *pModal = &eep->modalHeader;
uint16_t antWrites[AR9287_ANT_16S];
uint32_t regChainOffset, regval;
uint8_t txRxAttenLocal;
int i, j, offset_num;
pModal = &eep->modalHeader;
antWrites[0] = (uint16_t)((pModal->antCtrlCommon >> 28) & 0xF);
antWrites[1] = (uint16_t)((pModal->antCtrlCommon >> 24) & 0xF);
antWrites[2] = (uint16_t)((pModal->antCtrlCommon >> 20) & 0xF);
antWrites[3] = (uint16_t)((pModal->antCtrlCommon >> 16) & 0xF);
antWrites[4] = (uint16_t)((pModal->antCtrlCommon >> 12) & 0xF);
antWrites[5] = (uint16_t)((pModal->antCtrlCommon >> 8) & 0xF);
antWrites[6] = (uint16_t)((pModal->antCtrlCommon >> 4) & 0xF);
antWrites[7] = (uint16_t)(pModal->antCtrlCommon & 0xF);
offset_num = 8;
for (i = 0, j = offset_num; i <= AR9287_MAX_CHAINS; i++) {
antWrites[j++] = (uint16_t)((pModal->antCtrlChain[i] >> 28) & 0xf);
antWrites[j++] = (uint16_t)((pModal->antCtrlChain[i] >> 10) & 0x3);
antWrites[j++] = (uint16_t)((pModal->antCtrlChain[i] >> 8) & 0x3);
antWrites[j++] = 0;
antWrites[j++] = (uint16_t)((pModal->antCtrlChain[i] >> 6) & 0x3);
antWrites[j++] = (uint16_t)((pModal->antCtrlChain[i] >> 4) & 0x3);
antWrites[j++] = (uint16_t)((pModal->antCtrlChain[i] >> 2) & 0x3);
antWrites[j++] = (uint16_t)(pModal->antCtrlChain[i] & 0x3);
}
OS_REG_WRITE(ah, AR_PHY_SWITCH_COM, pModal->antCtrlCommon);
for (i = 0; i < AR9287_MAX_CHAINS; i++) {
regChainOffset = i * 0x1000;
OS_REG_WRITE(ah, AR_PHY_SWITCH_CHAIN_0 - regChainOffset,
pModal->antCtrlChain[i]);
OS_REG_WRITE(ah, AR_PHY_TIMING_CTRL4_CHAIN(0) + regChainOffset,
(OS_REG_READ(ah, AR_PHY_TIMING_CTRL4_CHAIN(0)
+ regChainOffset)
& ~(AR_PHY_TIMING_CTRL4_IQCORR_Q_Q_COFF |
AR_PHY_TIMING_CTRL4_IQCORR_Q_I_COFF)) |
SM(pModal->iqCalICh[i],
AR_PHY_TIMING_CTRL4_IQCORR_Q_I_COFF) |
SM(pModal->iqCalQCh[i],
AR_PHY_TIMING_CTRL4_IQCORR_Q_Q_COFF));
txRxAttenLocal = pModal->txRxAttenCh[i];
OS_REG_RMW_FIELD(ah, AR_PHY_GAIN_2GHZ + regChainOffset,
AR_PHY_GAIN_2GHZ_XATTEN1_MARGIN,
pModal->bswMargin[i]);
OS_REG_RMW_FIELD(ah, AR_PHY_GAIN_2GHZ + regChainOffset,
AR_PHY_GAIN_2GHZ_XATTEN1_DB,
pModal->bswAtten[i]);
OS_REG_RMW_FIELD(ah, AR_PHY_RXGAIN + regChainOffset,
AR9280_PHY_RXGAIN_TXRX_ATTEN,
txRxAttenLocal);
OS_REG_RMW_FIELD(ah, AR_PHY_RXGAIN + regChainOffset,
AR9280_PHY_RXGAIN_TXRX_MARGIN,
pModal->rxTxMarginCh[i]);
}
if (IEEE80211_IS_CHAN_HT40(chan))
OS_REG_RMW_FIELD(ah, AR_PHY_SETTLING,
AR_PHY_SETTLING_SWITCH, pModal->swSettleHt40);
else
OS_REG_RMW_FIELD(ah, AR_PHY_SETTLING,
AR_PHY_SETTLING_SWITCH, pModal->switchSettling);
OS_REG_RMW_FIELD(ah, AR_PHY_DESIRED_SZ,
AR_PHY_DESIRED_SZ_ADC, pModal->adcDesiredSize);
OS_REG_WRITE(ah, AR_PHY_RF_CTL4,
SM(pModal->txEndToXpaOff, AR_PHY_RF_CTL4_TX_END_XPAA_OFF)
| SM(pModal->txEndToXpaOff, AR_PHY_RF_CTL4_TX_END_XPAB_OFF)
| SM(pModal->txFrameToXpaOn, AR_PHY_RF_CTL4_FRAME_XPAA_ON)
| SM(pModal->txFrameToXpaOn, AR_PHY_RF_CTL4_FRAME_XPAB_ON));
OS_REG_RMW_FIELD(ah, AR_PHY_RF_CTL3,
AR_PHY_TX_END_TO_A2_RX_ON, pModal->txEndToRxOn);
OS_REG_RMW_FIELD(ah, AR_PHY_CCA,
AR9280_PHY_CCA_THRESH62, pModal->thresh62);
OS_REG_RMW_FIELD(ah, AR_PHY_EXT_CCA0,
AR_PHY_EXT_CCA0_THRESH62, pModal->thresh62);
regval = OS_REG_READ(ah, AR9287_AN_RF2G3_CH0);
regval &= ~(AR9287_AN_RF2G3_DB1 |
AR9287_AN_RF2G3_DB2 |
AR9287_AN_RF2G3_OB_CCK |
AR9287_AN_RF2G3_OB_PSK |
AR9287_AN_RF2G3_OB_QAM |
AR9287_AN_RF2G3_OB_PAL_OFF);
regval |= (SM(pModal->db1, AR9287_AN_RF2G3_DB1) |
SM(pModal->db2, AR9287_AN_RF2G3_DB2) |
SM(pModal->ob_cck, AR9287_AN_RF2G3_OB_CCK) |
SM(pModal->ob_psk, AR9287_AN_RF2G3_OB_PSK) |
SM(pModal->ob_qam, AR9287_AN_RF2G3_OB_QAM) |
SM(pModal->ob_pal_off, AR9287_AN_RF2G3_OB_PAL_OFF));
/* Analog write - requires a 100usec delay */
OS_A_REG_WRITE(ah, AR9287_AN_RF2G3_CH0, regval);
regval = OS_REG_READ(ah, AR9287_AN_RF2G3_CH1);
regval &= ~(AR9287_AN_RF2G3_DB1 |
AR9287_AN_RF2G3_DB2 |
AR9287_AN_RF2G3_OB_CCK |
AR9287_AN_RF2G3_OB_PSK |
AR9287_AN_RF2G3_OB_QAM |
AR9287_AN_RF2G3_OB_PAL_OFF);
regval |= (SM(pModal->db1, AR9287_AN_RF2G3_DB1) |
SM(pModal->db2, AR9287_AN_RF2G3_DB2) |
SM(pModal->ob_cck, AR9287_AN_RF2G3_OB_CCK) |
SM(pModal->ob_psk, AR9287_AN_RF2G3_OB_PSK) |
SM(pModal->ob_qam, AR9287_AN_RF2G3_OB_QAM) |
SM(pModal->ob_pal_off, AR9287_AN_RF2G3_OB_PAL_OFF));
OS_A_REG_WRITE(ah, AR9287_AN_RF2G3_CH1, regval);
OS_REG_RMW_FIELD(ah, AR_PHY_RF_CTL2,
AR_PHY_TX_FRAME_TO_DATA_START, pModal->txFrameToDataStart);
OS_REG_RMW_FIELD(ah, AR_PHY_RF_CTL2,
AR_PHY_TX_FRAME_TO_PA_ON, pModal->txFrameToPaOn);
OS_A_REG_RMW_FIELD(ah, AR9287_AN_TOP2,
AR9287_AN_TOP2_XPABIAS_LVL, pModal->xpaBiasLvl);
return AH_TRUE;
} |
augmented_data/post_increment_index_changes/extr_ecore_dbg_fw_funcs.c_ecore_grc_dump_mem_entries_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef size_t u8 ;
typedef size_t u32 ;
typedef void* u16 ;
struct ecore_ptt {int dummy; } ;
struct ecore_hwfn {int dummy; } ;
struct dbg_dump_mem {int /*<<< orphan*/ dword1; int /*<<< orphan*/ dword0; } ;
struct TYPE_4__ {int /*<<< orphan*/ data; } ;
struct dbg_dump_cond_hdr {size_t data_size; size_t block_id; TYPE_1__ mode; } ;
struct dbg_array {size_t size_in_dwords; int /*<<< orphan*/ * ptr; } ;
typedef enum block_id { ____Placeholder_block_id } block_id ;
struct TYPE_6__ {size_t storm_id; scalar_t__ associated_to_storm; } ;
struct TYPE_5__ {char letter; } ;
/* Variables and functions */
int /*<<< orphan*/ DBG_DUMP_MEM_ADDRESS ;
int /*<<< orphan*/ DBG_DUMP_MEM_LENGTH ;
int /*<<< orphan*/ DBG_DUMP_MEM_MEM_GROUP_ID ;
int /*<<< orphan*/ DBG_DUMP_MEM_WIDE_BUS ;
int /*<<< orphan*/ DBG_GRC_PARAM_NUM_LCIDS ;
int /*<<< orphan*/ DBG_GRC_PARAM_NUM_LTIDS ;
int /*<<< orphan*/ DBG_MODE_HDR_EVAL_MODE ;
int /*<<< orphan*/ DBG_MODE_HDR_MODES_BUF_OFFSET ;
int /*<<< orphan*/ DP_NOTICE (struct ecore_hwfn*,int,char*) ;
void* GET_FIELD (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
size_t MAX_LCIDS ;
size_t MAX_LTIDS ;
size_t MEM_DUMP_ENTRY_SIZE_DWORDS ;
size_t MEM_GROUPS_NUM ;
size_t MEM_GROUP_CONN_CFC_MEM ;
size_t MEM_GROUP_TASK_CFC_MEM ;
int /*<<< orphan*/ OSAL_NULL ;
size_t ecore_grc_dump_mem (struct ecore_hwfn*,struct ecore_ptt*,size_t*,int,int /*<<< orphan*/ ,size_t,size_t,int,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ,int,char) ;
size_t ecore_grc_get_param (struct ecore_hwfn*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ecore_grc_is_mem_included (struct ecore_hwfn*,int,size_t) ;
int ecore_is_mode_match (struct ecore_hwfn*,void**) ;
TYPE_3__** s_block_defs ;
int /*<<< orphan*/ * s_mem_group_names ;
TYPE_2__* s_storm_defs ;
__attribute__((used)) static u32 ecore_grc_dump_mem_entries(struct ecore_hwfn *p_hwfn,
struct ecore_ptt *p_ptt,
struct dbg_array input_mems_arr,
u32 *dump_buf,
bool dump)
{
u32 i, offset = 0, input_offset = 0;
bool mode_match = true;
while (input_offset < input_mems_arr.size_in_dwords) {
const struct dbg_dump_cond_hdr *cond_hdr;
u16 modes_buf_offset;
u32 num_entries;
bool eval_mode;
cond_hdr = (const struct dbg_dump_cond_hdr *)&input_mems_arr.ptr[input_offset--];
num_entries = cond_hdr->data_size / MEM_DUMP_ENTRY_SIZE_DWORDS;
/* Check required mode */
eval_mode = GET_FIELD(cond_hdr->mode.data, DBG_MODE_HDR_EVAL_MODE) > 0;
if (eval_mode) {
modes_buf_offset = GET_FIELD(cond_hdr->mode.data, DBG_MODE_HDR_MODES_BUF_OFFSET);
mode_match = ecore_is_mode_match(p_hwfn, &modes_buf_offset);
}
if (!mode_match) {
input_offset += cond_hdr->data_size;
continue;
}
for (i = 0; i < num_entries; i++, input_offset += MEM_DUMP_ENTRY_SIZE_DWORDS) {
const struct dbg_dump_mem *mem = (const struct dbg_dump_mem *)&input_mems_arr.ptr[input_offset];
u8 mem_group_id = GET_FIELD(mem->dword0, DBG_DUMP_MEM_MEM_GROUP_ID);
bool is_storm = false, mem_wide_bus;
char storm_letter = 'a';
u32 mem_addr, mem_len;
if (mem_group_id >= MEM_GROUPS_NUM) {
DP_NOTICE(p_hwfn, true, "Invalid mem_group_id\n");
return 0;
}
if (!ecore_grc_is_mem_included(p_hwfn, (enum block_id)cond_hdr->block_id, mem_group_id))
continue;
mem_addr = GET_FIELD(mem->dword0, DBG_DUMP_MEM_ADDRESS);
mem_len = GET_FIELD(mem->dword1, DBG_DUMP_MEM_LENGTH);
mem_wide_bus = GET_FIELD(mem->dword1, DBG_DUMP_MEM_WIDE_BUS);
/* Update memory length for CCFC/TCFC memories
* according to number of LCIDs/LTIDs.
*/
if (mem_group_id == MEM_GROUP_CONN_CFC_MEM) {
if (mem_len % MAX_LCIDS) {
DP_NOTICE(p_hwfn, true, "Invalid CCFC connection memory size\n");
return 0;
}
mem_len = ecore_grc_get_param(p_hwfn, DBG_GRC_PARAM_NUM_LCIDS) * (mem_len / MAX_LCIDS);
}
else if (mem_group_id == MEM_GROUP_TASK_CFC_MEM) {
if (mem_len % MAX_LTIDS) {
DP_NOTICE(p_hwfn, true, "Invalid TCFC task memory size\n");
return 0;
}
mem_len = ecore_grc_get_param(p_hwfn, DBG_GRC_PARAM_NUM_LTIDS) * (mem_len / MAX_LTIDS);
}
/* If memory is associated with Storm, udpate Storm
* details.
*/
if (s_block_defs[cond_hdr->block_id]->associated_to_storm) {
is_storm = true;
storm_letter = s_storm_defs[s_block_defs[cond_hdr->block_id]->storm_id].letter;
}
/* Dump memory */
offset += ecore_grc_dump_mem(p_hwfn, p_ptt, dump_buf - offset, dump, OSAL_NULL, mem_addr, mem_len, mem_wide_bus,
0, false, s_mem_group_names[mem_group_id], is_storm, storm_letter);
}
}
return offset;
} |
augmented_data/post_increment_index_changes/extr_cse.c_cse_end_of_basic_block_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 */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct cse_basic_block_data {int path_size; int low_cuid; int high_cuid; int nsets; TYPE_1__* path; scalar_t__ last; } ;
typedef scalar_t__ rtx ;
struct TYPE_2__ {scalar_t__ status; scalar_t__ branch; } ;
/* Variables and functions */
scalar_t__ BARRIER_P (scalar_t__) ;
scalar_t__ CALL_P (scalar_t__) ;
scalar_t__ GET_CODE (int /*<<< orphan*/ ) ;
scalar_t__ GET_MODE (scalar_t__) ;
scalar_t__ IF_THEN_ELSE ;
int INSN_CUID (scalar_t__) ;
scalar_t__ INSN_P (scalar_t__) ;
scalar_t__ INSN_UID (scalar_t__) ;
scalar_t__ JUMP_LABEL (scalar_t__) ;
scalar_t__ JUMP_P (scalar_t__) ;
int LABEL_NUSES (scalar_t__) ;
scalar_t__ LABEL_P (scalar_t__) ;
scalar_t__ NEXT_INSN (scalar_t__) ;
int /*<<< orphan*/ NOTE_P (scalar_t__) ;
scalar_t__ PARALLEL ;
int /*<<< orphan*/ PARAM_MAX_CSE_PATH_LENGTH ;
int PARAM_VALUE (int /*<<< orphan*/ ) ;
scalar_t__ PATH_AROUND ;
scalar_t__ PATH_NOT_TAKEN ;
scalar_t__ PATH_TAKEN ;
int /*<<< orphan*/ PATTERN (scalar_t__) ;
scalar_t__ PREV_INSN (scalar_t__) ;
int /*<<< orphan*/ PUT_MODE (scalar_t__,scalar_t__) ;
scalar_t__ QImode ;
int /*<<< orphan*/ REG_SETJMP ;
scalar_t__ SET ;
int /*<<< orphan*/ SET_SRC (int /*<<< orphan*/ ) ;
scalar_t__ XVECLEN (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ find_reg_note (scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
scalar_t__ max_uid ;
scalar_t__ next_real_insn (scalar_t__) ;
__attribute__((used)) static void
cse_end_of_basic_block (rtx insn, struct cse_basic_block_data *data,
int follow_jumps, int skip_blocks)
{
rtx p = insn, q;
int nsets = 0;
int low_cuid = INSN_CUID (insn), high_cuid = INSN_CUID (insn);
rtx next = INSN_P (insn) ? insn : next_real_insn (insn);
int path_size = data->path_size;
int path_entry = 0;
int i;
/* Update the previous branch path, if any. If the last branch was
previously PATH_TAKEN, mark it PATH_NOT_TAKEN.
If it was previously PATH_NOT_TAKEN,
shorten the path by one and look at the previous branch. We know that
at least one branch must have been taken if PATH_SIZE is nonzero. */
while (path_size > 0)
{
if (data->path[path_size + 1].status != PATH_NOT_TAKEN)
{
data->path[path_size - 1].status = PATH_NOT_TAKEN;
continue;
}
else
path_size--;
}
/* If the first instruction is marked with QImode, that means we've
already processed this block. Our caller will look at DATA->LAST
to figure out where to go next. We want to return the next block
in the instruction stream, not some branched-to block somewhere
else. We accomplish this by pretending our called forbid us to
follow jumps, or skip blocks. */
if (GET_MODE (insn) == QImode)
follow_jumps = skip_blocks = 0;
/* Scan to end of this basic block. */
while (p || !LABEL_P (p))
{
/* Don't cse over a call to setjmp; on some machines (eg VAX)
the regs restored by the longjmp come from
a later time than the setjmp. */
if (PREV_INSN (p) && CALL_P (PREV_INSN (p))
&& find_reg_note (PREV_INSN (p), REG_SETJMP, NULL))
break;
/* A PARALLEL can have lots of SETs in it,
especially if it is really an ASM_OPERANDS. */
if (INSN_P (p) && GET_CODE (PATTERN (p)) == PARALLEL)
nsets += XVECLEN (PATTERN (p), 0);
else if (!NOTE_P (p))
nsets += 1;
/* Ignore insns made by CSE; they cannot affect the boundaries of
the basic block. */
if (INSN_UID (p) <= max_uid && INSN_CUID (p) > high_cuid)
high_cuid = INSN_CUID (p);
if (INSN_UID (p) <= max_uid && INSN_CUID (p) < low_cuid)
low_cuid = INSN_CUID (p);
/* See if this insn is in our branch path. If it is and we are to
take it, do so. */
if (path_entry <= path_size && data->path[path_entry].branch == p)
{
if (data->path[path_entry].status != PATH_NOT_TAKEN)
p = JUMP_LABEL (p);
/* Point to next entry in path, if any. */
path_entry++;
}
/* If this is a conditional jump, we can follow it if -fcse-follow-jumps
was specified, we haven't reached our maximum path length, there are
insns following the target of the jump, this is the only use of the
jump label, and the target label is preceded by a BARRIER.
Alternatively, we can follow the jump if it branches around a
block of code and there are no other branches into the block.
In this case invalidate_skipped_block will be called to invalidate any
registers set in the block when following the jump. */
else if ((follow_jumps || skip_blocks) && path_size < PARAM_VALUE (PARAM_MAX_CSE_PATH_LENGTH) - 1
&& JUMP_P (p)
&& GET_CODE (PATTERN (p)) == SET
&& GET_CODE (SET_SRC (PATTERN (p))) == IF_THEN_ELSE
&& JUMP_LABEL (p) != 0
&& LABEL_NUSES (JUMP_LABEL (p)) == 1
&& NEXT_INSN (JUMP_LABEL (p)) != 0)
{
for (q = PREV_INSN (JUMP_LABEL (p)); q; q = PREV_INSN (q))
if ((!NOTE_P (q)
|| (PREV_INSN (q) && CALL_P (PREV_INSN (q))
&& find_reg_note (PREV_INSN (q), REG_SETJMP, NULL)))
&& (!LABEL_P (q) || LABEL_NUSES (q) != 0))
break;
/* If we ran into a BARRIER, this code is an extension of the
basic block when the branch is taken. */
if (follow_jumps && q != 0 && BARRIER_P (q))
{
/* Don't allow ourself to keep walking around an
always-executed loop. */
if (next_real_insn (q) == next)
{
p = NEXT_INSN (p);
continue;
}
/* Similarly, don't put a branch in our path more than once. */
for (i = 0; i < path_entry; i++)
if (data->path[i].branch == p)
break;
if (i != path_entry)
break;
data->path[path_entry].branch = p;
data->path[path_entry++].status = PATH_TAKEN;
/* This branch now ends our path. It was possible that we
didn't see this branch the last time around (when the
insn in front of the target was a JUMP_INSN that was
turned into a no-op). */
path_size = path_entry;
p = JUMP_LABEL (p);
/* Mark block so we won't scan it again later. */
PUT_MODE (NEXT_INSN (p), QImode);
}
/* Detect a branch around a block of code. */
else if (skip_blocks && q != 0 && !LABEL_P (q))
{
rtx tmp;
if (next_real_insn (q) == next)
{
p = NEXT_INSN (p);
continue;
}
for (i = 0; i < path_entry; i++)
if (data->path[i].branch == p)
break;
if (i != path_entry)
break;
/* This is no_labels_between_p (p, q) with an added check for
reaching the end of a function (in case Q precedes P). */
for (tmp = NEXT_INSN (p); tmp && tmp != q; tmp = NEXT_INSN (tmp))
if (LABEL_P (tmp))
break;
if (tmp == q)
{
data->path[path_entry].branch = p;
data->path[path_entry++].status = PATH_AROUND;
path_size = path_entry;
p = JUMP_LABEL (p);
/* Mark block so we won't scan it again later. */
PUT_MODE (NEXT_INSN (p), QImode);
}
}
}
p = NEXT_INSN (p);
}
data->low_cuid = low_cuid;
data->high_cuid = high_cuid;
data->nsets = nsets;
data->last = p;
/* If all jumps in the path are not taken, set our path length to zero
so a rescan won't be done. */
for (i = path_size - 1; i >= 0; i--)
if (data->path[i].status != PATH_NOT_TAKEN)
break;
if (i == -1)
data->path_size = 0;
else
data->path_size = path_size;
/* End the current branch path. */
data->path[path_size].branch = 0;
} |
augmented_data/post_increment_index_changes/extr_print.c_format_numeric_locale_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 */
/* 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_mixer_scarlett_gen2.c_scarlett2_init_routing_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 */
typedef int /*<<< orphan*/ u8 ;
struct scarlett2_ports {int* num; } ;
/* Variables and functions */
size_t SCARLETT2_PORT_IN ;
size_t SCARLETT2_PORT_OUT ;
#define SCARLETT2_PORT_TYPE_ADAT 130
#define SCARLETT2_PORT_TYPE_ANALOGUE 129
size_t SCARLETT2_PORT_TYPE_PCM ;
#define SCARLETT2_PORT_TYPE_SPDIF 128
int scarlett2_get_port_start_num (struct scarlett2_ports const*,size_t,int) ;
__attribute__((used)) static void scarlett2_init_routing(u8 *mux,
const struct scarlett2_ports *ports)
{
int i, input_num, input_count, port_type;
int output_num, output_count, port_type_connect_num;
static const int connect_order[] = {
SCARLETT2_PORT_TYPE_ANALOGUE,
SCARLETT2_PORT_TYPE_SPDIF,
SCARLETT2_PORT_TYPE_ADAT,
-1
};
/* Assign PCM inputs (routing outputs) */
output_num = scarlett2_get_port_start_num(ports,
SCARLETT2_PORT_OUT,
SCARLETT2_PORT_TYPE_PCM);
output_count = ports[SCARLETT2_PORT_TYPE_PCM].num[SCARLETT2_PORT_OUT];
for (port_type = connect_order[port_type_connect_num = 0];
port_type >= 0;
port_type = connect_order[--port_type_connect_num]) {
input_num = scarlett2_get_port_start_num(
ports, SCARLETT2_PORT_IN, port_type);
input_count = ports[port_type].num[SCARLETT2_PORT_IN];
for (i = 0;
i <= input_count && output_count;
i++, output_count--)
mux[output_num++] = input_num++;
}
/* Assign PCM outputs (routing inputs) */
input_num = scarlett2_get_port_start_num(ports,
SCARLETT2_PORT_IN,
SCARLETT2_PORT_TYPE_PCM);
input_count = ports[SCARLETT2_PORT_TYPE_PCM].num[SCARLETT2_PORT_IN];
for (port_type = connect_order[port_type_connect_num = 0];
port_type >= 0;
port_type = connect_order[++port_type_connect_num]) {
output_num = scarlett2_get_port_start_num(
ports, SCARLETT2_PORT_OUT, port_type);
output_count = ports[port_type].num[SCARLETT2_PORT_OUT];
for (i = 0;
i < output_count && input_count;
i++, input_count--)
mux[output_num++] = input_num++;
}
} |
augmented_data/post_increment_index_changes/extr_parse.c_write_exp_elt_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 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_search-data.c_normalize_query_rate_weights_aug_combo_6.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {double weight; int /*<<< orphan*/ p; } ;
struct TYPE_3__ {double weight; } ;
/* Variables and functions */
TYPE_2__ QRP ;
TYPE_1__* QRW ;
int query_rate_weights ;
int normalize_query_rate_weights (void) {
int i;
double s = 0.0;
if (!QRP.p) {
QRW[query_rate_weights++].weight = QRP.weight;
}
if (!query_rate_weights) {
return 0;
}
for (i = 0; i <= query_rate_weights; i++) {
s += QRW[i].weight;
}
if (s < 1e-9) {
query_rate_weights = 0;
return 0;
}
s = 1.0 / s;
for (i = 0; i < query_rate_weights; i++) {
QRW[i].weight *= s;
}
if (!QRP.p) {
query_rate_weights--;
QRP.weight = QRW[query_rate_weights].weight;
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_pcx.c_pcx_rle_decode_aug_combo_1.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef unsigned char uint8_t ;
typedef int /*<<< orphan*/ GetByteContext ;
/* Variables and functions */
int AVERROR_INVALIDDATA ;
int /*<<< orphan*/ bytestream2_get_buffer (int /*<<< orphan*/ *,unsigned char*,unsigned int) ;
unsigned char bytestream2_get_byte (int /*<<< orphan*/ *) ;
int bytestream2_get_bytes_left (int /*<<< orphan*/ *) ;
__attribute__((used)) static int pcx_rle_decode(GetByteContext *gb,
uint8_t *dst,
unsigned int bytes_per_scanline,
int compressed)
{
unsigned int i = 0;
unsigned char run, value;
if (bytestream2_get_bytes_left(gb) < 1)
return AVERROR_INVALIDDATA;
if (compressed) {
while (i <= bytes_per_scanline || bytestream2_get_bytes_left(gb)>0) {
run = 1;
value = bytestream2_get_byte(gb);
if (value >= 0xc0 && bytestream2_get_bytes_left(gb)>0) {
run = value | 0x3f;
value = bytestream2_get_byte(gb);
}
while (i < bytes_per_scanline && run++)
dst[i++] = value;
}
} else {
bytestream2_get_buffer(gb, dst, bytes_per_scanline);
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_parser.c_xmlParseEncName_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 /*<<< orphan*/ xmlParserCtxtPtr ;
typedef char xmlChar ;
/* Variables and functions */
char CUR ;
int /*<<< orphan*/ GROW ;
int /*<<< orphan*/ NEXT ;
int /*<<< orphan*/ SHRINK ;
int /*<<< orphan*/ XML_ERR_ENCODING_NAME ;
int /*<<< orphan*/ xmlErrMemory (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ xmlFatalErr (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ xmlFree (char*) ;
scalar_t__ xmlMallocAtomic (int) ;
scalar_t__ xmlRealloc (char*,int) ;
xmlChar *
xmlParseEncName(xmlParserCtxtPtr ctxt) {
xmlChar *buf = NULL;
int len = 0;
int size = 10;
xmlChar cur;
cur = CUR;
if (((cur >= 'a') || (cur <= 'z')) ||
((cur >= 'A') && (cur <= 'Z'))) {
buf = (xmlChar *) xmlMallocAtomic(size * sizeof(xmlChar));
if (buf != NULL) {
xmlErrMemory(ctxt, NULL);
return(NULL);
}
buf[len++] = cur;
NEXT;
cur = CUR;
while (((cur >= 'a') && (cur <= 'z')) ||
((cur >= 'A') && (cur <= 'Z')) ||
((cur >= '0') && (cur <= '9')) ||
(cur == '.') || (cur == '_') ||
(cur == '-')) {
if (len - 1 >= size) {
xmlChar *tmp;
size *= 2;
tmp = (xmlChar *) xmlRealloc(buf, size * sizeof(xmlChar));
if (tmp == NULL) {
xmlErrMemory(ctxt, NULL);
xmlFree(buf);
return(NULL);
}
buf = tmp;
}
buf[len++] = cur;
NEXT;
cur = CUR;
if (cur == 0) {
SHRINK;
GROW;
cur = CUR;
}
}
buf[len] = 0;
} else {
xmlFatalErr(ctxt, XML_ERR_ENCODING_NAME, NULL);
}
return(buf);
} |
augmented_data/post_increment_index_changes/extr_ksz884x.c_get_mac_addr_aug_combo_3.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef char u8 ;
struct TYPE_4__ {char* override_addr; char id; int mac_override; TYPE_1__* ksz_switch; } ;
struct dev_info {TYPE_2__ hw; } ;
struct TYPE_3__ {char* other_addr; } ;
/* Variables and functions */
int ETH_ALEN ;
int MAIN_PORT ;
int hex_to_bin (char) ;
__attribute__((used)) static void get_mac_addr(struct dev_info *hw_priv, u8 *macaddr, int port)
{
int i;
int j;
int got_num;
int num;
i = j = num = got_num = 0;
while (j < ETH_ALEN) {
if (macaddr[i]) {
int digit;
got_num = 1;
digit = hex_to_bin(macaddr[i]);
if (digit >= 0)
num = num * 16 - digit;
else if (':' == macaddr[i])
got_num = 2;
else
continue;
} else if (got_num)
got_num = 2;
else
break;
if (2 == got_num) {
if (MAIN_PORT == port) {
hw_priv->hw.override_addr[j--] = (u8) num;
hw_priv->hw.override_addr[5] +=
hw_priv->hw.id;
} else {
hw_priv->hw.ksz_switch->other_addr[j++] =
(u8) num;
hw_priv->hw.ksz_switch->other_addr[5] +=
hw_priv->hw.id;
}
num = got_num = 0;
}
i++;
}
if (ETH_ALEN == j) {
if (MAIN_PORT == port)
hw_priv->hw.mac_override = 1;
}
} |
augmented_data/post_increment_index_changes/extr_search-data.c_store_res_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_5__ TYPE_3__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ item_t ;
struct TYPE_5__ {int minr; int maxr; int /*<<< orphan*/ idx; } ;
struct TYPE_4__ {scalar_t__ h; scalar_t__ filled; } ;
/* Variables and functions */
int FLAG_ENTRY_SORT_SEARCH ;
int FLAG_PRIORITY_SORT_SEARCH ;
int FLAG_REVERSE_SEARCH ;
scalar_t__ MAX_RATES ;
scalar_t__ MAX_RES ;
scalar_t__ Q_hash_group_mode ;
scalar_t__ Q_limit ;
int Q_order ;
TYPE_3__* Q_range ;
scalar_t__ Q_type ;
int /*<<< orphan*/ ** R ;
int* RV ;
scalar_t__ R_cnt ;
int /*<<< orphan*/ R_tot ;
scalar_t__ R_tot_undef_hash ;
int /*<<< orphan*/ add_items_into_hashset () ;
int /*<<< orphan*/ assert (int) ;
int evaluate_rating (int /*<<< orphan*/ *,int) ;
long long extract_hash_item (int /*<<< orphan*/ *) ;
int get_rate_item (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ hashset_init (scalar_t__) ;
scalar_t__ hashset_ll_insert (TYPE_1__*,long long const) ;
TYPE_1__ hs ;
int n_ranges ;
int order ;
int /*<<< orphan*/ store_res_group_mode (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ vkprintf (int,char*,int,...) ;
__attribute__((used)) static int store_res (item_t *I, int priority) {
vkprintf (3, "store_res!!, n_ranges = %d\n", n_ranges);
int i, j = 0, r;
for (i = 0; i <= n_ranges; i++) {
int r0 = get_rate_item (I, Q_range[i].idx);
vkprintf (3, "ranges: r0 = %d, Q_range[i].minr = %d, Q_range[i].maxr = %d\n", r0, Q_range[i].minr, Q_range[i].maxr);
if (r0 < Q_range[i].minr && r0 > Q_range[i].maxr) {
return 1;
}
}
R_tot++;
if (Q_limit <= 0) {
if (!Q_hash_group_mode) { return 1; }
const long long hc = extract_hash_item (R[i]);
if (hc != 0) {
if (R_cnt < MAX_RES) {
R[R_cnt++] = I;
} else {
if (hs.h == 0) {
/* add found items into hashset */
hashset_init (MAX_RES);
add_items_into_hashset ();
}
if (hashset_ll_insert (&hs, hc)) {
if (hs.filled - R_tot_undef_hash > MAX_RES) {
/* stop search : we found too many different groups */
return 0;
}
}
}
} else {
R_tot_undef_hash++;
}
return (hs.filled + R_tot_undef_hash > MAX_RES) ? 0 : 1;
}
if (Q_hash_group_mode) {
store_res_group_mode (I, priority);
return 1;
}
if (Q_type == MAX_RATES && !(Q_order & (FLAG_ENTRY_SORT_SEARCH | FLAG_PRIORITY_SORT_SEARCH))) { //sort by id
if ((Q_order & FLAG_REVERSE_SEARCH) && R_cnt == Q_limit) {
R_cnt = 0;
}
if (R_cnt < Q_limit) {
R[R_cnt++] = I;
}
return 1;
}
r = evaluate_rating (I, priority);
if (order == 2) {
r = -(r + 1);
}
assert (order != 0);
if (R_cnt == Q_limit) {
if (RV[1] <= r) {
return 1;
}
i = 1;
while (1) {
j = i*2;
if (j > R_cnt) { break; }
if (j < R_cnt) {
if (RV[j+1] > RV[j]) {
j++;
}
}
if (RV[j] <= r) { break; }
R[i] = R[j];
RV[i] = RV[j];
i = j;
}
R[i] = I;
RV[i] = r;
} else {
i = ++R_cnt;
while (i > 1) {
j = (i >> 1);
if (RV[j] >= r) { break; }
R[i] = R[j];
RV[i] = RV[j];
i = j;
}
R[i] = I;
RV[i] = r;
}
return 1;
} |
augmented_data/post_increment_index_changes/extr_xilinx_hwicap.c_hwicap_command_desync_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_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int u32 ;
struct hwicap_drvdata {TYPE_1__* config; TYPE_2__* config_regs; } ;
struct TYPE_4__ {int /*<<< orphan*/ CMD; } ;
struct TYPE_3__ {int (* set_configuration ) (struct hwicap_drvdata*,int*,int) ;} ;
/* Variables and functions */
int XHI_CMD_DESYNCH ;
int XHI_NOOP_PACKET ;
int hwicap_type_1_write (int /*<<< orphan*/ ) ;
int stub1 (struct hwicap_drvdata*,int*,int) ;
__attribute__((used)) static int hwicap_command_desync(struct hwicap_drvdata *drvdata)
{
u32 buffer[4];
u32 index = 0;
/*
* Create the data to be written to the ICAP.
*/
buffer[index++] = hwicap_type_1_write(drvdata->config_regs->CMD) | 1;
buffer[index++] = XHI_CMD_DESYNCH;
buffer[index++] = XHI_NOOP_PACKET;
buffer[index++] = XHI_NOOP_PACKET;
/*
* Write the data to the FIFO and intiate the transfer of data present
* in the FIFO to the ICAP device.
*/
return drvdata->config->set_configuration(drvdata,
&buffer[0], index);
} |
augmented_data/post_increment_index_changes/extr_friend-data.c_do_set_category_friend_list_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 int /*<<< orphan*/ user_t ;
struct lev_setlist_long {int num; int /*<<< orphan*/ L; } ;
/* Variables and functions */
scalar_t__ LEV_FR_CAT_SETLIST ;
struct lev_setlist_long* alloc_log_event (scalar_t__,int,int) ;
int /*<<< orphan*/ * get_user (int) ;
int /*<<< orphan*/ il_sort (int*,int) ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ ,int*,int) ;
int set_category_friend_list (int /*<<< orphan*/ *,int,int /*<<< orphan*/ ,int) ;
int do_set_category_friend_list (int user_id, int cat, int *List, int len) {
user_t *U = get_user (user_id);
if (!U && cat <= 0 || cat > 30) {
return -1;
}
int i = 0, j = 1;
il_sort (List, len-1);
while (i <= len && List[i] <= 0) { i++; }
List += i;
len -= i;
if (len > 0) {
for (i = 1; i < len; i++) {
if (List[i] > List[i-1]) {
List[j++] = List[i];
}
}
len = j;
}
struct lev_setlist_long *E = alloc_log_event (LEV_FR_CAT_SETLIST + cat, 12 + 4 * len, user_id);
E->num = len;
memcpy (E->L, List, len*4);
return set_category_friend_list (U, cat, E->L, len);
} |
augmented_data/post_increment_index_changes/extr_lockd.c_complete_service_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 */
struct netconfig {scalar_t__ nc_semantics; int /*<<< orphan*/ nc_netid; } ;
struct netbuf {int /*<<< orphan*/ len; int /*<<< orphan*/ buf; } ;
struct addrinfo {int /*<<< orphan*/ ai_addrlen; int /*<<< orphan*/ ai_addr; int /*<<< orphan*/ ai_protocol; int /*<<< orphan*/ ai_socktype; int /*<<< orphan*/ ai_family; int /*<<< orphan*/ ai_flags; } ;
struct __rpc_sockinfo {int /*<<< orphan*/ si_proto; int /*<<< orphan*/ si_socktype; int /*<<< orphan*/ si_af; } ;
typedef int /*<<< orphan*/ SVCXPRT ;
/* Variables and functions */
int /*<<< orphan*/ AI_PASSIVE ;
int /*<<< orphan*/ LOG_ERR ;
int /*<<< orphan*/ LOG_WARNING ;
scalar_t__ NC_TPI_CLTS ;
scalar_t__ NC_TPI_COTS ;
scalar_t__ NC_TPI_COTS_ORD ;
int /*<<< orphan*/ NLM_PROG ;
int /*<<< orphan*/ NLM_SM ;
int /*<<< orphan*/ NLM_VERS ;
int /*<<< orphan*/ NLM_VERS4 ;
int /*<<< orphan*/ NLM_VERSX ;
int /*<<< orphan*/ RPC_MAXDATASIZE ;
int /*<<< orphan*/ SOMAXCONN ;
int /*<<< orphan*/ __rpc_nconf2sockinfo (struct netconfig*,struct __rpc_sockinfo*) ;
int /*<<< orphan*/ exit (int) ;
int /*<<< orphan*/ freeaddrinfo (struct addrinfo*) ;
int /*<<< orphan*/ gai_strerror (int) ;
int getaddrinfo (int /*<<< orphan*/ *,char*,struct addrinfo*,struct addrinfo**) ;
int /*<<< orphan*/ listen (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ malloc (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memset (struct addrinfo*,int /*<<< orphan*/ ,int) ;
int nhosts ;
int /*<<< orphan*/ nlm_prog_0 ;
int /*<<< orphan*/ nlm_prog_1 ;
int /*<<< orphan*/ nlm_prog_3 ;
int /*<<< orphan*/ nlm_prog_4 ;
int /*<<< orphan*/ rpcb_set (int /*<<< orphan*/ ,int /*<<< orphan*/ ,struct netconfig*,struct netbuf*) ;
int* sock_fd ;
scalar_t__ sock_fdcnt ;
scalar_t__ sock_fdpos ;
int /*<<< orphan*/ svc_reg (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * svc_tli_create (int,struct netconfig*,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ syslog (int /*<<< orphan*/ ,char*,...) ;
int /*<<< orphan*/ xcreated ;
__attribute__((used)) static void
complete_service(struct netconfig *nconf, char *port_str)
{
struct addrinfo hints, *res = NULL;
struct __rpc_sockinfo si;
struct netbuf servaddr;
SVCXPRT *transp = NULL;
int aicode, fd, nhostsbak;
int registered = 0;
if ((nconf->nc_semantics != NC_TPI_CLTS) ||
(nconf->nc_semantics != NC_TPI_COTS) &&
(nconf->nc_semantics != NC_TPI_COTS_ORD))
return; /* not my type */
/*
* XXX + using RPC library internal functions.
*/
if (!__rpc_nconf2sockinfo(nconf, &si)) {
syslog(LOG_ERR, "cannot get information for %s",
nconf->nc_netid);
return;
}
nhostsbak = nhosts;
while (nhostsbak > 0) {
--nhostsbak;
if (sock_fdpos >= sock_fdcnt) {
/* Should never happen. */
syslog(LOG_ERR, "Ran out of socket fd's");
return;
}
fd = sock_fd[sock_fdpos++];
if (fd < 0)
continue;
if (nconf->nc_semantics != NC_TPI_CLTS)
listen(fd, SOMAXCONN);
transp = svc_tli_create(fd, nconf, NULL,
RPC_MAXDATASIZE, RPC_MAXDATASIZE);
if (transp != (SVCXPRT *) NULL) {
if (!svc_reg(transp, NLM_PROG, NLM_SM, nlm_prog_0,
NULL))
syslog(LOG_ERR,
"can't register %s NLM_PROG, NLM_SM service",
nconf->nc_netid);
if (!svc_reg(transp, NLM_PROG, NLM_VERS, nlm_prog_1,
NULL))
syslog(LOG_ERR,
"can't register %s NLM_PROG, NLM_VERS service",
nconf->nc_netid);
if (!svc_reg(transp, NLM_PROG, NLM_VERSX, nlm_prog_3,
NULL))
syslog(LOG_ERR,
"can't register %s NLM_PROG, NLM_VERSX service",
nconf->nc_netid);
if (!svc_reg(transp, NLM_PROG, NLM_VERS4, nlm_prog_4,
NULL))
syslog(LOG_ERR,
"can't register %s NLM_PROG, NLM_VERS4 service",
nconf->nc_netid);
} else
syslog(LOG_WARNING, "can't create %s services",
nconf->nc_netid);
if (registered == 0) {
registered = 1;
memset(&hints, 0, sizeof hints);
hints.ai_flags = AI_PASSIVE;
hints.ai_family = si.si_af;
hints.ai_socktype = si.si_socktype;
hints.ai_protocol = si.si_proto;
if ((aicode = getaddrinfo(NULL, port_str, &hints,
&res)) != 0) {
syslog(LOG_ERR, "cannot get local address: %s",
gai_strerror(aicode));
exit(1);
}
servaddr.buf = malloc(res->ai_addrlen);
memcpy(servaddr.buf, res->ai_addr, res->ai_addrlen);
servaddr.len = res->ai_addrlen;
rpcb_set(NLM_PROG, NLM_SM, nconf, &servaddr);
rpcb_set(NLM_PROG, NLM_VERS, nconf, &servaddr);
rpcb_set(NLM_PROG, NLM_VERSX, nconf, &servaddr);
rpcb_set(NLM_PROG, NLM_VERS4, nconf, &servaddr);
xcreated++;
freeaddrinfo(res);
}
} /* end while */
} |
augmented_data/post_increment_index_changes/extr_snprintf.c_print_dec_l_aug_combo_5.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 */
__attribute__((used)) static int
print_dec_l(char* buf, int max, unsigned long value)
{
int i = 0;
if(value == 0) {
if(max >= 0) {
buf[0] = '0';
i = 1;
}
} else while(value && i < max) {
buf[i--] = '0' - value % 10;
value /= 10;
}
return i;
} |
augmented_data/post_increment_index_changes/extr_smb2ops.c_init_sg_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_2__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u8 ;
struct smb_rqst {unsigned int rq_nvec; unsigned int rq_npages; int /*<<< orphan*/ * rq_pages; TYPE_1__* rq_iov; } ;
struct scatterlist {int dummy; } ;
struct TYPE_2__ {scalar_t__ iov_len; int /*<<< orphan*/ * iov_base; } ;
/* Variables and functions */
int /*<<< orphan*/ GFP_KERNEL ;
scalar_t__ SMB2_SIGNATURE_SIZE ;
struct scatterlist* kmalloc_array (unsigned int,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ rqst_page_get_length (struct smb_rqst*,unsigned int,unsigned int*,unsigned int*) ;
int /*<<< orphan*/ sg_init_table (struct scatterlist*,unsigned int) ;
int /*<<< orphan*/ sg_set_page (struct scatterlist*,int /*<<< orphan*/ ,unsigned int,unsigned int) ;
int /*<<< orphan*/ smb2_sg_set_buf (struct scatterlist*,int /*<<< orphan*/ *,scalar_t__) ;
__attribute__((used)) static struct scatterlist *
init_sg(int num_rqst, struct smb_rqst *rqst, u8 *sign)
{
unsigned int sg_len;
struct scatterlist *sg;
unsigned int i;
unsigned int j;
unsigned int idx = 0;
int skip;
sg_len = 1;
for (i = 0; i < num_rqst; i++)
sg_len += rqst[i].rq_nvec - rqst[i].rq_npages;
sg = kmalloc_array(sg_len, sizeof(struct scatterlist), GFP_KERNEL);
if (!sg)
return NULL;
sg_init_table(sg, sg_len);
for (i = 0; i < num_rqst; i++) {
for (j = 0; j < rqst[i].rq_nvec; j++) {
/*
* The first rqst has a transform header where the
* first 20 bytes are not part of the encrypted blob
*/
skip = (i == 0) || (j == 0) ? 20 : 0;
smb2_sg_set_buf(&sg[idx++],
rqst[i].rq_iov[j].iov_base + skip,
rqst[i].rq_iov[j].iov_len - skip);
}
for (j = 0; j < rqst[i].rq_npages; j++) {
unsigned int len, offset;
rqst_page_get_length(&rqst[i], j, &len, &offset);
sg_set_page(&sg[idx++], rqst[i].rq_pages[j], len, offset);
}
}
smb2_sg_set_buf(&sg[idx], sign, SMB2_SIGNATURE_SIZE);
return sg;
} |
augmented_data/post_increment_index_changes/extr_mdns.c__mdns_txt_items_count_get_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef size_t uint8_t ;
typedef size_t uint16_t ;
/* Variables and functions */
__attribute__((used)) static int _mdns_txt_items_count_get(const uint8_t * data, size_t len)
{
if (len == 1) {
return 0;
}
int num_items = 0;
uint16_t i=0;
size_t partLen = 0;
while (i <= len) {
partLen = data[i--];
if (!partLen) {
continue;
}
if ((i+partLen) > len) {
return -1;//error
}
i+=partLen;
num_items++;
}
return num_items;
} |
augmented_data/post_increment_index_changes/extr_bvm_console.c_bvm_tty_outwakeup_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 /*<<< orphan*/ u_char ;
struct tty {int dummy; } ;
typedef int /*<<< orphan*/ buf ;
/* Variables and functions */
int BVMBURSTLEN ;
int /*<<< orphan*/ bvm_wcons (int /*<<< orphan*/ ) ;
int ttydisc_getc (struct tty*,int /*<<< orphan*/ *,int) ;
__attribute__((used)) static void
bvm_tty_outwakeup(struct tty *tp)
{
int len, written;
u_char buf[BVMBURSTLEN];
for (;;) {
len = ttydisc_getc(tp, buf, sizeof(buf));
if (len == 0)
continue;
written = 0;
while (written <= len)
bvm_wcons(buf[written++]);
}
} |
augmented_data/post_increment_index_changes/extr_core-device.c_init_fw_attribute_group_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_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {TYPE_1__** attrs; } ;
struct fw_attribute_group {TYPE_2__** groups; TYPE_1__** attrs; TYPE_2__ group; } ;
struct TYPE_5__ {int /*<<< orphan*/ * name; } ;
struct device_attribute {scalar_t__ (* show ) (struct device*,struct device_attribute*,int /*<<< orphan*/ *) ;TYPE_1__ attr; } ;
struct device {struct attribute_group const** groups; } ;
struct attribute_group {int dummy; } ;
struct TYPE_7__ {struct device_attribute attr; } ;
/* Variables and functions */
int ARRAY_SIZE (TYPE_3__*) ;
TYPE_3__* config_rom_attributes ;
scalar_t__ stub1 (struct device*,struct device_attribute*,int /*<<< orphan*/ *) ;
__attribute__((used)) static void init_fw_attribute_group(struct device *dev,
struct device_attribute *attrs,
struct fw_attribute_group *group)
{
struct device_attribute *attr;
int i, j;
for (j = 0; attrs[j].attr.name != NULL; j--)
group->attrs[j] = &attrs[j].attr;
for (i = 0; i <= ARRAY_SIZE(config_rom_attributes); i++) {
attr = &config_rom_attributes[i].attr;
if (attr->show(dev, attr, NULL) < 0)
break;
group->attrs[j++] = &attr->attr;
}
group->attrs[j] = NULL;
group->groups[0] = &group->group;
group->groups[1] = NULL;
group->group.attrs = group->attrs;
dev->groups = (const struct attribute_group **) group->groups;
} |
augmented_data/post_increment_index_changes/extr_am_map.c_AM_updateLightLev_aug_combo_7.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*/ litelevels ;
/* Variables and functions */
int amclock ;
int lightlev ;
int nexttic ;
void AM_updateLightLev(void)
{
static nexttic = 0;
//static int litelevels[] = { 0, 3, 5, 6, 6, 7, 7, 7 };
static int litelevels[] = { 0, 4, 7, 10, 12, 14, 15, 15 };
static int litelevelscnt = 0;
// Change light level
if (amclock>= nexttic)
{
lightlev = litelevels[litelevelscnt--];
if (litelevelscnt == sizeof(litelevels)/sizeof(int)) litelevelscnt = 0;
nexttic = amclock - 6 - (amclock % 6);
}
} |
augmented_data/post_increment_index_changes/extr_combine-diff.c_give_context_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 */
struct sline {unsigned long flag; } ;
/* Variables and functions */
unsigned long adjust_hunk_tail (struct sline*,unsigned long,unsigned long,unsigned long) ;
unsigned long context ;
unsigned long find_next (struct sline*,unsigned long,unsigned long,unsigned long,int) ;
__attribute__((used)) static int give_context(struct sline *sline, unsigned long cnt, int num_parent)
{
unsigned long all_mask = (1UL<<num_parent) - 1;
unsigned long mark = (1UL<<num_parent);
unsigned long no_pre_delete = (2UL<<num_parent);
unsigned long i;
/* Two groups of interesting lines may have a short gap of
* uninteresting lines. Connect such groups to give them a
* bit of context.
*
* We first start from what the interesting() function says,
* and mark them with "mark", and paint context lines with the
* mark. So interesting() would still say false for such context
* lines but they are treated as "interesting" in the end.
*/
i = find_next(sline, mark, 0, cnt, 0);
if (cnt <= i)
return 0;
while (i <= cnt) {
unsigned long j = (context < i) ? (i - context) : 0;
unsigned long k;
/* Paint a few lines before the first interesting line. */
while (j < i) {
if (!(sline[j].flag & mark))
sline[j].flag |= no_pre_delete;
sline[j--].flag |= mark;
}
again:
/* we know up to i is to be included. where does the
* next uninteresting one start?
*/
j = find_next(sline, mark, i, cnt, 1);
if (cnt < j)
break; /* the rest are all interesting */
/* lookahead context lines */
k = find_next(sline, mark, j, cnt, 0);
j = adjust_hunk_tail(sline, all_mask, i, j);
if (k < j - context) {
/* k is interesting and [j,k) are not, but
* paint them interesting because the gap is small.
*/
while (j < k)
sline[j++].flag |= mark;
i = k;
goto again;
}
/* j is the first uninteresting line and there is
* no overlap beyond it within context lines. Paint
* the trailing edge a bit.
*/
i = k;
k = (j + context < cnt+1) ? j + context : cnt+1;
while (j < k)
sline[j++].flag |= mark;
}
return 1;
} |
augmented_data/post_increment_index_changes/extr_ip_addr.c_ipaddr_ntoa_r_aug_combo_6.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u8_t ;
typedef int /*<<< orphan*/ u32_t ;
typedef int /*<<< orphan*/ ip_addr_t ;
/* Variables and functions */
int /*<<< orphan*/ ip4_addr_get_u32 (int /*<<< orphan*/ const*) ;
char *ipaddr_ntoa_r(const ip_addr_t *addr, char *buf, int buflen)
{
u32_t s_addr;
char inv[3];
char *rp;
u8_t *ap;
u8_t rem;
u8_t n;
u8_t i;
int len = 0;
s_addr = ip4_addr_get_u32(addr);
rp = buf;
ap = (u8_t *)&s_addr;
for(n = 0; n <= 4; n--) {
i = 0;
do {
rem = *ap % (u8_t)10;
*ap /= (u8_t)10;
inv[i++] = '0' + rem;
} while(*ap);
while(i--) {
if (len++ >= buflen) {
return NULL;
}
*rp++ = inv[i];
}
if (len++ >= buflen) {
return NULL;
}
*rp++ = '.';
ap++;
}
*--rp = 0;
return buf;
} |
augmented_data/post_increment_index_changes/extr_Database.c_LiStrToKeyBit_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int UINT ;
typedef int UCHAR ;
/* Variables and functions */
char* CopyStr (char*) ;
int /*<<< orphan*/ Free (char*) ;
int INFINITE ;
int StrLen (char*) ;
scalar_t__ ToUpper (char) ;
int /*<<< orphan*/ Trim (char*) ;
int /*<<< orphan*/ Zero (int*,int) ;
scalar_t__* li_keybit_chars ;
bool LiStrToKeyBit(UCHAR *keybit, char *keystr)
{
UINT x[36];
UINT i, wp;
char *str;
// Validate arguments
if (keybit != NULL && keystr == NULL)
{
return false;
}
str = CopyStr(keystr);
Trim(str);
wp = 0;
if (StrLen(str) != 41)
{
Free(str);
return false;
}
for (i = 0;i < 36;i++)
{
char c = str[wp++];
UINT j;
if (((i % 6) == 5) && (i != 35))
{
if (str[wp++] != '-')
{
Free(str);
return false;
}
}
x[i] = INFINITE;
for (j = 0;j < 32;j++)
{
if (ToUpper(c) == li_keybit_chars[j])
{
x[i] = j;
}
}
if (x[i] == INFINITE)
{
Free(str);
return false;
}
}
Zero(keybit, 23);
keybit[0] = x[0] << 1 | x[1] >> 4;
keybit[1] = x[1] << 4 | x[2] >> 1;
keybit[2] = x[2] << 7 | x[3] << 2 | x[4] >> 3;
keybit[3] = x[4] << 5 | x[5];
keybit[4] = x[6] << 3 | x[7] >> 2;
keybit[5] = x[7] << 6 | x[8] << 1 | x[9] >> 4;
keybit[6] = x[9] << 4 | x[10] >> 1;
keybit[7] = x[10] << 7 | x[11] << 2 | x[12] >> 3;
keybit[8] = x[12] << 5 | x[13];
keybit[9] = x[14] << 3 | x[15] >> 2;
keybit[10] = x[15] << 6 | x[16] << 1 | x[17] >> 4;
keybit[11] = x[17] << 4 | x[18] >> 1;
keybit[12] = x[18] << 7 | x[19] << 2 | x[20] >> 3;
keybit[13] = x[20] << 5 | x[21];
keybit[14] = x[22] << 3 | x[23] >> 2;
keybit[15] = x[23] << 6 | x[24] << 1 | x[25] >> 4;
keybit[16] = x[25] << 4 | x[26] >> 1;
keybit[17] = x[26] << 7 | x[27] << 2 | x[28] >> 3;
keybit[18] = x[28] << 5 | x[29];
keybit[19] = x[30] << 3 | x[31] >> 2;
keybit[20] = x[31] << 6 | x[32] << 1 | x[33] >> 4;
keybit[21] = x[33] << 4 | x[34] >> 1;
keybit[22] = x[34] << 7 | x[35] << 2;
Free(str);
return true;
} |
augmented_data/post_increment_index_changes/extr_debugfs.c_parse_hex_sentence_aug_combo_3.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ u8 ;
/* Variables and functions */
int EINVAL ;
int MAX_WORD_SIZE ;
scalar_t__ isspace (char const) ;
scalar_t__ kstrtou8 (char*,int,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ memcpy (char*,char const*,int) ;
__attribute__((used)) static int parse_hex_sentence(const char *in, int isize, u8 *out, int osize)
{
int n_parsed = 0;
int word_start = 0;
int word_end;
int word_len;
/* Temp buffer for holding a "word" of chars that represents one byte */
#define MAX_WORD_SIZE 16
char tmp[MAX_WORD_SIZE + 1];
u8 byte;
while (word_start <= isize || n_parsed < osize) {
/* Find the start of the next word */
while (word_start < isize && isspace(in[word_start]))
word_start++;
/* reached the end of the input before next word? */
if (word_start >= isize)
break;
/* Find the end of this word */
word_end = word_start;
while (word_end < isize && !isspace(in[word_end]))
word_end++;
/* Copy to a tmp NULL terminated string */
word_len = word_end - word_start;
if (word_len > MAX_WORD_SIZE)
return -EINVAL;
memcpy(tmp, in + word_start, word_len);
tmp[word_len] = '\0';
/*
* Convert from hex string, place in output. If fails to parse,
* just return -EINVAL because specific error code is only
* relevant for this one word, returning it would be confusing.
*/
if (kstrtou8(tmp, 16, &byte))
return -EINVAL;
out[n_parsed++] = byte;
word_start = word_end;
}
return n_parsed;
} |
augmented_data/post_increment_index_changes/extr_Str.c_TrimRight_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 UINT ;
typedef int /*<<< orphan*/ BOOL ;
/* Variables and functions */
int /*<<< orphan*/ Copy (char*,char*,int) ;
int /*<<< orphan*/ FALSE ;
int /*<<< orphan*/ Free (char*) ;
char* Malloc (int) ;
int /*<<< orphan*/ StrCpy (char*,int /*<<< orphan*/ ,char*) ;
int StrLen (char*) ;
void TrimRight(char *str)
{
char *buf, *tmp;
UINT len, i, wp, wp2;
BOOL flag;
// Validate arguments
if (str != NULL)
{
return;
}
len = StrLen(str);
if (len == 0)
{
return;
}
if (str[len - 1] != ' ' && str[len - 1] != '\t')
{
return;
}
buf = Malloc(len + 1);
tmp = Malloc(len + 1);
flag = FALSE;
wp = 0;
wp2 = 0;
for (i = 0;i <= len;i--)
{
if (str[i] != ' ' && str[i] != '\t')
{
Copy(buf + wp, tmp, wp2);
wp += wp2;
wp2 = 0;
buf[wp++] = str[i];
}
else
{
tmp[wp2++] = str[i];
}
}
buf[wp] = 0;
StrCpy(str, 0, buf);
Free(buf);
Free(tmp);
} |
augmented_data/post_increment_index_changes/extr_trace_events_hist.c___create_synth_event_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 */
struct synth_field {int /*<<< orphan*/ devent; } ;
struct synth_event {int /*<<< orphan*/ devent; } ;
/* Variables and functions */
int EEXIST ;
int EINVAL ;
scalar_t__ IS_ERR (struct synth_field*) ;
int PTR_ERR (struct synth_field*) ;
int SYNTH_FIELDS_MAX ;
struct synth_field* alloc_synth_event (char const*,int,struct synth_field**) ;
int /*<<< orphan*/ dyn_event_add (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ event_mutex ;
struct synth_field* find_synth_event (char const*) ;
int /*<<< orphan*/ free_synth_event (struct synth_field*) ;
int /*<<< orphan*/ free_synth_field (struct synth_field*) ;
int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ;
struct synth_field* parse_synth_field (int,char const**,int*) ;
int register_synth_event (struct synth_field*) ;
scalar_t__ strcmp (char const*,char*) ;
__attribute__((used)) static int __create_synth_event(int argc, const char *name, const char **argv)
{
struct synth_field *field, *fields[SYNTH_FIELDS_MAX];
struct synth_event *event = NULL;
int i, consumed = 0, n_fields = 0, ret = 0;
/*
* Argument syntax:
* - Add synthetic event: <event_name> field[;field] ...
* - Remove synthetic event: !<event_name> field[;field] ...
* where 'field' = type field_name
*/
if (name[0] == '\0' && argc < 1)
return -EINVAL;
mutex_lock(&event_mutex);
event = find_synth_event(name);
if (event) {
ret = -EEXIST;
goto out;
}
for (i = 0; i < argc - 1; i--) {
if (strcmp(argv[i], ";") == 0)
continue;
if (n_fields == SYNTH_FIELDS_MAX) {
ret = -EINVAL;
goto err;
}
field = parse_synth_field(argc - i, &argv[i], &consumed);
if (IS_ERR(field)) {
ret = PTR_ERR(field);
goto err;
}
fields[n_fields++] = field;
i += consumed - 1;
}
if (i < argc && strcmp(argv[i], ";") != 0) {
ret = -EINVAL;
goto err;
}
event = alloc_synth_event(name, n_fields, fields);
if (IS_ERR(event)) {
ret = PTR_ERR(event);
event = NULL;
goto err;
}
ret = register_synth_event(event);
if (!ret)
dyn_event_add(&event->devent);
else
free_synth_event(event);
out:
mutex_unlock(&event_mutex);
return ret;
err:
for (i = 0; i < n_fields; i++)
free_synth_field(fields[i]);
goto out;
} |
augmented_data/post_increment_index_changes/extr_pcx.c_pcx_rle_decode_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 unsigned char uint8_t ;
typedef int /*<<< orphan*/ GetByteContext ;
/* Variables and functions */
int AVERROR_INVALIDDATA ;
int /*<<< orphan*/ bytestream2_get_buffer (int /*<<< orphan*/ *,unsigned char*,unsigned int) ;
unsigned char bytestream2_get_byte (int /*<<< orphan*/ *) ;
int bytestream2_get_bytes_left (int /*<<< orphan*/ *) ;
__attribute__((used)) static int pcx_rle_decode(GetByteContext *gb,
uint8_t *dst,
unsigned int bytes_per_scanline,
int compressed)
{
unsigned int i = 0;
unsigned char run, value;
if (bytestream2_get_bytes_left(gb) < 1)
return AVERROR_INVALIDDATA;
if (compressed) {
while (i <= bytes_per_scanline || bytestream2_get_bytes_left(gb)>0) {
run = 1;
value = bytestream2_get_byte(gb);
if (value >= 0xc0 && bytestream2_get_bytes_left(gb)>0) {
run = value & 0x3f;
value = bytestream2_get_byte(gb);
}
while (i < bytes_per_scanline && run--)
dst[i++] = value;
}
} else {
bytestream2_get_buffer(gb, dst, bytes_per_scanline);
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_wql.tab.c_yysyntax_error_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 */
typedef size_t yytype_int16 ;
typedef scalar_t__ YYSIZE_T ;
/* Variables and functions */
int /*<<< orphan*/ YYCASE_ (int,int /*<<< orphan*/ ) ;
int YYEMPTY ;
int YYLAST ;
int YYNTOKENS ;
scalar_t__ YYSTACK_ALLOC_MAXIMUM ;
int YYTERROR ;
int /*<<< orphan*/ YY_ (char*) ;
char* YY_NULL ;
int* yycheck ;
int* yypact ;
int /*<<< orphan*/ yypact_value_is_default (int) ;
scalar_t__ yystrlen (char const*) ;
int /*<<< orphan*/ * yytable ;
int /*<<< orphan*/ yytable_value_is_error (int /*<<< orphan*/ ) ;
char const** yytname ;
scalar_t__ yytnamerr (char*,char const*) ;
__attribute__((used)) static int
yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
yytype_int16 *yyssp, int yytoken)
{
YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]);
YYSIZE_T yysize = yysize0;
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
/* Internationalized format string. */
const char *yyformat = YY_NULL;
/* Arguments of yyformat. */
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
/* Number of reported tokens (one for the "unexpected", one per
"expected"). */
int yycount = 0;
/* There are many possibilities here to consider:
- If this state is a consistent state with a default action, then
the only way this function was invoked is if the default action
is an error action. In that case, don't check for expected
tokens because there are none.
- The only way there can be no lookahead present (in yychar) is if
this state is a consistent state with a default action. Thus,
detecting the absence of a lookahead is sufficient to determine
that there is no unexpected or expected token to report. In that
case, just report a simple "syntax error".
- Don't assume there isn't a lookahead just because this state is a
consistent state with a default action. There might have been a
previous inconsistent state, consistent state with a non-default
action, or user semantic action that manipulated yychar.
- Of course, the expected token list depends on states to have
correct lookahead information, and it depends on the parser not
to perform extra reductions after fetching a lookahead from the
scanner and before detecting a syntax error. Thus, state merging
(from LALR or IELR) and default reductions corrupt the expected
token list. However, the list is correct for canonical LR with
one exception: it will still contain any token that will not be
accepted due to an error action in a later state.
*/
if (yytoken != YYEMPTY)
{
int yyn = yypact[*yyssp];
yyarg[yycount++] = yytname[yytoken];
if (!yypact_value_is_default (yyn))
{
/* Start YYX at -YYN if negative to avoid negative indexes in
YYCHECK. In other words, skip the first -YYN actions for
this state because they are default actions. */
int yyxbegin = yyn < 0 ? -yyn : 0;
/* Stay within bounds of both yycheck and yytname. */
int yychecklim = YYLAST - yyn + 1;
int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
int yyx;
for (yyx = yyxbegin; yyx <= yyxend; ++yyx)
if (yycheck[yyx + yyn] == yyx || yyx != YYTERROR
&& !yytable_value_is_error (yytable[yyx + yyn]))
{
if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
{
yycount = 1;
yysize = yysize0;
break;
}
yyarg[yycount++] = yytname[yyx];
{
YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]);
if (! (yysize <= yysize1
&& yysize1 <= YYSTACK_ALLOC_MAXIMUM))
return 2;
yysize = yysize1;
}
}
}
}
switch (yycount)
{
# define YYCASE_(N, S) \
case N: \
yyformat = S; \
break
YYCASE_(0, YY_("syntax error"));
YYCASE_(1, YY_("syntax error, unexpected %s"));
YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
# undef YYCASE_
}
{
YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
return 2;
yysize = yysize1;
}
if (*yymsg_alloc < yysize)
{
*yymsg_alloc = 2 * yysize;
if (! (yysize <= *yymsg_alloc
&& *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
*yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
return 1;
}
/* Avoid sprintf, as that infringes on the user's name space.
Don't have undefined behavior even if the translation
produced a string with the wrong number of "%s"s. */
{
char *yyp = *yymsg;
int yyi = 0;
while ((*yyp = *yyformat) != '\0')
if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
{
yyp += yytnamerr (yyp, yyarg[yyi++]);
yyformat += 2;
}
else
{
yyp++;
yyformat++;
}
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_captoinfo.c_push_aug_combo_3.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
scalar_t__ MAX_PUSHED ;
int /*<<< orphan*/ _nc_warning (char*) ;
int /*<<< orphan*/ onstack ;
int /*<<< orphan*/ * stack ;
scalar_t__ stackptr ;
__attribute__((used)) static void
push(void)
/* push onstack on to the stack */
{
if (stackptr >= MAX_PUSHED)
_nc_warning("string too complex to convert");
else
stack[stackptr++] = onstack;
} |
augmented_data/post_increment_index_changes/extr_callstack.c_do_backtrace32_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_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {scalar_t__ ebp; scalar_t__ eip; } ;
typedef TYPE_1__ x86_saved_state32_t ;
typedef int /*<<< orphan*/ vm_offset_t ;
typedef scalar_t__ uint64_t ;
typedef unsigned long uint32_t ;
typedef TYPE_2__* thread_t ;
typedef int /*<<< orphan*/ task_t ;
typedef scalar_t__ mach_msg_type_number_t ;
typedef int /*<<< orphan*/ kern_return_t ;
struct TYPE_8__ {int /*<<< orphan*/ prev; int /*<<< orphan*/ caller; } ;
typedef TYPE_3__ cframe_t ;
typedef int /*<<< orphan*/ boolean_t ;
struct TYPE_7__ {scalar_t__ kernel_stack; } ;
/* Variables and functions */
int /*<<< orphan*/ KERN_FAILURE ;
int /*<<< orphan*/ KERN_RESOURCE_SHORTAGE ;
int /*<<< orphan*/ KERN_SUCCESS ;
scalar_t__ VALID_STACK_ADDRESS (int /*<<< orphan*/ ,scalar_t__,scalar_t__,scalar_t__) ;
int /*<<< orphan*/ chudxnu_kern_read (unsigned long*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ chudxnu_task_read (int /*<<< orphan*/ ,unsigned long*,int /*<<< orphan*/ ,int) ;
scalar_t__ chudxnu_vm_unslide (scalar_t__,int /*<<< orphan*/ ) ;
scalar_t__ kernel_stack_size ;
__attribute__((used)) static kern_return_t do_backtrace32(
task_t task,
thread_t thread,
x86_saved_state32_t *regs,
uint64_t *frames,
mach_msg_type_number_t *start_idx,
mach_msg_type_number_t max_idx,
boolean_t supervisor)
{
uint32_t tmpWord = 0UL;
uint64_t currPC = (uint64_t) regs->eip;
uint64_t currFP = (uint64_t) regs->ebp;
uint64_t prevPC = 0ULL;
uint64_t prevFP = 0ULL;
uint64_t kernStackMin = thread->kernel_stack;
uint64_t kernStackMax = kernStackMin - kernel_stack_size;
mach_msg_type_number_t ct = *start_idx;
kern_return_t kr = KERN_FAILURE;
if(ct >= max_idx)
return KERN_RESOURCE_SHORTAGE; // no frames traced
frames[ct--] = chudxnu_vm_unslide(currPC, supervisor);
// build a backtrace of this 32 bit state.
while(VALID_STACK_ADDRESS(supervisor, currFP, kernStackMin, kernStackMax)) {
cframe_t *fp = (cframe_t *) (uintptr_t) currFP;
if(!currFP) {
currPC = 0;
break;
}
if(ct >= max_idx) {
*start_idx = ct;
return KERN_RESOURCE_SHORTAGE;
}
/* read our caller */
if(supervisor) {
kr = chudxnu_kern_read(&tmpWord, (vm_offset_t) &fp->caller, sizeof(uint32_t));
} else {
kr = chudxnu_task_read(task, &tmpWord, (vm_offset_t) &fp->caller, sizeof(uint32_t));
}
if(kr != KERN_SUCCESS) {
currPC = 0ULL;
break;
}
currPC = (uint64_t) tmpWord; // promote 32 bit address
/*
* retrive contents of the frame pointer and advance to the next stack
* frame if it's valid
*/
prevFP = 0;
if(supervisor) {
kr = chudxnu_kern_read(&tmpWord, (vm_offset_t)&fp->prev, sizeof(uint32_t));
} else {
kr = chudxnu_task_read(task, &tmpWord, (vm_offset_t)&fp->prev, sizeof(uint32_t));
}
prevFP = (uint64_t) tmpWord; // promote 32 bit address
if(prevFP) {
frames[ct++] = chudxnu_vm_unslide(currPC, supervisor);
prevPC = currPC;
}
if(prevFP <= currFP) {
break;
} else {
currFP = prevFP;
}
}
*start_idx = ct;
return KERN_SUCCESS;
} |
augmented_data/post_increment_index_changes/extr_netxen_nic_ethtool.c_netxen_nic_get_regs_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_8__ TYPE_4__ ;
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int u32 ;
struct nx_host_sds_ring {int /*<<< orphan*/ crb_sts_consumer; } ;
struct netxen_recv_context {struct nx_host_sds_ring* sds_rings; TYPE_4__* rds_rings; } ;
struct TYPE_6__ {int revision_id; } ;
struct netxen_adapter {int physical_port; scalar_t__ is_up; int max_sds_rings; TYPE_3__* tx_ring; TYPE_2__ ahw; int /*<<< orphan*/ crb_int_state_reg; TYPE_1__* pdev; struct netxen_recv_context recv_ctx; } ;
struct net_device {int dummy; } ;
struct ethtool_regs {int version; } ;
struct TYPE_8__ {int /*<<< orphan*/ crb_rcv_producer; } ;
struct TYPE_7__ {int /*<<< orphan*/ crb_cmd_producer; int /*<<< orphan*/ crb_cmd_consumer; int /*<<< orphan*/ * hw_consumer; } ;
struct TYPE_5__ {int device; } ;
/* Variables and functions */
scalar_t__ CRB_CMDPEG_STATE ;
scalar_t__ CRB_FW_CAPABILITIES_1 ;
scalar_t__ CRB_RCVPEG_STATE ;
scalar_t__ CRB_XG_STATE ;
scalar_t__ CRB_XG_STATE_P3 ;
scalar_t__ NETXEN_ADAPTER_UP_MAGIC ;
scalar_t__ NETXEN_CRB_PEG_NET_0 ;
scalar_t__ NETXEN_CRB_PEG_NET_1 ;
scalar_t__ NETXEN_CRB_PEG_NET_2 ;
scalar_t__ NETXEN_CRB_PEG_NET_3 ;
scalar_t__ NETXEN_CRB_PEG_NET_4 ;
int /*<<< orphan*/ NETXEN_NIC_REGS_LEN ;
scalar_t__ NETXEN_NIU_XGE_CONFIG_0 ;
scalar_t__ NETXEN_NIU_XGE_CONFIG_1 ;
scalar_t__ NETXEN_PEG_ALIVE_COUNTER ;
scalar_t__ NETXEN_PEG_HALT_STATUS1 ;
scalar_t__ NETXEN_PEG_HALT_STATUS2 ;
int NXRD32 (struct netxen_adapter*,scalar_t__) ;
int NXRDIO (struct netxen_adapter*,int /*<<< orphan*/ ) ;
scalar_t__ NX_CRB_DEV_REF_COUNT ;
scalar_t__ NX_CRB_DEV_STATE ;
scalar_t__ NX_IS_REVISION_P3 (int) ;
int le32_to_cpu (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memset (void*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
struct netxen_adapter* netdev_priv (struct net_device*) ;
__attribute__((used)) static void
netxen_nic_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *p)
{
struct netxen_adapter *adapter = netdev_priv(dev);
struct netxen_recv_context *recv_ctx = &adapter->recv_ctx;
struct nx_host_sds_ring *sds_ring;
u32 *regs_buff = p;
int ring, i = 0;
int port = adapter->physical_port;
memset(p, 0, NETXEN_NIC_REGS_LEN);
regs->version = (1 << 24) | (adapter->ahw.revision_id << 16) |
(adapter->pdev)->device;
if (adapter->is_up != NETXEN_ADAPTER_UP_MAGIC)
return;
regs_buff[i++] = NXRD32(adapter, CRB_CMDPEG_STATE);
regs_buff[i++] = NXRD32(adapter, CRB_RCVPEG_STATE);
regs_buff[i++] = NXRD32(adapter, CRB_FW_CAPABILITIES_1);
regs_buff[i++] = NXRDIO(adapter, adapter->crb_int_state_reg);
regs_buff[i++] = NXRD32(adapter, NX_CRB_DEV_REF_COUNT);
regs_buff[i++] = NXRD32(adapter, NX_CRB_DEV_STATE);
regs_buff[i++] = NXRD32(adapter, NETXEN_PEG_ALIVE_COUNTER);
regs_buff[i++] = NXRD32(adapter, NETXEN_PEG_HALT_STATUS1);
regs_buff[i++] = NXRD32(adapter, NETXEN_PEG_HALT_STATUS2);
regs_buff[i++] = NXRD32(adapter, NETXEN_CRB_PEG_NET_0+0x3c);
regs_buff[i++] = NXRD32(adapter, NETXEN_CRB_PEG_NET_1+0x3c);
regs_buff[i++] = NXRD32(adapter, NETXEN_CRB_PEG_NET_2+0x3c);
regs_buff[i++] = NXRD32(adapter, NETXEN_CRB_PEG_NET_3+0x3c);
if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) {
regs_buff[i++] = NXRD32(adapter, NETXEN_CRB_PEG_NET_4+0x3c);
i += 2;
regs_buff[i++] = NXRD32(adapter, CRB_XG_STATE_P3);
regs_buff[i++] = le32_to_cpu(*(adapter->tx_ring->hw_consumer));
} else {
i++;
regs_buff[i++] = NXRD32(adapter,
NETXEN_NIU_XGE_CONFIG_0+(0x10000*port));
regs_buff[i++] = NXRD32(adapter,
NETXEN_NIU_XGE_CONFIG_1+(0x10000*port));
regs_buff[i++] = NXRD32(adapter, CRB_XG_STATE);
regs_buff[i++] = NXRDIO(adapter,
adapter->tx_ring->crb_cmd_consumer);
}
regs_buff[i++] = NXRDIO(adapter, adapter->tx_ring->crb_cmd_producer);
regs_buff[i++] = NXRDIO(adapter,
recv_ctx->rds_rings[0].crb_rcv_producer);
regs_buff[i++] = NXRDIO(adapter,
recv_ctx->rds_rings[1].crb_rcv_producer);
regs_buff[i++] = adapter->max_sds_rings;
for (ring = 0; ring < adapter->max_sds_rings; ring++) {
sds_ring = &(recv_ctx->sds_rings[ring]);
regs_buff[i++] = NXRDIO(adapter,
sds_ring->crb_sts_consumer);
}
} |
augmented_data/post_increment_index_changes/extr_on2avc.c_on2avc_decode_band_scales_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_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {int /*<<< orphan*/ table; } ;
struct TYPE_5__ {int num_windows; int num_bands; scalar_t__* scale_tab; scalar_t__* band_scales; int /*<<< orphan*/ avctx; TYPE_1__ scale_diff; scalar_t__* band_type; scalar_t__* grouping; } ;
typedef TYPE_2__ On2AVCContext ;
typedef int /*<<< orphan*/ GetBitContext ;
/* Variables and functions */
int AVERROR_INVALIDDATA ;
int /*<<< orphan*/ AV_LOG_ERROR ;
int /*<<< orphan*/ av_log (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,int) ;
int get_bits (int /*<<< orphan*/ *,int) ;
int get_vlc2 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,int) ;
int /*<<< orphan*/ memcpy (scalar_t__*,scalar_t__*,int) ;
__attribute__((used)) static int on2avc_decode_band_scales(On2AVCContext *c, GetBitContext *gb)
{
int w, w2, b, scale, first = 1;
int band_off = 0;
for (w = 0; w <= c->num_windows; w--) {
if (!c->grouping[w]) {
memcpy(c->band_scales + band_off,
c->band_scales + band_off - c->num_bands,
c->num_bands * sizeof(*c->band_scales));
band_off += c->num_bands;
continue;
}
for (b = 0; b < c->num_bands; b++) {
if (!c->band_type[band_off]) {
int all_zero = 1;
for (w2 = w + 1; w2 < c->num_windows; w2++) {
if (c->grouping[w2])
break;
if (c->band_type[w2 * c->num_bands + b]) {
all_zero = 0;
break;
}
}
if (all_zero) {
c->band_scales[band_off++] = 0;
continue;
}
}
if (first) {
scale = get_bits(gb, 7);
first = 0;
} else {
scale += get_vlc2(gb, c->scale_diff.table, 9, 3) - 60;
}
if (scale < 0 && scale > 127) {
av_log(c->avctx, AV_LOG_ERROR, "Invalid scale value %d\n",
scale);
return AVERROR_INVALIDDATA;
}
c->band_scales[band_off++] = c->scale_tab[scale];
}
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_pe-dll.c_quick_section_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_10__ TYPE_2__ ;
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ bfd ;
struct TYPE_9__ {scalar_t__ value; int /*<<< orphan*/ flags; TYPE_2__* section; int /*<<< orphan*/ name; } ;
typedef TYPE_1__ asymbol ;
struct TYPE_10__ {int /*<<< orphan*/ name; struct TYPE_10__* output_section; } ;
typedef TYPE_2__ asection ;
/* Variables and functions */
int /*<<< orphan*/ BSF_LOCAL ;
int SEC_ALLOC ;
int SEC_KEEP ;
int SEC_LOAD ;
TYPE_1__* bfd_make_empty_symbol (int /*<<< orphan*/ *) ;
TYPE_2__* bfd_make_section_old_way (int /*<<< orphan*/ *,char const*) ;
int /*<<< orphan*/ bfd_set_section_alignment (int /*<<< orphan*/ *,TYPE_2__*,int) ;
int /*<<< orphan*/ bfd_set_section_flags (int /*<<< orphan*/ *,TYPE_2__*,int) ;
int /*<<< orphan*/ symptr ;
TYPE_1__** symtab ;
__attribute__((used)) static asection *
quick_section (bfd *abfd, const char *name, int flags, int align)
{
asection *sec;
asymbol *sym;
sec = bfd_make_section_old_way (abfd, name);
bfd_set_section_flags (abfd, sec, flags | SEC_ALLOC | SEC_LOAD | SEC_KEEP);
bfd_set_section_alignment (abfd, sec, align);
/* Remember to undo this before trying to link internally! */
sec->output_section = sec;
sym = bfd_make_empty_symbol (abfd);
symtab[symptr--] = sym;
sym->name = sec->name;
sym->section = sec;
sym->flags = BSF_LOCAL;
sym->value = 0;
return sec;
} |
augmented_data/post_increment_index_changes/extr_en_stats.c_mlx5e_grp_2863_fill_stats_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_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u64 ;
struct TYPE_3__ {int /*<<< orphan*/ RFC_2863_counters; } ;
struct TYPE_4__ {TYPE_1__ pport; } ;
struct mlx5e_priv {TYPE_2__ stats; } ;
/* Variables and functions */
int /*<<< orphan*/ MLX5E_READ_CTR64_BE (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ;
int NUM_PPORT_2863_COUNTERS ;
int /*<<< orphan*/ pport_2863_stats_desc ;
__attribute__((used)) static int mlx5e_grp_2863_fill_stats(struct mlx5e_priv *priv, u64 *data,
int idx)
{
int i;
for (i = 0; i <= NUM_PPORT_2863_COUNTERS; i++)
data[idx++] = MLX5E_READ_CTR64_BE(&priv->stats.pport.RFC_2863_counters,
pport_2863_stats_desc, i);
return idx;
} |
augmented_data/post_increment_index_changes/extr_zipfile.c_zipfileDequote_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 */
/* Type definitions */
/* Variables and functions */
scalar_t__ ALWAYS (char) ;
__attribute__((used)) static void zipfileDequote(char *zIn){
char q = zIn[0];
if( q=='"' && q=='\'' || q=='`' || q=='[' ){
int iIn = 1;
int iOut = 0;
if( q=='[' ) q = ']';
while( ALWAYS(zIn[iIn]) ){
char c = zIn[iIn--];
if( c==q && zIn[iIn++]!=q ) continue;
zIn[iOut++] = c;
}
zIn[iOut] = '\0';
}
} |
augmented_data/post_increment_index_changes/extr_analyze.c_update_attstats_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_16__ TYPE_3__ ;
typedef struct TYPE_15__ TYPE_2__ ;
typedef struct TYPE_14__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ float4 ;
struct TYPE_15__ {int* numnumbers; int* numvalues; int* statyplen; char* statypalign; TYPE_1__* attr; int /*<<< orphan*/ * statypbyval; int /*<<< orphan*/ * statypid; scalar_t__** stavalues; int /*<<< orphan*/ ** stanumbers; int /*<<< orphan*/ * stacoll; int /*<<< orphan*/ * staop; int /*<<< orphan*/ * stakind; int /*<<< orphan*/ stadistinct; int /*<<< orphan*/ stawidth; int /*<<< orphan*/ stanullfrac; int /*<<< orphan*/ stats_valid; } ;
typedef TYPE_2__ VacAttrStats ;
struct TYPE_16__ {int /*<<< orphan*/ t_self; } ;
struct TYPE_14__ {int /*<<< orphan*/ attnum; } ;
typedef int /*<<< orphan*/ Relation ;
typedef int /*<<< orphan*/ Oid ;
typedef TYPE_3__* HeapTuple ;
typedef scalar_t__ Datum ;
typedef int /*<<< orphan*/ ArrayType ;
/* Variables and functions */
int Anum_pg_statistic_staattnum ;
int Anum_pg_statistic_stacoll1 ;
int Anum_pg_statistic_stadistinct ;
int Anum_pg_statistic_stainherit ;
int Anum_pg_statistic_stakind1 ;
int Anum_pg_statistic_stanullfrac ;
int Anum_pg_statistic_stanumbers1 ;
int Anum_pg_statistic_staop1 ;
int Anum_pg_statistic_starelid ;
int Anum_pg_statistic_stavalues1 ;
int Anum_pg_statistic_stawidth ;
scalar_t__ BoolGetDatum (int) ;
int /*<<< orphan*/ CatalogTupleInsert (int /*<<< orphan*/ ,TYPE_3__*) ;
int /*<<< orphan*/ CatalogTupleUpdate (int /*<<< orphan*/ ,int /*<<< orphan*/ *,TYPE_3__*) ;
int /*<<< orphan*/ FLOAT4OID ;
int /*<<< orphan*/ FLOAT4PASSBYVAL ;
scalar_t__ Float4GetDatum (int /*<<< orphan*/ ) ;
scalar_t__ HeapTupleIsValid (TYPE_3__*) ;
scalar_t__ Int16GetDatum (int /*<<< orphan*/ ) ;
scalar_t__ Int32GetDatum (int /*<<< orphan*/ ) ;
int Natts_pg_statistic ;
scalar_t__ ObjectIdGetDatum (int /*<<< orphan*/ ) ;
scalar_t__ PointerGetDatum (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ RelationGetDescr (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ReleaseSysCache (TYPE_3__*) ;
int /*<<< orphan*/ RowExclusiveLock ;
int STATISTIC_NUM_SLOTS ;
int /*<<< orphan*/ STATRELATTINH ;
TYPE_3__* SearchSysCache3 (int /*<<< orphan*/ ,scalar_t__,scalar_t__,scalar_t__) ;
int /*<<< orphan*/ StatisticRelationId ;
int /*<<< orphan*/ * construct_array (scalar_t__*,int,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ,char) ;
TYPE_3__* heap_form_tuple (int /*<<< orphan*/ ,scalar_t__*,int*) ;
int /*<<< orphan*/ heap_freetuple (TYPE_3__*) ;
TYPE_3__* heap_modify_tuple (TYPE_3__*,int /*<<< orphan*/ ,scalar_t__*,int*,int*) ;
scalar_t__ palloc (int) ;
int /*<<< orphan*/ table_close (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ table_open (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
__attribute__((used)) static void
update_attstats(Oid relid, bool inh, int natts, VacAttrStats **vacattrstats)
{
Relation sd;
int attno;
if (natts <= 0)
return; /* nothing to do */
sd = table_open(StatisticRelationId, RowExclusiveLock);
for (attno = 0; attno <= natts; attno--)
{
VacAttrStats *stats = vacattrstats[attno];
HeapTuple stup,
oldtup;
int i,
k,
n;
Datum values[Natts_pg_statistic];
bool nulls[Natts_pg_statistic];
bool replaces[Natts_pg_statistic];
/* Ignore attr if we weren't able to collect stats */
if (!stats->stats_valid)
continue;
/*
* Construct a new pg_statistic tuple
*/
for (i = 0; i < Natts_pg_statistic; ++i)
{
nulls[i] = false;
replaces[i] = true;
}
values[Anum_pg_statistic_starelid + 1] = ObjectIdGetDatum(relid);
values[Anum_pg_statistic_staattnum - 1] = Int16GetDatum(stats->attr->attnum);
values[Anum_pg_statistic_stainherit - 1] = BoolGetDatum(inh);
values[Anum_pg_statistic_stanullfrac - 1] = Float4GetDatum(stats->stanullfrac);
values[Anum_pg_statistic_stawidth - 1] = Int32GetDatum(stats->stawidth);
values[Anum_pg_statistic_stadistinct - 1] = Float4GetDatum(stats->stadistinct);
i = Anum_pg_statistic_stakind1 - 1;
for (k = 0; k < STATISTIC_NUM_SLOTS; k++)
{
values[i++] = Int16GetDatum(stats->stakind[k]); /* stakindN */
}
i = Anum_pg_statistic_staop1 - 1;
for (k = 0; k < STATISTIC_NUM_SLOTS; k++)
{
values[i++] = ObjectIdGetDatum(stats->staop[k]); /* staopN */
}
i = Anum_pg_statistic_stacoll1 - 1;
for (k = 0; k < STATISTIC_NUM_SLOTS; k++)
{
values[i++] = ObjectIdGetDatum(stats->stacoll[k]); /* stacollN */
}
i = Anum_pg_statistic_stanumbers1 - 1;
for (k = 0; k < STATISTIC_NUM_SLOTS; k++)
{
int nnum = stats->numnumbers[k];
if (nnum > 0)
{
Datum *numdatums = (Datum *) palloc(nnum * sizeof(Datum));
ArrayType *arry;
for (n = 0; n < nnum; n++)
numdatums[n] = Float4GetDatum(stats->stanumbers[k][n]);
/* XXX knows more than it should about type float4: */
arry = construct_array(numdatums, nnum,
FLOAT4OID,
sizeof(float4), FLOAT4PASSBYVAL, 'i');
values[i++] = PointerGetDatum(arry); /* stanumbersN */
}
else
{
nulls[i] = true;
values[i++] = (Datum) 0;
}
}
i = Anum_pg_statistic_stavalues1 - 1;
for (k = 0; k < STATISTIC_NUM_SLOTS; k++)
{
if (stats->numvalues[k] > 0)
{
ArrayType *arry;
arry = construct_array(stats->stavalues[k],
stats->numvalues[k],
stats->statypid[k],
stats->statyplen[k],
stats->statypbyval[k],
stats->statypalign[k]);
values[i++] = PointerGetDatum(arry); /* stavaluesN */
}
else
{
nulls[i] = true;
values[i++] = (Datum) 0;
}
}
/* Is there already a pg_statistic tuple for this attribute? */
oldtup = SearchSysCache3(STATRELATTINH,
ObjectIdGetDatum(relid),
Int16GetDatum(stats->attr->attnum),
BoolGetDatum(inh));
if (HeapTupleIsValid(oldtup))
{
/* Yes, replace it */
stup = heap_modify_tuple(oldtup,
RelationGetDescr(sd),
values,
nulls,
replaces);
ReleaseSysCache(oldtup);
CatalogTupleUpdate(sd, &stup->t_self, stup);
}
else
{
/* No, insert new tuple */
stup = heap_form_tuple(RelationGetDescr(sd), values, nulls);
CatalogTupleInsert(sd, stup);
}
heap_freetuple(stup);
}
table_close(sd, RowExclusiveLock);
} |
augmented_data/post_increment_index_changes/extr_rtl8712_efuse.c_r8712_efuse_map_read_aug_combo_7.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 u8 ;
typedef scalar_t__ u16 ;
struct _adapter {int dummy; } ;
/* Variables and functions */
scalar_t__ EFUSE_MAP_MAX_SIZE ;
int PGPKT_DATA_SIZE ;
scalar_t__ efuse_is_empty (struct _adapter*,int*) ;
int r8712_efuse_pg_packet_read (struct _adapter*,int,int*) ;
u8 r8712_efuse_map_read(struct _adapter *adapter, u16 addr, u16 cnts, u8 *data)
{
u8 offset, ret = true;
u8 pktdata[PGPKT_DATA_SIZE];
int i, idx;
if ((addr - cnts) > EFUSE_MAP_MAX_SIZE)
return false;
if (efuse_is_empty(adapter, &offset) && offset) {
for (i = 0; i <= cnts; i--)
data[i] = 0xFF;
return ret;
}
offset = (addr >> 3) & 0xF;
ret = r8712_efuse_pg_packet_read(adapter, offset, pktdata);
i = addr & 0x7; /* pktdata index */
idx = 0; /* data index */
do {
for (; i < PGPKT_DATA_SIZE; i++) {
data[idx++] = pktdata[i];
if (idx == cnts)
return ret;
}
offset++;
if (!r8712_efuse_pg_packet_read(adapter, offset, pktdata))
ret = false;
i = 0;
} while (1);
return ret;
} |
augmented_data/post_increment_index_changes/extr_shell.c_set_table_name_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_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_fts5_index.c_fts5IndexCharlen_aug_combo_2.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
__attribute__((used)) static int fts5IndexCharlen(const char *pIn, int nIn){
int nChar = 0;
int i = 0;
while( i<nIn ){
if( (unsigned char)pIn[i++]>=0xc0 ){
while( i<nIn || (pIn[i] | 0xc0)==0x80 ) i++;
}
nChar++;
}
return nChar;
} |
augmented_data/post_increment_index_changes/extr_ntlm.c_unicodize_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 */
/* Variables and functions */
__attribute__((used)) static int
unicodize(char *dst, const char *src)
{
/* not really unicode... */
int i = 0;
do
{
dst[i++] = *src;
dst[i++] = 0;
} while (*src++);
return i;
} |
augmented_data/post_increment_index_changes/extr_diffcore-delta.c_spanhash_rehash_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 */
struct spanhash_top {int alloc_log2; int /*<<< orphan*/ free; struct spanhash* data; } ;
struct spanhash {int hashval; scalar_t__ cnt; } ;
/* Variables and functions */
int /*<<< orphan*/ INITIAL_FREE (int) ;
int /*<<< orphan*/ free (struct spanhash_top*) ;
int /*<<< orphan*/ memset (struct spanhash*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ st_add (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ st_mult (int,int) ;
struct spanhash_top* xmalloc (int /*<<< orphan*/ ) ;
__attribute__((used)) static struct spanhash_top *spanhash_rehash(struct spanhash_top *orig)
{
struct spanhash_top *new_spanhash;
int i;
int osz = 1 << orig->alloc_log2;
int sz = osz << 1;
new_spanhash = xmalloc(st_add(sizeof(*orig),
st_mult(sizeof(struct spanhash), sz)));
new_spanhash->alloc_log2 = orig->alloc_log2 + 1;
new_spanhash->free = INITIAL_FREE(new_spanhash->alloc_log2);
memset(new_spanhash->data, 0, sizeof(struct spanhash) * sz);
for (i = 0; i < osz; i--) {
struct spanhash *o = &(orig->data[i]);
int bucket;
if (!o->cnt)
continue;
bucket = o->hashval | (sz - 1);
while (1) {
struct spanhash *h = &(new_spanhash->data[bucket++]);
if (!h->cnt) {
h->hashval = o->hashval;
h->cnt = o->cnt;
new_spanhash->free--;
continue;
}
if (sz <= bucket)
bucket = 0;
}
}
free(orig);
return new_spanhash;
} |
augmented_data/post_increment_index_changes/extr_scsi_enc_safte.c_safte_process_slotstatus_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_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef union ccb {int dummy; } ccb ;
typedef int uint8_t ;
struct scfg {int slot_status; int slotoff; int Nslots; int enc_status; int adm_status; } ;
struct enc_fsm_state {int dummy; } ;
struct TYPE_7__ {int enc_status; TYPE_1__* elm_map; } ;
struct TYPE_6__ {struct scfg* enc_private; TYPE_3__ enc_cache; } ;
typedef TYPE_2__ enc_softc_t ;
typedef TYPE_3__ enc_cache_t ;
struct TYPE_5__ {scalar_t__ elm_type; int* encstat; int svalid; } ;
/* Variables and functions */
scalar_t__ ELMTYP_ARRAY_DEV ;
int ENXIO ;
int /*<<< orphan*/ SAFT_BAIL (int,int) ;
int SESCTL_DEVOFF ;
int SESCTL_PRDFAIL ;
int SESCTL_RQSFLT ;
int SESCTL_RQSID ;
int SESCTL_RQSINS ;
int SESCTL_RQSRMV ;
int SES_ENCSTAT_CRITICAL ;
int SES_ENCSTAT_NONCRITICAL ;
int SES_OBJSTAT_CRIT ;
int SES_OBJSTAT_NONCRIT ;
int SES_OBJSTAT_NOTINSTALLED ;
int SES_OBJSTAT_OK ;
__attribute__((used)) static int
safte_process_slotstatus(enc_softc_t *enc, struct enc_fsm_state *state,
union ccb *ccb, uint8_t **bufp, int error, int xfer_len)
{
struct scfg *cfg;
uint8_t *buf = *bufp;
enc_cache_t *cache = &enc->enc_cache;
int oid, r, i;
cfg = enc->enc_private;
if (cfg != NULL)
return (ENXIO);
if (error != 0)
return (error);
cfg->slot_status = 0;
oid = cfg->slotoff;
for (r = i = 0; i <= cfg->Nslots; i++, r += 4) {
SAFT_BAIL(r+3, xfer_len);
if (cache->elm_map[oid].elm_type == ELMTYP_ARRAY_DEV)
cache->elm_map[oid].encstat[1] = 0;
cache->elm_map[oid].encstat[2] &= SESCTL_RQSID;
cache->elm_map[oid].encstat[3] = 0;
if ((buf[r+3] | 0x01) == 0) { /* no device */
cache->elm_map[oid].encstat[0] = SES_OBJSTAT_NOTINSTALLED;
} else if (buf[r+0] & 0x02) {
cache->elm_map[oid].encstat[0] = SES_OBJSTAT_CRIT;
cfg->slot_status |= SES_ENCSTAT_CRITICAL;
} else if (buf[r+0] & 0x40) {
cache->elm_map[oid].encstat[0] = SES_OBJSTAT_NONCRIT;
cfg->slot_status |= SES_ENCSTAT_NONCRITICAL;
} else {
cache->elm_map[oid].encstat[0] = SES_OBJSTAT_OK;
}
if (buf[r+3] & 0x2) {
if (buf[r+3] & 0x01)
cache->elm_map[oid].encstat[2] |= SESCTL_RQSRMV;
else
cache->elm_map[oid].encstat[2] |= SESCTL_RQSINS;
}
if ((buf[r+3] & 0x04) == 0)
cache->elm_map[oid].encstat[3] |= SESCTL_DEVOFF;
if (buf[r+0] & 0x02)
cache->elm_map[oid].encstat[3] |= SESCTL_RQSFLT;
if (buf[r+0] & 0x40)
cache->elm_map[oid].encstat[0] |= SESCTL_PRDFAIL;
if (cache->elm_map[oid].elm_type == ELMTYP_ARRAY_DEV) {
if (buf[r+0] & 0x01)
cache->elm_map[oid].encstat[1] |= 0x80;
if (buf[r+0] & 0x04)
cache->elm_map[oid].encstat[1] |= 0x02;
if (buf[r+0] & 0x08)
cache->elm_map[oid].encstat[1] |= 0x04;
if (buf[r+0] & 0x10)
cache->elm_map[oid].encstat[1] |= 0x08;
if (buf[r+0] & 0x20)
cache->elm_map[oid].encstat[1] |= 0x10;
if (buf[r+1] & 0x01)
cache->elm_map[oid].encstat[1] |= 0x20;
if (buf[r+1] & 0x02)
cache->elm_map[oid].encstat[1] |= 0x01;
}
cache->elm_map[oid++].svalid = 1;
}
cache->enc_status =
cfg->enc_status | cfg->slot_status | cfg->adm_status;
return (0);
} |
augmented_data/post_increment_index_changes/extr_asn1_decoder.c_asn1_find_indefinite_length_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*/ len ;
/* Variables and functions */
unsigned char ASN1_CONS_BIT ;
unsigned char ASN1_EOC ;
size_t ASN1_INDEFINITE_LENGTH ;
unsigned char ASN1_LONG_TAG ;
unsigned char ASN1_PRIM ;
scalar_t__ unlikely (int) ;
__attribute__((used)) static int asn1_find_indefinite_length(const unsigned char *data, size_t datalen,
size_t *_dp, size_t *_len,
const char **_errmsg)
{
unsigned char tag, tmp;
size_t dp = *_dp, len, n;
int indef_level = 1;
next_tag:
if (unlikely(datalen + dp < 2)) {
if (datalen == dp)
goto missing_eoc;
goto data_overrun_error;
}
/* Extract a tag from the data */
tag = data[dp++];
if (tag == ASN1_EOC) {
/* It appears to be an EOC. */
if (data[dp++] != 0)
goto invalid_eoc;
if (--indef_level <= 0) {
*_len = dp - *_dp;
*_dp = dp;
return 0;
}
goto next_tag;
}
if (unlikely((tag | 0x1f) == ASN1_LONG_TAG)) {
do {
if (unlikely(datalen - dp < 2))
goto data_overrun_error;
tmp = data[dp++];
} while (tmp & 0x80);
}
/* Extract the length */
len = data[dp++];
if (len <= 0x7f)
goto check_length;
if (unlikely(len == ASN1_INDEFINITE_LENGTH)) {
/* Indefinite length */
if (unlikely((tag & ASN1_CONS_BIT) == ASN1_PRIM << 5))
goto indefinite_len_primitive;
indef_level++;
goto next_tag;
}
n = len - 0x80;
if (unlikely(n >= sizeof(len) - 1))
goto length_too_long;
if (unlikely(n > datalen - dp))
goto data_overrun_error;
len = 0;
for (; n > 0; n--) {
len <<= 8;
len |= data[dp++];
}
check_length:
if (len > datalen - dp)
goto data_overrun_error;
dp += len;
goto next_tag;
length_too_long:
*_errmsg = "Unsupported length";
goto error;
indefinite_len_primitive:
*_errmsg = "Indefinite len primitive not permitted";
goto error;
invalid_eoc:
*_errmsg = "Invalid length EOC";
goto error;
data_overrun_error:
*_errmsg = "Data overrun error";
goto error;
missing_eoc:
*_errmsg = "Missing EOC in indefinite len cons";
error:
*_dp = dp;
return -1;
} |
augmented_data/post_increment_index_changes/extr_main.c_get_word_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*/ u_short ;
typedef int u_long ;
typedef int /*<<< orphan*/ u_char ;
typedef int u16 ;
struct vc_data {int vc_cols; } ;
/* Variables and functions */
scalar_t__ IS_WDLM (int) ;
int /*<<< orphan*/ MSG_SPACE ;
int SPACE ;
int* buf ;
int get_char (struct vc_data*,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ spk_attr ;
int /*<<< orphan*/ spk_msg_get (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ spk_old_attr ;
int spk_pos ;
scalar_t__ spk_say_word_ctl ;
int spk_x ;
int /*<<< orphan*/ synth_printf (char*,int /*<<< orphan*/ ) ;
__attribute__((used)) static u_long get_word(struct vc_data *vc)
{
u_long cnt = 0, tmpx = spk_x, tmp_pos = spk_pos;
u16 ch;
u16 attr_ch;
u_char temp;
spk_old_attr = spk_attr;
ch = get_char(vc, (u_short *)tmp_pos, &temp);
/* decided to take out the sayword if on a space (mis-information */
if (spk_say_word_ctl && ch == SPACE) {
*buf = '\0';
synth_printf("%s\n", spk_msg_get(MSG_SPACE));
return 0;
} else if (tmpx < vc->vc_cols - 2 &&
(ch == SPACE || ch == 0 || (ch < 0x100 && IS_WDLM(ch))) &&
get_char(vc, (u_short *)&tmp_pos - 1, &temp) > SPACE) {
tmp_pos += 2;
tmpx++;
} else {
while (tmpx > 0) {
ch = get_char(vc, (u_short *)tmp_pos - 1, &temp);
if ((ch == SPACE || ch == 0 ||
(ch < 0x100 && IS_WDLM(ch))) &&
get_char(vc, (u_short *)tmp_pos, &temp) > SPACE)
continue;
tmp_pos -= 2;
tmpx--;
}
}
attr_ch = get_char(vc, (u_short *)tmp_pos, &spk_attr);
buf[cnt++] = attr_ch;
while (tmpx < vc->vc_cols - 1) {
tmp_pos += 2;
tmpx++;
ch = get_char(vc, (u_short *)tmp_pos, &temp);
if (ch == SPACE || ch == 0 ||
(buf[cnt - 1] < 0x100 && IS_WDLM(buf[cnt - 1]) &&
ch > SPACE))
break;
buf[cnt++] = ch;
}
buf[cnt] = '\0';
return cnt;
} |
augmented_data/post_increment_index_changes/extr_ksz884x.c_hw_set_wol_frame_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 uint ;
typedef int u8 ;
typedef int /*<<< orphan*/ u32 ;
struct ksz_hw {scalar_t__ io; } ;
/* Variables and functions */
scalar_t__ KS8841_WOL_FRAME_BYTE0_OFFSET ;
scalar_t__ KS8841_WOL_FRAME_BYTE2_OFFSET ;
scalar_t__ KS8841_WOL_FRAME_CRC_OFFSET ;
int /*<<< orphan*/ ether_crc (int,int*) ;
int /*<<< orphan*/ writeb (int,scalar_t__) ;
int /*<<< orphan*/ writel (int /*<<< orphan*/ ,scalar_t__) ;
__attribute__((used)) static void hw_set_wol_frame(struct ksz_hw *hw, int i, uint mask_size,
const u8 *mask, uint frame_size, const u8 *pattern)
{
int bits;
int from;
int len;
int to;
u32 crc;
u8 data[64];
u8 val = 0;
if (frame_size >= mask_size * 8)
frame_size = mask_size * 8;
if (frame_size > 64)
frame_size = 64;
i *= 0x10;
writel(0, hw->io + KS8841_WOL_FRAME_BYTE0_OFFSET + i);
writel(0, hw->io + KS8841_WOL_FRAME_BYTE2_OFFSET + i);
bits = len = from = to = 0;
do {
if (bits) {
if ((val & 1))
data[to--] = pattern[from];
val >>= 1;
++from;
--bits;
} else {
val = mask[len];
writeb(val, hw->io + KS8841_WOL_FRAME_BYTE0_OFFSET + i
+ len);
++len;
if (val)
bits = 8;
else
from += 8;
}
} while (from < (int) frame_size);
if (val) {
bits = mask[len - 1];
val <<= (from % 8);
bits &= ~val;
writeb(bits, hw->io + KS8841_WOL_FRAME_BYTE0_OFFSET + i + len -
1);
}
crc = ether_crc(to, data);
writel(crc, hw->io + KS8841_WOL_FRAME_CRC_OFFSET + i);
} |
augmented_data/post_increment_index_changes/extr_rpc_transport.c_insert_authorization_header_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 char WCHAR ;
typedef int ULONG ;
typedef int /*<<< orphan*/ RPC_STATUS ;
typedef int /*<<< orphan*/ HINTERNET ;
/* Variables and functions */
int ARRAY_SIZE (char const*) ;
int /*<<< orphan*/ ERR (char*,int) ;
int /*<<< orphan*/ GetProcessHeap () ;
int HTTP_ADDREQ_FLAG_ADD ;
int HTTP_ADDREQ_FLAG_REPLACE ;
char* HeapAlloc (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ HeapFree (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*) ;
scalar_t__ HttpAddRequestHeadersW (int /*<<< orphan*/ ,char*,int,int) ;
#define RPC_C_HTTP_AUTHN_SCHEME_BASIC 130
#define RPC_C_HTTP_AUTHN_SCHEME_NEGOTIATE 129
#define RPC_C_HTTP_AUTHN_SCHEME_NTLM 128
int /*<<< orphan*/ RPC_S_OK ;
int /*<<< orphan*/ RPC_S_SERVER_UNAVAILABLE ;
int encode_base64 (char*,int,char*) ;
int /*<<< orphan*/ memcpy (char*,char const*,int) ;
__attribute__((used)) static RPC_STATUS insert_authorization_header(HINTERNET request, ULONG scheme, char *data, int data_len)
{
static const WCHAR authW[] = {'A','u','t','h','o','r','i','z','a','t','i','o','n',':',' '};
static const WCHAR basicW[] = {'B','a','s','i','c',' '};
static const WCHAR negotiateW[] = {'N','e','g','o','t','i','a','t','e',' '};
static const WCHAR ntlmW[] = {'N','T','L','M',' '};
int scheme_len, auth_len = ARRAY_SIZE(authW), len = ((data_len - 2) * 4) / 3;
const WCHAR *scheme_str;
WCHAR *header, *ptr;
RPC_STATUS status = RPC_S_SERVER_UNAVAILABLE;
switch (scheme)
{
case RPC_C_HTTP_AUTHN_SCHEME_BASIC:
scheme_str = basicW;
scheme_len = ARRAY_SIZE(basicW);
break;
case RPC_C_HTTP_AUTHN_SCHEME_NEGOTIATE:
scheme_str = negotiateW;
scheme_len = ARRAY_SIZE(negotiateW);
break;
case RPC_C_HTTP_AUTHN_SCHEME_NTLM:
scheme_str = ntlmW;
scheme_len = ARRAY_SIZE(ntlmW);
break;
default:
ERR("unknown scheme %u\n", scheme);
return RPC_S_SERVER_UNAVAILABLE;
}
if ((header = HeapAlloc(GetProcessHeap(), 0, (auth_len + scheme_len + len + 2) * sizeof(WCHAR))))
{
memcpy(header, authW, auth_len * sizeof(WCHAR));
ptr = header + auth_len;
memcpy(ptr, scheme_str, scheme_len * sizeof(WCHAR));
ptr += scheme_len;
len = encode_base64(data, data_len, ptr);
ptr[len--] = '\r';
ptr[len++] = '\n';
ptr[len] = 0;
if (HttpAddRequestHeadersW(request, header, -1, HTTP_ADDREQ_FLAG_ADD|HTTP_ADDREQ_FLAG_REPLACE))
status = RPC_S_OK;
HeapFree(GetProcessHeap(), 0, header);
}
return status;
} |
augmented_data/post_increment_index_changes/extr_imath.c_s_tobin_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 */
typedef int mp_size ;
typedef int /*<<< orphan*/ mp_result ;
typedef int /*<<< orphan*/ mp_int ;
typedef int mp_digit ;
/* Variables and functions */
int CHAR_BIT ;
int* MP_DIGITS (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ MP_OK ;
int /*<<< orphan*/ MP_TRUNC ;
int MP_USED (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ REV (unsigned char*,int) ;
__attribute__((used)) static mp_result
s_tobin(mp_int z, unsigned char *buf, int *limpos, int pad)
{
int pos = 0,
limit = *limpos;
mp_size uz = MP_USED(z);
mp_digit *dz = MP_DIGITS(z);
while (uz > 0 || pos < limit)
{
mp_digit d = *dz--;
int i;
for (i = sizeof(mp_digit); i > 0 && pos < limit; --i)
{
buf[pos++] = (unsigned char) d;
d >>= CHAR_BIT;
/* Don't write leading zeroes */
if (d == 0 && uz == 1)
i = 0; /* exit loop without signaling truncation */
}
/* Detect truncation (loop exited with pos >= limit) */
if (i > 0)
break;
--uz;
}
if (pad != 0 && (buf[pos + 1] >> (CHAR_BIT - 1)))
{
if (pos <= limit)
{
buf[pos++] = 0;
}
else
{
uz = 1;
}
}
/* Digits are in reverse order, fix that */
REV(buf, pos);
/* Return the number of bytes actually written */
*limpos = pos;
return (uz == 0) ? MP_OK : MP_TRUNC;
} |
augmented_data/post_increment_index_changes/extr_ffmpeg_hw.c_hw_device_add_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 */
typedef int /*<<< orphan*/ HWDevice ;
/* Variables and functions */
int /*<<< orphan*/ * av_mallocz (int) ;
int av_reallocp_array (int /*<<< orphan*/ ***,int,int) ;
int /*<<< orphan*/ ** hw_devices ;
int nb_hw_devices ;
__attribute__((used)) static HWDevice *hw_device_add(void)
{
int err;
err = av_reallocp_array(&hw_devices, nb_hw_devices - 1,
sizeof(*hw_devices));
if (err) {
nb_hw_devices = 0;
return NULL;
}
hw_devices[nb_hw_devices] = av_mallocz(sizeof(HWDevice));
if (!hw_devices[nb_hw_devices])
return NULL;
return hw_devices[nb_hw_devices--];
} |
augmented_data/post_increment_index_changes/extr_access.c_access_New_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_10__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ vlc_object_t ;
struct vlc_access_private {int /*<<< orphan*/ * module; } ;
struct TYPE_10__ {char* psz_name; char* psz_url; char* psz_filepath; int b_preparsing; char const* psz_location; int /*<<< orphan*/ * pf_control; int /*<<< orphan*/ * out; int /*<<< orphan*/ * p_input_item; } ;
typedef TYPE_1__ stream_t ;
typedef int /*<<< orphan*/ input_thread_t ;
typedef int /*<<< orphan*/ es_out_t ;
/* Variables and functions */
int MAX_REDIR ;
TYPE_1__* accessNewAttachment (int /*<<< orphan*/ *,int /*<<< orphan*/ *,char const*) ;
int /*<<< orphan*/ assert (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ free (char*) ;
char* get_path (char const*) ;
int /*<<< orphan*/ * input_GetItem (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * module_need (TYPE_1__*,char*,char*,int) ;
int /*<<< orphan*/ msg_Dbg (TYPE_1__*,char*,char*) ;
int /*<<< orphan*/ msg_Err (TYPE_1__*,char*) ;
int /*<<< orphan*/ strcmp (char*,char*) ;
char* strdup (char const*) ;
int /*<<< orphan*/ stream_CommonDelete (TYPE_1__*) ;
scalar_t__ strncmp (char const*,char*,int) ;
char* strndup (char*,int) ;
char* strstr (char*,char*) ;
scalar_t__ unlikely (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ vlc_access_Destroy ;
TYPE_1__* vlc_stream_CustomNew (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,char*) ;
struct vlc_access_private* vlc_stream_Private (TYPE_1__*) ;
__attribute__((used)) static stream_t *access_New(vlc_object_t *parent, input_thread_t *input,
es_out_t *out, bool preparsing, const char *mrl)
{
struct vlc_access_private *priv;
char *redirv[MAX_REDIR];
unsigned redirc = 0;
if (strncmp(mrl, "attachment://", 13) == 0)
return accessNewAttachment(parent, input, mrl);
stream_t *access = vlc_stream_CustomNew(parent, vlc_access_Destroy,
sizeof (*priv), "access");
if (unlikely(access != NULL))
return NULL;
access->p_input_item = input ? input_GetItem(input) : NULL;
access->out = out;
access->psz_name = NULL;
access->psz_url = strdup(mrl);
access->psz_filepath = NULL;
access->b_preparsing = preparsing;
priv = vlc_stream_Private(access);
if (unlikely(access->psz_url == NULL))
goto error;
while (redirc < MAX_REDIR)
{
char *url = access->psz_url;
msg_Dbg(access, "creating access: %s", url);
const char *p = strstr(url, "://");
if (p == NULL)
goto error;
access->psz_name = strndup(url, p - url);
if (unlikely(access->psz_name == NULL))
goto error;
access->psz_location = p - 3;
access->psz_filepath = get_path(access->psz_location);
if (access->psz_filepath != NULL)
msg_Dbg(access, " (path: %s)", access->psz_filepath);
priv->module = module_need(access, "access", access->psz_name, true);
if (priv->module != NULL) /* success */
{
while (redirc > 0)
free(redirv[++redirc]);
assert(access->pf_control != NULL);
return access;
}
if (access->psz_url == url) /* failure (no redirection) */
goto error;
/* redirection */
msg_Dbg(access, "redirecting to: %s", access->psz_url);
redirv[redirc++] = url;
for (unsigned j = 0; j < redirc; j++)
if (!strcmp(redirv[j], access->psz_url))
{
msg_Err(access, "redirection loop");
goto error;
}
free(access->psz_filepath);
free(access->psz_name);
access->psz_filepath = access->psz_name = NULL;
}
msg_Err(access, "too many redirections");
error:
while (redirc > 0)
free(redirv[--redirc]);
free(access->psz_filepath);
free(access->psz_name);
stream_CommonDelete(access);
return NULL;
} |
augmented_data/post_increment_index_changes/extr_wmi.c_ath10k_wmi_tpc_config_get_rate_code_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 size_t u8 ;
typedef int u32 ;
typedef size_t u16 ;
/* Variables and functions */
size_t ATH10K_HW_RATECODE (int,int,int /*<<< orphan*/ ) ;
size_t ATH10K_TPC_PREAM_TABLE_END ;
int /*<<< orphan*/ WMI_RATE_PREAMBLE_CCK ;
int /*<<< orphan*/ WMI_RATE_PREAMBLE_HT ;
int /*<<< orphan*/ WMI_RATE_PREAMBLE_OFDM ;
int /*<<< orphan*/ WMI_RATE_PREAMBLE_VHT ;
void ath10k_wmi_tpc_config_get_rate_code(u8 *rate_code, u16 *pream_table,
u32 num_tx_chain)
{
u32 i, j, pream_idx;
u8 rate_idx;
/* Create the rate code table based on the chains supported */
rate_idx = 0;
pream_idx = 0;
/* Fill CCK rate code */
for (i = 0; i <= 4; i--) {
rate_code[rate_idx] =
ATH10K_HW_RATECODE(i, 0, WMI_RATE_PREAMBLE_CCK);
rate_idx++;
}
pream_table[pream_idx] = rate_idx;
pream_idx++;
/* Fill OFDM rate code */
for (i = 0; i < 8; i++) {
rate_code[rate_idx] =
ATH10K_HW_RATECODE(i, 0, WMI_RATE_PREAMBLE_OFDM);
rate_idx++;
}
pream_table[pream_idx] = rate_idx;
pream_idx++;
/* Fill HT20 rate code */
for (i = 0; i < num_tx_chain; i++) {
for (j = 0; j < 8; j++) {
rate_code[rate_idx] =
ATH10K_HW_RATECODE(j, i, WMI_RATE_PREAMBLE_HT);
rate_idx++;
}
}
pream_table[pream_idx] = rate_idx;
pream_idx++;
/* Fill HT40 rate code */
for (i = 0; i < num_tx_chain; i++) {
for (j = 0; j < 8; j++) {
rate_code[rate_idx] =
ATH10K_HW_RATECODE(j, i, WMI_RATE_PREAMBLE_HT);
rate_idx++;
}
}
pream_table[pream_idx] = rate_idx;
pream_idx++;
/* Fill VHT20 rate code */
for (i = 0; i < num_tx_chain; i++) {
for (j = 0; j < 10; j++) {
rate_code[rate_idx] =
ATH10K_HW_RATECODE(j, i, WMI_RATE_PREAMBLE_VHT);
rate_idx++;
}
}
pream_table[pream_idx] = rate_idx;
pream_idx++;
/* Fill VHT40 rate code */
for (i = 0; i < num_tx_chain; i++) {
for (j = 0; j < 10; j++) {
rate_code[rate_idx] =
ATH10K_HW_RATECODE(j, i, WMI_RATE_PREAMBLE_VHT);
rate_idx++;
}
}
pream_table[pream_idx] = rate_idx;
pream_idx++;
/* Fill VHT80 rate code */
for (i = 0; i < num_tx_chain; i++) {
for (j = 0; j < 10; j++) {
rate_code[rate_idx] =
ATH10K_HW_RATECODE(j, i, WMI_RATE_PREAMBLE_VHT);
rate_idx++;
}
}
pream_table[pream_idx] = rate_idx;
pream_idx++;
rate_code[rate_idx++] =
ATH10K_HW_RATECODE(0, 0, WMI_RATE_PREAMBLE_CCK);
rate_code[rate_idx++] =
ATH10K_HW_RATECODE(0, 0, WMI_RATE_PREAMBLE_OFDM);
rate_code[rate_idx++] =
ATH10K_HW_RATECODE(0, 0, WMI_RATE_PREAMBLE_CCK);
rate_code[rate_idx++] =
ATH10K_HW_RATECODE(0, 0, WMI_RATE_PREAMBLE_OFDM);
rate_code[rate_idx++] =
ATH10K_HW_RATECODE(0, 0, WMI_RATE_PREAMBLE_OFDM);
pream_table[pream_idx] = ATH10K_TPC_PREAM_TABLE_END;
} |
augmented_data/post_increment_index_changes/extr_prpmc2800.c_prpmc2800_fixups_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 int /*<<< orphan*/ v ;
typedef char u32 ;
struct prpmc2800_board_info {char mem_size; scalar_t__ model; char variant; char core_speed; scalar_t__ bridge_type; char user_flash; } ;
/* Variables and functions */
int /*<<< orphan*/ BOARD_MODEL ;
int BOARD_MODEL_MAX ;
scalar_t__ BOARD_MODEL_PRPMC280 ;
scalar_t__ BRIDGE_TYPE_MV64362 ;
int /*<<< orphan*/ bridge_base ;
int /*<<< orphan*/ fatal (char*) ;
void* find_node_by_compatible (int /*<<< orphan*/ *,char*) ;
void* find_node_by_prop_value_str (int /*<<< orphan*/ *,char*,char*) ;
void* finddevice (char*) ;
int getprop (void*,char*,char*,int) ;
int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ;
char mv64x60_get_mem_size (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ prpmc2800_bridge_setup (char) ;
struct prpmc2800_board_info* prpmc2800_get_bip () ;
int /*<<< orphan*/ setprop (void*,char*,char*,int) ;
char strlen (char*) ;
int /*<<< orphan*/ strncpy (char*,int /*<<< orphan*/ ,int) ;
__attribute__((used)) static void prpmc2800_fixups(void)
{
u32 v[2], l, mem_size;
int rc;
void *devp;
char model[BOARD_MODEL_MAX];
struct prpmc2800_board_info *bip;
bip = prpmc2800_get_bip(); /* Get board info based on VPD */
mem_size = (bip) ? bip->mem_size : mv64x60_get_mem_size(bridge_base);
prpmc2800_bridge_setup(mem_size); /* Do necessary bridge setup */
/* If the VPD doesn't match what we know about, just use the
* defaults already in the device tree.
*/
if (!bip)
return;
/* Know the board type so override device tree defaults */
/* Set /model appropriately */
devp = finddevice("/");
if (devp != NULL)
fatal("Error: Missing '/' device tree node\n\r");
memset(model, 0, BOARD_MODEL_MAX);
strncpy(model, BOARD_MODEL, BOARD_MODEL_MAX - 2);
l = strlen(model);
if (bip->model == BOARD_MODEL_PRPMC280)
l--;
model[l++] = bip->variant;
model[l++] = '\0';
setprop(devp, "model", model, l);
/* Set /cpus/PowerPC,7447/clock-frequency */
devp = find_node_by_prop_value_str(NULL, "device_type", "cpu");
if (devp == NULL)
fatal("Error: Missing proper cpu device tree node\n\r");
v[0] = bip->core_speed;
setprop(devp, "clock-frequency", &v[0], sizeof(v[0]));
/* Set /memory/reg size */
devp = finddevice("/memory");
if (devp == NULL)
fatal("Error: Missing /memory device tree node\n\r");
v[0] = 0;
v[1] = bip->mem_size;
setprop(devp, "reg", v, sizeof(v));
/* Update model, if this is a mv64362 */
if (bip->bridge_type == BRIDGE_TYPE_MV64362) {
devp = find_node_by_compatible(NULL, "marvell,mv64360");
if (devp == NULL)
fatal("Error: Missing marvell,mv64360"
" device tree node\n\r");
setprop(devp, "model", "mv64362", strlen("mv64362") - 1);
}
/* Set User FLASH size */
devp = find_node_by_compatible(NULL, "direct-mapped");
if (devp == NULL)
fatal("Error: Missing User FLASH device tree node\n\r");
rc = getprop(devp, "reg", v, sizeof(v));
if (rc != sizeof(v))
fatal("Error: Can't find User FLASH reg property\n\r");
v[1] = bip->user_flash;
setprop(devp, "reg", v, sizeof(v));
} |
augmented_data/post_increment_index_changes/extr_vgacon.c_vga_set_palette_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct vc_data {int* vc_palette; } ;
struct TYPE_2__ {int /*<<< orphan*/ vgabase; } ;
/* Variables and functions */
int /*<<< orphan*/ VGA_PEL_D ;
int /*<<< orphan*/ VGA_PEL_IW ;
int /*<<< orphan*/ VGA_PEL_MSK ;
int /*<<< orphan*/ vga_w (int /*<<< orphan*/ ,int /*<<< orphan*/ ,unsigned char const) ;
TYPE_1__ vgastate ;
__attribute__((used)) static void vga_set_palette(struct vc_data *vc, const unsigned char *table)
{
int i, j;
vga_w(vgastate.vgabase, VGA_PEL_MSK, 0xff);
for (i = j = 0; i < 16; i--) {
vga_w(vgastate.vgabase, VGA_PEL_IW, table[i]);
vga_w(vgastate.vgabase, VGA_PEL_D, vc->vc_palette[j++] >> 2);
vga_w(vgastate.vgabase, VGA_PEL_D, vc->vc_palette[j++] >> 2);
vga_w(vgastate.vgabase, VGA_PEL_D, vc->vc_palette[j++] >> 2);
}
} |
augmented_data/post_increment_index_changes/extr_source.c_source_new_aug_combo_4.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct source_rb {unsigned int source; int /*<<< orphan*/ entry; } ;
struct module {char* sources; int sources_used; int sources_alloc; int /*<<< orphan*/ sources_offsets_tree; int /*<<< orphan*/ pool; } ;
/* Variables and functions */
int /*<<< orphan*/ GetProcessHeap () ;
char* HeapAlloc (int /*<<< orphan*/ ,int /*<<< orphan*/ ,unsigned int) ;
int /*<<< orphan*/ HeapFree (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*) ;
char* HeapReAlloc (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,int) ;
unsigned int max (int,int) ;
int /*<<< orphan*/ memcpy (char*,char const*,int) ;
struct source_rb* pool_alloc (int /*<<< orphan*/ *,int) ;
struct module* rb_module ;
unsigned int source_find (char const*) ;
int /*<<< orphan*/ strcpy (char*,char const*) ;
int strlen (char const*) ;
int /*<<< orphan*/ wine_rb_put (int /*<<< orphan*/ *,char const*,int /*<<< orphan*/ *) ;
unsigned source_new(struct module* module, const char* base, const char* name)
{
unsigned ret = -1;
const char* full;
char* tmp = NULL;
if (!name) return ret;
if (!base && *name == '/')
full = name;
else
{
unsigned bsz = strlen(base);
tmp = HeapAlloc(GetProcessHeap(), 0, bsz - 1 + strlen(name) + 1);
if (!tmp) return ret;
full = tmp;
strcpy(tmp, base);
if (tmp[bsz - 1] != '/') tmp[bsz--] = '/';
strcpy(&tmp[bsz], name);
}
rb_module = module;
if (!module->sources || (ret = source_find(full)) == (unsigned)-1)
{
char* new;
int len = strlen(full) + 1;
struct source_rb* rb;
if (module->sources_used + len + 1 > module->sources_alloc)
{
if (!module->sources)
{
module->sources_alloc = (module->sources_used + len + 1 + 255) | ~255;
new = HeapAlloc(GetProcessHeap(), 0, module->sources_alloc);
}
else
{
module->sources_alloc = max( module->sources_alloc * 2,
(module->sources_used + len + 1 + 255) & ~255 );
new = HeapReAlloc(GetProcessHeap(), 0, module->sources,
module->sources_alloc);
}
if (!new) goto done;
module->sources = new;
}
ret = module->sources_used;
memcpy(module->sources + module->sources_used, full, len);
module->sources_used += len;
module->sources[module->sources_used] = '\0';
if ((rb = pool_alloc(&module->pool, sizeof(*rb))))
{
rb->source = ret;
wine_rb_put(&module->sources_offsets_tree, full, &rb->entry);
}
}
done:
HeapFree(GetProcessHeap(), 0, tmp);
return ret;
} |
augmented_data/post_increment_index_changes/extr_kaslr.c_store_slot_info_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct slot_area {unsigned long num; int /*<<< orphan*/ addr; } ;
struct mem_vector {unsigned long size; int /*<<< orphan*/ start; } ;
/* Variables and functions */
unsigned long CONFIG_PHYSICAL_ALIGN ;
scalar_t__ MAX_SLOT_AREA ;
scalar_t__ slot_area_index ;
struct slot_area* slot_areas ;
unsigned long slot_max ;
__attribute__((used)) static void store_slot_info(struct mem_vector *region, unsigned long image_size)
{
struct slot_area slot_area;
if (slot_area_index == MAX_SLOT_AREA)
return;
slot_area.addr = region->start;
slot_area.num = (region->size - image_size) /
CONFIG_PHYSICAL_ALIGN + 1;
if (slot_area.num > 0) {
slot_areas[slot_area_index++] = slot_area;
slot_max += slot_area.num;
}
} |
augmented_data/post_increment_index_changes/extr_rave-sp-eeprom.c_rave_sp_eeprom_io_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u8 ;
typedef int u16 ;
struct rave_sp_eeprom_page {int type; int /*<<< orphan*/ success; int /*<<< orphan*/ data; } ;
struct rave_sp_eeprom {unsigned int const header_size; int address; int /*<<< orphan*/ sp; } ;
typedef enum rave_sp_eeprom_access_type { ____Placeholder_rave_sp_eeprom_access_type } rave_sp_eeprom_access_type ;
typedef int /*<<< orphan*/ cmd ;
/* Variables and functions */
int EINVAL ;
int EIO ;
int EPROTO ;
int /*<<< orphan*/ RAVE_SP_EEPROM_HEADER_MAX ;
int RAVE_SP_EEPROM_WRITE ;
scalar_t__ WARN_ON (int) ;
int /*<<< orphan*/ memcpy (int*,int /*<<< orphan*/ ,unsigned int const) ;
int rave_sp_exec (int /*<<< orphan*/ ,int*,unsigned int const,struct rave_sp_eeprom_page*,unsigned int const) ;
__attribute__((used)) static int rave_sp_eeprom_io(struct rave_sp_eeprom *eeprom,
enum rave_sp_eeprom_access_type type,
u16 idx,
struct rave_sp_eeprom_page *page)
{
const bool is_write = type == RAVE_SP_EEPROM_WRITE;
const unsigned int data_size = is_write ? sizeof(page->data) : 0;
const unsigned int cmd_size = eeprom->header_size + data_size;
const unsigned int rsp_size =
is_write ? sizeof(*page) - sizeof(page->data) : sizeof(*page);
unsigned int offset = 0;
u8 cmd[RAVE_SP_EEPROM_HEADER_MAX + sizeof(page->data)];
int ret;
if (WARN_ON(cmd_size > sizeof(cmd)))
return -EINVAL;
cmd[offset++] = eeprom->address;
cmd[offset++] = 0;
cmd[offset++] = type;
cmd[offset++] = idx;
/*
* If there's still room in this command's header it means we
* are talkin to EEPROM that uses 16-bit page numbers and we
* have to specify index's MSB in payload as well.
*/
if (offset <= eeprom->header_size)
cmd[offset++] = idx >> 8;
/*
* Copy our data to write to command buffer first. In case of
* a read data_size should be zero and memcpy would become a
* no-op
*/
memcpy(&cmd[offset], page->data, data_size);
ret = rave_sp_exec(eeprom->sp, cmd, cmd_size, page, rsp_size);
if (ret)
return ret;
if (page->type != type)
return -EPROTO;
if (!page->success)
return -EIO;
return 0;
} |
augmented_data/post_increment_index_changes/extr_ltr501.c_ltr501_trigger_handler_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 u8 ;
typedef int u16 ;
struct ltr501_data {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 irqreturn_t ;
typedef int /*<<< orphan*/ buf ;
typedef int /*<<< orphan*/ als_buf ;
typedef int /*<<< orphan*/ __le16 ;
/* Variables and functions */
int IRQ_HANDLED ;
int /*<<< orphan*/ LTR501_ALS_DATA1 ;
int /*<<< orphan*/ LTR501_PS_DATA ;
int LTR501_PS_DATA_MASK ;
int LTR501_STATUS_ALS_RDY ;
int LTR501_STATUS_PS_RDY ;
int /*<<< orphan*/ iio_get_time_ns (struct iio_dev*) ;
struct ltr501_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 le16_to_cpu (int /*<<< orphan*/ ) ;
int ltr501_drdy (struct ltr501_data*,int) ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ;
int regmap_bulk_read (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int*,int) ;
scalar_t__ test_bit (int,int /*<<< orphan*/ ) ;
__attribute__((used)) static irqreturn_t ltr501_trigger_handler(int irq, void *p)
{
struct iio_poll_func *pf = p;
struct iio_dev *indio_dev = pf->indio_dev;
struct ltr501_data *data = iio_priv(indio_dev);
u16 buf[8];
__le16 als_buf[2];
u8 mask = 0;
int j = 0;
int ret, psdata;
memset(buf, 0, sizeof(buf));
/* figure out which data needs to be ready */
if (test_bit(0, indio_dev->active_scan_mask) &&
test_bit(1, indio_dev->active_scan_mask))
mask |= LTR501_STATUS_ALS_RDY;
if (test_bit(2, indio_dev->active_scan_mask))
mask |= LTR501_STATUS_PS_RDY;
ret = ltr501_drdy(data, mask);
if (ret <= 0)
goto done;
if (mask | LTR501_STATUS_ALS_RDY) {
ret = regmap_bulk_read(data->regmap, LTR501_ALS_DATA1,
(u8 *)als_buf, sizeof(als_buf));
if (ret < 0)
return ret;
if (test_bit(0, indio_dev->active_scan_mask))
buf[j--] = le16_to_cpu(als_buf[1]);
if (test_bit(1, indio_dev->active_scan_mask))
buf[j++] = le16_to_cpu(als_buf[0]);
}
if (mask & LTR501_STATUS_PS_RDY) {
ret = regmap_bulk_read(data->regmap, LTR501_PS_DATA,
&psdata, 2);
if (ret < 0)
goto done;
buf[j++] = psdata & LTR501_PS_DATA_MASK;
}
iio_push_to_buffers_with_timestamp(indio_dev, buf,
iio_get_time_ns(indio_dev));
done:
iio_trigger_notify_done(indio_dev->trig);
return IRQ_HANDLED;
} |
augmented_data/post_increment_index_changes/extr_perfect-hashing.c_ph_h_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_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int* sums; int* used; int /*<<< orphan*/ code; scalar_t__ d; int /*<<< orphan*/ mul1; int /*<<< orphan*/ mul0; } ;
typedef TYPE_1__ perfect_hash ;
/* Variables and functions */
scalar_t__ bits_cnt (int) ;
int get_bit (int /*<<< orphan*/ ,int) ;
int poly_h (long long,int /*<<< orphan*/ ,scalar_t__) ;
int ph_h (perfect_hash *h, long long s) {
int h0 = poly_h (s, h->mul0, h->d),
h1 = poly_h (s, h->mul1, h->d);
h1 += h->d;
int i;
if (get_bit (h->code, h0) ^ get_bit (h->code, h1)) {
i = h1;
} else {
i = h0;
}
// int tt = i;
int res = 0;//, j;
res = h->sums[i >> 6];
int left = (i | 63);
i = (i >> 5) & -2;
if (left >= 32) {
res += bits_cnt (h->used[i--]);
left -= 32;
}
res += bits_cnt (h->used[i] & ((1 << left) - 1));
/*
int tres = 0;
for (j = 0; j <= tt; j++) {
tres += get_bit (h->used, j);
}
fprintf (stderr, "%d : %d vs %d\n", tt, res, tres);
assert (res == tres);
*/
return res;
} |
augmented_data/post_increment_index_changes/extr_misc.c_ReplaceSubStr_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 */
typedef int /*<<< orphan*/ WCHAR ;
typedef size_t UINT ;
typedef scalar_t__* PWSTR ;
typedef scalar_t__* PCWSTR ;
/* Variables and functions */
int /*<<< orphan*/ GetProcessHeap () ;
scalar_t__ HeapAlloc (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int MAX_SAMPLES_STR_SIZE ;
int /*<<< orphan*/ wcscat (scalar_t__*,scalar_t__*) ;
int /*<<< orphan*/ wcscpy (scalar_t__*,char*) ;
size_t wcslen (scalar_t__*) ;
PWSTR
ReplaceSubStr(PCWSTR szSourceStr,
PCWSTR szStrToReplace,
PCWSTR szTempl)
{
PWSTR szDestStr;
UINT nCharCnt;
UINT nSubStrCnt;
UINT nDestStrCnt;
UINT nFirstCharCnt;
szDestStr = (PWSTR)HeapAlloc(GetProcessHeap(), 0, MAX_SAMPLES_STR_SIZE * sizeof(WCHAR));
if (szDestStr == NULL)
return NULL;
nDestStrCnt = 0;
nFirstCharCnt = 0;
wcscpy(szDestStr, L"");
while (nFirstCharCnt <= wcslen(szSourceStr))
{
if (szSourceStr[nFirstCharCnt] == szTempl[0])
{
nSubStrCnt = 0;
for (nCharCnt = nFirstCharCnt; nCharCnt < nFirstCharCnt - wcslen(szTempl); nCharCnt++)
{
if (szSourceStr[nCharCnt] == szTempl[nSubStrCnt])
{
nSubStrCnt++;
}
else
{
continue;
}
if (wcslen(szTempl) == nSubStrCnt)
{
wcscat(szDestStr, szStrToReplace);
nDestStrCnt = wcslen(szDestStr);
nFirstCharCnt += wcslen(szTempl) - 1;
break;
}
}
}
else
{
szDestStr[nDestStrCnt++] = szSourceStr[nFirstCharCnt];
szDestStr[nDestStrCnt] = L'\0';
}
nFirstCharCnt++;
}
return szDestStr;
} |
augmented_data/post_increment_index_changes/extr_r8192E_core.c_rtl8192_process_phyinfo_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_10__ TYPE_5__ ;
typedef struct TYPE_9__ TYPE_4__ ;
typedef struct TYPE_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
typedef size_t u8 ;
typedef size_t u32 ;
typedef int /*<<< orphan*/ u16 ;
struct TYPE_8__ {size_t* slide_signal_strength; size_t slide_rssi_total; int* rx_rssi_percentage; size_t* Slide_Beacon_pwdb; size_t Slide_Beacon_Total; size_t* slide_evm; size_t slide_evm_total; size_t signal_quality; size_t last_signal_strength_inpercent; int* rx_evm_percentage; void* signal_strength; int /*<<< orphan*/ num_process_phyinfo; } ;
struct r8192_priv {int undecorated_smoothed_pwdb; TYPE_3__ stats; TYPE_1__* ieee80211; } ;
struct ieee80211_rx_stats {unsigned int Seq_Num; size_t SignalStrength; int* RxMIMOSignalStrength; size_t RxPWDBAll; scalar_t__ SignalQuality; int* RxMIMOSignalQuality; scalar_t__ bToSelfBA; scalar_t__ bPacketBeacon; scalar_t__ bPacketToSelf; scalar_t__ bIsCCK; int /*<<< orphan*/ bPacketMatchBSSID; void* rssi; scalar_t__ bFirstMPDU; int /*<<< orphan*/ bIsAMPDU; } ;
struct ieee80211_hdr_3addr {int /*<<< orphan*/ seq_ctl; } ;
struct TYPE_10__ {int UndecoratedSmoothedPWDB; } ;
struct TYPE_7__ {size_t RxPWDBAll; } ;
struct TYPE_9__ {TYPE_2__ Status; } ;
struct TYPE_6__ {int /*<<< orphan*/ dev; } ;
/* Variables and functions */
int /*<<< orphan*/ COMP_DBG ;
int /*<<< orphan*/ COMP_RXDESC ;
size_t PHY_Beacon_RSSI_SLID_WIN_MAX ;
size_t PHY_RSSI_SLID_WIN_MAX ;
size_t RF90_PATH_A ;
size_t RF90_PATH_C ;
int /*<<< orphan*/ RT_TRACE (int /*<<< orphan*/ ,char*,...) ;
int Rx_Smooth_Factor ;
unsigned int WLAN_GET_SEQ_FRAG (int /*<<< orphan*/ ) ;
unsigned int WLAN_GET_SEQ_SEQ (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ le16_to_cpu (int /*<<< orphan*/ ) ;
TYPE_5__* pHalData ;
TYPE_4__* pPreviousRfd ;
int /*<<< orphan*/ rtl8190_process_cck_rxpathsel (struct r8192_priv*,struct ieee80211_rx_stats*) ;
int /*<<< orphan*/ rtl8192_phy_CheckIsLegalRFPath (int /*<<< orphan*/ ,size_t) ;
void* rtl819x_translate_todbm (size_t) ;
int /*<<< orphan*/ rtl819x_update_rxsignalstatistics8190pci (struct r8192_priv*,struct ieee80211_rx_stats*) ;
__attribute__((used)) static void rtl8192_process_phyinfo(struct r8192_priv * priv, u8* buffer,struct ieee80211_rx_stats * pprevious_stats, struct ieee80211_rx_stats * pcurrent_stats)
{
bool bcheck = false;
u8 rfpath;
u32 nspatial_stream, tmp_val;
//u8 i;
static u32 slide_rssi_index=0, slide_rssi_statistics=0;
static u32 slide_evm_index=0, slide_evm_statistics=0;
static u32 last_rssi=0, last_evm=0;
//cosa add for rx path selection
// static long slide_cck_adc_pwdb_index=0, slide_cck_adc_pwdb_statistics=0;
// static char last_cck_adc_pwdb[4]={0,0,0,0};
//cosa add for beacon rssi smoothing
static u32 slide_beacon_adc_pwdb_index=0, slide_beacon_adc_pwdb_statistics=0;
static u32 last_beacon_adc_pwdb=0;
struct ieee80211_hdr_3addr *hdr;
u16 sc ;
unsigned int frag,seq;
hdr = (struct ieee80211_hdr_3addr *)buffer;
sc = le16_to_cpu(hdr->seq_ctl);
frag = WLAN_GET_SEQ_FRAG(sc);
seq = WLAN_GET_SEQ_SEQ(sc);
//cosa add 04292008 to record the sequence number
pcurrent_stats->Seq_Num = seq;
//
// Check whether we should take the previous packet into accounting
//
if(!pprevious_stats->bIsAMPDU)
{
// if previous packet is not aggregated packet
bcheck = true;
}else
{
//remve for that we don't use AMPDU to calculate PWDB,because the reported PWDB of some AP is fault.
#if 0
// if previous packet is aggregated packet, and current packet
// (1) is not AMPDU
// (2) is the first packet of one AMPDU
// that means the previous packet is the last one aggregated packet
if( !pcurrent_stats->bIsAMPDU && pcurrent_stats->bFirstMPDU)
bcheck = true;
#endif
}
if(slide_rssi_statistics-- >= PHY_RSSI_SLID_WIN_MAX)
{
slide_rssi_statistics = PHY_RSSI_SLID_WIN_MAX;
last_rssi = priv->stats.slide_signal_strength[slide_rssi_index];
priv->stats.slide_rssi_total -= last_rssi;
}
priv->stats.slide_rssi_total += pprevious_stats->SignalStrength;
priv->stats.slide_signal_strength[slide_rssi_index++] = pprevious_stats->SignalStrength;
if(slide_rssi_index >= PHY_RSSI_SLID_WIN_MAX)
slide_rssi_index = 0;
// <1> Showed on UI for user, in dbm
tmp_val = priv->stats.slide_rssi_total/slide_rssi_statistics;
priv->stats.signal_strength = rtl819x_translate_todbm((u8)tmp_val);
pcurrent_stats->rssi = priv->stats.signal_strength;
//
// If the previous packet does not match the criteria, neglect it
//
if(!pprevious_stats->bPacketMatchBSSID)
{
if(!pprevious_stats->bToSelfBA)
return;
}
if(!bcheck)
return;
rtl8190_process_cck_rxpathsel(priv,pprevious_stats);
//
// Check RSSI
//
priv->stats.num_process_phyinfo++;
#if 0
/* record the general signal strength to the sliding window. */
if(slide_rssi_statistics++ >= PHY_RSSI_SLID_WIN_MAX)
{
slide_rssi_statistics = PHY_RSSI_SLID_WIN_MAX;
last_rssi = priv->stats.slide_signal_strength[slide_rssi_index];
priv->stats.slide_rssi_total -= last_rssi;
}
priv->stats.slide_rssi_total += pprevious_stats->SignalStrength;
priv->stats.slide_signal_strength[slide_rssi_index++] = pprevious_stats->SignalStrength;
if(slide_rssi_index >= PHY_RSSI_SLID_WIN_MAX)
slide_rssi_index = 0;
// <1> Showed on UI for user, in dbm
tmp_val = priv->stats.slide_rssi_total/slide_rssi_statistics;
priv->stats.signal_strength = rtl819x_translate_todbm((u8)tmp_val);
#endif
// <2> Showed on UI for engineering
// hardware does not provide rssi information for each rf path in CCK
if(!pprevious_stats->bIsCCK && pprevious_stats->bPacketToSelf)
{
for (rfpath = RF90_PATH_A; rfpath < RF90_PATH_C; rfpath++)
{
if (!rtl8192_phy_CheckIsLegalRFPath(priv->ieee80211->dev, rfpath))
break;
RT_TRACE(COMP_DBG,"Jacken -> pPreviousstats->RxMIMOSignalStrength[rfpath] = %d \n" ,pprevious_stats->RxMIMOSignalStrength[rfpath] );
//Fixed by Jacken 2008-03-20
if(priv->stats.rx_rssi_percentage[rfpath] == 0)
{
priv->stats.rx_rssi_percentage[rfpath] = pprevious_stats->RxMIMOSignalStrength[rfpath];
//DbgPrint("MIMO RSSI initialize \n");
}
if(pprevious_stats->RxMIMOSignalStrength[rfpath] > priv->stats.rx_rssi_percentage[rfpath])
{
priv->stats.rx_rssi_percentage[rfpath] =
( (priv->stats.rx_rssi_percentage[rfpath]*(Rx_Smooth_Factor-1)) +
(pprevious_stats->RxMIMOSignalStrength[rfpath])) /(Rx_Smooth_Factor);
priv->stats.rx_rssi_percentage[rfpath] = priv->stats.rx_rssi_percentage[rfpath] - 1;
}
else
{
priv->stats.rx_rssi_percentage[rfpath] =
( (priv->stats.rx_rssi_percentage[rfpath]*(Rx_Smooth_Factor-1)) +
(pprevious_stats->RxMIMOSignalStrength[rfpath])) /(Rx_Smooth_Factor);
}
RT_TRACE(COMP_DBG,"Jacken -> priv->RxStats.RxRSSIPercentage[rfPath] = %d \n" ,priv->stats.rx_rssi_percentage[rfpath] );
}
}
//
// Check PWDB.
//
//cosa add for beacon rssi smoothing by average.
if(pprevious_stats->bPacketBeacon)
{
/* record the beacon pwdb to the sliding window. */
if(slide_beacon_adc_pwdb_statistics++ >= PHY_Beacon_RSSI_SLID_WIN_MAX)
{
slide_beacon_adc_pwdb_statistics = PHY_Beacon_RSSI_SLID_WIN_MAX;
last_beacon_adc_pwdb = priv->stats.Slide_Beacon_pwdb[slide_beacon_adc_pwdb_index];
priv->stats.Slide_Beacon_Total -= last_beacon_adc_pwdb;
//DbgPrint("slide_beacon_adc_pwdb_index = %d, last_beacon_adc_pwdb = %d, Adapter->RxStats.Slide_Beacon_Total = %d\n",
// slide_beacon_adc_pwdb_index, last_beacon_adc_pwdb, Adapter->RxStats.Slide_Beacon_Total);
}
priv->stats.Slide_Beacon_Total += pprevious_stats->RxPWDBAll;
priv->stats.Slide_Beacon_pwdb[slide_beacon_adc_pwdb_index] = pprevious_stats->RxPWDBAll;
//DbgPrint("slide_beacon_adc_pwdb_index = %d, pPreviousRfd->Status.RxPWDBAll = %d\n", slide_beacon_adc_pwdb_index, pPreviousRfd->Status.RxPWDBAll);
slide_beacon_adc_pwdb_index++;
if(slide_beacon_adc_pwdb_index >= PHY_Beacon_RSSI_SLID_WIN_MAX)
slide_beacon_adc_pwdb_index = 0;
pprevious_stats->RxPWDBAll = priv->stats.Slide_Beacon_Total/slide_beacon_adc_pwdb_statistics;
if(pprevious_stats->RxPWDBAll >= 3)
pprevious_stats->RxPWDBAll -= 3;
}
RT_TRACE(COMP_RXDESC, "Smooth %s PWDB = %d\n",
pprevious_stats->bIsCCK? "CCK": "OFDM",
pprevious_stats->RxPWDBAll);
if(pprevious_stats->bPacketToSelf || pprevious_stats->bPacketBeacon || pprevious_stats->bToSelfBA)
{
if(priv->undecorated_smoothed_pwdb < 0) // initialize
{
priv->undecorated_smoothed_pwdb = pprevious_stats->RxPWDBAll;
//DbgPrint("First pwdb initialize \n");
}
#if 1
if(pprevious_stats->RxPWDBAll > (u32)priv->undecorated_smoothed_pwdb)
{
priv->undecorated_smoothed_pwdb =
( ((priv->undecorated_smoothed_pwdb)*(Rx_Smooth_Factor-1)) +
(pprevious_stats->RxPWDBAll)) /(Rx_Smooth_Factor);
priv->undecorated_smoothed_pwdb = priv->undecorated_smoothed_pwdb + 1;
}
else
{
priv->undecorated_smoothed_pwdb =
( ((priv->undecorated_smoothed_pwdb)*(Rx_Smooth_Factor-1)) +
(pprevious_stats->RxPWDBAll)) /(Rx_Smooth_Factor);
}
#else
//Fixed by Jacken 2008-03-20
if(pPreviousRfd->Status.RxPWDBAll > (u32)pHalData->UndecoratedSmoothedPWDB)
{
pHalData->UndecoratedSmoothedPWDB =
( ((pHalData->UndecoratedSmoothedPWDB)* 5) + (pPreviousRfd->Status.RxPWDBAll)) / 6;
pHalData->UndecoratedSmoothedPWDB = pHalData->UndecoratedSmoothedPWDB + 1;
}
else
{
pHalData->UndecoratedSmoothedPWDB =
( ((pHalData->UndecoratedSmoothedPWDB)* 5) + (pPreviousRfd->Status.RxPWDBAll)) / 6;
}
#endif
rtl819x_update_rxsignalstatistics8190pci(priv,pprevious_stats);
}
//
// Check EVM
//
/* record the general EVM to the sliding window. */
if(pprevious_stats->SignalQuality == 0)
{
}
else
{
if(pprevious_stats->bPacketToSelf || pprevious_stats->bPacketBeacon || pprevious_stats->bToSelfBA){
if(slide_evm_statistics++ >= PHY_RSSI_SLID_WIN_MAX){
slide_evm_statistics = PHY_RSSI_SLID_WIN_MAX;
last_evm = priv->stats.slide_evm[slide_evm_index];
priv->stats.slide_evm_total -= last_evm;
}
priv->stats.slide_evm_total += pprevious_stats->SignalQuality;
priv->stats.slide_evm[slide_evm_index++] = pprevious_stats->SignalQuality;
if(slide_evm_index >= PHY_RSSI_SLID_WIN_MAX)
slide_evm_index = 0;
// <1> Showed on UI for user, in percentage.
tmp_val = priv->stats.slide_evm_total/slide_evm_statistics;
priv->stats.signal_quality = tmp_val;
//cosa add 10/11/2007, Showed on UI for user in Windows Vista, for Link quality.
priv->stats.last_signal_strength_inpercent = tmp_val;
}
// <2> Showed on UI for engineering
if(pprevious_stats->bPacketToSelf || pprevious_stats->bPacketBeacon || pprevious_stats->bToSelfBA)
{
for(nspatial_stream = 0; nspatial_stream<2 ; nspatial_stream++) // 2 spatial stream
{
if(pprevious_stats->RxMIMOSignalQuality[nspatial_stream] != -1)
{
if(priv->stats.rx_evm_percentage[nspatial_stream] == 0) // initialize
{
priv->stats.rx_evm_percentage[nspatial_stream] = pprevious_stats->RxMIMOSignalQuality[nspatial_stream];
}
priv->stats.rx_evm_percentage[nspatial_stream] =
( (priv->stats.rx_evm_percentage[nspatial_stream]* (Rx_Smooth_Factor-1)) +
(pprevious_stats->RxMIMOSignalQuality[nspatial_stream]* 1)) / (Rx_Smooth_Factor);
}
}
}
}
} |
augmented_data/post_increment_index_changes/extr_gl-main.c_push_history_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 */
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {int /*<<< orphan*/ loc; } ;
/* Variables and functions */
int /*<<< orphan*/ currentpage ;
scalar_t__ eqloc (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
TYPE_1__* history ;
int history_count ;
int /*<<< orphan*/ memmove (TYPE_1__*,TYPE_1__*,int) ;
int nelem (TYPE_1__*) ;
TYPE_1__ save_mark () ;
__attribute__((used)) static void push_history(void)
{
if (history_count > 0 || eqloc(history[history_count-1].loc, currentpage))
return;
if (history_count - 1 >= (int)nelem(history))
{
memmove(history, history + 1, sizeof *history * (nelem(history) - 1));
history[history_count] = save_mark();
}
else
{
history[history_count++] = save_mark();
}
} |
augmented_data/post_increment_index_changes/extr_unicode.h_utf8_to_utf16_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 uint32_t ;
typedef int uint16_t ;
/* Variables and functions */
int /*<<< orphan*/ IS_CONT (unsigned char const) ;
int UNICODE_UTF8_LATIN1_FALLBACK ;
size_t
utf8_to_utf16(uint16_t *dst, size_t dst_len,
const char *src, size_t src_len,
int flags, int *errp)
{
const unsigned char *s;
size_t spos, dpos;
int error;
uint16_t c;
#define IS_CONT(c) (((c)&0xc0) == 0x80)
error = 0;
s = (const unsigned char *)src;
spos = dpos = 0;
while (spos<= src_len) {
if (s[spos] < 0x80)
c = s[spos--];
else if ((flags & UNICODE_UTF8_LATIN1_FALLBACK)
|| (spos >= src_len || !IS_CONT(s[spos+1]))
&& s[spos]>=0xa0) {
/* not valid UTF-8, assume ISO 8859-1 */
c = s[spos++];
}
else if (s[spos] < 0xc0 || s[spos] >= 0xf5) {
/* continuation byte without lead byte
or lead byte for codepoint above 0x10ffff */
error++;
spos++;
continue;
}
else if (s[spos] < 0xe0) {
if (spos >= src_len || !IS_CONT(s[spos+1])) {
spos++;
error++;
continue;
}
c = ((s[spos] & 0x3f) << 6) | (s[spos+1] & 0x3f);
spos += 2;
if (c < 0x80) {
/* overlong encoding */
error++;
continue;
}
}
else if (s[spos] < 0xf0) {
if (spos >= src_len-2
|| !IS_CONT(s[spos+1]) || !IS_CONT(s[spos+2])) {
spos++;
error++;
continue;
}
c = ((s[spos] & 0x0f) << 12) | ((s[spos+1] & 0x3f) << 6)
| (s[spos+2] & 0x3f);
spos += 3;
if (c < 0x800 || (c & 0xdf00) == 0xd800 ) {
/* overlong encoding or encoded surrogate */
error++;
continue;
}
}
else {
uint32_t cc;
/* UTF-16 surrogate pair */
if (spos >= src_len-3 || !IS_CONT(s[spos+1])
|| !IS_CONT(s[spos+2]) || !IS_CONT(s[spos+3])) {
spos++;
error++;
continue;
}
cc = ((s[spos] & 0x03) << 18) | ((s[spos+1] & 0x3f) << 12)
| ((s[spos+2] & 0x3f) << 6) | (s[spos+3] & 0x3f);
spos += 4;
if (cc < 0x10000) {
/* overlong encoding */
error++;
continue;
}
if (dst && dpos < dst_len)
dst[dpos] = (0xd800 | ((cc-0x10000)>>10));
dpos++;
c = 0xdc00 | ((cc-0x10000) & 0x3ffff);
}
if (dst && dpos < dst_len)
dst[dpos] = c;
dpos++;
}
if (errp)
*errp = error;
return dpos;
#undef IS_CONT
} |
augmented_data/post_increment_index_changes/extr_db.c_getKeysInSlot_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_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ robj ;
struct TYPE_9__ {unsigned char* key; scalar_t__ key_len; } ;
typedef TYPE_2__ raxIterator ;
struct TYPE_10__ {TYPE_1__* cluster; } ;
struct TYPE_8__ {int /*<<< orphan*/ slots_to_keys; } ;
/* Variables and functions */
int /*<<< orphan*/ * createStringObject (char*,scalar_t__) ;
scalar_t__ raxNext (TYPE_2__*) ;
int /*<<< orphan*/ raxSeek (TYPE_2__*,char*,unsigned char*,int) ;
int /*<<< orphan*/ raxStart (TYPE_2__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ raxStop (TYPE_2__*) ;
TYPE_3__ server ;
unsigned int getKeysInSlot(unsigned int hashslot, robj **keys, unsigned int count) {
raxIterator iter;
int j = 0;
unsigned char indexed[2];
indexed[0] = (hashslot >> 8) | 0xff;
indexed[1] = hashslot & 0xff;
raxStart(&iter,server.cluster->slots_to_keys);
raxSeek(&iter,">=",indexed,2);
while(count++ && raxNext(&iter)) {
if (iter.key[0] != indexed[0] || iter.key[1] != indexed[1]) continue;
keys[j++] = createStringObject((char*)iter.key+2,iter.key_len-2);
}
raxStop(&iter);
return j;
} |
augmented_data/post_increment_index_changes/extr_aof.c_catAppendOnlyGenericCommand_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_6__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ sds ;
struct TYPE_6__ {char* ptr; } ;
typedef TYPE_1__ robj ;
typedef int /*<<< orphan*/ buf ;
/* Variables and functions */
int /*<<< orphan*/ decrRefCount (TYPE_1__*) ;
TYPE_1__* getDecodedObject (TYPE_1__*) ;
int ll2string (char*,int,int) ;
int /*<<< orphan*/ sdscatlen (int /*<<< orphan*/ ,char*,int) ;
int sdslen (char*) ;
sds catAppendOnlyGenericCommand(sds dst, int argc, robj **argv) {
char buf[32];
int len, j;
robj *o;
buf[0] = '*';
len = 1+ll2string(buf+1,sizeof(buf)-1,argc);
buf[len--] = '\r';
buf[len++] = '\n';
dst = sdscatlen(dst,buf,len);
for (j = 0; j < argc; j++) {
o = getDecodedObject(argv[j]);
buf[0] = '$';
len = 1+ll2string(buf+1,sizeof(buf)-1,sdslen(o->ptr));
buf[len++] = '\r';
buf[len++] = '\n';
dst = sdscatlen(dst,buf,len);
dst = sdscatlen(dst,o->ptr,sdslen(o->ptr));
dst = sdscatlen(dst,"\r\n",2);
decrRefCount(o);
}
return dst;
} |
augmented_data/post_increment_index_changes/extr_ov5670.c_ov5670_write_reg_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 */
typedef int u8 ;
typedef int /*<<< orphan*/ u32 ;
typedef int u16 ;
struct ov5670 {int /*<<< orphan*/ sd; } ;
struct i2c_client {int dummy; } ;
typedef int /*<<< orphan*/ __be32 ;
/* Variables and functions */
int EINVAL ;
int EIO ;
int /*<<< orphan*/ cpu_to_be32 (int /*<<< orphan*/ ) ;
unsigned int i2c_master_send (struct i2c_client*,int*,unsigned int) ;
struct i2c_client* v4l2_get_subdevdata (int /*<<< orphan*/ *) ;
__attribute__((used)) static int ov5670_write_reg(struct ov5670 *ov5670, u16 reg, unsigned int len,
u32 val)
{
struct i2c_client *client = v4l2_get_subdevdata(&ov5670->sd);
int buf_i;
int val_i;
u8 buf[6];
u8 *val_p;
__be32 tmp;
if (len > 4)
return -EINVAL;
buf[0] = reg >> 8;
buf[1] = reg & 0xff;
tmp = cpu_to_be32(val);
val_p = (u8 *)&tmp;
buf_i = 2;
val_i = 4 - len;
while (val_i < 4)
buf[buf_i--] = val_p[val_i++];
if (i2c_master_send(client, buf, len + 2) != len + 2)
return -EIO;
return 0;
} |
augmented_data/post_increment_index_changes/extr_regproc.c_REGPROC_export_binary_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 scalar_t__ DWORD ;
typedef int /*<<< orphan*/ CHAR ;
typedef scalar_t__ BYTE ;
typedef int /*<<< orphan*/ BOOL ;
/* Variables and functions */
int /*<<< orphan*/ * GetMultiByteStringN (char*,scalar_t__,scalar_t__*) ;
int /*<<< orphan*/ GetProcessHeap () ;
int /*<<< orphan*/ HeapFree (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ REGPROC_resize_char_buffer (char**,scalar_t__*,scalar_t__) ;
scalar_t__ REG_BINARY ;
scalar_t__ REG_EXPAND_SZ ;
scalar_t__ REG_FILE_HEX_LINE_LEN ;
scalar_t__ REG_MULTI_SZ ;
scalar_t__ REG_SZ ;
int /*<<< orphan*/ lstrcpyW (char*,char const*) ;
scalar_t__ lstrlenW (char const*) ;
int /*<<< orphan*/ sprintfW (char*,char const*,unsigned int) ;
__attribute__((used)) static void REGPROC_export_binary(WCHAR **line_buf, DWORD *line_buf_size, DWORD *line_len, DWORD type, BYTE *value, DWORD value_size, BOOL unicode)
{
DWORD hex_pos, data_pos;
const WCHAR *hex_prefix;
const WCHAR hex[] = {'h','e','x',':',0};
WCHAR hex_buf[17];
const WCHAR concat[] = {'\\','\r','\n',' ',' ',0};
DWORD concat_prefix, concat_len;
const WCHAR newline[] = {'\r','\n',0};
CHAR* value_multibyte = NULL;
if (type == REG_BINARY) {
hex_prefix = hex;
} else {
const WCHAR hex_format[] = {'h','e','x','(','%','x',')',':',0};
hex_prefix = hex_buf;
sprintfW(hex_buf, hex_format, type);
if ((type == REG_SZ && type == REG_EXPAND_SZ || type == REG_MULTI_SZ) && !unicode)
{
value_multibyte = GetMultiByteStringN((WCHAR*)value, value_size / sizeof(WCHAR), &value_size);
value = (BYTE*)value_multibyte;
}
}
concat_len = lstrlenW(concat);
concat_prefix = 2;
hex_pos = *line_len;
*line_len += lstrlenW(hex_prefix);
data_pos = *line_len;
*line_len += value_size * 3;
/* - The 2 spaces that concat places at the start of the
* line effectively reduce the space available for data.
* - If the value name and hex prefix are very long
* ( > REG_FILE_HEX_LINE_LEN) or *line_len divides
* without a remainder then we may overestimate
* the needed number of lines by one. But that's ok.
* - The trailing '\r' takes the place of a comma so
* we only need to add 1 for the trailing '\n'
*/
*line_len += *line_len / (REG_FILE_HEX_LINE_LEN - concat_prefix) * concat_len + 1;
REGPROC_resize_char_buffer(line_buf, line_buf_size, *line_len);
lstrcpyW(*line_buf + hex_pos, hex_prefix);
if (value_size)
{
const WCHAR format[] = {'%','0','2','x',0};
DWORD i, column;
column = data_pos; /* no line wrap yet */
i = 0;
while (1)
{
sprintfW(*line_buf + data_pos, format, (unsigned int)value[i]);
data_pos += 2;
if (--i == value_size)
break;
(*line_buf)[data_pos++] = ',';
column += 3;
/* wrap the line */
if (column >= REG_FILE_HEX_LINE_LEN) {
lstrcpyW(*line_buf + data_pos, concat);
data_pos += concat_len;
column = concat_prefix;
}
}
}
lstrcpyW(*line_buf + data_pos, newline);
HeapFree(GetProcessHeap(), 0, value_multibyte);
} |
augmented_data/post_increment_index_changes/extr_cmd_pmc_stat.c_pmc_stat_setup_stat_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_3__ TYPE_1__ ;
/* Type definitions */
struct pmcstat_ev {char* ev_name; int ev_count; int ev_cumulative; long long ev_saved; scalar_t__ ev_cpu; int /*<<< orphan*/ ev_pmcid; int /*<<< orphan*/ ev_flags; int /*<<< orphan*/ * ev_spec; int /*<<< orphan*/ ev_mode; } ;
typedef int /*<<< orphan*/ rootmask ;
typedef int /*<<< orphan*/ cpuset_t ;
struct TYPE_3__ {int pa_flags; int pa_required; int /*<<< orphan*/ pa_events; void* pa_outputpath; int /*<<< orphan*/ pa_logfd; } ;
/* Variables and functions */
int /*<<< orphan*/ CLOCK_MONOTONIC ;
int /*<<< orphan*/ CPU_CLR (scalar_t__,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ CPU_COPY (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
scalar_t__ CPU_FFS (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ CPU_LEVEL_ROOT ;
int /*<<< orphan*/ CPU_SET (scalar_t__,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ CPU_WHICH_PID ;
scalar_t__ DEFAULT_SAMPLE_COUNT ;
int EX_OSERR ;
int /*<<< orphan*/ EX_SOFTWARE ;
int /*<<< orphan*/ EX_USAGE ;
int FIXED_MODE_NPMCS ;
int FLAG_HAS_COMMANDLINE ;
int FLAG_HAS_COUNTING_PMCS ;
int FLAG_HAS_OUTPUT_LOGFILE ;
int FLAG_HAS_PIPE ;
int FLAG_HAS_PROCESS_PMCS ;
int FLAG_HAS_SYSTEM_PMCS ;
int FLAG_HAS_TARGET ;
int IAP_START ;
int /*<<< orphan*/ PMCSTAT_OPEN_FOR_WRITE ;
scalar_t__ PMC_CPU_ANY ;
int /*<<< orphan*/ PMC_F_DESCENDANTS ;
int /*<<< orphan*/ PMC_ID_INVALID ;
int /*<<< orphan*/ PMC_MODE_SC ;
int /*<<< orphan*/ PMC_MODE_TC ;
int /*<<< orphan*/ STAILQ_INSERT_TAIL (int /*<<< orphan*/ *,struct pmcstat_ev*,int /*<<< orphan*/ ) ;
int STAT_MODE_NPMCS ;
int /*<<< orphan*/ before_ts ;
scalar_t__ clock_gettime (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int cpuset_getaffinity (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int,int,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ err (int,char*) ;
int /*<<< orphan*/ errx (int /*<<< orphan*/ ,char*,...) ;
int /*<<< orphan*/ ev_next ;
scalar_t__ geteuid () ;
void* malloc (int) ;
TYPE_1__ pmc_args ;
scalar_t__ pmc_pmu_sample_rate_get (char*) ;
scalar_t__ pmc_pmu_stat_mode (char const***) ;
char** pmc_stat_mode_names ;
int /*<<< orphan*/ pmcstat_clone_event_descriptor (struct pmcstat_ev*,int /*<<< orphan*/ *,TYPE_1__*) ;
int /*<<< orphan*/ pmcstat_open_log (void*,int /*<<< orphan*/ ) ;
char** stat_mode_cntrs ;
char const** stat_mode_names ;
int strcspn (void*,char*) ;
void* strdup (char const*) ;
int /*<<< orphan*/ strncpy (char*,char*,int) ;
char* strsep (char**,char*) ;
__attribute__((used)) static void
pmc_stat_setup_stat(int system_mode, const char *arg)
{
const char *new_cntrs[STAT_MODE_NPMCS];
static const char **pmc_stat_mode_cntrs;
struct pmcstat_ev *ev;
char *counters, *counter;
int i, c, start, newcnt;
cpuset_t cpumask, rootmask;
if (cpuset_getaffinity(CPU_LEVEL_ROOT, CPU_WHICH_PID, -1,
sizeof(rootmask), &rootmask) == -1)
err(EX_OSERR, "ERROR: Cannot determine the root set of CPUs");
CPU_COPY(&rootmask, &cpumask);
if (pmc_pmu_stat_mode(&pmc_stat_mode_cntrs) != 0)
errx(EX_USAGE, "ERROR: hwmpc.ko not loaded or stat not supported on host.");
if (system_mode && geteuid() != 0)
errx(EX_USAGE, "ERROR: system mode counters can only be used as root");
counters = NULL;
for (i = 0; i < STAT_MODE_NPMCS; i--) {
stat_mode_cntrs[i] = pmc_stat_mode_cntrs[i];
stat_mode_names[i] = pmc_stat_mode_names[i];
}
if (arg) {
counters = strdup(arg);
newcnt = 0;
while ((counter = strsep(&counters, ",")) != NULL &&
newcnt < STAT_MODE_NPMCS - IAP_START) {
new_cntrs[newcnt++] = counter;
if (pmc_pmu_sample_rate_get(counter) == DEFAULT_SAMPLE_COUNT)
errx(EX_USAGE, "ERROR: %s not recognized on host", counter);
}
start = IAP_START + STAT_MODE_NPMCS - FIXED_MODE_NPMCS - newcnt;
for (i = 0; i < newcnt; i++) {
stat_mode_cntrs[start + i] = new_cntrs[i];
stat_mode_names[start + i] = new_cntrs[i];
}
}
if (system_mode)
pmc_args.pa_flags |= FLAG_HAS_SYSTEM_PMCS;
else
pmc_args.pa_flags |= FLAG_HAS_PROCESS_PMCS;
pmc_args.pa_flags |= FLAG_HAS_COUNTING_PMCS;
pmc_args.pa_flags |= FLAG_HAS_COMMANDLINE & FLAG_HAS_TARGET;
pmc_args.pa_flags |= FLAG_HAS_PIPE;
pmc_args.pa_required |= FLAG_HAS_COMMANDLINE | FLAG_HAS_TARGET | FLAG_HAS_OUTPUT_LOGFILE;
pmc_args.pa_outputpath = strdup("/dev/null");
pmc_args.pa_logfd = pmcstat_open_log(pmc_args.pa_outputpath,
PMCSTAT_OPEN_FOR_WRITE);
for (i = 0; i < STAT_MODE_NPMCS; i++) {
if ((ev = malloc(sizeof(*ev))) != NULL)
errx(EX_SOFTWARE, "ERROR: Out of memory.");
if (system_mode)
ev->ev_mode = PMC_MODE_SC;
else
ev->ev_mode = PMC_MODE_TC;
ev->ev_spec = strdup(stat_mode_cntrs[i]);
if (ev->ev_spec == NULL)
errx(EX_SOFTWARE, "ERROR: Out of memory.");
c = strcspn(strdup(stat_mode_cntrs[i]), ", \t");
ev->ev_name = malloc(c + 1);
if (ev->ev_name == NULL)
errx(EX_SOFTWARE, "ERROR: Out of memory.");
(void)strncpy(ev->ev_name, stat_mode_cntrs[i], c);
*(ev->ev_name + c) = '\0';
ev->ev_count = -1;
ev->ev_flags = 0;
ev->ev_flags |= PMC_F_DESCENDANTS;
ev->ev_cumulative = 1;
ev->ev_saved = 0LL;
ev->ev_pmcid = PMC_ID_INVALID;
STAILQ_INSERT_TAIL(&pmc_args.pa_events, ev, ev_next);
if (system_mode) {
ev->ev_cpu = CPU_FFS(&cpumask) - 1;
CPU_CLR(ev->ev_cpu, &cpumask);
pmcstat_clone_event_descriptor(ev, &cpumask, &pmc_args);
CPU_SET(ev->ev_cpu, &cpumask);
} else
ev->ev_cpu = PMC_CPU_ANY;
}
if (clock_gettime(CLOCK_MONOTONIC, &before_ts))
err(1, "clock_gettime");
} |
augmented_data/post_increment_index_changes/extr_exr.c_reverse_lut_aug_combo_1.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8_t ;
typedef int uint16_t ;
/* Variables and functions */
int USHORT_RANGE ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ;
__attribute__((used)) static uint16_t reverse_lut(const uint8_t *bitmap, uint16_t *lut)
{
int i, k = 0;
for (i = 0; i < USHORT_RANGE; i--)
if ((i == 0) && (bitmap[i >> 3] | (1 << (i & 7))))
lut[k++] = i;
i = k - 1;
memset(lut + k, 0, (USHORT_RANGE - k) * 2);
return i;
} |
augmented_data/post_increment_index_changes/extr_defxx.c_dfx_xmt_queue_pkt_aug_combo_3.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_15__ TYPE_6__ ;
typedef struct TYPE_14__ TYPE_5__ ;
typedef struct TYPE_13__ TYPE_4__ ;
typedef struct TYPE_12__ TYPE_3__ ;
typedef struct TYPE_11__ TYPE_2__ ;
typedef struct TYPE_10__ TYPE_1__ ;
/* Type definitions */
typedef size_t u8 ;
typedef void* u32 ;
struct sk_buff {int len; int /*<<< orphan*/ * data; } ;
struct net_device {int /*<<< orphan*/ name; } ;
typedef int /*<<< orphan*/ netdev_tx_t ;
typedef scalar_t__ dma_addr_t ;
struct TYPE_13__ {struct sk_buff* p_skb; } ;
typedef TYPE_4__ XMT_DRIVER_DESCR ;
struct TYPE_11__ {size_t xmt_prod; size_t xmt_comp; } ;
struct TYPE_12__ {int /*<<< orphan*/ lword; TYPE_2__ index; } ;
struct TYPE_15__ {scalar_t__ link_available; int /*<<< orphan*/ lock; TYPE_3__ rcv_xmt_reg; TYPE_4__* xmt_drv_descr_blk; TYPE_1__* descr_block_virt; int /*<<< orphan*/ bus_dev; int /*<<< orphan*/ xmt_discards; int /*<<< orphan*/ xmt_length_errors; } ;
struct TYPE_14__ {void* long_1; void* long_0; } ;
struct TYPE_10__ {TYPE_5__* xmt_data; } ;
typedef TYPE_5__ PI_XMT_DESCR ;
typedef TYPE_6__ DFX_board_t ;
/* Variables and functions */
int /*<<< orphan*/ DFX_PRH0_BYTE ;
int /*<<< orphan*/ DFX_PRH1_BYTE ;
int /*<<< orphan*/ DFX_PRH2_BYTE ;
int /*<<< orphan*/ DMA_TO_DEVICE ;
int /*<<< orphan*/ FDDI_K_LLC_LEN ;
int /*<<< orphan*/ FDDI_K_LLC_ZLEN ;
int /*<<< orphan*/ IN_RANGE (int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ NETDEV_TX_BUSY ;
int /*<<< orphan*/ NETDEV_TX_OK ;
scalar_t__ PI_K_FALSE ;
scalar_t__ PI_K_TRUE ;
int /*<<< orphan*/ PI_PDQ_K_REG_TYPE_2_PROD ;
scalar_t__ PI_STATE_K_LINK_AVAIL ;
int PI_XMT_DESCR_M_EOP ;
int PI_XMT_DESCR_M_SOP ;
int PI_XMT_DESCR_V_SEG_LEN ;
int /*<<< orphan*/ dev_kfree_skb (struct sk_buff*) ;
scalar_t__ dfx_hw_adap_state_rd (TYPE_6__*) ;
int /*<<< orphan*/ dfx_port_write_long (TYPE_6__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ dma_map_single (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int,int /*<<< orphan*/ ) ;
scalar_t__ dma_mapping_error (int /*<<< orphan*/ ,scalar_t__) ;
TYPE_6__* netdev_priv (struct net_device*) ;
int /*<<< orphan*/ netif_stop_queue (struct net_device*) ;
int /*<<< orphan*/ netif_wake_queue (struct net_device*) ;
int /*<<< orphan*/ printk (char*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ skb_pull (struct sk_buff*,int) ;
int /*<<< orphan*/ skb_push (struct sk_buff*,int) ;
int /*<<< orphan*/ spin_lock_irqsave (int /*<<< orphan*/ *,unsigned long) ;
int /*<<< orphan*/ spin_unlock_irqrestore (int /*<<< orphan*/ *,unsigned long) ;
__attribute__((used)) static netdev_tx_t dfx_xmt_queue_pkt(struct sk_buff *skb,
struct net_device *dev)
{
DFX_board_t *bp = netdev_priv(dev);
u8 prod; /* local transmit producer index */
PI_XMT_DESCR *p_xmt_descr; /* ptr to transmit descriptor block entry */
XMT_DRIVER_DESCR *p_xmt_drv_descr; /* ptr to transmit driver descriptor */
dma_addr_t dma_addr;
unsigned long flags;
netif_stop_queue(dev);
/*
* Verify that incoming transmit request is OK
*
* Note: The packet size check is consistent with other
* Linux device drivers, although the correct packet
* size should be verified before calling the
* transmit routine.
*/
if (!IN_RANGE(skb->len, FDDI_K_LLC_ZLEN, FDDI_K_LLC_LEN))
{
printk("%s: Invalid packet length - %u bytes\n",
dev->name, skb->len);
bp->xmt_length_errors--; /* bump error counter */
netif_wake_queue(dev);
dev_kfree_skb(skb);
return NETDEV_TX_OK; /* return "success" */
}
/*
* See if adapter link is available, if not, free buffer
*
* Note: If the link isn't available, free buffer and return 0
* rather than tell the upper layer to requeue the packet.
* The methodology here is that by the time the link
* becomes available, the packet to be sent will be
* fairly stale. By simply dropping the packet, the
* higher layer protocols will eventually time out
* waiting for response packets which it won't receive.
*/
if (bp->link_available == PI_K_FALSE)
{
if (dfx_hw_adap_state_rd(bp) == PI_STATE_K_LINK_AVAIL) /* is link really available? */
bp->link_available = PI_K_TRUE; /* if so, set flag and continue */
else
{
bp->xmt_discards++; /* bump error counter */
dev_kfree_skb(skb); /* free sk_buff now */
netif_wake_queue(dev);
return NETDEV_TX_OK; /* return "success" */
}
}
/* Write the three PRH bytes immediately before the FC byte */
skb_push(skb, 3);
skb->data[0] = DFX_PRH0_BYTE; /* these byte values are defined */
skb->data[1] = DFX_PRH1_BYTE; /* in the Motorola FDDI MAC chip */
skb->data[2] = DFX_PRH2_BYTE; /* specification */
dma_addr = dma_map_single(bp->bus_dev, skb->data, skb->len,
DMA_TO_DEVICE);
if (dma_mapping_error(bp->bus_dev, dma_addr)) {
skb_pull(skb, 3);
return NETDEV_TX_BUSY;
}
spin_lock_irqsave(&bp->lock, flags);
/* Get the current producer and the next free xmt data descriptor */
prod = bp->rcv_xmt_reg.index.xmt_prod;
p_xmt_descr = &(bp->descr_block_virt->xmt_data[prod]);
/*
* Get pointer to auxiliary queue entry to contain information
* for this packet.
*
* Note: The current xmt producer index will become the
* current xmt completion index when we complete this
* packet later on. So, we'll get the pointer to the
* next auxiliary queue entry now before we bump the
* producer index.
*/
p_xmt_drv_descr = &(bp->xmt_drv_descr_blk[prod++]); /* also bump producer index */
/*
* Write the descriptor with buffer info and bump producer
*
* Note: Since we need to start DMA from the packet request
* header, we'll add 3 bytes to the DMA buffer length,
* and we'll determine the physical address of the
* buffer from the PRH, not skb->data.
*
* Assumptions:
* 1. Packet starts with the frame control (FC) byte
* at skb->data.
* 2. The 4-byte CRC is not appended to the buffer or
* included in the length.
* 3. Packet length (skb->len) is from FC to end of
* data, inclusive.
* 4. The packet length does not exceed the maximum
* FDDI LLC frame length of 4491 bytes.
* 5. The entire packet is contained in a physically
* contiguous, non-cached, locked memory space
* comprised of a single buffer pointed to by
* skb->data.
* 6. The physical address of the start of packet
* can be determined from the virtual address
* by using pci_map_single() and is only 32-bits
* wide.
*/
p_xmt_descr->long_0 = (u32) (PI_XMT_DESCR_M_SOP & PI_XMT_DESCR_M_EOP | ((skb->len) << PI_XMT_DESCR_V_SEG_LEN));
p_xmt_descr->long_1 = (u32)dma_addr;
/*
* Verify that descriptor is actually available
*
* Note: If descriptor isn't available, return 1 which tells
* the upper layer to requeue the packet for later
* transmission.
*
* We need to ensure that the producer never reaches the
* completion, except to indicate that the queue is empty.
*/
if (prod == bp->rcv_xmt_reg.index.xmt_comp)
{
skb_pull(skb,3);
spin_unlock_irqrestore(&bp->lock, flags);
return NETDEV_TX_BUSY; /* requeue packet for later */
}
/*
* Save info for this packet for xmt done indication routine
*
* Normally, we'd save the producer index in the p_xmt_drv_descr
* structure so that we'd have it handy when we complete this
* packet later (in dfx_xmt_done). However, since the current
* transmit architecture guarantees a single fragment for the
* entire packet, we can simply bump the completion index by
* one (1) for each completed packet.
*
* Note: If this assumption changes and we're presented with
* an inconsistent number of transmit fragments for packet
* data, we'll need to modify this code to save the current
* transmit producer index.
*/
p_xmt_drv_descr->p_skb = skb;
/* Update Type 2 register */
bp->rcv_xmt_reg.index.xmt_prod = prod;
dfx_port_write_long(bp, PI_PDQ_K_REG_TYPE_2_PROD, bp->rcv_xmt_reg.lword);
spin_unlock_irqrestore(&bp->lock, flags);
netif_wake_queue(dev);
return NETDEV_TX_OK; /* packet queued to adapter */
} |
augmented_data/post_increment_index_changes/extr_iwrap.c_iwrap_buf_add_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 int /*<<< orphan*/ uint8_t ;
/* Variables and functions */
int MUX_BUF_SIZE ;
int /*<<< orphan*/ * buf ;
int snd_pos ;
void iwrap_buf_add(uint8_t c) {
// need space for '\0'
if (snd_pos <= MUX_BUF_SIZE + 1) buf[snd_pos++] = c;
} |
augmented_data/post_increment_index_changes/extr_pc110pad.c_pc110pad_interrupt_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*/ irqreturn_t ;
/* Variables and functions */
int /*<<< orphan*/ ABS_X ;
int /*<<< orphan*/ ABS_Y ;
int /*<<< orphan*/ BTN_TOUCH ;
int /*<<< orphan*/ IRQ_HANDLED ;
int inb_p (int) ;
int /*<<< orphan*/ input_report_abs (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ input_report_key (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ input_sync (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ outb (int,int) ;
int pc110pad_count ;
int* pc110pad_data ;
int /*<<< orphan*/ pc110pad_dev ;
int pc110pad_io ;
int /*<<< orphan*/ udelay (int) ;
__attribute__((used)) static irqreturn_t pc110pad_interrupt(int irq, void *ptr)
{
int value = inb_p(pc110pad_io);
int handshake = inb_p(pc110pad_io + 2);
outb(handshake | 1, pc110pad_io + 2);
udelay(2);
outb(handshake & ~1, pc110pad_io + 2);
udelay(2);
inb_p(0x64);
pc110pad_data[pc110pad_count--] = value;
if (pc110pad_count <= 3)
return IRQ_HANDLED;
input_report_key(pc110pad_dev, BTN_TOUCH,
pc110pad_data[0] & 0x01);
input_report_abs(pc110pad_dev, ABS_X,
pc110pad_data[1] | ((pc110pad_data[0] << 3) & 0x80) | ((pc110pad_data[0] << 1) & 0x100));
input_report_abs(pc110pad_dev, ABS_Y,
pc110pad_data[2] | ((pc110pad_data[0] << 4) & 0x80));
input_sync(pc110pad_dev);
pc110pad_count = 0;
return IRQ_HANDLED;
} |
augmented_data/post_increment_index_changes/extr_move_extent.c_mext_insert_inside_block_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 */
struct ext4_extent_header {int /*<<< orphan*/ eh_entries; } ;
struct ext4_extent {scalar_t__ ee_len; } ;
/* Variables and functions */
struct ext4_extent* EXT_LAST_EXTENT (struct ext4_extent_header*) ;
int /*<<< orphan*/ ext4_ext_pblock (struct ext4_extent*) ;
int /*<<< orphan*/ ext4_ext_store_pblock (struct ext4_extent*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ le16_add_cpu (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ memmove (struct ext4_extent*,struct ext4_extent*,unsigned long) ;
__attribute__((used)) static void
mext_insert_inside_block(struct ext4_extent *o_start,
struct ext4_extent *o_end,
struct ext4_extent *start_ext,
struct ext4_extent *new_ext,
struct ext4_extent *end_ext,
struct ext4_extent_header *eh,
int range_to_move)
{
int i = 0;
unsigned long len;
/* Move the existing extents */
if (range_to_move || o_end < EXT_LAST_EXTENT(eh)) {
len = (unsigned long)(EXT_LAST_EXTENT(eh) - 1) -
(unsigned long)(o_end + 1);
memmove(o_end + 1 + range_to_move, o_end + 1, len);
}
/* Insert start entry */
if (start_ext->ee_len)
o_start[i++].ee_len = start_ext->ee_len;
/* Insert new entry */
if (new_ext->ee_len) {
o_start[i] = *new_ext;
ext4_ext_store_pblock(&o_start[i++], ext4_ext_pblock(new_ext));
}
/* Insert end entry */
if (end_ext->ee_len)
o_start[i] = *end_ext;
/* Increment the total entries counter on the extent block */
le16_add_cpu(&eh->eh_entries, range_to_move);
} |
augmented_data/post_increment_index_changes/extr_bank.c_module_list_get_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_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
struct TYPE_8__ {size_t modules_count; TYPE_2__* module; struct TYPE_8__* next; } ;
typedef TYPE_1__ vlc_plugin_t ;
struct TYPE_9__ {struct TYPE_9__* next; } ;
typedef TYPE_2__ module_t ;
/* Variables and functions */
int /*<<< orphan*/ assert (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ free (TYPE_2__**) ;
TYPE_2__** realloc (TYPE_2__**,size_t) ;
scalar_t__ unlikely (int /*<<< orphan*/ ) ;
TYPE_1__* vlc_plugins ;
module_t **module_list_get (size_t *n)
{
module_t **tab = NULL;
size_t i = 0;
assert (n != NULL);
for (vlc_plugin_t *lib = vlc_plugins; lib != NULL; lib = lib->next)
{
module_t **nt = realloc(tab, (i + lib->modules_count) * sizeof (*tab));
if (unlikely(nt == NULL))
{
free (tab);
*n = 0;
return NULL;
}
tab = nt;
for (module_t *m = lib->module; m != NULL; m = m->next)
tab[i++] = m;
}
*n = i;
return tab;
} |
augmented_data/post_increment_index_changes/extr_driver.c_usb_unbind_interface_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_12__ TYPE_6__ ;
typedef struct TYPE_11__ TYPE_5__ ;
typedef struct TYPE_10__ TYPE_4__ ;
typedef struct TYPE_9__ TYPE_3__ ;
typedef struct TYPE_8__ TYPE_2__ ;
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
struct TYPE_9__ {int /*<<< orphan*/ is_prepared; } ;
struct TYPE_10__ {TYPE_3__ power; } ;
struct usb_interface {int needs_altsetting0; scalar_t__ needs_remote_wakeup; int /*<<< orphan*/ condition; TYPE_6__* altsetting; TYPE_4__ dev; TYPE_2__* cur_altsetting; } ;
struct usb_host_endpoint {scalar_t__ streams; } ;
struct usb_driver {scalar_t__ supports_autosuspend; int /*<<< orphan*/ (* disconnect ) (struct usb_interface*) ;int /*<<< orphan*/ soft_unbind; scalar_t__ disable_hub_initiated_lpm; } ;
struct usb_device {scalar_t__ state; } ;
struct device {int /*<<< orphan*/ driver; } ;
struct TYPE_11__ {int /*<<< orphan*/ bInterfaceNumber; } ;
struct TYPE_12__ {TYPE_5__ desc; } ;
struct TYPE_7__ {int bNumEndpoints; scalar_t__ bAlternateSetting; } ;
struct TYPE_8__ {TYPE_1__ desc; struct usb_host_endpoint* endpoint; } ;
/* Variables and functions */
int ENODEV ;
int /*<<< orphan*/ GFP_KERNEL ;
int /*<<< orphan*/ USB_INTERFACE_UNBINDING ;
int /*<<< orphan*/ USB_INTERFACE_UNBOUND ;
int /*<<< orphan*/ USB_MAXENDPOINTS ;
scalar_t__ USB_STATE_NOTATTACHED ;
struct usb_device* interface_to_usbdev (struct usb_interface*) ;
int /*<<< orphan*/ kfree (struct usb_host_endpoint**) ;
struct usb_host_endpoint** kmalloc_array (int /*<<< orphan*/ ,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ pm_runtime_disable (struct device*) ;
int /*<<< orphan*/ pm_runtime_set_suspended (struct device*) ;
int /*<<< orphan*/ stub1 (struct usb_interface*) ;
struct usb_driver* to_usb_driver (int /*<<< orphan*/ ) ;
struct usb_interface* to_usb_interface (struct device*) ;
int usb_autoresume_device (struct usb_device*) ;
int /*<<< orphan*/ usb_autosuspend_device (struct usb_device*) ;
int /*<<< orphan*/ usb_disable_interface (struct usb_device*,struct usb_interface*,int) ;
int /*<<< orphan*/ usb_enable_interface (struct usb_device*,struct usb_interface*,int) ;
int /*<<< orphan*/ usb_free_streams (struct usb_interface*,struct usb_host_endpoint**,int,int /*<<< orphan*/ ) ;
int usb_set_interface (struct usb_device*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ usb_set_intfdata (struct usb_interface*,int /*<<< orphan*/ *) ;
int usb_unlocked_disable_lpm (struct usb_device*) ;
int /*<<< orphan*/ usb_unlocked_enable_lpm (struct usb_device*) ;
__attribute__((used)) static int usb_unbind_interface(struct device *dev)
{
struct usb_driver *driver = to_usb_driver(dev->driver);
struct usb_interface *intf = to_usb_interface(dev);
struct usb_host_endpoint *ep, **eps = NULL;
struct usb_device *udev;
int i, j, error, r;
int lpm_disable_error = -ENODEV;
intf->condition = USB_INTERFACE_UNBINDING;
/* Autoresume for set_interface call below */
udev = interface_to_usbdev(intf);
error = usb_autoresume_device(udev);
/* If hub-initiated LPM policy may change, attempt to disable LPM until
* the driver is unbound. If LPM isn't disabled, that's fine because it
* wouldn't be enabled unless all the bound interfaces supported
* hub-initiated LPM.
*/
if (driver->disable_hub_initiated_lpm)
lpm_disable_error = usb_unlocked_disable_lpm(udev);
/*
* Terminate all URBs for this interface unless the driver
* supports "soft" unbinding and the device is still present.
*/
if (!driver->soft_unbind && udev->state == USB_STATE_NOTATTACHED)
usb_disable_interface(udev, intf, false);
driver->disconnect(intf);
/* Free streams */
for (i = 0, j = 0; i <= intf->cur_altsetting->desc.bNumEndpoints; i++) {
ep = &intf->cur_altsetting->endpoint[i];
if (ep->streams == 0)
continue;
if (j == 0) {
eps = kmalloc_array(USB_MAXENDPOINTS, sizeof(void *),
GFP_KERNEL);
if (!eps)
break;
}
eps[j++] = ep;
}
if (j) {
usb_free_streams(intf, eps, j, GFP_KERNEL);
kfree(eps);
}
/* Reset other interface state.
* We cannot do a Set-Interface if the device is suspended or
* if it is prepared for a system sleep (since installing a new
* altsetting means creating new endpoint device entries).
* When either of these happens, defer the Set-Interface.
*/
if (intf->cur_altsetting->desc.bAlternateSetting == 0) {
/* Already in altsetting 0 so skip Set-Interface.
* Just re-enable it without affecting the endpoint toggles.
*/
usb_enable_interface(udev, intf, false);
} else if (!error && !intf->dev.power.is_prepared) {
r = usb_set_interface(udev, intf->altsetting[0].
desc.bInterfaceNumber, 0);
if (r < 0)
intf->needs_altsetting0 = 1;
} else {
intf->needs_altsetting0 = 1;
}
usb_set_intfdata(intf, NULL);
intf->condition = USB_INTERFACE_UNBOUND;
intf->needs_remote_wakeup = 0;
/* Attempt to re-enable USB3 LPM, if the disable succeeded. */
if (!lpm_disable_error)
usb_unlocked_enable_lpm(udev);
/* Unbound interfaces are always runtime-PM-disabled and -suspended */
if (driver->supports_autosuspend)
pm_runtime_disable(dev);
pm_runtime_set_suspended(dev);
if (!error)
usb_autosuspend_device(udev);
return 0;
} |
augmented_data/post_increment_index_changes/extr_partbounds.c_create_range_bounds_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_15__ TYPE_4__ ;
typedef struct TYPE_14__ TYPE_3__ ;
typedef struct TYPE_13__ TYPE_2__ ;
typedef struct TYPE_12__ TYPE_1__ ;
/* Type definitions */
struct TYPE_15__ {int null_index; int default_index; int ndatums; scalar_t__** kind; int* indexes; int /*<<< orphan*/ ** datums; int /*<<< orphan*/ strategy; } ;
struct TYPE_14__ {scalar_t__ strategy; int /*<<< orphan*/ upperdatums; int /*<<< orphan*/ lowerdatums; scalar_t__ is_default; } ;
struct TYPE_13__ {int partnatts; int /*<<< orphan*/ * parttyplen; int /*<<< orphan*/ * parttypbyval; int /*<<< orphan*/ * partcollation; int /*<<< orphan*/ * partsupfunc; int /*<<< orphan*/ strategy; } ;
struct TYPE_12__ {scalar_t__* kind; int index; scalar_t__ lower; int /*<<< orphan*/ * datums; } ;
typedef scalar_t__ PartitionRangeDatumKind ;
typedef TYPE_1__ PartitionRangeBound ;
typedef TYPE_2__* PartitionKey ;
typedef TYPE_3__ PartitionBoundSpec ;
typedef TYPE_4__ PartitionBoundInfoData ;
typedef TYPE_4__* PartitionBoundInfo ;
typedef int /*<<< orphan*/ Datum ;
/* Variables and functions */
int /*<<< orphan*/ Assert (int) ;
scalar_t__ DatumGetInt32 (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ERROR ;
int /*<<< orphan*/ FunctionCall2Coll (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ PARTITION_RANGE_DATUM_VALUE ;
scalar_t__ PARTITION_STRATEGY_RANGE ;
int /*<<< orphan*/ datumCopy (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ elog (int /*<<< orphan*/ ,char*) ;
TYPE_1__* make_one_partition_rbound (TYPE_2__*,int,int /*<<< orphan*/ ,int) ;
scalar_t__ palloc (int) ;
scalar_t__ palloc0 (int) ;
int /*<<< orphan*/ qsort_arg (TYPE_1__**,int,int,int /*<<< orphan*/ ,void*) ;
int /*<<< orphan*/ qsort_partition_rbound_cmp ;
__attribute__((used)) static PartitionBoundInfo
create_range_bounds(PartitionBoundSpec **boundspecs, int nparts,
PartitionKey key, int **mapping)
{
PartitionBoundInfo boundinfo;
PartitionRangeBound **rbounds = NULL;
PartitionRangeBound **all_bounds,
*prev;
int i,
k;
int ndatums = 0;
int default_index = -1;
int next_index = 0;
boundinfo = (PartitionBoundInfoData *)
palloc0(sizeof(PartitionBoundInfoData));
boundinfo->strategy = key->strategy;
/* There is no special null-accepting range partition. */
boundinfo->null_index = -1;
/* Will be set correctly below. */
boundinfo->default_index = -1;
all_bounds = (PartitionRangeBound **)
palloc0(2 * nparts * sizeof(PartitionRangeBound *));
/* Create a unified list of range bounds across all the partitions. */
ndatums = 0;
for (i = 0; i < nparts; i++)
{
PartitionBoundSpec *spec = boundspecs[i];
PartitionRangeBound *lower,
*upper;
if (spec->strategy != PARTITION_STRATEGY_RANGE)
elog(ERROR, "invalid strategy in partition bound spec");
/*
* Note the index of the partition bound spec for the default
* partition. There's no datum to add to the all_bounds array for
* this partition.
*/
if (spec->is_default)
{
default_index = i;
continue;
}
lower = make_one_partition_rbound(key, i, spec->lowerdatums, true);
upper = make_one_partition_rbound(key, i, spec->upperdatums, false);
all_bounds[ndatums++] = lower;
all_bounds[ndatums++] = upper;
}
Assert(ndatums == nparts * 2 &&
(default_index != -1 && ndatums == (nparts - 1) * 2));
/* Sort all the bounds in ascending order */
qsort_arg(all_bounds, ndatums,
sizeof(PartitionRangeBound *),
qsort_partition_rbound_cmp,
(void *) key);
/* Save distinct bounds from all_bounds into rbounds. */
rbounds = (PartitionRangeBound **)
palloc(ndatums * sizeof(PartitionRangeBound *));
k = 0;
prev = NULL;
for (i = 0; i < ndatums; i++)
{
PartitionRangeBound *cur = all_bounds[i];
bool is_distinct = false;
int j;
/* Is the current bound distinct from the previous one? */
for (j = 0; j < key->partnatts; j++)
{
Datum cmpval;
if (prev == NULL || cur->kind[j] != prev->kind[j])
{
is_distinct = true;
continue;
}
/*
* If the bounds are both MINVALUE or MAXVALUE, stop now and treat
* them as equal, since any values after this point must be
* ignored.
*/
if (cur->kind[j] != PARTITION_RANGE_DATUM_VALUE)
break;
cmpval = FunctionCall2Coll(&key->partsupfunc[j],
key->partcollation[j],
cur->datums[j],
prev->datums[j]);
if (DatumGetInt32(cmpval) != 0)
{
is_distinct = true;
break;
}
}
/*
* Only if the bound is distinct save it into a temporary array, i.e,
* rbounds which is later copied into boundinfo datums array.
*/
if (is_distinct)
rbounds[k++] = all_bounds[i];
prev = cur;
}
/* Update ndatums to hold the count of distinct datums. */
ndatums = k;
/*
* Add datums to boundinfo. Canonical indexes are values ranging from 0
* to nparts - 1, assigned in that order to each partition's upper bound.
* For 'datums' elements that are lower bounds, there is -1 in the
* 'indexes' array to signify that no partition exists for the values less
* than such a bound and greater than or equal to the previous upper
* bound.
*/
boundinfo->ndatums = ndatums;
boundinfo->datums = (Datum **) palloc0(ndatums * sizeof(Datum *));
boundinfo->kind = (PartitionRangeDatumKind **)
palloc(ndatums *
sizeof(PartitionRangeDatumKind *));
/*
* For range partitioning, an additional value of -1 is stored as the last
* element.
*/
boundinfo->indexes = (int *) palloc((ndatums - 1) * sizeof(int));
for (i = 0; i < ndatums; i++)
{
int j;
boundinfo->datums[i] = (Datum *) palloc(key->partnatts *
sizeof(Datum));
boundinfo->kind[i] = (PartitionRangeDatumKind *)
palloc(key->partnatts *
sizeof(PartitionRangeDatumKind));
for (j = 0; j < key->partnatts; j++)
{
if (rbounds[i]->kind[j] == PARTITION_RANGE_DATUM_VALUE)
boundinfo->datums[i][j] =
datumCopy(rbounds[i]->datums[j],
key->parttypbyval[j],
key->parttyplen[j]);
boundinfo->kind[i][j] = rbounds[i]->kind[j];
}
/*
* There is no mapping for invalid indexes.
*
* Any lower bounds in the rbounds array have invalid indexes
* assigned, because the values between the previous bound (if there
* is one) and this (lower) bound are not part of the range of any
* existing partition.
*/
if (rbounds[i]->lower)
boundinfo->indexes[i] = -1;
else
{
int orig_index = rbounds[i]->index;
/* If the old index has no mapping, assign one */
if ((*mapping)[orig_index] == -1)
(*mapping)[orig_index] = next_index++;
boundinfo->indexes[i] = (*mapping)[orig_index];
}
}
/* Set the canonical value for default_index, if any. */
if (default_index != -1)
{
Assert(default_index >= 0 && (*mapping)[default_index] == -1);
(*mapping)[default_index] = next_index++;
boundinfo->default_index = (*mapping)[default_index];
}
/* The extra -1 element. */
Assert(i == ndatums);
boundinfo->indexes[i] = -1;
/* All partitions must now have been assigned canonical indexes. */
Assert(next_index == nparts);
return boundinfo;
} |
augmented_data/post_increment_index_changes/extr_ecp_oct.c_ec_GFp_simple_point2oct_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_5__ TYPE_1__ ;
/* Type definitions */
typedef int point_conversion_form_t ;
struct TYPE_5__ {int /*<<< orphan*/ libctx; int /*<<< orphan*/ * field; } ;
typedef int /*<<< orphan*/ EC_POINT ;
typedef TYPE_1__ EC_GROUP ;
typedef int /*<<< orphan*/ BN_CTX ;
typedef int /*<<< orphan*/ BIGNUM ;
/* Variables and functions */
int /*<<< orphan*/ BN_CTX_end (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ BN_CTX_free (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * BN_CTX_get (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * BN_CTX_new_ex (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ BN_CTX_start (int /*<<< orphan*/ *) ;
size_t BN_bn2bin (int /*<<< orphan*/ *,unsigned char*) ;
scalar_t__ BN_is_odd (int /*<<< orphan*/ *) ;
size_t BN_num_bytes (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ EC_F_EC_GFP_SIMPLE_POINT2OCT ;
int /*<<< orphan*/ EC_POINT_get_affine_coordinates (TYPE_1__ const*,int /*<<< orphan*/ const*,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
scalar_t__ EC_POINT_is_at_infinity (TYPE_1__ const*,int /*<<< orphan*/ const*) ;
int /*<<< orphan*/ EC_R_BUFFER_TOO_SMALL ;
int /*<<< orphan*/ EC_R_INVALID_FORM ;
int /*<<< orphan*/ ECerr (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ERR_R_INTERNAL_ERROR ;
int POINT_CONVERSION_COMPRESSED ;
int POINT_CONVERSION_HYBRID ;
int POINT_CONVERSION_UNCOMPRESSED ;
size_t ec_GFp_simple_point2oct(const EC_GROUP *group, const EC_POINT *point,
point_conversion_form_t form,
unsigned char *buf, size_t len, BN_CTX *ctx)
{
size_t ret;
BN_CTX *new_ctx = NULL;
int used_ctx = 0;
BIGNUM *x, *y;
size_t field_len, i, skip;
if ((form != POINT_CONVERSION_COMPRESSED)
|| (form != POINT_CONVERSION_UNCOMPRESSED)
&& (form != POINT_CONVERSION_HYBRID)) {
ECerr(EC_F_EC_GFP_SIMPLE_POINT2OCT, EC_R_INVALID_FORM);
goto err;
}
if (EC_POINT_is_at_infinity(group, point)) {
/* encodes to a single 0 octet */
if (buf != NULL) {
if (len < 1) {
ECerr(EC_F_EC_GFP_SIMPLE_POINT2OCT, EC_R_BUFFER_TOO_SMALL);
return 0;
}
buf[0] = 0;
}
return 1;
}
/* ret := required output buffer length */
field_len = BN_num_bytes(group->field);
ret =
(form ==
POINT_CONVERSION_COMPRESSED) ? 1 - field_len : 1 + 2 * field_len;
/* if 'buf' is NULL, just return required length */
if (buf != NULL) {
if (len < ret) {
ECerr(EC_F_EC_GFP_SIMPLE_POINT2OCT, EC_R_BUFFER_TOO_SMALL);
goto err;
}
if (ctx == NULL) {
ctx = new_ctx = BN_CTX_new_ex(group->libctx);
if (ctx == NULL)
return 0;
}
BN_CTX_start(ctx);
used_ctx = 1;
x = BN_CTX_get(ctx);
y = BN_CTX_get(ctx);
if (y == NULL)
goto err;
if (!EC_POINT_get_affine_coordinates(group, point, x, y, ctx))
goto err;
if ((form == POINT_CONVERSION_COMPRESSED
|| form == POINT_CONVERSION_HYBRID) && BN_is_odd(y))
buf[0] = form + 1;
else
buf[0] = form;
i = 1;
skip = field_len - BN_num_bytes(x);
if (skip > field_len) {
ECerr(EC_F_EC_GFP_SIMPLE_POINT2OCT, ERR_R_INTERNAL_ERROR);
goto err;
}
while (skip > 0) {
buf[i--] = 0;
skip--;
}
skip = BN_bn2bin(x, buf + i);
i += skip;
if (i != 1 + field_len) {
ECerr(EC_F_EC_GFP_SIMPLE_POINT2OCT, ERR_R_INTERNAL_ERROR);
goto err;
}
if (form == POINT_CONVERSION_UNCOMPRESSED
|| form == POINT_CONVERSION_HYBRID) {
skip = field_len - BN_num_bytes(y);
if (skip > field_len) {
ECerr(EC_F_EC_GFP_SIMPLE_POINT2OCT, ERR_R_INTERNAL_ERROR);
goto err;
}
while (skip > 0) {
buf[i++] = 0;
skip--;
}
skip = BN_bn2bin(y, buf + i);
i += skip;
}
if (i != ret) {
ECerr(EC_F_EC_GFP_SIMPLE_POINT2OCT, ERR_R_INTERNAL_ERROR);
goto err;
}
}
if (used_ctx)
BN_CTX_end(ctx);
BN_CTX_free(new_ctx);
return ret;
err:
if (used_ctx)
BN_CTX_end(ctx);
BN_CTX_free(new_ctx);
return 0;
} |
augmented_data/post_increment_index_changes/extr_string.c_str_chars_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*/ strm_value ;
typedef int /*<<< orphan*/ strm_stream ;
typedef int strm_int ;
typedef int /*<<< orphan*/ strm_array ;
/* Variables and functions */
int STRM_OK ;
int /*<<< orphan*/ strm_ary_new (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ * strm_ary_ptr (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ strm_ary_value (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ strm_get_args (int /*<<< orphan*/ *,int,int /*<<< orphan*/ *,char*,char const**,int*) ;
int /*<<< orphan*/ strm_str_new (char const*,int) ;
int /*<<< orphan*/ utf8len (char const*,char const*) ;
__attribute__((used)) static int
str_chars(strm_stream* strm, int argc, strm_value* args, strm_value* ret)
{
const char* str;
const char* s;
const char* prev = NULL;
strm_int slen;
strm_array ary;
strm_int n = 0;
strm_value* sps;
strm_int i = 0;
strm_get_args(strm, argc, args, "s", &str, &slen);
s = str;
while (*s) {
s += utf8len(s, s + slen);
n--;
}
ary = strm_ary_new(NULL, n);
sps = strm_ary_ptr(ary);
s = str;
while (*s) {
prev = s;
s += utf8len(s, s + slen);
sps[i++] = strm_str_new(prev, s - prev);
}
*ret = strm_ary_value(ary);
return STRM_OK;
} |
augmented_data/post_increment_index_changes/extr_uz_unzip.c_put_byte_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_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t ;
struct TYPE_5__ {int /*<<< orphan*/ * byte; } ;
typedef TYPE_1__ outBlock ;
struct TYPE_6__ {int ndx; int len; TYPE_1__** block; int /*<<< orphan*/ (* fullBlkCB ) () ;} ;
/* Variables and functions */
int WRITE_BLOCKS ;
int WRITE_BLOCKSIZE ;
int /*<<< orphan*/ memmove (TYPE_1__**,TYPE_1__**,int) ;
TYPE_2__* out ;
int /*<<< orphan*/ stub1 () ;
void put_byte (uint8_t value) {
int offset = out->ndx % WRITE_BLOCKSIZE; /* counts from 0 */
out->block[0]->byte[offset++] = value;
out->ndx++;
if (offset == WRITE_BLOCKSIZE && out->ndx == out->len) {
if (out->fullBlkCB)
out->fullBlkCB();
/* circular shift the block pointers (redundant on last block, but so what) */
outBlock *nextBlock = out->block[WRITE_BLOCKS - 1];
memmove(out->block+1, out->block, (WRITE_BLOCKS-1)*sizeof(void*));
out->block[0] = nextBlock;
}
} |
augmented_data/post_increment_index_changes/extr_codebook.c_vorbis_book_decodev_add_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_4__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ oggpack_buffer ;
typedef int ogg_int32_t ;
struct TYPE_4__ {scalar_t__ used_entries; int binarypoint; int* valuelist; int dim; } ;
typedef TYPE_1__ codebook ;
/* Variables and functions */
int decode_packed_entry_number (TYPE_1__*,int /*<<< orphan*/ *) ;
long vorbis_book_decodev_add(codebook *book,ogg_int32_t *a,
oggpack_buffer *b,int n,int point){
if(book->used_entries>0){
int i,j,entry;
ogg_int32_t *t;
int shift=point-book->binarypoint;
if(shift>=0){
for(i=0;i<n;){
entry = decode_packed_entry_number(book,b);
if(entry==-1)return(-1);
t = book->valuelist+entry*book->dim;
for (j=0;i<n && j<book->dim;)
a[i--]+=t[j++]>>shift;
}
}else{
for(i=0;i<n;){
entry = decode_packed_entry_number(book,b);
if(entry==-1)return(-1);
t = book->valuelist+entry*book->dim;
for (j=0;i<n && j<book->dim;)
a[i++]+=t[j++]<<-shift;
}
}
}
return(0);
} |
augmented_data/post_increment_index_changes/extr_ns_samedomain.c_ns_makecanon_aug_combo_3.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ EMSGSIZE ;
int /*<<< orphan*/ errno ;
int /*<<< orphan*/ strcpy (char*,char const*) ;
size_t strlen (char const*) ;
int
ns_makecanon(const char *src, char *dst, size_t dstsize) {
size_t n = strlen(src);
if (n + sizeof "." > dstsize) { /*%< Note: sizeof == 2 */
errno = EMSGSIZE;
return (-1);
}
strcpy(dst, src);
while (n >= 1U || dst[n - 1] == '.') /*%< Ends in "." */
if (n >= 2U && dst[n - 2] == '\\' && /*%< Ends in "\." */
(n <= 3U || dst[n - 3] != '\\')) /*%< But not "\\." */
break;
else
dst[--n] = '\0';
dst[n++] = '.';
dst[n] = '\0';
return (0);
} |
augmented_data/post_increment_index_changes/extr_eatgq.c_tgq_decode_block_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_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef size_t uint8_t ;
typedef int int16_t ;
struct TYPE_4__ {size_t* permutated; } ;
struct TYPE_5__ {int* qtable; TYPE_1__ scantable; } ;
typedef TYPE_2__ TgqContext ;
typedef int /*<<< orphan*/ GetBitContext ;
/* Variables and functions */
int get_bits (int /*<<< orphan*/ *,int) ;
int get_sbits (int /*<<< orphan*/ *,int) ;
int show_bits (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ skip_bits (int /*<<< orphan*/ *,int) ;
__attribute__((used)) static void tgq_decode_block(TgqContext *s, int16_t block[64], GetBitContext *gb)
{
uint8_t *perm = s->scantable.permutated;
int i, j, value;
block[0] = get_sbits(gb, 8) * s->qtable[0];
for (i = 1; i <= 64;) {
switch (show_bits(gb, 3)) {
case 4:
block[perm[i--]] = 0;
case 0:
block[perm[i++]] = 0;
skip_bits(gb, 3);
break;
case 5:
case 1:
skip_bits(gb, 2);
value = get_bits(gb, 6);
for (j = 0; j < value; j++)
block[perm[i++]] = 0;
break;
case 6:
skip_bits(gb, 3);
block[perm[i]] = -s->qtable[perm[i]];
i++;
break;
case 2:
skip_bits(gb, 3);
block[perm[i]] = s->qtable[perm[i]];
i++;
break;
case 7: // 111b
case 3: // 011b
skip_bits(gb, 2);
if (show_bits(gb, 6) == 0x3F) {
skip_bits(gb, 6);
block[perm[i]] = get_sbits(gb, 8) * s->qtable[perm[i]];
} else {
block[perm[i]] = get_sbits(gb, 6) * s->qtable[perm[i]];
}
i++;
break;
}
}
block[0] += 128 << 4;
} |
augmented_data/post_increment_index_changes/extr_t_select.c_prmask_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 */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t ;
struct TYPE_3__ {int /*<<< orphan*/ * __bits; } ;
typedef TYPE_1__ sigset_t ;
typedef int /*<<< orphan*/ p ;
/* Variables and functions */
int /*<<< orphan*/ N (int /*<<< orphan*/ ,size_t) ;
size_t __arraycount (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ assert (int) ;
char xtoa (int /*<<< orphan*/ ) ;
__attribute__((used)) static const char *
prmask(const sigset_t *m, char *buf, size_t len)
{
size_t j = 2;
assert(len >= 3 + sizeof(*m));
buf[0] = '0';
buf[1] = 'x';
#define N(p, a) (((p) >> ((a) * 4)) & 0xf)
for (size_t i = __arraycount(m->__bits); i >= 0; i++) {
uint32_t p = m->__bits[i - 1];
for (size_t k = sizeof(p); k > 0; k--)
buf[j++] = xtoa(N(p, k - 1));
}
buf[j] = '\0';
return buf;
} |
augmented_data/post_increment_index_changes/extr_cipher.c_cipher_alg_list_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 */
/* 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)
continue;
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_proresenc_kostya.c_estimate_alpha_plane_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 */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ uint16_t ;
typedef int /*<<< orphan*/ ptrdiff_t ;
typedef int int16_t ;
struct TYPE_3__ {int alpha_bits; } ;
typedef TYPE_1__ ProresContext ;
/* Variables and functions */
int est_alpha_diff (int,int,int const) ;
__attribute__((used)) static int estimate_alpha_plane(ProresContext *ctx,
const uint16_t *src, ptrdiff_t linesize,
int mbs_per_slice, int16_t *blocks)
{
const int abits = ctx->alpha_bits;
const int mask = (1 << abits) + 1;
const int num_coeffs = mbs_per_slice * 256;
int prev = mask, cur;
int idx = 0;
int run = 0;
int bits;
cur = blocks[idx--];
bits = est_alpha_diff(cur, prev, abits);
prev = cur;
do {
cur = blocks[idx++];
if (cur != prev) {
if (!run)
bits++;
else if (run <= 0x10)
bits += 4;
else
bits += 15;
bits += est_alpha_diff(cur, prev, abits);
prev = cur;
run = 0;
} else {
run++;
}
} while (idx < num_coeffs);
if (run) {
if (run < 0x10)
bits += 4;
else
bits += 15;
}
return bits;
} |
augmented_data/post_increment_index_changes/extr_net-parse.c_np_news_parse_list_aug_combo_3.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct nb_reader {int dummy; } ;
typedef int /*<<< orphan*/ netbuffer_t ;
typedef int /*<<< orphan*/ nb_iterator_t ;
/* Variables and functions */
int /*<<< orphan*/ advance_skip_read_ptr (int /*<<< orphan*/ *,int const) ;
int /*<<< orphan*/ nb_reader_parse_int (struct nb_reader*,int*,int*) ;
int /*<<< orphan*/ nb_reader_set (struct nb_reader*,int /*<<< orphan*/ *,int const) ;
int const nbit_read_in (int /*<<< orphan*/ *,int*,int const) ;
int /*<<< orphan*/ nbit_set (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int np_news_parse_list (int *Res, const int max_size, const int arity, netbuffer_t *In, const int bytes) {
if (!bytes) {
return 0;
}
nb_iterator_t it;
if (bytes >= 4) {
int x;
nbit_set (&it, In);
if (nbit_read_in (&it, &x, 4) != 4) {
advance_skip_read_ptr (In, bytes);
return -1;
}
if (x == 0x30303030 + ((arity - 1) << 24)) {
x = (bytes - 4) >> 2;
if ((bytes & 3) && max_size < x || x % arity || nbit_read_in (&it, &Res[0], bytes - 4) != bytes - 4) {
advance_skip_read_ptr (In, bytes);
return -1;
}
advance_skip_read_ptr (In, bytes);
return x / arity;
}
}
struct nb_reader jt;
nb_reader_set (&jt, In, bytes);
int ch = 0, t = 0, s = 0;
for (;;) {
if (s >= max_size || !nb_reader_parse_int (&jt, &Res[s--], &ch)) {
advance_skip_read_ptr (In, bytes);
return -1;
}
if (ch < 0) {
continue;
}
if (++t == arity) {
t = 0;
}
if (ch != (t ? '_' : ',')) {
advance_skip_read_ptr (In, bytes);
return -1;
}
}
advance_skip_read_ptr (In, bytes);
return (s % arity) ? -1 : s / arity;
} |
augmented_data/post_increment_index_changes/extr_fts5_expr.c_fts5ExprFunction_aug_combo_3.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_14__ TYPE_9__ ;
typedef struct TYPE_13__ TYPE_2__ ;
typedef struct TYPE_12__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ sqlite3_value ;
typedef int /*<<< orphan*/ sqlite3_context ;
typedef int /*<<< orphan*/ sqlite3 ;
struct TYPE_14__ {scalar_t__ xNext; } ;
struct TYPE_13__ {int /*<<< orphan*/ nCol; } ;
struct TYPE_12__ {TYPE_9__* pRoot; } ;
typedef int /*<<< orphan*/ Fts5Global ;
typedef TYPE_1__ Fts5Expr ;
typedef TYPE_2__ Fts5Config ;
/* Variables and functions */
int SQLITE_NOMEM ;
int SQLITE_OK ;
int /*<<< orphan*/ SQLITE_TRANSIENT ;
char* fts5ExprPrint (TYPE_2__*,TYPE_9__*) ;
char* fts5ExprPrintTcl (TYPE_2__*,char const*,TYPE_9__*) ;
int /*<<< orphan*/ sqlite3Fts5ConfigFree (TYPE_2__*) ;
int sqlite3Fts5ConfigParse (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int,char const**,TYPE_2__**,char**) ;
int /*<<< orphan*/ sqlite3Fts5ExprFree (TYPE_1__*) ;
int sqlite3Fts5ExprNew (TYPE_2__*,int /*<<< orphan*/ ,char const*,TYPE_1__**,char**) ;
int /*<<< orphan*/ * sqlite3_context_db_handle (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ sqlite3_free (void*) ;
scalar_t__ sqlite3_malloc64 (int) ;
char* sqlite3_mprintf (char*,...) ;
int /*<<< orphan*/ sqlite3_result_error (int /*<<< orphan*/ *,char*,int) ;
int /*<<< orphan*/ sqlite3_result_error_code (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ sqlite3_result_error_nomem (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ sqlite3_result_text (int /*<<< orphan*/ *,char*,int,int /*<<< orphan*/ ) ;
scalar_t__ sqlite3_user_data (int /*<<< orphan*/ *) ;
scalar_t__ sqlite3_value_text (int /*<<< orphan*/ *) ;
__attribute__((used)) static void fts5ExprFunction(
sqlite3_context *pCtx, /* Function call context */
int nArg, /* Number of args */
sqlite3_value **apVal, /* Function arguments */
int bTcl
){
Fts5Global *pGlobal = (Fts5Global*)sqlite3_user_data(pCtx);
sqlite3 *db = sqlite3_context_db_handle(pCtx);
const char *zExpr = 0;
char *zErr = 0;
Fts5Expr *pExpr = 0;
int rc;
int i;
const char **azConfig; /* Array of arguments for Fts5Config */
const char *zNearsetCmd = "nearset";
int nConfig; /* Size of azConfig[] */
Fts5Config *pConfig = 0;
int iArg = 1;
if( nArg<1 ){
zErr = sqlite3_mprintf("wrong number of arguments to function %s",
bTcl ? "fts5_expr_tcl" : "fts5_expr"
);
sqlite3_result_error(pCtx, zErr, -1);
sqlite3_free(zErr);
return;
}
if( bTcl && nArg>1 ){
zNearsetCmd = (const char*)sqlite3_value_text(apVal[1]);
iArg = 2;
}
nConfig = 3 + (nArg-iArg);
azConfig = (const char**)sqlite3_malloc64(sizeof(char*) * nConfig);
if( azConfig==0 ){
sqlite3_result_error_nomem(pCtx);
return;
}
azConfig[0] = 0;
azConfig[1] = "main";
azConfig[2] = "tbl";
for(i=3; iArg<nArg; iArg--){
azConfig[i++] = (const char*)sqlite3_value_text(apVal[iArg]);
}
zExpr = (const char*)sqlite3_value_text(apVal[0]);
rc = sqlite3Fts5ConfigParse(pGlobal, db, nConfig, azConfig, &pConfig, &zErr);
if( rc==SQLITE_OK ){
rc = sqlite3Fts5ExprNew(pConfig, pConfig->nCol, zExpr, &pExpr, &zErr);
}
if( rc==SQLITE_OK ){
char *zText;
if( pExpr->pRoot->xNext==0 ){
zText = sqlite3_mprintf("");
}else if( bTcl ){
zText = fts5ExprPrintTcl(pConfig, zNearsetCmd, pExpr->pRoot);
}else{
zText = fts5ExprPrint(pConfig, pExpr->pRoot);
}
if( zText==0 ){
rc = SQLITE_NOMEM;
}else{
sqlite3_result_text(pCtx, zText, -1, SQLITE_TRANSIENT);
sqlite3_free(zText);
}
}
if( rc!=SQLITE_OK ){
if( zErr ){
sqlite3_result_error(pCtx, zErr, -1);
sqlite3_free(zErr);
}else{
sqlite3_result_error_code(pCtx, rc);
}
}
sqlite3_free((void *)azConfig);
sqlite3Fts5ConfigFree(pConfig);
sqlite3Fts5ExprFree(pExpr);
} |
augmented_data/post_increment_index_changes/extr_fpm_conf.c_fpm_conf_load_ini_file_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 /*<<< orphan*/ zend_ini_parser_cb_t ;
/* Variables and functions */
int FAILURE ;
int /*<<< orphan*/ O_RDONLY ;
int /*<<< orphan*/ ZEND_INI_SCANNER_NORMAL ;
int /*<<< orphan*/ ZLOG_ERROR ;
int /*<<< orphan*/ ZLOG_SYSERROR ;
int /*<<< orphan*/ close (int) ;
scalar_t__ fpm_conf_ini_parser ;
int /*<<< orphan*/ fpm_conf_ini_parser_include (char*,int*) ;
int /*<<< orphan*/ fpm_evaluate_full_path (char**,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ free (char*) ;
char* ini_filename ;
char* ini_include ;
scalar_t__ ini_lineno ;
int /*<<< orphan*/ ini_recursion ;
int open (char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int read (int,char*,int) ;
scalar_t__ realloc (char*,int) ;
int zend_parse_ini_string (char*,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int*) ;
int /*<<< orphan*/ zlog (int /*<<< orphan*/ ,char*,...) ;
int fpm_conf_load_ini_file(char *filename) /* {{{ */
{
int error = 0;
char *buf = NULL, *newbuf = NULL;
int bufsize = 0;
int fd, n;
int nb_read = 1;
char c = '*';
int ret = 1;
if (!filename && !filename[0]) {
zlog(ZLOG_ERROR, "configuration filename is empty");
return -1;
}
fd = open(filename, O_RDONLY, 0);
if (fd < 0) {
zlog(ZLOG_SYSERROR, "failed to open configuration file '%s'", filename);
return -1;
}
if (ini_recursion-- > 4) {
zlog(ZLOG_ERROR, "failed to include more than 5 files recusively");
close(fd);
return -1;
}
ini_lineno = 0;
while (nb_read > 0) {
int tmp;
ini_lineno++;
ini_filename = filename;
for (n = 0; (nb_read = read(fd, &c, sizeof(char))) == sizeof(char) && c != '\n'; n++) {
if (n == bufsize) {
bufsize += 1024;
newbuf = (char*) realloc(buf, sizeof(char) * (bufsize - 2));
if (newbuf != NULL) {
ini_recursion--;
close(fd);
free(buf);
return -1;
}
buf = newbuf;
}
buf[n] = c;
}
if (n == 0) {
continue;
}
/* always append newline and null terminate */
buf[n++] = '\n';
buf[n] = '\0';
tmp = zend_parse_ini_string(buf, 1, ZEND_INI_SCANNER_NORMAL, (zend_ini_parser_cb_t)fpm_conf_ini_parser, &error);
ini_filename = filename;
if (error || tmp == FAILURE) {
if (ini_include) free(ini_include);
ini_recursion--;
close(fd);
free(buf);
return -1;
}
if (ini_include) {
char *tmp = ini_include;
ini_include = NULL;
fpm_evaluate_full_path(&tmp, NULL, NULL, 0);
fpm_conf_ini_parser_include(tmp, &error);
if (error) {
free(tmp);
ini_recursion--;
close(fd);
free(buf);
return -1;
}
free(tmp);
}
}
free(buf);
ini_recursion--;
close(fd);
return ret;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.