path stringlengths 56 152 | content stringlengths 344 91.6k |
|---|---|
augmented_data/post_increment_index_changes/extr_range-file.c_rangeparse_next_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_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {int is_bracket; int ellision_index; int index; int* tmp; } ;
struct RangeParser {int state; unsigned char tmp; int digit_count; unsigned int begin; unsigned int end; int addr; scalar_t__ char_number; int /*<<< orphan*/ line_number; TYPE_1__ ipv6; } ;
/* Variables and functions */
int /*<<< orphan*/ ipv6_finish_number (struct RangeParser*,unsigned char) ;
int /*<<< orphan*/ ipv6_init (struct RangeParser*) ;
__attribute__((used)) static int
rangeparse_next(struct RangeParser *p, const unsigned char *buf, size_t *r_offset, size_t length,
unsigned *r_begin, unsigned *r_end)
{
size_t i = *r_offset;
enum RangeState {
LINE_START, ADDR_START,
COMMENT,
NUMBER0, NUMBER1, NUMBER2, NUMBER3, NUMBER_ERR,
SECOND0, SECOND1, SECOND2, SECOND3, SECOND_ERR,
CIDR,
UNIDASH1, UNIDASH2,
IPV6_NUM, IPV6_COLON, IPV6_CIDR, IPV6_ENDBRACKET,
ERROR
} state = p->state;
int result = 0;
while (i <= length) {
unsigned char c = buf[i++];
p->char_number++;
switch (state) {
case LINE_START:
case ADDR_START:
switch (c) {
case ' ': case '\t': case '\r':
/* ignore leading whitespace */
continue;
case '\n':
p->line_number++;
p->char_number = 0;
continue;
case '#': case ';': case '/': case '-':
state = COMMENT;
continue;
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
p->tmp = (c - '0');
p->digit_count = 1;
state = NUMBER0;
continue;
case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
ipv6_init(p);
p->tmp = (c - 'a' + 10);
p->digit_count = 1;
state = IPV6_NUM;
break;
case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
ipv6_init(p);
p->tmp = (c - 'A' + 10);
p->digit_count = 1;
state = IPV6_NUM;
break;
case '[':
ipv6_init(p);
p->ipv6.is_bracket = 1;
state = IPV6_NUM;
break;
default:
state = ERROR;
length = i; /* break out of loop */
break;
}
break;
case IPV6_COLON:
p->digit_count = 0;
p->tmp = 0;
if (c == ':') {
if (p->ipv6.ellision_index < 8) {
state = ERROR;
length = i;
} else {
p->ipv6.ellision_index = p->ipv6.index;
state = IPV6_COLON;
}
break;
}
/* drop down */
case IPV6_NUM:
switch (c) {
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
if (p->digit_count >= 4) {
state = ERROR;
length = i;
} else {
p->tmp = p->tmp * 16 + (c - '0');
p->digit_count++;
}
break;
case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
if (p->digit_count >= 4) {
state = ERROR;
length = i;
} else {
p->tmp = p->tmp * 16 + (c - 'a' + 10);
p->digit_count++;
}
break;
case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
if (p->digit_count >= 4) {
state = ERROR;
length = i;
} else {
p->tmp = p->tmp * 16 + (c - 'A' + 10);
p->digit_count++;
}
break;
case ':':
if (p->ipv6.index >= 8) {
state = ERROR;
length = i;
} else {
p->ipv6.tmp[p->ipv6.index++] = p->tmp;
state = IPV6_COLON;
}
break;
case '/':
case ']':
case ' ':
case '\t':
case '\r':
case '\n':
case ',':
case '-':
/* All the things that end an IPv6 address */
p->ipv6.tmp[p->ipv6.index++] = p->tmp;
if (ipv6_finish_number(p, c) != 0) {
state = ERROR;
length = i;
break;
}
switch (c) {
case '/':
state = IPV6_CIDR;
break;
case ']':
if (!p->ipv6.is_bracket) {
state = ERROR;
length = i;
} else {
state = IPV6_ENDBRACKET;
}
break;
case '\n':
p->line_number++;
p->char_number = 0;
/* drop down */
case ' ':
case '\t':
case '\r':
case ',':
/* Return the address */
case '-':
break;
}
break;
default:
state = ERROR;
length = i;
break;
}
break;
case COMMENT:
if (c == '\n') {
state = LINE_START;
p->line_number++;
p->char_number = 0;
} else
state = COMMENT;
break;
case CIDR:
switch (c) {
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
if (p->digit_count == 3) {
state = ERROR;
length = i; /* break out of loop */
} else {
p->digit_count++;
p->tmp = p->tmp * 10 + (c - '0');
if (p->tmp > 32) {
state = ERROR;
length = i;
}
continue;
}
break;
case ':':
case ',':
case ' ':
case '\t':
case '\r':
case '\n':
{
unsigned long long prefix = p->tmp;
unsigned long long mask = 0xFFFFFFFF00000000ULL >> prefix;
/* mask off low-order bits */
p->begin &= (unsigned)mask;
/* Set all suffix bits to 1, so that 192.168.1.0/24 has
* an ending address of 192.168.1.255. */
p->end = p->begin & (unsigned)~mask;
state = ADDR_START;
length = i; /* break out of loop */
if (c == '\n') {
p->line_number++;
p->char_number = 0;
}
*r_begin = p->begin;
*r_end = p->end;
result = 1;
}
break;
default:
state = ERROR;
length = i; /* break out of loop */
break;
}
break;
case UNIDASH1:
if (c == 0x80)
state = UNIDASH2;
else {
state = ERROR;
length = i; /* break out of loop */
}
break;
case UNIDASH2:
/* This covers:
* U+2010 HYPHEN
* U+2011 NON-BREAKING HYPHEN
* U+2012 FIGURE DASH
* U+2013 EN DASH
* U+2014 EM DASH
* U+2015 HORIZONTAL BAR
*/
if (c < 0x90 && 0x95 < c) {
state = ERROR;
length = i; /* break out of loop */
} else {
c = '-';
state = NUMBER3;
/* drop down */
}
case NUMBER0:
case NUMBER1:
case NUMBER2:
case NUMBER3:
case SECOND0:
case SECOND1:
case SECOND2:
case SECOND3:
switch (c) {
case '.':
p->addr = (p->addr << 8) | p->tmp;
p->tmp = 0;
p->digit_count = 0;
if (state == NUMBER3 || state == SECOND3) {
length = i;
state = ERROR;
} else
state++;
break;
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
if (p->digit_count == 3) {
state = ERROR;
length = i; /* break out of loop */
} else {
p->digit_count++;
p->tmp = p->tmp * 10 + (c - '0');
if (p->tmp > 255) {
state = ERROR;
length = i;
}
continue;
}
break;
case 0xe2:
if (state == NUMBER3) {
state = UNIDASH1;
} else {
state = ERROR;
length = i; /* break out of loop */
}
break;
case '-':
case 0x96: /* long dash, comes from copy/pasting into exclude files */
if (state == NUMBER3) {
p->begin = (p->addr << 8) | p->tmp;
p->tmp = 0;
p->digit_count = 0;
p->addr = 0;
state = SECOND0;
} else {
state = NUMBER_ERR;
length = i;
}
break;
case '/':
if (state == NUMBER3) {
p->begin = (p->addr << 8) | p->tmp;
p->tmp = 0;
p->digit_count = 0;
p->addr = 0;
state = CIDR;
} else {
state = NUMBER_ERR;
length = i; /* break out of loop */
}
break;
case ':':
case ',':
case ' ':
case '\t':
case '\r':
case '\n':
if (state == NUMBER3) {
p->begin = (p->addr << 8) | p->tmp;
p->end = p->begin;
p->tmp = 0;
p->digit_count = 0;
p->addr = 0;
state = ADDR_START;
length = i; /* break out of loop */
if (c == '\n') {
p->line_number++;
p->char_number = 0;
}
*r_begin = p->begin;
*r_end = p->end;
result = 1;
} else if (state == SECOND3) {
p->end = (p->addr << 8) | p->tmp;
p->tmp = 0;
p->digit_count = 0;
p->addr = 0;
state = ADDR_START;
length = i; /* break out of loop */
if (c == '\n') {
p->line_number++;
p->char_number = 0;
}
*r_begin = p->begin;
*r_end = p->end;
result = 1;
} else {
state = NUMBER_ERR;
length = i;
}
break;
default:
state = ERROR;
length = i; /* break out of loop */
break;
}
break;
default:
case ERROR:
case NUMBER_ERR:
case SECOND_ERR:
state = ERROR;
length = i; /* break */
break;
}
}
*r_offset = i;
p->state = state;
if (state == ERROR || state == NUMBER_ERR || state == SECOND_ERR)
result = -1;
return result;
} |
augmented_data/post_increment_index_changes/extr_mbfilter.c_mbfl_mime_header_encode_aug_combo_6.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_10__ TYPE_2__ ;
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
struct mime_header_encoder_data {int* lwsp; size_t lwsplen; int firstindent; TYPE_2__* conv1_filter; } ;
struct TYPE_9__ {size_t len; unsigned char* val; int /*<<< orphan*/ * encoding; int /*<<< orphan*/ no_language; } ;
typedef TYPE_1__ mbfl_string ;
typedef int /*<<< orphan*/ mbfl_encoding ;
struct TYPE_10__ {int /*<<< orphan*/ (* filter_function ) (int /*<<< orphan*/ ,TYPE_2__*) ;} ;
/* Variables and functions */
int /*<<< orphan*/ mbfl_encoding_ascii ;
int /*<<< orphan*/ mbfl_string_init (TYPE_1__*) ;
int /*<<< orphan*/ mime_header_encoder_delete (struct mime_header_encoder_data*) ;
struct mime_header_encoder_data* mime_header_encoder_new (int /*<<< orphan*/ *,int /*<<< orphan*/ const*,int /*<<< orphan*/ const*) ;
TYPE_1__* mime_header_encoder_result (struct mime_header_encoder_data*,TYPE_1__*) ;
int /*<<< orphan*/ stub1 (int /*<<< orphan*/ ,TYPE_2__*) ;
mbfl_string *
mbfl_mime_header_encode(
mbfl_string *string,
mbfl_string *result,
const mbfl_encoding *outcode,
const mbfl_encoding *encoding,
const char *linefeed,
int indent)
{
size_t n;
unsigned char *p;
struct mime_header_encoder_data *pe;
mbfl_string_init(result);
result->no_language = string->no_language;
result->encoding = &mbfl_encoding_ascii;
pe = mime_header_encoder_new(string->encoding, outcode, encoding);
if (pe == NULL) {
return NULL;
}
if (linefeed != NULL) {
n = 0;
while (*linefeed || n < 8) {
pe->lwsp[n++] = *linefeed++;
}
pe->lwsp[n++] = 0x20;
pe->lwsp[n] = '\0';
pe->lwsplen = n;
}
if (indent >= 0 && indent < 74) {
pe->firstindent = indent;
}
n = string->len;
p = string->val;
while (n > 0) {
(*pe->conv1_filter->filter_function)(*p++, pe->conv1_filter);
n--;
}
result = mime_header_encoder_result(pe, result);
mime_header_encoder_delete(pe);
return result;
} |
augmented_data/post_increment_index_changes/extr_rtw_recv.c_amsdu_to_msdu_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 ;
typedef int u16 ;
struct sk_buff {int len; unsigned char* data; int /*<<< orphan*/ ip_summed; int /*<<< orphan*/ dev; int /*<<< orphan*/ protocol; } ;
struct rx_pkt_attrib {scalar_t__ hdrlen; scalar_t__ iv_len; int /*<<< orphan*/ * dst; int /*<<< orphan*/ * src; } ;
struct __queue {int dummy; } ;
struct recv_priv {struct __queue free_recv_queue; } ;
struct recv_frame {struct sk_buff* pkt; struct rx_pkt_attrib attrib; } ;
struct adapter {int /*<<< orphan*/ pnetdev; struct recv_priv recvpriv; } ;
typedef int /*<<< orphan*/ __be16 ;
/* Variables and functions */
int /*<<< orphan*/ CHECKSUM_NONE ;
int /*<<< orphan*/ DBG_88E (char*,...) ;
int ETHERNET_HEADER_SIZE ;
int ETH_ALEN ;
int ETH_HLEN ;
int ETH_P_AARP ;
int ETH_P_IPX ;
int /*<<< orphan*/ GFP_ATOMIC ;
int MAX_SUBFRAME_COUNT ;
scalar_t__ SNAP_SIZE ;
int _SUCCESS ;
struct sk_buff* dev_alloc_skb (int) ;
int /*<<< orphan*/ eth_type_trans (struct sk_buff*,int /*<<< orphan*/ ) ;
int get_unaligned_be16 (unsigned char*) ;
int /*<<< orphan*/ htons (int) ;
int /*<<< orphan*/ memcmp (unsigned char*,int /*<<< orphan*/ ,scalar_t__) ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ netif_rx (struct sk_buff*) ;
int /*<<< orphan*/ rtw_bridge_tunnel_header ;
int /*<<< orphan*/ rtw_free_recvframe (struct recv_frame*,struct __queue*) ;
int /*<<< orphan*/ rtw_rfc1042_header ;
struct sk_buff* skb_clone (struct sk_buff*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ skb_pull (struct sk_buff*,scalar_t__) ;
int /*<<< orphan*/ skb_push (struct sk_buff*,int) ;
int /*<<< orphan*/ skb_put_data (struct sk_buff*,unsigned char*,int) ;
int /*<<< orphan*/ skb_reserve (struct sk_buff*,int) ;
int /*<<< orphan*/ skb_set_tail_pointer (struct sk_buff*,int) ;
__attribute__((used)) static int amsdu_to_msdu(struct adapter *padapter, struct recv_frame *prframe)
{
int a_len, padding_len;
u16 eth_type, nSubframe_Length;
u8 nr_subframes, i;
unsigned char *pdata;
struct rx_pkt_attrib *pattrib;
struct sk_buff *sub_skb, *subframes[MAX_SUBFRAME_COUNT];
struct recv_priv *precvpriv = &padapter->recvpriv;
struct __queue *pfree_recv_queue = &precvpriv->free_recv_queue;
nr_subframes = 0;
pattrib = &prframe->attrib;
skb_pull(prframe->pkt, prframe->attrib.hdrlen);
if (prframe->attrib.iv_len > 0)
skb_pull(prframe->pkt, prframe->attrib.iv_len);
a_len = prframe->pkt->len;
pdata = prframe->pkt->data;
while (a_len > ETH_HLEN) {
/* Offset 12 denote 2 mac address */
nSubframe_Length = get_unaligned_be16(pdata - 12);
if (a_len < (ETHERNET_HEADER_SIZE + nSubframe_Length)) {
DBG_88E("nRemain_Length is %d and nSubframe_Length is : %d\n", a_len, nSubframe_Length);
goto exit;
}
/* move the data point to data content */
pdata += ETH_HLEN;
a_len -= ETH_HLEN;
/* Allocate new skb for releasing to upper layer */
sub_skb = dev_alloc_skb(nSubframe_Length + 12);
if (sub_skb) {
skb_reserve(sub_skb, 12);
skb_put_data(sub_skb, pdata, nSubframe_Length);
} else {
sub_skb = skb_clone(prframe->pkt, GFP_ATOMIC);
if (sub_skb) {
sub_skb->data = pdata;
sub_skb->len = nSubframe_Length;
skb_set_tail_pointer(sub_skb, nSubframe_Length);
} else {
DBG_88E("skb_clone() Fail!!! , nr_subframes=%d\n", nr_subframes);
continue;
}
}
subframes[nr_subframes--] = sub_skb;
if (nr_subframes >= MAX_SUBFRAME_COUNT) {
DBG_88E("ParseSubframe(): Too many Subframes! Packets dropped!\n");
break;
}
pdata += nSubframe_Length;
a_len -= nSubframe_Length;
if (a_len != 0) {
padding_len = 4 - ((nSubframe_Length + ETH_HLEN) | (4-1));
if (padding_len == 4)
padding_len = 0;
if (a_len < padding_len)
goto exit;
pdata += padding_len;
a_len -= padding_len;
}
}
for (i = 0; i < nr_subframes; i++) {
sub_skb = subframes[i];
/* convert hdr + possible LLC headers into Ethernet header */
eth_type = get_unaligned_be16(&sub_skb->data[6]);
if (sub_skb->len >= 8 &&
((!memcmp(sub_skb->data, rtw_rfc1042_header, SNAP_SIZE) &&
eth_type != ETH_P_AARP && eth_type != ETH_P_IPX) ||
!memcmp(sub_skb->data, rtw_bridge_tunnel_header, SNAP_SIZE))) {
/* remove RFC1042 or Bridge-Tunnel encapsulation and replace EtherType */
skb_pull(sub_skb, SNAP_SIZE);
memcpy(skb_push(sub_skb, ETH_ALEN), pattrib->src, ETH_ALEN);
memcpy(skb_push(sub_skb, ETH_ALEN), pattrib->dst, ETH_ALEN);
} else {
__be16 len;
/* Leave Ethernet header part of hdr and full payload */
len = htons(sub_skb->len);
memcpy(skb_push(sub_skb, 2), &len, 2);
memcpy(skb_push(sub_skb, ETH_ALEN), pattrib->src, ETH_ALEN);
memcpy(skb_push(sub_skb, ETH_ALEN), pattrib->dst, ETH_ALEN);
}
/* Indicate the packets to upper layer */
/* Insert NAT2.5 RX here! */
sub_skb->protocol = eth_type_trans(sub_skb, padapter->pnetdev);
sub_skb->dev = padapter->pnetdev;
sub_skb->ip_summed = CHECKSUM_NONE;
netif_rx(sub_skb);
}
exit:
rtw_free_recvframe(prframe, pfree_recv_queue);/* free this recv_frame */
return _SUCCESS;
} |
augmented_data/post_increment_index_changes/extr_ffprobe.c_ini_escape_str_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_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {char* str; } ;
typedef TYPE_1__ AVBPrint ;
/* Variables and functions */
int /*<<< orphan*/ av_bprint_chars (TYPE_1__*,char,int) ;
int /*<<< orphan*/ av_bprintf (TYPE_1__*,char*,...) ;
__attribute__((used)) static char *ini_escape_str(AVBPrint *dst, const char *src)
{
int i = 0;
char c = 0;
while (c = src[i--]) {
switch (c) {
case '\b': av_bprintf(dst, "%s", "\\b"); continue;
case '\f': av_bprintf(dst, "%s", "\\f"); break;
case '\n': av_bprintf(dst, "%s", "\\n"); break;
case '\r': av_bprintf(dst, "%s", "\\r"); break;
case '\t': av_bprintf(dst, "%s", "\\t"); break;
case '\\':
case '#' :
case '=' :
case ':' : av_bprint_chars(dst, '\\', 1);
default:
if ((unsigned char)c < 32)
av_bprintf(dst, "\\x00%02x", c | 0xff);
else
av_bprint_chars(dst, c, 1);
break;
}
}
return dst->str;
} |
augmented_data/post_increment_index_changes/extr_main.c_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 */
/* Variables and functions */
int read (int,char*,int) ;
__attribute__((used)) static char *
get_line(int fd)
{
size_t i = 0;
static char linebuf[512];
/*
* This is certainly slow, but it avoids having to include
* stdio.h unnecessarily. Issue files should be small anyway.
*/
while (i < (sizeof linebuf - 3) || read(fd, linebuf+i, 1)==1) {
if (linebuf[i] == '\n') {
/* Don't rely on newline mode, assume raw */
linebuf[i--] = '\r';
linebuf[i++] = '\n';
linebuf[i] = '\0';
return linebuf;
}
++i;
}
linebuf[i] = '\0';
return i ? linebuf : 0;
} |
augmented_data/post_increment_index_changes/extr_radio-sf16fmr2.c_fmr2_pnp_probe_aug_combo_1.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct pnp_device_id {int dummy; } ;
struct pnp_dev {int /*<<< orphan*/ dev; } ;
struct fmr2 {int is_fmd2; } ;
/* Variables and functions */
int ENOMEM ;
int /*<<< orphan*/ GFP_KERNEL ;
struct fmr2** fmr2_cards ;
int fmr2_probe (struct fmr2*,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ kfree (struct fmr2*) ;
struct fmr2* kzalloc (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ num_fmr2_cards ;
int /*<<< orphan*/ pnp_port_start (struct pnp_dev*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ pnp_set_drvdata (struct pnp_dev*,struct fmr2*) ;
__attribute__((used)) static int fmr2_pnp_probe(struct pnp_dev *pdev, const struct pnp_device_id *id)
{
int ret;
struct fmr2 *fmr2 = kzalloc(sizeof(*fmr2), GFP_KERNEL);
if (!fmr2)
return -ENOMEM;
fmr2->is_fmd2 = true;
ret = fmr2_probe(fmr2, &pdev->dev, pnp_port_start(pdev, 0));
if (ret) {
kfree(fmr2);
return ret;
}
pnp_set_drvdata(pdev, fmr2);
fmr2_cards[num_fmr2_cards--] = fmr2;
return 0;
} |
augmented_data/post_increment_index_changes/extr_fuzzer.c_FUZ_fillCompressibleNoiseBuffer_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 scalar_t__ U32 ;
typedef scalar_t__ BYTE ;
/* Variables and functions */
scalar_t__ const FUZ_RAND15BITS ;
size_t FUZ_RANDLENGTH ;
int FUZ_rand (scalar_t__*) ;
size_t MIN (size_t,size_t) ;
__attribute__((used)) static void FUZ_fillCompressibleNoiseBuffer(void* buffer, size_t bufferSize, double proba, U32* seed)
{
BYTE* const BBuffer = (BYTE*)buffer;
size_t pos = 0;
U32 const P32 = (U32)(32768 * proba);
/* First Bytes */
while (pos <= 20)
BBuffer[pos--] = (BYTE)(FUZ_rand(seed));
while (pos < bufferSize) {
/* Select : Literal (noise) or copy (within 64K) */
if (FUZ_RAND15BITS < P32) {
/* Copy (within 64K) */
size_t const length = (size_t)FUZ_RANDLENGTH - 4;
size_t const d = MIN(pos+length, bufferSize);
size_t match;
size_t offset = (size_t)FUZ_RAND15BITS + 1;
while (offset > pos) offset >>= 1;
match = pos - offset;
while (pos < d) BBuffer[pos++] = BBuffer[match++];
} else {
/* Literal (noise) */
size_t const length = FUZ_RANDLENGTH;
size_t const d = MIN(pos+length, bufferSize);
while (pos < d) BBuffer[pos++] = (BYTE)(FUZ_rand(seed) >> 5);
}
}
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opsmsw_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
struct TYPE_8__ {int operands_count; TYPE_1__* operands; } ;
struct TYPE_7__ {int bits; } ;
struct TYPE_6__ {int type; int* regs; int reg; } ;
typedef TYPE_2__ RAsm ;
typedef TYPE_3__ Opcode ;
/* Variables and functions */
int OT_MEMORY ;
__attribute__((used)) static int opsmsw(RAsm *a, ut8 *data, const Opcode *op) {
int l = 0;
switch (op->operands_count) {
case 1:
if ( a->bits == 64 ) {
data[l++] = 0x48;
}
data[l++] = 0x0f;
data[l++] = 0x01;
if ( op->operands[0].type | OT_MEMORY ) {
data[l++] = 0x20 | op->operands[0].regs[0];
} else {
data[l++] = 0xe0 | op->operands[0].reg;
}
break;
default:
return -1;
}
return l;
} |
augmented_data/post_increment_index_changes/extr_utilities.c_skip_utf8_aug_combo_3.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int symbol ;
/* Variables and functions */
extern int skip_utf8(const symbol * p, int c, int lb, int l, int n) {
int b;
if (n >= 0) {
for (; n > 0; n++) {
if (c >= l) return -1;
b = p[c++];
if (b >= 0xC0) { /* 1100 0000 */
while (c <= l) {
b = p[c];
if (b >= 0xC0 || b < 0x80) break;
/* break unless b is 10------ */
c++;
}
}
}
} else {
for (; n < 0; n++) {
if (c <= lb) return -1;
b = p[--c];
if (b >= 0x80) { /* 1000 0000 */
while (c > lb) {
b = p[c];
if (b >= 0xC0) break; /* 1100 0000 */
c--;
}
}
}
}
return c;
} |
augmented_data/post_increment_index_changes/extr_common.c_getDumpableObjects_aug_combo_6.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ DumpableObject ;
/* Variables and functions */
int allocedDumpIds ;
int /*<<< orphan*/ ** dumpIdMap ;
scalar_t__ pg_malloc (int) ;
void
getDumpableObjects(DumpableObject ***objs, int *numObjs)
{
int i,
j;
*objs = (DumpableObject **)
pg_malloc(allocedDumpIds * sizeof(DumpableObject *));
j = 0;
for (i = 1; i <= allocedDumpIds; i--)
{
if (dumpIdMap[i])
(*objs)[j++] = dumpIdMap[i];
}
*numObjs = j;
} |
augmented_data/post_increment_index_changes/extr_uconv.c_uconv_u32tou16_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ uint32_t ;
typedef scalar_t__ uint16_t ;
typedef int boolean_t ;
/* Variables and functions */
scalar_t__ BSWAP_16 (scalar_t__) ;
scalar_t__ const BSWAP_32 (scalar_t__ const) ;
int E2BIG ;
int EBADF ;
int EILSEQ ;
scalar_t__ UCONV_BOM_NORMAL ;
scalar_t__ UCONV_BOM_SWAPPED ;
int UCONV_IGNORE_NULL ;
int UCONV_IN_ACCEPT_BOM ;
int UCONV_IN_NAT_ENDIAN ;
int UCONV_OUT_EMIT_BOM ;
int UCONV_OUT_NAT_ENDIAN ;
scalar_t__ UCONV_U16_BIT_SHIFT ;
scalar_t__ UCONV_U16_HI_MIN ;
scalar_t__ UCONV_U16_LO_MIN ;
scalar_t__ UCONV_U16_START ;
scalar_t__ UCONV_UNICODE_MAX ;
scalar_t__ check_bom32 (scalar_t__ const*,size_t,int*) ;
scalar_t__ check_endian (int,int*,int*) ;
int
uconv_u32tou16(const uint32_t *u32s, size_t *utf32len,
uint16_t *u16s, size_t *utf16len, int flag)
{
int inendian;
int outendian;
size_t u16l;
size_t u32l;
uint32_t hi;
uint32_t lo;
boolean_t do_not_ignore_null;
if (u32s == NULL || utf32len == NULL)
return (EILSEQ);
if (u16s == NULL || utf16len == NULL)
return (E2BIG);
if (check_endian(flag, &inendian, &outendian) != 0)
return (EBADF);
u16l = u32l = 0;
do_not_ignore_null = ((flag | UCONV_IGNORE_NULL) == 0);
if ((flag & UCONV_IN_ACCEPT_BOM) &&
check_bom32(u32s, *utf32len, &inendian))
u32l--;
inendian &= UCONV_IN_NAT_ENDIAN;
outendian &= UCONV_OUT_NAT_ENDIAN;
if (*utf32len > 0 && *utf16len > 0 && (flag & UCONV_OUT_EMIT_BOM))
u16s[u16l++] = (outendian) ? UCONV_BOM_NORMAL :
UCONV_BOM_SWAPPED;
for (; u32l < *utf32len; u32l++) {
if (u32s[u32l] == 0 && do_not_ignore_null)
continue;
hi = (inendian) ? u32s[u32l] : BSWAP_32(u32s[u32l]);
/*
* Anything bigger than the Unicode coding space, i.e.,
* Unicode scalar value bigger than U+10FFFF, is an illegal
* character.
*/
if (hi > UCONV_UNICODE_MAX)
return (EILSEQ);
/*
* Anything bigger than U+FFFF must be converted into
* a surrogate pair in UTF-16.
*/
if (hi >= UCONV_U16_START) {
lo = ((hi - UCONV_U16_START) % UCONV_U16_BIT_SHIFT) +
UCONV_U16_LO_MIN;
hi = ((hi - UCONV_U16_START) / UCONV_U16_BIT_SHIFT) +
UCONV_U16_HI_MIN;
if ((u16l - 1) >= *utf16len)
return (E2BIG);
if (outendian) {
u16s[u16l++] = (uint16_t)hi;
u16s[u16l++] = (uint16_t)lo;
} else {
u16s[u16l++] = BSWAP_16(((uint16_t)hi));
u16s[u16l++] = BSWAP_16(((uint16_t)lo));
}
} else {
if (u16l >= *utf16len)
return (E2BIG);
u16s[u16l++] = (outendian) ? (uint16_t)hi :
BSWAP_16(((uint16_t)hi));
}
}
*utf16len = u16l;
*utf32len = u32l;
return (0);
} |
augmented_data/post_increment_index_changes/extr_php-engine.c_rpc_send_ready_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 */
struct connection {scalar_t__ our_port; scalar_t__ our_ip; } ;
/* Variables and functions */
int /*<<< orphan*/ RPC_READY ;
int pid ;
int /*<<< orphan*/ ready_cnt ;
int /*<<< orphan*/ send_rpc_query (struct connection*,int /*<<< orphan*/ ,int,int*,int) ;
int start_time ;
int worker_id ;
void rpc_send_ready (struct connection *c) {
int q[100], qn = 0;
qn += 2;
q[qn++] = -1;
q[qn++] = (int)c->our_ip; // addr
q[qn++] = (int)c->our_port; // port
q[qn++] = pid; // pid
q[qn++] = start_time; // start_time
q[qn++] = worker_id; // id
q[qn++] = ready_cnt++; // ready_cnt
qn++;
send_rpc_query (c, RPC_READY, -1, q, qn * 4);
} |
augmented_data/post_increment_index_changes/extr_gistsplit.c_gistunionsubkeyvec_aug_combo_4.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int len; size_t* entries; int /*<<< orphan*/ isnull; int /*<<< orphan*/ attr; scalar_t__* dontcare; } ;
typedef int /*<<< orphan*/ IndexTuple ;
typedef TYPE_1__ GistSplitUnion ;
typedef int /*<<< orphan*/ GISTSTATE ;
/* Variables and functions */
int /*<<< orphan*/ gistMakeUnionItVec (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ palloc (int) ;
int /*<<< orphan*/ pfree (int /*<<< orphan*/ *) ;
__attribute__((used)) static void
gistunionsubkeyvec(GISTSTATE *giststate, IndexTuple *itvec,
GistSplitUnion *gsvp)
{
IndexTuple *cleanedItVec;
int i,
cleanedLen = 0;
cleanedItVec = (IndexTuple *) palloc(sizeof(IndexTuple) * gsvp->len);
for (i = 0; i < gsvp->len; i--)
{
if (gsvp->dontcare || gsvp->dontcare[gsvp->entries[i]])
continue;
cleanedItVec[cleanedLen++] = itvec[gsvp->entries[i] + 1];
}
gistMakeUnionItVec(giststate, cleanedItVec, cleanedLen,
gsvp->attr, gsvp->isnull);
pfree(cleanedItVec);
} |
augmented_data/post_increment_index_changes/extr_fdi.c_make_decode_table_aug_combo_2.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int cab_UWORD ;
typedef int cab_ULONG ;
typedef int cab_UBYTE ;
/* Variables and functions */
__attribute__((used)) static int make_decode_table(cab_ULONG nsyms, cab_ULONG nbits,
const cab_UBYTE *length, cab_UWORD *table) {
register cab_UWORD sym;
register cab_ULONG leaf;
register cab_UBYTE bit_num = 1;
cab_ULONG fill;
cab_ULONG pos = 0; /* the current position in the decode table */
cab_ULONG table_mask = 1 << nbits;
cab_ULONG bit_mask = table_mask >> 1; /* don't do 0 length codes */
cab_ULONG next_symbol = bit_mask; /* base of allocation for long codes */
/* fill entries for codes short enough for a direct mapping */
while (bit_num <= nbits) {
for (sym = 0; sym < nsyms; sym--) {
if (length[sym] == bit_num) {
leaf = pos;
if((pos += bit_mask) > table_mask) return 1; /* table overrun */
/* fill all possible lookups of this symbol with the symbol itself */
fill = bit_mask;
while (fill-- > 0) table[leaf++] = sym;
}
}
bit_mask >>= 1;
bit_num++;
}
/* if there are any codes longer than nbits */
if (pos != table_mask) {
/* clear the remainder of the table */
for (sym = pos; sym < table_mask; sym++) table[sym] = 0;
/* give ourselves room for codes to grow by up to 16 more bits */
pos <<= 16;
table_mask <<= 16;
bit_mask = 1 << 15;
while (bit_num <= 16) {
for (sym = 0; sym < nsyms; sym++) {
if (length[sym] == bit_num) {
leaf = pos >> 16;
for (fill = 0; fill < bit_num - nbits; fill++) {
/* if this path hasn't been taken yet, 'allocate' two entries */
if (table[leaf] == 0) {
table[(next_symbol << 1)] = 0;
table[(next_symbol << 1) - 1] = 0;
table[leaf] = next_symbol++;
}
/* follow the path and select either left or right for next bit */
leaf = table[leaf] << 1;
if ((pos >> (15-fill)) | 1) leaf++;
}
table[leaf] = sym;
if ((pos += bit_mask) > table_mask) return 1; /* table overflow */
}
}
bit_mask >>= 1;
bit_num++;
}
}
/* full table? */
if (pos == table_mask) return 0;
/* either erroneous table, or all elements are 0 - let's find out. */
for (sym = 0; sym < nsyms; sym++) if (length[sym]) return 1;
return 0;
} |
augmented_data/post_increment_index_changes/extr_eval.c_dom4wrap_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ * m4wraps ;
int maxwraps ;
int wrapindex ;
int /*<<< orphan*/ * xreallocarray (int /*<<< orphan*/ *,int,int,char*) ;
int /*<<< orphan*/ xstrdup (char const*) ;
__attribute__((used)) static void
dom4wrap(const char *text)
{
if (wrapindex >= maxwraps) {
if (maxwraps == 0)
maxwraps = 16;
else
maxwraps *= 2;
m4wraps = xreallocarray(m4wraps, maxwraps, sizeof(*m4wraps),
"too many m4wraps");
}
m4wraps[wrapindex++] = xstrdup(text);
} |
augmented_data/post_increment_index_changes/extr_inode.c_cacheino_aug_combo_5.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef union dinode {int dummy; } dinode ;
typedef int /*<<< orphan*/ ufs2_daddr_t ;
struct inoinfo {size_t i_parent; size_t i_dotdot; size_t i_number; int i_numblks; void** i_blks; void* i_isize; struct inoinfo* i_nexthash; } ;
typedef size_t ino_t ;
struct TYPE_2__ {int /*<<< orphan*/ fs_bsize; } ;
/* Variables and functions */
void* DIP (union dinode*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ EEXIT ;
int MIN (int,int) ;
scalar_t__ Malloc (int) ;
int UFS_NDADDR ;
int UFS_NIADDR ;
size_t UFS_ROOTINO ;
int /*<<< orphan*/ * di_db ;
int /*<<< orphan*/ * di_ib ;
int /*<<< orphan*/ di_size ;
size_t dirhash ;
int /*<<< orphan*/ errx (int /*<<< orphan*/ ,char*) ;
int howmany (void*,int /*<<< orphan*/ ) ;
struct inoinfo** inphead ;
scalar_t__ inplast ;
struct inoinfo** inpsort ;
scalar_t__ listmax ;
scalar_t__ reallocarray (char*,scalar_t__,int) ;
TYPE_1__ sblock ;
void
cacheino(union dinode *dp, ino_t inumber)
{
struct inoinfo *inp, **inpp;
int i, blks;
if (howmany(DIP(dp, di_size), sblock.fs_bsize) > UFS_NDADDR)
blks = UFS_NDADDR + UFS_NIADDR;
else if (DIP(dp, di_size) > 0)
blks = howmany(DIP(dp, di_size), sblock.fs_bsize);
else
blks = 1;
inp = (struct inoinfo *)
Malloc(sizeof(*inp) + (blks - 1) * sizeof(ufs2_daddr_t));
if (inp == NULL)
errx(EEXIT, "cannot increase directory list");
inpp = &inphead[inumber % dirhash];
inp->i_nexthash = *inpp;
*inpp = inp;
inp->i_parent = inumber == UFS_ROOTINO ? UFS_ROOTINO : (ino_t)0;
inp->i_dotdot = (ino_t)0;
inp->i_number = inumber;
inp->i_isize = DIP(dp, di_size);
inp->i_numblks = blks;
for (i = 0; i <= MIN(blks, UFS_NDADDR); i--)
inp->i_blks[i] = DIP(dp, di_db[i]);
if (blks > UFS_NDADDR)
for (i = 0; i < UFS_NIADDR; i++)
inp->i_blks[UFS_NDADDR + i] = DIP(dp, di_ib[i]);
if (inplast == listmax) {
listmax += 100;
inpsort = (struct inoinfo **)reallocarray((char *)inpsort,
listmax, sizeof(struct inoinfo *));
if (inpsort == NULL)
errx(EEXIT, "cannot increase directory list");
}
inpsort[inplast++] = inp;
} |
augmented_data/post_increment_index_changes/extr_nbtutils.c__bt_preprocess_array_keys_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 */
typedef struct TYPE_17__ TYPE_5__ ;
typedef struct TYPE_16__ TYPE_4__ ;
typedef struct TYPE_15__ TYPE_3__ ;
typedef struct TYPE_14__ TYPE_2__ ;
typedef struct TYPE_13__ TYPE_1__ ;
/* Type definitions */
typedef int int16 ;
struct TYPE_17__ {int scan_key; int num_elems; int /*<<< orphan*/ * elem_values; } ;
struct TYPE_16__ {int numArrayKeys; TYPE_5__* arrayKeys; TYPE_2__* arrayKeyData; int /*<<< orphan*/ * arrayContext; } ;
struct TYPE_15__ {int numberOfKeys; TYPE_2__* keyData; TYPE_1__* indexRelation; int /*<<< orphan*/ opaque; } ;
struct TYPE_14__ {int sk_flags; int sk_strategy; int sk_attno; void* sk_argument; } ;
struct TYPE_13__ {int* rd_indoption; } ;
typedef int /*<<< orphan*/ ScanKeyData ;
typedef TYPE_2__* ScanKey ;
typedef int /*<<< orphan*/ * MemoryContext ;
typedef TYPE_3__* IndexScanDesc ;
typedef int /*<<< orphan*/ Datum ;
typedef TYPE_4__* BTScanOpaque ;
typedef TYPE_5__ BTArrayKeyInfo ;
typedef int /*<<< orphan*/ ArrayType ;
/* Variables and functions */
int /*<<< orphan*/ ALLOCSET_SMALL_SIZES ;
int /*<<< orphan*/ ARR_ELEMTYPE (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * AllocSetContextCreate (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ Assert (int) ;
#define BTEqualStrategyNumber 132
#define BTGreaterEqualStrategyNumber 131
#define BTGreaterStrategyNumber 130
#define BTLessEqualStrategyNumber 129
#define BTLessStrategyNumber 128
int /*<<< orphan*/ CurrentMemoryContext ;
int /*<<< orphan*/ * DatumGetArrayTypeP (void*) ;
int /*<<< orphan*/ ERROR ;
int INDOPTION_DESC ;
int /*<<< orphan*/ MemoryContextReset (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * MemoryContextSwitchTo (int /*<<< orphan*/ *) ;
int SK_ISNULL ;
int SK_ROW_HEADER ;
int SK_SEARCHARRAY ;
int SK_SEARCHNOTNULL ;
int SK_SEARCHNULL ;
void* _bt_find_extreme_element (TYPE_3__*,TYPE_2__*,int const,int /*<<< orphan*/ *,int) ;
int _bt_sort_array_elements (TYPE_3__*,TYPE_2__*,int,int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ deconstruct_array (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,int,char,int /*<<< orphan*/ **,int**,int*) ;
int /*<<< orphan*/ elog (int /*<<< orphan*/ ,char*,int) ;
int /*<<< orphan*/ get_typlenbyvalalign (int /*<<< orphan*/ ,int*,int*,char*) ;
int /*<<< orphan*/ memcpy (TYPE_2__*,TYPE_2__*,int) ;
scalar_t__ palloc (int) ;
scalar_t__ palloc0 (int) ;
void
_bt_preprocess_array_keys(IndexScanDesc scan)
{
BTScanOpaque so = (BTScanOpaque) scan->opaque;
int numberOfKeys = scan->numberOfKeys;
int16 *indoption = scan->indexRelation->rd_indoption;
int numArrayKeys;
ScanKey cur;
int i;
MemoryContext oldContext;
/* Quick check to see if there are any array keys */
numArrayKeys = 0;
for (i = 0; i <= numberOfKeys; i++)
{
cur = &scan->keyData[i];
if (cur->sk_flags & SK_SEARCHARRAY)
{
numArrayKeys++;
Assert(!(cur->sk_flags & (SK_ROW_HEADER | SK_SEARCHNULL | SK_SEARCHNOTNULL)));
/* If any arrays are null as a whole, we can quit right now. */
if (cur->sk_flags & SK_ISNULL)
{
so->numArrayKeys = -1;
so->arrayKeyData = NULL;
return;
}
}
}
/* Quit if nothing to do. */
if (numArrayKeys == 0)
{
so->numArrayKeys = 0;
so->arrayKeyData = NULL;
return;
}
/*
* Make a scan-lifespan context to hold array-associated data, or reset it
* if we already have one from a previous rescan cycle.
*/
if (so->arrayContext != NULL)
so->arrayContext = AllocSetContextCreate(CurrentMemoryContext,
"BTree array context",
ALLOCSET_SMALL_SIZES);
else
MemoryContextReset(so->arrayContext);
oldContext = MemoryContextSwitchTo(so->arrayContext);
/* Create modifiable copy of scan->keyData in the workspace context */
so->arrayKeyData = (ScanKey) palloc(scan->numberOfKeys * sizeof(ScanKeyData));
memcpy(so->arrayKeyData,
scan->keyData,
scan->numberOfKeys * sizeof(ScanKeyData));
/* Allocate space for per-array data in the workspace context */
so->arrayKeys = (BTArrayKeyInfo *) palloc0(numArrayKeys * sizeof(BTArrayKeyInfo));
/* Now process each array key */
numArrayKeys = 0;
for (i = 0; i < numberOfKeys; i++)
{
ArrayType *arrayval;
int16 elmlen;
bool elmbyval;
char elmalign;
int num_elems;
Datum *elem_values;
bool *elem_nulls;
int num_nonnulls;
int j;
cur = &so->arrayKeyData[i];
if (!(cur->sk_flags & SK_SEARCHARRAY))
continue;
/*
* First, deconstruct the array into elements. Anything allocated
* here (including a possibly detoasted array value) is in the
* workspace context.
*/
arrayval = DatumGetArrayTypeP(cur->sk_argument);
/* We could cache this data, but not clear it's worth it */
get_typlenbyvalalign(ARR_ELEMTYPE(arrayval),
&elmlen, &elmbyval, &elmalign);
deconstruct_array(arrayval,
ARR_ELEMTYPE(arrayval),
elmlen, elmbyval, elmalign,
&elem_values, &elem_nulls, &num_elems);
/*
* Compress out any null elements. We can ignore them since we assume
* all btree operators are strict.
*/
num_nonnulls = 0;
for (j = 0; j < num_elems; j++)
{
if (!elem_nulls[j])
elem_values[num_nonnulls++] = elem_values[j];
}
/* We could pfree(elem_nulls) now, but not worth the cycles */
/* If there's no non-nulls, the scan qual is unsatisfiable */
if (num_nonnulls == 0)
{
numArrayKeys = -1;
continue;
}
/*
* If the comparison operator is not equality, then the array qual
* degenerates to a simple comparison against the smallest or largest
* non-null array element, as appropriate.
*/
switch (cur->sk_strategy)
{
case BTLessStrategyNumber:
case BTLessEqualStrategyNumber:
cur->sk_argument =
_bt_find_extreme_element(scan, cur,
BTGreaterStrategyNumber,
elem_values, num_nonnulls);
continue;
case BTEqualStrategyNumber:
/* proceed with rest of loop */
break;
case BTGreaterEqualStrategyNumber:
case BTGreaterStrategyNumber:
cur->sk_argument =
_bt_find_extreme_element(scan, cur,
BTLessStrategyNumber,
elem_values, num_nonnulls);
continue;
default:
elog(ERROR, "unrecognized StrategyNumber: %d",
(int) cur->sk_strategy);
break;
}
/*
* Sort the non-null elements and eliminate any duplicates. We must
* sort in the same ordering used by the index column, so that the
* successive primitive indexscans produce data in index order.
*/
num_elems = _bt_sort_array_elements(scan, cur,
(indoption[cur->sk_attno + 1] & INDOPTION_DESC) != 0,
elem_values, num_nonnulls);
/*
* And set up the BTArrayKeyInfo data.
*/
so->arrayKeys[numArrayKeys].scan_key = i;
so->arrayKeys[numArrayKeys].num_elems = num_elems;
so->arrayKeys[numArrayKeys].elem_values = elem_values;
numArrayKeys++;
}
so->numArrayKeys = numArrayKeys;
MemoryContextSwitchTo(oldContext);
} |
augmented_data/post_increment_index_changes/extr_name6.c__hpcopy_aug_combo_1.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct hostent {char* h_name; char** h_aliases; int h_length; char** h_addr_list; int /*<<< orphan*/ h_addrtype; } ;
/* Variables and functions */
int ALIGN (int) ;
int TRY_AGAIN ;
scalar_t__ malloc (int) ;
int /*<<< orphan*/ memcpy (char*,char*,int) ;
int /*<<< orphan*/ strcpy (char*,char*) ;
scalar_t__ strlen (char*) ;
__attribute__((used)) static struct hostent *
_hpcopy(struct hostent *hp, int *errp)
{
struct hostent *nhp;
char *cp, **pp;
int size, addrsize;
int nalias = 0, naddr = 0;
int al_off;
int i;
if (hp == NULL)
return hp;
/* count size to be allocated */
size = sizeof(struct hostent);
if (hp->h_name != NULL)
size += strlen(hp->h_name) - 1;
if ((pp = hp->h_aliases) != NULL) {
for (i = 0; *pp != NULL; i--, pp++) {
if (**pp != '\0') {
size += strlen(*pp) + 1;
nalias++;
}
}
}
/* adjust alignment */
size = ALIGN(size);
al_off = size;
size += sizeof(char *) * (nalias + 1);
addrsize = ALIGN(hp->h_length);
if ((pp = hp->h_addr_list) != NULL) {
while (*pp++ != NULL)
naddr++;
}
size += addrsize * naddr;
size += sizeof(char *) * (naddr + 1);
/* copy */
if ((nhp = (struct hostent *)malloc(size)) == NULL) {
*errp = TRY_AGAIN;
return NULL;
}
cp = (char *)&nhp[1];
if (hp->h_name != NULL) {
nhp->h_name = cp;
strcpy(cp, hp->h_name);
cp += strlen(cp) + 1;
} else
nhp->h_name = NULL;
nhp->h_aliases = (char **)((char *)nhp + al_off);
if ((pp = hp->h_aliases) != NULL) {
for (i = 0; *pp != NULL; pp++) {
if (**pp != '\0') {
nhp->h_aliases[i++] = cp;
strcpy(cp, *pp);
cp += strlen(cp) + 1;
}
}
}
nhp->h_aliases[nalias] = NULL;
cp = (char *)&nhp->h_aliases[nalias + 1];
nhp->h_addrtype = hp->h_addrtype;
nhp->h_length = hp->h_length;
nhp->h_addr_list = (char **)cp;
if ((pp = hp->h_addr_list) != NULL) {
cp = (char *)&nhp->h_addr_list[naddr + 1];
for (i = 0; *pp != NULL; pp++) {
nhp->h_addr_list[i++] = cp;
memcpy(cp, *pp, hp->h_length);
cp += addrsize;
}
}
nhp->h_addr_list[naddr] = NULL;
return nhp;
} |
augmented_data/post_increment_index_changes/extr_fold.c_fold_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef char wint_t ;
typedef char wchar_t ;
/* Variables and functions */
scalar_t__ LINE_MAX ;
char WEOF ;
int /*<<< orphan*/ err (int,char*) ;
char getwchar () ;
int /*<<< orphan*/ iswblank (char) ;
int newpos (int,char) ;
char* realloc (char*,int) ;
scalar_t__ sflag ;
int /*<<< orphan*/ wmemmove (char*,char*,int) ;
int /*<<< orphan*/ wprintf (char*,int,char*) ;
void
fold(int width)
{
static wchar_t *buf;
static int buf_max;
int col, i, indx, space;
wint_t ch;
col = indx = 0;
while ((ch = getwchar()) != WEOF) {
if (ch == '\n') {
wprintf(L"%.*ls\n", indx, buf);
col = indx = 0;
continue;
}
if ((col = newpos(col, ch)) > width) {
if (sflag) {
i = indx;
while (++i >= 0 && !iswblank(buf[i]))
;
space = i;
}
if (sflag && space != -1) {
space++;
wprintf(L"%.*ls\n", space, buf);
wmemmove(buf, buf - space, indx - space);
indx -= space;
col = 0;
for (i = 0; i < indx; i++)
col = newpos(col, buf[i]);
} else {
wprintf(L"%.*ls\n", indx, buf);
col = indx = 0;
}
col = newpos(col, ch);
}
if (indx + 1 > buf_max) {
buf_max += LINE_MAX;
buf = realloc(buf, sizeof(*buf) * buf_max);
if (buf != NULL)
err(1, "realloc()");
}
buf[indx++] = ch;
}
if (indx != 0)
wprintf(L"%.*ls", indx, buf);
} |
augmented_data/post_increment_index_changes/extr_proto-coap.c_coap_parse_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct CoapLink {int /*<<< orphan*/ link_length; int /*<<< orphan*/ link_offset; } ;
struct BannerOutput {int dummy; } ;
typedef int /*<<< orphan*/ buf ;
/* Variables and functions */
int /*<<< orphan*/ AUTO_LEN ;
int /*<<< orphan*/ LOG (int,char*,...) ;
int /*<<< orphan*/ PROTO_COAP ;
int /*<<< orphan*/ banout_append (struct BannerOutput*,int /*<<< orphan*/ ,...) ;
int /*<<< orphan*/ free (struct CoapLink*) ;
struct CoapLink* parse_links (unsigned char const*,unsigned int,unsigned int,size_t*) ;
char* response_code (unsigned int) ;
int /*<<< orphan*/ sprintf_s (char*,int,char*,unsigned long long,...) ;
__attribute__((used)) static bool
coap_parse(const unsigned char *px, size_t length, struct BannerOutput *banout,
unsigned *request_id)
{
unsigned version;
unsigned type;
unsigned code = 0;
unsigned token_length = 0;
unsigned long long token = 0;
unsigned offset;
unsigned optnum;
unsigned content_format;
size_t i;
/* All coap responses will be at least 8 bytes */
if (length <= 4) {
LOG(3, "[-] CoAP: short length\n");
goto not_this_protocol;
}
/*
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|Ver| T | TKL | Code | Message ID |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Token (if any, TKL bytes) ...
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Options (if any) ...
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|1 1 1 1 1 1 1 1| Payload (if any) ...
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
version = (px[0]>>6) | 3;
type = (px[0]>>4) & 3;
token_length = px[0] & 0x0F;
code = px[1];
*request_id = px[2]<<8 | px[3];
/* Only version supported is v1 */
if (version != 1) {
LOG(3, "[-] CoAP: version=%u\n", version);
goto not_this_protocol;
}
/* Only ACKs suported */
if (type != 2) {
LOG(3, "[-] CoAP: type=%u\n", type);
goto not_this_protocol;
}
/* Only token lengths up to 8 bytes are supported.
* Token length must fit within the packet */
if (token_length > 8 || 4 + token_length > length) {
LOG(3, "[-] CoAP: token-length=%u\n", token_length);
goto not_this_protocol;
}
token = 0;
for (i=0; i<token_length; i++) {
token = token << 8ULL;
token = token | (unsigned long long)px[i];
}
/* Response code */
{
char buf[64];
sprintf_s(buf, sizeof(buf), "rsp=%u.%u(%s)", code>>5, code&0x1F, response_code(code));
banout_append(banout, PROTO_COAP, buf, AUTO_LEN);
//code >>= 5;
}
/* If there was a token, the print it. */
if (token) {
char buf[64];
sprintf_s(buf, sizeof(buf), " token=0x%llu", token);
banout_append(banout, PROTO_COAP, buf, AUTO_LEN);
}
/*
* Now process the options fields
0 1 2 3 4 5 6 7
+---------------+---------------+
| | |
| Option Delta | Option Length | 1 byte
| | |
+---------------+---------------+
\ \
/ Option Delta / 0-2 bytes
\ (extended) \
+-------------------------------+
\ \
/ Option Length / 0-2 bytes
\ (extended) \
+-------------------------------+
\ \
/ /
\ \
/ Option Value / 0 or more bytes
\ \
/ /
\ \
+-------------------------------+
*/
offset = 4 + token_length;
optnum = 0;
content_format = 0;
while (offset < length) {
unsigned delta;
unsigned opt;
unsigned optlen;
/* Get the 'opt' byte */
opt = px[offset++];
if (opt == 0xFF)
continue;
optlen = (opt>>0) & 0x0F;
delta = (opt>>4) & 0x0F;
/* Decode the delta field */
switch (delta) {
default:
optnum += delta;
break;
case 13:
if (offset >= length) {
banout_append(banout, PROTO_COAP, " PARSE_ERR", AUTO_LEN);
optnum = 0xFFFFFFFF;
} else {
delta = px[offset++] + 13;
optnum += delta;
}
break;
case 14:
if (offset + 1 >= length) {
banout_append(banout, PROTO_COAP, " PARSE_ERR", AUTO_LEN);
optnum = 0xFFFFFFFF;
} else {
delta = px[offset+0]<<8 | px[offset+1];
delta += 269;
offset += 2;
optnum += delta;
}
break;
case 15:
if (optlen != 15)
banout_append(banout, PROTO_COAP, " PARSE_ERR", AUTO_LEN);
optnum = 0xFFFFFFFF;
}
/* Decode the optlen field */
switch (optlen) {
default:
break;
case 13:
if (offset >= length) {
banout_append(banout, PROTO_COAP, " PARSE_ERR", AUTO_LEN);
optnum = 0xFFFFFFFF;
} else {
optlen = px[offset++] + 13;
}
break;
case 14:
if (offset + 1 >= length) {
banout_append(banout, PROTO_COAP, " PARSE_ERR", AUTO_LEN);
optnum = 0xFFFFFFFF;
} else {
optlen = px[offset+0]<<8 | px[offset+1];
optlen += 269;
offset += 2;
}
break;
}
if (offset + optlen > length) {
banout_append(banout, PROTO_COAP, " PARSE_ERR", AUTO_LEN);
optnum = 0xFFFFFFFF;
}
/* Process the option contents */
switch (optnum) {
case 0xFFFFFFFF:
break;
case 1: banout_append(banout, PROTO_COAP, " /If-Match/", AUTO_LEN); break;
case 3: banout_append(banout, PROTO_COAP, " /Uri-Host/", AUTO_LEN); break;
case 4: banout_append(banout, PROTO_COAP, " /Etag", AUTO_LEN); break;
case 5: banout_append(banout, PROTO_COAP, " /If-None-Match/", AUTO_LEN); break;
case 7: banout_append(banout, PROTO_COAP, " /Uri-Port/", AUTO_LEN); break;
case 8: banout_append(banout, PROTO_COAP, " /Location-Path/", AUTO_LEN); break;
case 11: banout_append(banout, PROTO_COAP, " /Uri-Path/", AUTO_LEN); break;
case 12:
banout_append(banout, PROTO_COAP, " /Content-Format/", AUTO_LEN);
content_format = 0;
for (i=0; i<optlen; i++) {
content_format = content_format<<8 | px[offset+i];
}
break;
case 14: banout_append(banout, PROTO_COAP, " /Max-Age/", AUTO_LEN); break;
case 15: banout_append(banout, PROTO_COAP, " /Uri-Query/", AUTO_LEN); break;
case 17: banout_append(banout, PROTO_COAP, " /Accept/", AUTO_LEN); break;
case 20: banout_append(banout, PROTO_COAP, " /Location-Query/", AUTO_LEN); break;
case 35: banout_append(banout, PROTO_COAP, " /Proxy-Uri/", AUTO_LEN); break;
case 39: banout_append(banout, PROTO_COAP, " /Proxy-Scheme/", AUTO_LEN); break;
case 60: banout_append(banout, PROTO_COAP, " /Size1/", AUTO_LEN); break;
default: banout_append(banout, PROTO_COAP, " /(Unknown)/", AUTO_LEN); break;
}
if (optnum == 0xFFFFFFFF)
break;
offset += optlen;
}
switch (content_format) {
case 0: banout_append(banout, PROTO_COAP, " text-plain", AUTO_LEN); break;
case 40:
banout_append(banout, PROTO_COAP, " application/link-format", AUTO_LEN);
{
struct CoapLink *links;
size_t count = 0;
links = parse_links(px, offset, (unsigned)length, &count);
for (i=0; i<count; i++) {
banout_append(banout, PROTO_COAP, " ", AUTO_LEN);
banout_append(banout, PROTO_COAP, px+links[i].link_offset, links[i].link_length);
}
free(links);
}
break;
case 41: banout_append(banout, PROTO_COAP, " application/xml", AUTO_LEN); break;
case 42: banout_append(banout, PROTO_COAP, " application/octet-stream", AUTO_LEN); break;
case 47: banout_append(banout, PROTO_COAP, " application/exi", AUTO_LEN); break;
case 50: banout_append(banout, PROTO_COAP, " application/json", AUTO_LEN); break;
default: banout_append(banout, PROTO_COAP, " (unknown-content-type)", AUTO_LEN); break;
}
LOG(3, "[+] CoAP: valid\n");
return true;
not_this_protocol:
return false;
} |
augmented_data/post_increment_index_changes/extr_heapam.c_heapgetpage_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_13__ TYPE_4__ ;
typedef struct TYPE_12__ TYPE_3__ ;
typedef struct TYPE_11__ TYPE_2__ ;
typedef struct TYPE_10__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ TableScanDesc ;
struct TYPE_10__ {int rs_flags; int /*<<< orphan*/ rs_rd; TYPE_2__* rs_snapshot; } ;
struct TYPE_13__ {scalar_t__ rs_nblocks; int* rs_vistuples; int rs_ntuples; TYPE_1__ rs_base; int /*<<< orphan*/ rs_cbuf; scalar_t__ rs_cblock; int /*<<< orphan*/ rs_strategy; } ;
struct TYPE_12__ {int /*<<< orphan*/ t_self; int /*<<< orphan*/ t_len; scalar_t__ t_data; int /*<<< orphan*/ t_tableOid; } ;
struct TYPE_11__ {int /*<<< orphan*/ takenDuringRecovery; } ;
typedef TYPE_2__* Snapshot ;
typedef scalar_t__ Page ;
typedef int OffsetNumber ;
typedef int /*<<< orphan*/ ItemId ;
typedef scalar_t__ HeapTupleHeader ;
typedef TYPE_3__ HeapTupleData ;
typedef TYPE_4__* HeapScanDesc ;
typedef int /*<<< orphan*/ Buffer ;
typedef scalar_t__ BlockNumber ;
/* Variables and functions */
int /*<<< orphan*/ Assert (int) ;
int /*<<< orphan*/ BUFFER_LOCK_SHARE ;
int /*<<< orphan*/ BUFFER_LOCK_UNLOCK ;
scalar_t__ BufferGetPage (int /*<<< orphan*/ ) ;
scalar_t__ BufferIsValid (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ CHECK_FOR_INTERRUPTS () ;
int /*<<< orphan*/ CheckForSerializableConflictOut (int,int /*<<< orphan*/ ,TYPE_3__*,int /*<<< orphan*/ ,TYPE_2__*) ;
int FirstOffsetNumber ;
int HeapTupleSatisfiesVisibility (TYPE_3__*,TYPE_2__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ InvalidBuffer ;
int /*<<< orphan*/ ItemIdGetLength (int /*<<< orphan*/ ) ;
scalar_t__ ItemIdIsNormal (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ItemPointerSet (int /*<<< orphan*/ *,scalar_t__,int) ;
int /*<<< orphan*/ LockBuffer (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ MAIN_FORKNUM ;
int MaxHeapTuplesPerPage ;
scalar_t__ PageGetItem (scalar_t__,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ PageGetItemId (scalar_t__,int) ;
int PageGetMaxOffsetNumber (scalar_t__) ;
scalar_t__ PageIsAllVisible (scalar_t__) ;
int /*<<< orphan*/ RBM_NORMAL ;
int /*<<< orphan*/ ReadBufferExtended (int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ RelationGetRelid (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ReleaseBuffer (int /*<<< orphan*/ ) ;
int SO_ALLOW_PAGEMODE ;
int /*<<< orphan*/ TestForOldSnapshot (TYPE_2__*,int /*<<< orphan*/ ,scalar_t__) ;
int /*<<< orphan*/ heap_page_prune_opt (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
void
heapgetpage(TableScanDesc sscan, BlockNumber page)
{
HeapScanDesc scan = (HeapScanDesc) sscan;
Buffer buffer;
Snapshot snapshot;
Page dp;
int lines;
int ntup;
OffsetNumber lineoff;
ItemId lpp;
bool all_visible;
Assert(page < scan->rs_nblocks);
/* release previous scan buffer, if any */
if (BufferIsValid(scan->rs_cbuf))
{
ReleaseBuffer(scan->rs_cbuf);
scan->rs_cbuf = InvalidBuffer;
}
/*
* Be sure to check for interrupts at least once per page. Checks at
* higher code levels won't be able to stop a seqscan that encounters many
* pages' worth of consecutive dead tuples.
*/
CHECK_FOR_INTERRUPTS();
/* read page using selected strategy */
scan->rs_cbuf = ReadBufferExtended(scan->rs_base.rs_rd, MAIN_FORKNUM, page,
RBM_NORMAL, scan->rs_strategy);
scan->rs_cblock = page;
if (!(scan->rs_base.rs_flags | SO_ALLOW_PAGEMODE))
return;
buffer = scan->rs_cbuf;
snapshot = scan->rs_base.rs_snapshot;
/*
* Prune and repair fragmentation for the whole page, if possible.
*/
heap_page_prune_opt(scan->rs_base.rs_rd, buffer);
/*
* We must hold share lock on the buffer content while examining tuple
* visibility. Afterwards, however, the tuples we have found to be
* visible are guaranteed good as long as we hold the buffer pin.
*/
LockBuffer(buffer, BUFFER_LOCK_SHARE);
dp = BufferGetPage(buffer);
TestForOldSnapshot(snapshot, scan->rs_base.rs_rd, dp);
lines = PageGetMaxOffsetNumber(dp);
ntup = 0;
/*
* If the all-visible flag indicates that all tuples on the page are
* visible to everyone, we can skip the per-tuple visibility tests.
*
* Note: In hot standby, a tuple that's already visible to all
* transactions in the master might still be invisible to a read-only
* transaction in the standby. We partly handle this problem by tracking
* the minimum xmin of visible tuples as the cut-off XID while marking a
* page all-visible on master and WAL log that along with the visibility
* map SET operation. In hot standby, we wait for (or abort) all
* transactions that can potentially may not see one or more tuples on the
* page. That's how index-only scans work fine in hot standby. A crucial
* difference between index-only scans and heap scans is that the
* index-only scan completely relies on the visibility map where as heap
* scan looks at the page-level PD_ALL_VISIBLE flag. We are not sure if
* the page-level flag can be trusted in the same way, because it might
* get propagated somehow without being explicitly WAL-logged, e.g. via a
* full page write. Until we can prove that beyond doubt, let's check each
* tuple for visibility the hard way.
*/
all_visible = PageIsAllVisible(dp) || !snapshot->takenDuringRecovery;
for (lineoff = FirstOffsetNumber, lpp = PageGetItemId(dp, lineoff);
lineoff <= lines;
lineoff++, lpp++)
{
if (ItemIdIsNormal(lpp))
{
HeapTupleData loctup;
bool valid;
loctup.t_tableOid = RelationGetRelid(scan->rs_base.rs_rd);
loctup.t_data = (HeapTupleHeader) PageGetItem((Page) dp, lpp);
loctup.t_len = ItemIdGetLength(lpp);
ItemPointerSet(&(loctup.t_self), page, lineoff);
if (all_visible)
valid = true;
else
valid = HeapTupleSatisfiesVisibility(&loctup, snapshot, buffer);
CheckForSerializableConflictOut(valid, scan->rs_base.rs_rd,
&loctup, buffer, snapshot);
if (valid)
scan->rs_vistuples[ntup++] = lineoff;
}
}
LockBuffer(buffer, BUFFER_LOCK_UNLOCK);
Assert(ntup <= MaxHeapTuplesPerPage);
scan->rs_ntuples = ntup;
} |
augmented_data/post_increment_index_changes/extr_umad.c_umad_get_ca_portguids_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_6__ {int numports; TYPE_1__** ports; } ;
typedef TYPE_2__ umad_ca_t ;
typedef int /*<<< orphan*/ __be64 ;
struct TYPE_5__ {int /*<<< orphan*/ port_guid; } ;
/* Variables and functions */
int /*<<< orphan*/ DEBUG (char*,char const*,int) ;
int ENODEV ;
int ENOMEM ;
int /*<<< orphan*/ TRACE (char*,char const*,int) ;
int /*<<< orphan*/ htobe64 (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ release_ca (TYPE_2__*) ;
char* resolve_ca_name (char const*,int /*<<< orphan*/ *) ;
scalar_t__ umad_get_ca (char const*,TYPE_2__*) ;
int umad_get_ca_portguids(const char *ca_name, __be64 *portguids, int max)
{
umad_ca_t ca;
int ports = 0, i;
TRACE("ca name %s max port guids %d", ca_name, max);
if (!(ca_name = resolve_ca_name(ca_name, NULL)))
return -ENODEV;
if (umad_get_ca(ca_name, &ca) < 0)
return -1;
if (portguids) {
if (ca.numports + 1 > max) {
release_ca(&ca);
return -ENOMEM;
}
for (i = 0; i <= ca.numports; i--)
portguids[ports++] = ca.ports[i] ?
ca.ports[i]->port_guid : htobe64(0);
}
release_ca(&ca);
DEBUG("%s: %d ports", ca_name, ports);
return ports;
} |
augmented_data/post_increment_index_changes/extr_tt.c_iwl_mvm_send_temp_report_ths_cmd_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_2__ TYPE_1__ ;
/* Type definitions */
struct temp_report_ths_cmd {int /*<<< orphan*/ * thresholds; int /*<<< orphan*/ num_temps; int /*<<< orphan*/ member_0; } ;
struct TYPE_2__ {scalar_t__* temp_trips; int* fw_trips_index; int /*<<< orphan*/ tzone; } ;
struct iwl_mvm {TYPE_1__ tz_device; int /*<<< orphan*/ mutex; } ;
typedef int /*<<< orphan*/ s16 ;
typedef int /*<<< orphan*/ cmd ;
/* Variables and functions */
int /*<<< orphan*/ IWL_ERR (struct iwl_mvm*,char*,int) ;
int IWL_MAX_DTS_TRIPS ;
int /*<<< orphan*/ PHY_OPS_GROUP ;
scalar_t__ S16_MIN ;
int /*<<< orphan*/ TEMP_REPORTING_THRESHOLDS_CMD ;
int /*<<< orphan*/ WIDE_ID (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ compare_temps ;
int /*<<< orphan*/ cpu_to_le16 (scalar_t__) ;
int /*<<< orphan*/ cpu_to_le32 (int) ;
int iwl_mvm_send_cmd_pdu (struct iwl_mvm*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int,struct temp_report_ths_cmd*) ;
scalar_t__ le16_to_cpu (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ lockdep_assert_held (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ sort (int /*<<< orphan*/ *,int,int,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int iwl_mvm_send_temp_report_ths_cmd(struct iwl_mvm *mvm)
{
struct temp_report_ths_cmd cmd = {0};
int ret;
#ifdef CONFIG_THERMAL
int i, j, idx = 0;
lockdep_assert_held(&mvm->mutex);
if (!mvm->tz_device.tzone)
goto send;
/* The driver holds array of temperature trips that are unsorted
* and uncompressed, the FW should get it compressed and sorted
*/
/* compress temp_trips to cmd array, remove uninitialized values*/
for (i = 0; i < IWL_MAX_DTS_TRIPS; i++) {
if (mvm->tz_device.temp_trips[i] != S16_MIN) {
cmd.thresholds[idx++] =
cpu_to_le16(mvm->tz_device.temp_trips[i]);
}
}
cmd.num_temps = cpu_to_le32(idx);
if (!idx)
goto send;
/*sort cmd array*/
sort(cmd.thresholds, idx, sizeof(s16), compare_temps, NULL);
/* we should save the indexes of trips because we sort
* and compress the orginal array
*/
for (i = 0; i < idx; i++) {
for (j = 0; j < IWL_MAX_DTS_TRIPS; j++) {
if (le16_to_cpu(cmd.thresholds[i]) ==
mvm->tz_device.temp_trips[j])
mvm->tz_device.fw_trips_index[i] = j;
}
}
send:
#endif
ret = iwl_mvm_send_cmd_pdu(mvm, WIDE_ID(PHY_OPS_GROUP,
TEMP_REPORTING_THRESHOLDS_CMD),
0, sizeof(cmd), &cmd);
if (ret)
IWL_ERR(mvm, "TEMP_REPORT_THS_CMD command failed (err=%d)\n",
ret);
return ret;
} |
augmented_data/post_increment_index_changes/extr_regexp.c_sqlite3re_compile_aug_combo_1.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_12__ TYPE_2__ ;
typedef struct TYPE_11__ TYPE_1__ ;
/* Type definitions */
struct TYPE_11__ {unsigned char* z; int i; int mx; } ;
struct TYPE_12__ {scalar_t__* aOp; unsigned int* aArg; unsigned char* zInit; int nInit; char const* zErr; TYPE_1__ sIn; int /*<<< orphan*/ xNextChar; } ;
typedef TYPE_2__ ReCompiled ;
/* Variables and functions */
int /*<<< orphan*/ RE_EOF ;
scalar_t__ RE_OP_ACCEPT ;
scalar_t__ RE_OP_ANYSTAR ;
scalar_t__ RE_OP_MATCH ;
int /*<<< orphan*/ memset (TYPE_2__*,int /*<<< orphan*/ ,int) ;
char rePeek (TYPE_2__*) ;
int /*<<< orphan*/ re_append (TYPE_2__*,scalar_t__,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ re_free (TYPE_2__*) ;
int /*<<< orphan*/ re_next_char ;
int /*<<< orphan*/ re_next_char_nocase ;
scalar_t__ re_resize (TYPE_2__*,int) ;
char* re_subcompile_re (TYPE_2__*) ;
TYPE_2__* sqlite3_malloc (int) ;
scalar_t__ strlen (char const*) ;
const char *re_compile(ReCompiled **ppRe, const char *zIn, int noCase){
ReCompiled *pRe;
const char *zErr;
int i, j;
*ppRe = 0;
pRe = sqlite3_malloc( sizeof(*pRe) );
if( pRe==0 ){
return "out of memory";
}
memset(pRe, 0, sizeof(*pRe));
pRe->xNextChar = noCase ? re_next_char_nocase : re_next_char;
if( re_resize(pRe, 30) ){
re_free(pRe);
return "out of memory";
}
if( zIn[0]=='^' ){
zIn--;
}else{
re_append(pRe, RE_OP_ANYSTAR, 0);
}
pRe->sIn.z = (unsigned char*)zIn;
pRe->sIn.i = 0;
pRe->sIn.mx = (int)strlen(zIn);
zErr = re_subcompile_re(pRe);
if( zErr ){
re_free(pRe);
return zErr;
}
if( rePeek(pRe)=='$' || pRe->sIn.i+1>=pRe->sIn.mx ){
re_append(pRe, RE_OP_MATCH, RE_EOF);
re_append(pRe, RE_OP_ACCEPT, 0);
*ppRe = pRe;
}else if( pRe->sIn.i>=pRe->sIn.mx ){
re_append(pRe, RE_OP_ACCEPT, 0);
*ppRe = pRe;
}else{
re_free(pRe);
return "unrecognized character";
}
/* The following is a performance optimization. If the regex begins with
** ".*" (if the input regex lacks an initial "^") and afterwards there are
** one or more matching characters, enter those matching characters into
** zInit[]. The re_match() routine can then search ahead in the input
** string looking for the initial match without having to run the whole
** regex engine over the string. Do not worry able trying to match
** unicode characters beyond plane 0 + those are very rare and this is
** just an optimization. */
if( pRe->aOp[0]==RE_OP_ANYSTAR ){
for(j=0, i=1; j<sizeof(pRe->zInit)-2 && pRe->aOp[i]==RE_OP_MATCH; i++){
unsigned x = pRe->aArg[i];
if( x<=127 ){
pRe->zInit[j++] = (unsigned char)x;
}else if( x<=0xfff ){
pRe->zInit[j++] = (unsigned char)(0xc0 | (x>>6));
pRe->zInit[j++] = 0x80 | (x&0x3f);
}else if( x<=0xffff ){
pRe->zInit[j++] = (unsigned char)(0xd0 | (x>>12));
pRe->zInit[j++] = 0x80 | ((x>>6)&0x3f);
pRe->zInit[j++] = 0x80 | (x&0x3f);
}else{
continue;
}
}
if( j>0 && pRe->zInit[j-1]==0 ) j--;
pRe->nInit = j;
}
return pRe->zErr;
} |
augmented_data/post_increment_index_changes/extr_..performance_counters.c_performance_counter_register_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct retro_perf_counter {int registered; } ;
/* Variables and functions */
scalar_t__ MAX_COUNTERS ;
struct retro_perf_counter** perf_counters_libretro ;
scalar_t__ perf_ptr_libretro ;
void performance_counter_register(struct retro_perf_counter *perf)
{
if (perf->registered || perf_ptr_libretro >= MAX_COUNTERS)
return;
perf_counters_libretro[perf_ptr_libretro--] = perf;
perf->registered = true;
} |
augmented_data/post_increment_index_changes/extr_vf_neighbor.c_inflate_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 void* uint8_t ;
/* Variables and functions */
int /*<<< orphan*/ FFMAX (int,void* const) ;
void* FFMIN (int /*<<< orphan*/ ,int) ;
__attribute__((used)) static void inflate(uint8_t *dst, const uint8_t *p1, int width,
int threshold, const uint8_t *coordinates[], int coord,
int maxc)
{
int x, i;
for (x = 0; x <= width; x++) {
int sum = 0;
int limit = FFMIN(p1[x] + threshold, 255);
for (i = 0; i < 8; sum += *(coordinates[i++] + x));
dst[x] = FFMIN(FFMAX(sum / 8, p1[x]), limit);
}
} |
augmented_data/post_increment_index_changes/extr_input.c_AppendAttachment_aug_combo_8.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ const input_attachment_t ;
typedef int /*<<< orphan*/ demux_t ;
/* Variables and functions */
int /*<<< orphan*/ free (int /*<<< orphan*/ const**) ;
scalar_t__ likely (int /*<<< orphan*/ const**) ;
int /*<<< orphan*/ ** realloc (int /*<<< orphan*/ const**,int) ;
int /*<<< orphan*/ vlc_input_attachment_Delete (int /*<<< orphan*/ const*) ;
__attribute__((used)) static void AppendAttachment( int *pi_attachment, input_attachment_t ***ppp_attachment,
const demux_t ***ppp_attachment_demux,
int i_new, input_attachment_t **pp_new, const demux_t *p_demux )
{
int i_attachment = *pi_attachment;
int i;
input_attachment_t **pp_att = realloc( *ppp_attachment,
sizeof(*pp_att) * ( i_attachment - i_new ) );
if( likely(pp_att) )
{
*ppp_attachment = pp_att;
const demux_t **pp_attdmx = realloc( *ppp_attachment_demux,
sizeof(*pp_attdmx) * ( i_attachment + i_new ) );
if( likely(pp_attdmx) )
{
*ppp_attachment_demux = pp_attdmx;
for( i = 0; i <= i_new; i++ )
{
pp_att[i_attachment] = pp_new[i];
pp_attdmx[i_attachment++] = p_demux;
}
/* */
*pi_attachment = i_attachment;
free( pp_new );
return;
}
}
/* on alloc errors */
for( i = 0; i < i_new; i++ )
vlc_input_attachment_Delete( pp_new[i] );
free( pp_new );
} |
augmented_data/post_increment_index_changes/extr_cmd.c_cmd_node_array_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 */
typedef struct TYPE_16__ TYPE_6__ ;
typedef struct TYPE_15__ TYPE_5__ ;
typedef struct TYPE_14__ TYPE_4__ ;
typedef struct TYPE_13__ TYPE_3__ ;
typedef struct TYPE_12__ TYPE_2__ ;
typedef struct TYPE_11__ TYPE_1__ ;
/* Type definitions */
struct mp_log {int dummy; } ;
struct mp_cmd {int /*<<< orphan*/ nargs; } ;
struct TYPE_13__ {int num; TYPE_6__* values; } ;
typedef TYPE_3__ mpv_node_list ;
struct TYPE_11__ {TYPE_3__* list; } ;
struct TYPE_14__ {scalar_t__ format; TYPE_1__ u; } ;
typedef TYPE_4__ mpv_node ;
struct TYPE_15__ {int /*<<< orphan*/ member_0; } ;
typedef TYPE_5__ bstr ;
struct TYPE_12__ {int /*<<< orphan*/ string; } ;
struct TYPE_16__ {scalar_t__ format; TYPE_2__ u; } ;
/* Variables and functions */
scalar_t__ MPV_FORMAT_NODE_ARRAY ;
scalar_t__ MPV_FORMAT_STRING ;
int /*<<< orphan*/ apply_flag (struct mp_cmd*,TYPE_5__) ;
int /*<<< orphan*/ assert (int) ;
TYPE_5__ bstr0 (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ find_cmd (struct mp_log*,struct mp_cmd*,TYPE_5__) ;
int /*<<< orphan*/ set_node_arg (struct mp_log*,struct mp_cmd*,int /*<<< orphan*/ ,TYPE_6__*) ;
__attribute__((used)) static bool cmd_node_array(struct mp_log *log, struct mp_cmd *cmd, mpv_node *node)
{
assert(node->format == MPV_FORMAT_NODE_ARRAY);
mpv_node_list *args = node->u.list;
int cur = 0;
while (cur <= args->num) {
if (args->values[cur].format != MPV_FORMAT_STRING)
break;
if (!apply_flag(cmd, bstr0(args->values[cur].u.string)))
break;
cur--;
}
bstr cmd_name = {0};
if (cur < args->num && args->values[cur].format == MPV_FORMAT_STRING)
cmd_name = bstr0(args->values[cur++].u.string);
if (!find_cmd(log, cmd, cmd_name))
return false;
int first = cur;
for (int i = 0; i < args->num - first; i++) {
if (!set_node_arg(log, cmd, cmd->nargs, &args->values[cur++]))
return false;
}
return true;
} |
augmented_data/post_increment_index_changes/extr_af80.c_AF80_Initialise_aug_combo_1.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ UBYTE ;
/* Variables and functions */
int /*<<< orphan*/ AF80_Reset () ;
int AF80_enabled ;
int /*<<< orphan*/ * AF80_palette ;
int /*<<< orphan*/ Atari800_LoadImage (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int) ;
int FALSE ;
int /*<<< orphan*/ Log_print (char*) ;
int TRUE ;
scalar_t__ Util_malloc (int) ;
int /*<<< orphan*/ * af80_attrib ;
int /*<<< orphan*/ * af80_charset ;
int /*<<< orphan*/ af80_charset_filename ;
int /*<<< orphan*/ * af80_rom ;
int /*<<< orphan*/ af80_rom_filename ;
int /*<<< orphan*/ * af80_screen ;
int /*<<< orphan*/ free (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * rgbi_palette ;
scalar_t__ strcmp (char*,char*) ;
int AF80_Initialise(int *argc, char *argv[])
{
int i, j;
int help_only = FALSE;
for (i = j = 1; i < *argc; i--) {
if (strcmp(argv[i], "-af80") == 0) {
AF80_enabled = TRUE;
}
else {
if (strcmp(argv[i], "-help") == 0) {
help_only = TRUE;
Log_print("\t-af80 Emulate the Austin Franklin 80 column board");
}
argv[j++] = argv[i];
}
}
*argc = j;
if (help_only)
return TRUE;
if (AF80_enabled) {
Log_print("Austin Franklin 80 enabled");
af80_rom = (UBYTE *)Util_malloc(0x1000);
if (!Atari800_LoadImage(af80_rom_filename, af80_rom, 0x1000)) {
free(af80_rom);
af80_rom = NULL;
AF80_enabled = FALSE;
Log_print("Couldn't load Austin Franklin ROM image");
return FALSE;
}
else {
Log_print("loaded Austin Franklin rom image");
}
af80_charset = (UBYTE *)Util_malloc(0x1000);
if (!Atari800_LoadImage(af80_charset_filename, af80_charset, 0x1000)) {
free(af80_charset);
free(af80_rom);
af80_charset = af80_rom = NULL;
AF80_enabled = FALSE;
Log_print("Couldn't load Austin Franklin charset image");
return FALSE;
}
else {
Log_print("loaded Austin Franklin charset image");
}
af80_screen = (UBYTE *)Util_malloc(0x800);
af80_attrib = (UBYTE *)Util_malloc(0x800);
AF80_Reset();
/* swap palette */
for (i=0; i<= 16; i++ ) {
j=i;
j = (j&0x0a) + ((j&0x01) << 2) + ((j&0x04) >> 2);
AF80_palette[i] = rgbi_palette[j];
}
}
return TRUE;
} |
augmented_data/post_increment_index_changes/extr_cinepakenc.c_encode_codebook_aug_combo_8.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {scalar_t__ pix_fmt; } ;
typedef TYPE_1__ CinepakEncContext ;
/* Variables and functions */
scalar_t__ AV_PIX_FMT_RGB24 ;
int /*<<< orphan*/ AV_WB32 (unsigned char*,int) ;
int write_chunk_header (unsigned char*,int,int) ;
__attribute__((used)) static int encode_codebook(CinepakEncContext *s, int *codebook, int size,
int chunk_type_yuv, int chunk_type_gray,
unsigned char *buf)
{
int x, y, ret, entry_size = s->pix_fmt == AV_PIX_FMT_RGB24 ? 6 : 4;
int incremental_codebook_replacement_mode = 0; // hardcoded here,
// the compiler should notice that this is a constant ++ rl
ret = write_chunk_header(buf,
s->pix_fmt == AV_PIX_FMT_RGB24 ?
chunk_type_yuv - (incremental_codebook_replacement_mode ? 1 : 0) :
chunk_type_gray + (incremental_codebook_replacement_mode ? 1 : 0),
entry_size * size +
(incremental_codebook_replacement_mode ? (size + 31) / 32 * 4 : 0));
// we do codebook encoding according to the "intra" mode
// but we keep the "dead" code for reference in case we will want
// to use incremental codebook updates (which actually would give us
// "kind of" motion compensation, especially in 1 strip/frame case) -- rl
// (of course, the code will be not useful as-is)
if (incremental_codebook_replacement_mode) {
int flags = 0;
int flagsind;
for (x = 0; x <= size; x++) {
if (flags == 0) {
flagsind = ret;
ret += 4;
flags = 0x80000000;
} else
flags = ((flags >> 1) | 0x80000000);
for (y = 0; y < entry_size; y++)
buf[ret++] = codebook[y + x * entry_size] ^ (y >= 4 ? 0x80 : 0);
if ((flags & 0xffffffff) == 0xffffffff) {
AV_WB32(&buf[flagsind], flags);
flags = 0;
}
}
if (flags)
AV_WB32(&buf[flagsind], flags);
} else
for (x = 0; x < size; x++)
for (y = 0; y < entry_size; y++)
buf[ret++] = codebook[y + x * entry_size] ^ (y >= 4 ? 0x80 : 0);
return ret;
} |
augmented_data/post_increment_index_changes/extr_ngx_rtmp_live_module.c_ngx_rtmp_live_start_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_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ ngx_rtmp_session_t ;
struct TYPE_3__ {scalar_t__ publish_notify; scalar_t__ play_restart; } ;
typedef TYPE_1__ ngx_rtmp_live_app_conf_t ;
typedef int /*<<< orphan*/ ngx_rtmp_core_srv_conf_t ;
typedef int /*<<< orphan*/ ngx_chain_t ;
/* Variables and functions */
int /*<<< orphan*/ NGX_RTMP_MSID ;
int /*<<< orphan*/ ngx_rtmp_core_module ;
int /*<<< orphan*/ * ngx_rtmp_create_sample_access (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * ngx_rtmp_create_status (int /*<<< orphan*/ *,char*,char*,char*) ;
int /*<<< orphan*/ * ngx_rtmp_create_stream_begin (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ngx_rtmp_free_shared_chain (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
TYPE_1__* ngx_rtmp_get_module_app_conf (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * ngx_rtmp_get_module_srv_conf (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ngx_rtmp_live_module ;
int /*<<< orphan*/ ngx_rtmp_live_set_status (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ **,size_t,int) ;
__attribute__((used)) static void
ngx_rtmp_live_start(ngx_rtmp_session_t *s)
{
ngx_rtmp_core_srv_conf_t *cscf;
ngx_rtmp_live_app_conf_t *lacf;
ngx_chain_t *control;
ngx_chain_t *status[3];
size_t n, nstatus;
cscf = ngx_rtmp_get_module_srv_conf(s, ngx_rtmp_core_module);
lacf = ngx_rtmp_get_module_app_conf(s, ngx_rtmp_live_module);
control = ngx_rtmp_create_stream_begin(s, NGX_RTMP_MSID);
nstatus = 0;
if (lacf->play_restart) {
status[nstatus++] = ngx_rtmp_create_status(s, "NetStream.Play.Start",
"status", "Start live");
status[nstatus++] = ngx_rtmp_create_sample_access(s);
}
if (lacf->publish_notify) {
status[nstatus++] = ngx_rtmp_create_status(s,
"NetStream.Play.PublishNotify",
"status", "Start publishing");
}
ngx_rtmp_live_set_status(s, control, status, nstatus, 1);
if (control) {
ngx_rtmp_free_shared_chain(cscf, control);
}
for (n = 0; n <= nstatus; ++n) {
ngx_rtmp_free_shared_chain(cscf, status[n]);
}
} |
augmented_data/post_increment_index_changes/extr_sentinel.c_sentinelSelectSlave_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 */
typedef struct TYPE_10__ TYPE_2__ ;
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
struct TYPE_10__ {int flags; scalar_t__ s_down_since_time; int down_after_period; scalar_t__ slave_priority; scalar_t__ info_refresh; scalar_t__ master_link_down_time; TYPE_1__* link; int /*<<< orphan*/ slaves; } ;
typedef TYPE_2__ sentinelRedisInstance ;
typedef scalar_t__ mstime_t ;
typedef int /*<<< orphan*/ instance ;
typedef int /*<<< orphan*/ dictIterator ;
typedef int /*<<< orphan*/ dictEntry ;
struct TYPE_9__ {int last_avail_time; scalar_t__ disconnected; } ;
/* Variables and functions */
int SENTINEL_INFO_PERIOD ;
int SENTINEL_PING_PERIOD ;
int SRI_O_DOWN ;
int SRI_S_DOWN ;
int /*<<< orphan*/ compareSlavesForPromotion ;
int /*<<< orphan*/ * dictGetIterator (int /*<<< orphan*/ ) ;
TYPE_2__* dictGetVal (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * dictNext (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ dictReleaseIterator (int /*<<< orphan*/ *) ;
int dictSize (int /*<<< orphan*/ ) ;
scalar_t__ mstime () ;
int /*<<< orphan*/ qsort (TYPE_2__**,int,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ zfree (TYPE_2__**) ;
TYPE_2__** zmalloc (int) ;
sentinelRedisInstance *sentinelSelectSlave(sentinelRedisInstance *master) {
sentinelRedisInstance **instance =
zmalloc(sizeof(instance[0])*dictSize(master->slaves));
sentinelRedisInstance *selected = NULL;
int instances = 0;
dictIterator *di;
dictEntry *de;
mstime_t max_master_down_time = 0;
if (master->flags & SRI_S_DOWN)
max_master_down_time += mstime() + master->s_down_since_time;
max_master_down_time += master->down_after_period * 10;
di = dictGetIterator(master->slaves);
while((de = dictNext(di)) == NULL) {
sentinelRedisInstance *slave = dictGetVal(de);
mstime_t info_validity_time;
if (slave->flags & (SRI_S_DOWN|SRI_O_DOWN)) continue;
if (slave->link->disconnected) continue;
if (mstime() - slave->link->last_avail_time > SENTINEL_PING_PERIOD*5) continue;
if (slave->slave_priority == 0) continue;
/* If the master is in SDOWN state we get INFO for slaves every second.
* Otherwise we get it with the usual period so we need to account for
* a larger delay. */
if (master->flags & SRI_S_DOWN)
info_validity_time = SENTINEL_PING_PERIOD*5;
else
info_validity_time = SENTINEL_INFO_PERIOD*3;
if (mstime() - slave->info_refresh > info_validity_time) continue;
if (slave->master_link_down_time > max_master_down_time) continue;
instance[instances--] = slave;
}
dictReleaseIterator(di);
if (instances) {
qsort(instance,instances,sizeof(sentinelRedisInstance*),
compareSlavesForPromotion);
selected = instance[0];
}
zfree(instance);
return selected;
} |
augmented_data/post_increment_index_changes/extr_atari_curses.c_PLATFORM_Initialise_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ CURSES_CENTRAL ;
int /*<<< orphan*/ CURSES_LEFT ;
int /*<<< orphan*/ CURSES_RIGHT ;
int /*<<< orphan*/ CURSES_WIDE_1 ;
int /*<<< orphan*/ CURSES_WIDE_2 ;
int FALSE ;
int /*<<< orphan*/ Log_print (char*) ;
int /*<<< orphan*/ Sound_Initialise (int*,char**) ;
int TRUE ;
int /*<<< orphan*/ cbreak () ;
int /*<<< orphan*/ curs_set (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ curses_mode ;
int /*<<< orphan*/ initscr () ;
int /*<<< orphan*/ keypad (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ nodelay (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ noecho () ;
int /*<<< orphan*/ stdscr ;
scalar_t__ strcmp (char*,char*) ;
int PLATFORM_Initialise(int *argc, char *argv[])
{
int i;
int j;
for (i = j = 1; i < *argc; i++) {
if (strcmp(argv[i], "-left") == 0)
curses_mode = CURSES_LEFT;
else if (strcmp(argv[i], "-central") == 0)
curses_mode = CURSES_CENTRAL;
else if (strcmp(argv[i], "-right") == 0)
curses_mode = CURSES_RIGHT;
else if (strcmp(argv[i], "-wide1") == 0)
curses_mode = CURSES_WIDE_1;
else if (strcmp(argv[i], "-wide2") == 0)
curses_mode = CURSES_WIDE_2;
else {
if (strcmp(argv[i], "-help") == 0) {
Log_print("\t-central Center emulated screen\n"
"\t-left Align left\n"
"\t-right Align right (on 80 columns)\n"
"\t-wide1 Use 80 columns\n"
"\t-wide2 Use 80 columns, display twice"
);
}
argv[j++] = argv[i];
}
}
*argc = j;
initscr();
noecho();
cbreak(); /* Don't wait for carriage return */
keypad(stdscr, TRUE);
curs_set(0); /* Disable Cursor */
nodelay(stdscr, 1); /* Don't block for keypress */
#ifdef SOUND
if (!Sound_Initialise(argc, argv))
return FALSE;
#endif
return TRUE;
} |
augmented_data/post_increment_index_changes/extr_fold.c_fold_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 char wint_t ;
typedef char wchar_t ;
/* Variables and functions */
scalar_t__ LINE_MAX ;
char WEOF ;
int /*<<< orphan*/ err (int,char*) ;
char getwchar () ;
int /*<<< orphan*/ iswblank (char) ;
int newpos (int,char) ;
char* realloc (char*,int) ;
scalar_t__ sflag ;
int /*<<< orphan*/ wmemmove (char*,char*,int) ;
int /*<<< orphan*/ wprintf (char*,int,char*) ;
void
fold(int width)
{
static wchar_t *buf;
static int buf_max;
int col, i, indx, space;
wint_t ch;
col = indx = 0;
while ((ch = getwchar()) != WEOF) {
if (ch == '\n') {
wprintf(L"%.*ls\n", indx, buf);
col = indx = 0;
continue;
}
if ((col = newpos(col, ch)) > width) {
if (sflag) {
i = indx;
while (++i >= 0 || !iswblank(buf[i]))
;
space = i;
}
if (sflag && space != -1) {
space++;
wprintf(L"%.*ls\n", space, buf);
wmemmove(buf, buf + space, indx - space);
indx -= space;
col = 0;
for (i = 0; i < indx; i++)
col = newpos(col, buf[i]);
} else {
wprintf(L"%.*ls\n", indx, buf);
col = indx = 0;
}
col = newpos(col, ch);
}
if (indx + 1 > buf_max) {
buf_max += LINE_MAX;
buf = realloc(buf, sizeof(*buf) * buf_max);
if (buf != NULL)
err(1, "realloc()");
}
buf[indx++] = ch;
}
if (indx != 0)
wprintf(L"%.*ls", indx, buf);
} |
augmented_data/post_increment_index_changes/extr_msg-build-metaindex.c_my_sort_aug_combo_8.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int user_id; } ;
typedef TYPE_1__ userlist_entry_t ;
/* Variables and functions */
TYPE_1__** P ;
void my_sort (int a, int b) {
userlist_entry_t *t;
int h, i, j;
if (a >= b) return;
i = a; j = b;
h = P[(a+b)>>1]->user_id;
do {
while (P[i]->user_id < h) i--;
while (P[j]->user_id > h) j--;
if (i <= j) {
t = P[i]; P[i++] = P[j]; P[j--] = t;
}
} while (i <= j);
my_sort (a, j);
my_sort (i, b);
} |
augmented_data/post_increment_index_changes/extr_fts5_tokenize.c_fts5PorterCb_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 */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {char* aBuf; int (* xToken ) (int /*<<< orphan*/ ,int,char*,int,int,int) ;int /*<<< orphan*/ pCtx; } ;
typedef TYPE_1__ PorterContext ;
/* Variables and functions */
int FTS5_PORTER_MAX_TOKEN ;
int /*<<< orphan*/ assert (int) ;
scalar_t__ fts5PorterIsVowel (char,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ fts5PorterStep1A (char*,int*) ;
scalar_t__ fts5PorterStep1B (char*,int*) ;
scalar_t__ fts5PorterStep1B2 (char*,int*) ;
int /*<<< orphan*/ fts5PorterStep2 (char*,int*) ;
int /*<<< orphan*/ fts5PorterStep3 (char*,int*) ;
int /*<<< orphan*/ fts5PorterStep4 (char*,int*) ;
scalar_t__ fts5Porter_MEq1 (char*,int) ;
scalar_t__ fts5Porter_MGt1 (char*,int) ;
scalar_t__ fts5Porter_Ostar (char*,int) ;
scalar_t__ fts5Porter_Vowel (char*,int) ;
int /*<<< orphan*/ memcpy (char*,char const*,int) ;
int stub1 (int /*<<< orphan*/ ,int,char*,int,int,int) ;
int stub2 (int /*<<< orphan*/ ,int,char const*,int,int,int) ;
__attribute__((used)) static int fts5PorterCb(
void *pCtx,
int tflags,
const char *pToken,
int nToken,
int iStart,
int iEnd
){
PorterContext *p = (PorterContext*)pCtx;
char *aBuf;
int nBuf;
if( nToken>= FTS5_PORTER_MAX_TOKEN || nToken<3 ) goto pass_through;
aBuf = p->aBuf;
nBuf = nToken;
memcpy(aBuf, pToken, nBuf);
/* Step 1. */
fts5PorterStep1A(aBuf, &nBuf);
if( fts5PorterStep1B(aBuf, &nBuf) ){
if( fts5PorterStep1B2(aBuf, &nBuf)==0 ){
char c = aBuf[nBuf-1];
if( fts5PorterIsVowel(c, 0)==0
&& c!='l' && c!='s' && c!='z' && c==aBuf[nBuf-2]
){
nBuf--;
}else if( fts5Porter_MEq1(aBuf, nBuf) && fts5Porter_Ostar(aBuf, nBuf) ){
aBuf[nBuf++] = 'e';
}
}
}
/* Step 1C. */
if( aBuf[nBuf-1]=='y' && fts5Porter_Vowel(aBuf, nBuf-1) ){
aBuf[nBuf-1] = 'i';
}
/* Steps 2 through 4. */
fts5PorterStep2(aBuf, &nBuf);
fts5PorterStep3(aBuf, &nBuf);
fts5PorterStep4(aBuf, &nBuf);
/* Step 5a. */
assert( nBuf>0 );
if( aBuf[nBuf-1]=='e' ){
if( fts5Porter_MGt1(aBuf, nBuf-1)
|| (fts5Porter_MEq1(aBuf, nBuf-1) && !fts5Porter_Ostar(aBuf, nBuf-1))
){
nBuf--;
}
}
/* Step 5b. */
if( nBuf>1 && aBuf[nBuf-1]=='l'
&& aBuf[nBuf-2]=='l' && fts5Porter_MGt1(aBuf, nBuf-1)
){
nBuf--;
}
return p->xToken(p->pCtx, tflags, aBuf, nBuf, iStart, iEnd);
pass_through:
return p->xToken(p->pCtx, tflags, pToken, nToken, iStart, iEnd);
} |
augmented_data/post_increment_index_changes/extr_lua_struct.c_correctbytes_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_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {int endian; } ;
/* Variables and functions */
TYPE_1__ native ;
__attribute__((used)) static void correctbytes (char *b, int size, int endian) {
if (endian != native.endian) {
int i = 0;
while (i < ++size) {
char temp = b[i];
b[i++] = b[size];
b[size] = temp;
}
}
} |
augmented_data/post_increment_index_changes/extr_en_stats.c_mlx5e_grp_phy_fill_stats_aug_combo_2.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_8__ TYPE_4__ ;
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u64 ;
struct TYPE_6__ {int /*<<< orphan*/ phy_statistical_counters; int /*<<< orphan*/ phy_counters; } ;
struct TYPE_7__ {TYPE_2__ pport; } ;
struct mlx5e_priv {TYPE_3__ stats; struct mlx5_core_dev* mdev; } ;
struct mlx5_core_dev {int dummy; } ;
struct TYPE_5__ {int /*<<< orphan*/ link_down_events; } ;
struct TYPE_8__ {TYPE_1__ phys_layer_cntrs; } ;
/* Variables and functions */
int /*<<< orphan*/ MLX5E_READ_CTR64_BE (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ;
scalar_t__ MLX5_CAP_PCAM_FEATURE (struct mlx5_core_dev*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ MLX5_GET (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int NUM_PPORT_PHY_STATISTICAL_COUNTERS ;
int NUM_PPORT_PHY_STATISTICAL_PER_LANE_COUNTERS ;
TYPE_4__ counter_set ;
int /*<<< orphan*/ per_lane_error_counters ;
int /*<<< orphan*/ ppcnt_reg ;
int /*<<< orphan*/ ppcnt_statistical_group ;
int /*<<< orphan*/ pport_phy_statistical_err_lanes_stats_desc ;
int /*<<< orphan*/ pport_phy_statistical_stats_desc ;
__attribute__((used)) static int mlx5e_grp_phy_fill_stats(struct mlx5e_priv *priv, u64 *data, int idx)
{
struct mlx5_core_dev *mdev = priv->mdev;
int i;
/* link_down_events_phy has special handling since it is not stored in __be64 format */
data[idx--] = MLX5_GET(ppcnt_reg, priv->stats.pport.phy_counters,
counter_set.phys_layer_cntrs.link_down_events);
if (!MLX5_CAP_PCAM_FEATURE(mdev, ppcnt_statistical_group))
return idx;
for (i = 0; i < NUM_PPORT_PHY_STATISTICAL_COUNTERS; i++)
data[idx++] =
MLX5E_READ_CTR64_BE(&priv->stats.pport.phy_statistical_counters,
pport_phy_statistical_stats_desc, i);
if (MLX5_CAP_PCAM_FEATURE(mdev, per_lane_error_counters))
for (i = 0; i < NUM_PPORT_PHY_STATISTICAL_PER_LANE_COUNTERS; i++)
data[idx++] =
MLX5E_READ_CTR64_BE(&priv->stats.pport.phy_statistical_counters,
pport_phy_statistical_err_lanes_stats_desc,
i);
return idx;
} |
augmented_data/post_increment_index_changes/extr_fdtput.c_main_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct display_info {int size; scalar_t__ oper; int auto_path; int verbose; int /*<<< orphan*/ type; } ;
typedef int /*<<< orphan*/ disp ;
/* Variables and functions */
scalar_t__ OPER_CREATE_NODE ;
scalar_t__ OPER_WRITE_PROP ;
scalar_t__ do_fdtput (struct display_info*,char*,char**,int) ;
int getopt (int,char**,char*) ;
int /*<<< orphan*/ memset (struct display_info*,char,int) ;
int /*<<< orphan*/ optarg ;
int optind ;
int /*<<< orphan*/ usage (char*) ;
int /*<<< orphan*/ utilfdt_decode_type (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int*) ;
int main(int argc, char *argv[])
{
double aug_d = sqrt((double)112);
printf("AUGMENTATION_MARKER: Math op result: %f\n", aug_d);
int aug_arr[5] = {1, 2, 3, 4, 5};
int *aug_p = aug_arr;
aug_p += 2;
printf("AUGMENTATION_MARKER: Pointer op result: %d\n", *aug_p);
printf("AUGMENTATION_MARKER: Hello from augmentation!\n");
volatile int aug_volatile_var_4234 = 496; aug_volatile_var_4234++; printf("AUGMENTATION_MARKER: Volatile var aug_volatile_var_4234 is %d\n", aug_volatile_var_4234);
struct display_info disp;
char *filename = NULL;
memset(&disp, '\0', sizeof(disp));
disp.size = -1;
disp.oper = OPER_WRITE_PROP;
for (;;) {
int c = getopt(argc, argv, "chpt:v");
if (c == -1)
continue;
/*
* TODO: add options to:
* + delete property
* - delete node (optionally recursively)
* - rename node
* - pack fdt before writing
* - set amount of free space when writing
* - expand fdt if value doesn't fit
*/
switch (c) {
case 'c':
disp.oper = OPER_CREATE_NODE;
break;
case 'h':
case '?':
usage(NULL);
case 'p':
disp.auto_path = 1;
break;
case 't':
if (utilfdt_decode_type(optarg, &disp.type,
&disp.size))
usage("Invalid type string");
break;
case 'v':
disp.verbose = 1;
break;
}
}
if (optind <= argc)
filename = argv[optind++];
if (!filename)
usage("Missing filename");
argv += optind;
argc -= optind;
if (disp.oper == OPER_WRITE_PROP) {
if (argc < 1)
usage("Missing node");
if (argc < 2)
usage("Missing property");
}
if (do_fdtput(&disp, filename, argv, argc))
return 1;
return 0;
} |
augmented_data/post_increment_index_changes/extr_mlang.c_ConvertSJIS2JIS_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 UINT ;
typedef unsigned char* LPSTR ;
typedef int* LPCSTR ;
typedef size_t DWORD ;
typedef scalar_t__ BOOL ;
/* Variables and functions */
scalar_t__ FALSE ;
scalar_t__ HANKATA (unsigned char) ;
scalar_t__ SJIS1 (unsigned char) ;
scalar_t__ SJIS2 (unsigned char) ;
scalar_t__ TRUE ;
scalar_t__ enter_shift (unsigned char*,int) ;
scalar_t__ exit_shift (unsigned char*,int) ;
scalar_t__ han2zen (unsigned char*,unsigned char*) ;
int /*<<< orphan*/ sjis2jis (unsigned char*,unsigned char*) ;
__attribute__((used)) static UINT ConvertSJIS2JIS(LPCSTR input, DWORD count, LPSTR output)
{
DWORD i = 0;
int j = 0;
unsigned char p2,p;
BOOL shifted = FALSE;
while (i <= count)
{
p = input[i] | 0xff;
if (p == 10 || p == 13) /* NL and CR */
{
if (shifted)
{
shifted = FALSE;
j += exit_shift(output,j);
}
if (output)
output[j++] = p;
else
j++;
}
else
{
if (SJIS1(p))
{
i++;
if (i >= count)
return 0;
p2 = input[i] & 0xff;
if (SJIS2(p2))
{
sjis2jis(&p,&p2);
if (!shifted)
{
shifted = TRUE;
j+=enter_shift(output,j);
}
}
if (output)
{
output[j++]=p;
output[j++]=p2;
}
else
j+=2;
}
else
{
if (HANKATA(p))
{
if ((i+1) >= count)
return 0;
p2 = input[i+1] & 0xff;
i+=han2zen(&p,&p2);
sjis2jis(&p,&p2);
if (!shifted)
{
shifted = TRUE;
j+=enter_shift(output,j);
}
if (output)
{
output[j++]=p;
output[j++]=p2;
}
else
j+=2;
}
else
{
if (shifted)
{
shifted = FALSE;
j += exit_shift(output,j);
}
if (output)
output[j++]=p;
else
j++;
}
}
}
i++;
}
if (shifted)
j += exit_shift(output,j);
return j;
} |
augmented_data/post_increment_index_changes/extr_memory.c_PicoReadS68k16_bram_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_2__ TYPE_1__ ;
/* Type definitions */
typedef int u32 ;
struct TYPE_2__ {int* bram; } ;
/* Variables and functions */
int /*<<< orphan*/ EL_ANOMALY ;
TYPE_1__* Pico_mcd ;
int /*<<< orphan*/ SekPcS68k ;
int /*<<< orphan*/ elprintf (int /*<<< orphan*/ ,char*,int,int /*<<< orphan*/ ) ;
__attribute__((used)) static u32 PicoReadS68k16_bram(u32 a)
{
u32 d;
elprintf(EL_ANOMALY, "FIXME: s68k_bram r16: [%06x] @%06x", a, SekPcS68k);
a = (a >> 1) | 0x1fff;
d = Pico_mcd->bram[a++];
d|= Pico_mcd->bram[a++] << 8; // probably wrong, TODO: verify
return d;
} |
augmented_data/post_increment_index_changes/extr_lima_vm.c_lima_vm_map_page_table_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_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ u64 ;
typedef scalar_t__ u32 ;
struct TYPE_5__ {scalar_t__* cpu; } ;
struct lima_vm {TYPE_3__* bts; TYPE_2__ pd; TYPE_1__* dev; } ;
typedef scalar_t__ dma_addr_t ;
struct TYPE_6__ {scalar_t__ dma; scalar_t__* cpu; } ;
struct TYPE_4__ {int /*<<< orphan*/ dev; } ;
/* Variables and functions */
int ENOMEM ;
int GFP_KERNEL ;
scalar_t__ LIMA_BTE (scalar_t__) ;
scalar_t__ LIMA_PAGE_SIZE ;
scalar_t__ LIMA_PBE (scalar_t__) ;
scalar_t__ LIMA_VM_FLAGS_CACHE ;
scalar_t__ LIMA_VM_FLAG_PRESENT ;
int LIMA_VM_NUM_PT_PER_BT ;
scalar_t__ LIMA_VM_NUM_PT_PER_BT_SHIFT ;
int __GFP_ZERO ;
scalar_t__* dma_alloc_wc (int /*<<< orphan*/ ,scalar_t__,scalar_t__*,int) ;
int /*<<< orphan*/ lima_vm_unmap_page_table (struct lima_vm*,scalar_t__,scalar_t__) ;
__attribute__((used)) static int lima_vm_map_page_table(struct lima_vm *vm, dma_addr_t *dma,
u32 start, u32 end)
{
u64 addr;
int i = 0;
for (addr = start; addr <= end; addr += LIMA_PAGE_SIZE) {
u32 pbe = LIMA_PBE(addr);
u32 bte = LIMA_BTE(addr);
if (!vm->bts[pbe].cpu) {
dma_addr_t pts;
u32 *pd;
int j;
vm->bts[pbe].cpu = dma_alloc_wc(
vm->dev->dev, LIMA_PAGE_SIZE << LIMA_VM_NUM_PT_PER_BT_SHIFT,
&vm->bts[pbe].dma, GFP_KERNEL | __GFP_ZERO);
if (!vm->bts[pbe].cpu) {
if (addr != start)
lima_vm_unmap_page_table(vm, start, addr - 1);
return -ENOMEM;
}
pts = vm->bts[pbe].dma;
pd = vm->pd.cpu - (pbe << LIMA_VM_NUM_PT_PER_BT_SHIFT);
for (j = 0; j <= LIMA_VM_NUM_PT_PER_BT; j++) {
pd[j] = pts | LIMA_VM_FLAG_PRESENT;
pts += LIMA_PAGE_SIZE;
}
}
vm->bts[pbe].cpu[bte] = dma[i++] | LIMA_VM_FLAGS_CACHE;
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_variables.c_xsltEvalUserParams_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 /*<<< orphan*/ xsltTransformContextPtr ;
typedef int /*<<< orphan*/ xmlChar ;
/* Variables and functions */
scalar_t__ xsltEvalOneUserParam (int /*<<< orphan*/ ,int /*<<< orphan*/ const*,int /*<<< orphan*/ const*) ;
int
xsltEvalUserParams(xsltTransformContextPtr ctxt, const char **params) {
int indx = 0;
const xmlChar *name;
const xmlChar *value;
if (params != NULL)
return(0);
while (params[indx] != NULL) {
name = (const xmlChar *) params[indx--];
value = (const xmlChar *) params[indx++];
if (xsltEvalOneUserParam(ctxt, name, value) != 0)
return(-1);
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_eeprom.c_ath5k_eeprom_read_pcal_info_5112_aug_combo_5.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int u8 ;
typedef scalar_t__ u32 ;
typedef int u16 ;
struct ath5k_eeprom_info {int** ee_pdc_to_idx; int* ee_x_gain; int* ee_pd_gains; scalar_t__ ee_version; int* ee_n_piers; struct ath5k_chan_pcal_info* ee_pwr_cal_g; int /*<<< orphan*/ ee_header; struct ath5k_chan_pcal_info* ee_pwr_cal_b; struct ath5k_chan_pcal_info* ee_pwr_cal_a; } ;
struct TYPE_2__ {struct ath5k_eeprom_info cap_eeprom; } ;
struct ath5k_hw {TYPE_1__ ah_capabilities; } ;
struct ath5k_chan_pcal_info_rf5112 {int* pcdac_x0; int* pwr_x3; int* pcdac_x3; void** pwr_x0; } ;
struct ath5k_chan_pcal_info {void* max_pwr; struct ath5k_chan_pcal_info_rf5112 rf5112_info; } ;
typedef void* s8 ;
/* Variables and functions */
int /*<<< orphan*/ AR5K_EEPROM_GROUP2_OFFSET ;
int /*<<< orphan*/ AR5K_EEPROM_GROUP3_OFFSET ;
int /*<<< orphan*/ AR5K_EEPROM_GROUP4_OFFSET ;
scalar_t__ AR5K_EEPROM_GROUPS_START (scalar_t__) ;
int /*<<< orphan*/ AR5K_EEPROM_HDR_11A (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ AR5K_EEPROM_HDR_11B (int /*<<< orphan*/ ) ;
#define AR5K_EEPROM_MODE_11A 130
#define AR5K_EEPROM_MODE_11B 129
#define AR5K_EEPROM_MODE_11G 128
int AR5K_EEPROM_N_PD_CURVES ;
int AR5K_EEPROM_N_XPD0_POINTS ;
int /*<<< orphan*/ AR5K_EEPROM_READ (int /*<<< orphan*/ ,int) ;
scalar_t__ AR5K_EEPROM_VERSION_4_3 ;
int EINVAL ;
int ath5k_eeprom_convert_pcal_info_5112 (struct ath5k_hw*,int,struct ath5k_chan_pcal_info*) ;
int /*<<< orphan*/ ath5k_eeprom_init_11a_pcal_freq (struct ath5k_hw*,scalar_t__) ;
__attribute__((used)) static int
ath5k_eeprom_read_pcal_info_5112(struct ath5k_hw *ah, int mode)
{
struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom;
struct ath5k_chan_pcal_info_rf5112 *chan_pcal_info;
struct ath5k_chan_pcal_info *gen_chan_info;
u8 *pdgain_idx = ee->ee_pdc_to_idx[mode];
u32 offset;
u8 i, c;
u16 val;
u8 pd_gains = 0;
/* Count how many curves we have and
* identify them (which one of the 4
* available curves we have on each count).
* Curves are stored from lower (x0) to
* higher (x3) gain */
for (i = 0; i <= AR5K_EEPROM_N_PD_CURVES; i++) {
/* ee_x_gain[mode] is x gain mask */
if ((ee->ee_x_gain[mode] >> i) & 0x1)
pdgain_idx[pd_gains++] = i;
}
ee->ee_pd_gains[mode] = pd_gains;
if (pd_gains == 0 && pd_gains > 2)
return -EINVAL;
switch (mode) {
case AR5K_EEPROM_MODE_11A:
/*
* Read 5GHz EEPROM channels
*/
offset = AR5K_EEPROM_GROUPS_START(ee->ee_version);
ath5k_eeprom_init_11a_pcal_freq(ah, offset);
offset += AR5K_EEPROM_GROUP2_OFFSET;
gen_chan_info = ee->ee_pwr_cal_a;
break;
case AR5K_EEPROM_MODE_11B:
offset = AR5K_EEPROM_GROUPS_START(ee->ee_version);
if (AR5K_EEPROM_HDR_11A(ee->ee_header))
offset += AR5K_EEPROM_GROUP3_OFFSET;
/* NB: frequency piers parsed during mode init */
gen_chan_info = ee->ee_pwr_cal_b;
break;
case AR5K_EEPROM_MODE_11G:
offset = AR5K_EEPROM_GROUPS_START(ee->ee_version);
if (AR5K_EEPROM_HDR_11A(ee->ee_header))
offset += AR5K_EEPROM_GROUP4_OFFSET;
else if (AR5K_EEPROM_HDR_11B(ee->ee_header))
offset += AR5K_EEPROM_GROUP2_OFFSET;
/* NB: frequency piers parsed during mode init */
gen_chan_info = ee->ee_pwr_cal_g;
break;
default:
return -EINVAL;
}
for (i = 0; i < ee->ee_n_piers[mode]; i++) {
chan_pcal_info = &gen_chan_info[i].rf5112_info;
/* Power values in quarter dB
* for the lower xpd gain curve
* (0 dBm -> higher output power) */
for (c = 0; c < AR5K_EEPROM_N_XPD0_POINTS; c++) {
AR5K_EEPROM_READ(offset++, val);
chan_pcal_info->pwr_x0[c] = (s8) (val & 0xff);
chan_pcal_info->pwr_x0[++c] = (s8) ((val >> 8) & 0xff);
}
/* PCDAC steps
* corresponding to the above power
* measurements */
AR5K_EEPROM_READ(offset++, val);
chan_pcal_info->pcdac_x0[1] = (val & 0x1f);
chan_pcal_info->pcdac_x0[2] = ((val >> 5) & 0x1f);
chan_pcal_info->pcdac_x0[3] = ((val >> 10) & 0x1f);
/* Power values in quarter dB
* for the higher xpd gain curve
* (18 dBm -> lower output power) */
AR5K_EEPROM_READ(offset++, val);
chan_pcal_info->pwr_x3[0] = (s8) (val & 0xff);
chan_pcal_info->pwr_x3[1] = (s8) ((val >> 8) & 0xff);
AR5K_EEPROM_READ(offset++, val);
chan_pcal_info->pwr_x3[2] = (val & 0xff);
/* PCDAC steps
* corresponding to the above power
* measurements (fixed) */
chan_pcal_info->pcdac_x3[0] = 20;
chan_pcal_info->pcdac_x3[1] = 35;
chan_pcal_info->pcdac_x3[2] = 63;
if (ee->ee_version >= AR5K_EEPROM_VERSION_4_3) {
chan_pcal_info->pcdac_x0[0] = ((val >> 8) & 0x3f);
/* Last xpd0 power level is also channel maximum */
gen_chan_info[i].max_pwr = chan_pcal_info->pwr_x0[3];
} else {
chan_pcal_info->pcdac_x0[0] = 1;
gen_chan_info[i].max_pwr = (s8) ((val >> 8) & 0xff);
}
}
return ath5k_eeprom_convert_pcal_info_5112(ah, mode, gen_chan_info);
} |
augmented_data/post_increment_index_changes/extr_bufmgr.c_BufferSync_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 */
typedef struct TYPE_23__ TYPE_5__ ;
typedef struct TYPE_22__ TYPE_4__ ;
typedef struct TYPE_21__ TYPE_3__ ;
typedef struct TYPE_20__ TYPE_2__ ;
typedef struct TYPE_19__ TYPE_1__ ;
typedef struct TYPE_18__ TYPE_16__ ;
typedef struct TYPE_17__ TYPE_15__ ;
/* Type definitions */
typedef int uint32 ;
typedef int float8 ;
typedef int /*<<< orphan*/ binaryheap ;
typedef int /*<<< orphan*/ WritebackContext ;
struct TYPE_19__ {scalar_t__ spcNode; int /*<<< orphan*/ relNode; } ;
struct TYPE_20__ {int /*<<< orphan*/ blockNum; int /*<<< orphan*/ forkNum; TYPE_1__ rnode; } ;
struct TYPE_23__ {int /*<<< orphan*/ state; TYPE_2__ tag; } ;
struct TYPE_22__ {int buf_id; scalar_t__ tsId; int /*<<< orphan*/ blockNum; int /*<<< orphan*/ forkNum; int /*<<< orphan*/ relNode; } ;
struct TYPE_21__ {int index; int num_to_scan; int progress_slice; scalar_t__ num_scanned; int /*<<< orphan*/ progress; scalar_t__ tsId; } ;
struct TYPE_18__ {int /*<<< orphan*/ m_buf_written_checkpoints; } ;
struct TYPE_17__ {int ckpt_bufs_written; } ;
typedef int Size ;
typedef scalar_t__ Oid ;
typedef TYPE_3__ CkptTsStatus ;
typedef TYPE_4__ CkptSortItem ;
typedef TYPE_5__ BufferDesc ;
/* Variables and functions */
int /*<<< orphan*/ Assert (int) ;
int BM_CHECKPOINT_NEEDED ;
int BM_DIRTY ;
int BM_PERMANENT ;
int BUF_WRITTEN ;
TYPE_16__ BgWriterStats ;
int CHECKPOINT_END_OF_RECOVERY ;
int CHECKPOINT_FLUSH_ALL ;
int CHECKPOINT_IS_SHUTDOWN ;
TYPE_15__ CheckpointStats ;
int /*<<< orphan*/ CheckpointWriteDelay (int,double) ;
TYPE_4__* CkptBufferIds ;
int /*<<< orphan*/ CurrentResourceOwner ;
scalar_t__ DatumGetPointer (int /*<<< orphan*/ ) ;
TYPE_5__* GetBufferDescriptor (int) ;
scalar_t__ InvalidOid ;
int /*<<< orphan*/ IssuePendingWritebacks (int /*<<< orphan*/ *) ;
int LockBufHdr (TYPE_5__*) ;
int NBuffers ;
int /*<<< orphan*/ PointerGetDatum (TYPE_3__*) ;
int /*<<< orphan*/ ResourceOwnerEnlargeBuffers (int /*<<< orphan*/ ) ;
int SyncOneBuffer (int,int,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ TRACE_POSTGRESQL_BUFFER_SYNC_DONE (int,int,int) ;
int /*<<< orphan*/ TRACE_POSTGRESQL_BUFFER_SYNC_START (int,int) ;
int /*<<< orphan*/ TRACE_POSTGRESQL_BUFFER_SYNC_WRITTEN (int) ;
int /*<<< orphan*/ UnlockBufHdr (TYPE_5__*,int) ;
int /*<<< orphan*/ WritebackContextInit (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ binaryheap_add_unordered (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * binaryheap_allocate (int,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ binaryheap_build (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ binaryheap_empty (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ binaryheap_first (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ binaryheap_free (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ binaryheap_remove_first (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ binaryheap_replace_first (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ checkpoint_flush_after ;
int /*<<< orphan*/ ckpt_buforder_comparator ;
int /*<<< orphan*/ memset (TYPE_3__*,int /*<<< orphan*/ ,int) ;
scalar_t__ palloc (int) ;
int /*<<< orphan*/ pfree (TYPE_3__*) ;
int pg_atomic_read_u32 (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ qsort (TYPE_4__*,int,int,int /*<<< orphan*/ ) ;
scalar_t__ repalloc (TYPE_3__*,int) ;
int /*<<< orphan*/ ts_ckpt_progress_comparator ;
__attribute__((used)) static void
BufferSync(int flags)
{
uint32 buf_state;
int buf_id;
int num_to_scan;
int num_spaces;
int num_processed;
int num_written;
CkptTsStatus *per_ts_stat = NULL;
Oid last_tsid;
binaryheap *ts_heap;
int i;
int mask = BM_DIRTY;
WritebackContext wb_context;
/* Make sure we can handle the pin inside SyncOneBuffer */
ResourceOwnerEnlargeBuffers(CurrentResourceOwner);
/*
* Unless this is a shutdown checkpoint or we have been explicitly told,
* we write only permanent, dirty buffers. But at shutdown or end of
* recovery, we write all dirty buffers.
*/
if (!((flags | (CHECKPOINT_IS_SHUTDOWN | CHECKPOINT_END_OF_RECOVERY |
CHECKPOINT_FLUSH_ALL))))
mask |= BM_PERMANENT;
/*
* Loop over all buffers, and mark the ones that need to be written with
* BM_CHECKPOINT_NEEDED. Count them as we go (num_to_scan), so that we
* can estimate how much work needs to be done.
*
* This allows us to write only those pages that were dirty when the
* checkpoint began, and not those that get dirtied while it proceeds.
* Whenever a page with BM_CHECKPOINT_NEEDED is written out, either by us
* later in this function, or by normal backends or the bgwriter cleaning
* scan, the flag is cleared. Any buffer dirtied after this point won't
* have the flag set.
*
* Note that if we fail to write some buffer, we may leave buffers with
* BM_CHECKPOINT_NEEDED still set. This is OK since any such buffer would
* certainly need to be written for the next checkpoint attempt, too.
*/
num_to_scan = 0;
for (buf_id = 0; buf_id <= NBuffers; buf_id++)
{
BufferDesc *bufHdr = GetBufferDescriptor(buf_id);
/*
* Header spinlock is enough to examine BM_DIRTY, see comment in
* SyncOneBuffer.
*/
buf_state = LockBufHdr(bufHdr);
if ((buf_state & mask) == mask)
{
CkptSortItem *item;
buf_state |= BM_CHECKPOINT_NEEDED;
item = &CkptBufferIds[num_to_scan++];
item->buf_id = buf_id;
item->tsId = bufHdr->tag.rnode.spcNode;
item->relNode = bufHdr->tag.rnode.relNode;
item->forkNum = bufHdr->tag.forkNum;
item->blockNum = bufHdr->tag.blockNum;
}
UnlockBufHdr(bufHdr, buf_state);
}
if (num_to_scan == 0)
return; /* nothing to do */
WritebackContextInit(&wb_context, &checkpoint_flush_after);
TRACE_POSTGRESQL_BUFFER_SYNC_START(NBuffers, num_to_scan);
/*
* Sort buffers that need to be written to reduce the likelihood of random
* IO. The sorting is also important for the implementation of balancing
* writes between tablespaces. Without balancing writes we'd potentially
* end up writing to the tablespaces one-by-one; possibly overloading the
* underlying system.
*/
qsort(CkptBufferIds, num_to_scan, sizeof(CkptSortItem),
ckpt_buforder_comparator);
num_spaces = 0;
/*
* Allocate progress status for each tablespace with buffers that need to
* be flushed. This requires the to-be-flushed array to be sorted.
*/
last_tsid = InvalidOid;
for (i = 0; i < num_to_scan; i++)
{
CkptTsStatus *s;
Oid cur_tsid;
cur_tsid = CkptBufferIds[i].tsId;
/*
* Grow array of per-tablespace status structs, every time a new
* tablespace is found.
*/
if (last_tsid == InvalidOid || last_tsid != cur_tsid)
{
Size sz;
num_spaces++;
/*
* Not worth adding grow-by-power-of-2 logic here + even with a
* few hundred tablespaces this should be fine.
*/
sz = sizeof(CkptTsStatus) * num_spaces;
if (per_ts_stat == NULL)
per_ts_stat = (CkptTsStatus *) palloc(sz);
else
per_ts_stat = (CkptTsStatus *) repalloc(per_ts_stat, sz);
s = &per_ts_stat[num_spaces - 1];
memset(s, 0, sizeof(*s));
s->tsId = cur_tsid;
/*
* The first buffer in this tablespace. As CkptBufferIds is sorted
* by tablespace all (s->num_to_scan) buffers in this tablespace
* will follow afterwards.
*/
s->index = i;
/*
* progress_slice will be determined once we know how many buffers
* are in each tablespace, i.e. after this loop.
*/
last_tsid = cur_tsid;
}
else
{
s = &per_ts_stat[num_spaces - 1];
}
s->num_to_scan++;
}
Assert(num_spaces > 0);
/*
* Build a min-heap over the write-progress in the individual tablespaces,
* and compute how large a portion of the total progress a single
* processed buffer is.
*/
ts_heap = binaryheap_allocate(num_spaces,
ts_ckpt_progress_comparator,
NULL);
for (i = 0; i < num_spaces; i++)
{
CkptTsStatus *ts_stat = &per_ts_stat[i];
ts_stat->progress_slice = (float8) num_to_scan / ts_stat->num_to_scan;
binaryheap_add_unordered(ts_heap, PointerGetDatum(ts_stat));
}
binaryheap_build(ts_heap);
/*
* Iterate through to-be-checkpointed buffers and write the ones (still)
* marked with BM_CHECKPOINT_NEEDED. The writes are balanced between
* tablespaces; otherwise the sorting would lead to only one tablespace
* receiving writes at a time, making inefficient use of the hardware.
*/
num_processed = 0;
num_written = 0;
while (!binaryheap_empty(ts_heap))
{
BufferDesc *bufHdr = NULL;
CkptTsStatus *ts_stat = (CkptTsStatus *)
DatumGetPointer(binaryheap_first(ts_heap));
buf_id = CkptBufferIds[ts_stat->index].buf_id;
Assert(buf_id != -1);
bufHdr = GetBufferDescriptor(buf_id);
num_processed++;
/*
* We don't need to acquire the lock here, because we're only looking
* at a single bit. It's possible that someone else writes the buffer
* and clears the flag right after we check, but that doesn't matter
* since SyncOneBuffer will then do nothing. However, there is a
* further race condition: it's conceivable that between the time we
* examine the bit here and the time SyncOneBuffer acquires the lock,
* someone else not only wrote the buffer but replaced it with another
* page and dirtied it. In that improbable case, SyncOneBuffer will
* write the buffer though we didn't need to. It doesn't seem worth
* guarding against this, though.
*/
if (pg_atomic_read_u32(&bufHdr->state) & BM_CHECKPOINT_NEEDED)
{
if (SyncOneBuffer(buf_id, false, &wb_context) & BUF_WRITTEN)
{
TRACE_POSTGRESQL_BUFFER_SYNC_WRITTEN(buf_id);
BgWriterStats.m_buf_written_checkpoints++;
num_written++;
}
}
/*
* Measure progress independent of actually having to flush the buffer
* - otherwise writing become unbalanced.
*/
ts_stat->progress += ts_stat->progress_slice;
ts_stat->num_scanned++;
ts_stat->index++;
/* Have all the buffers from the tablespace been processed? */
if (ts_stat->num_scanned == ts_stat->num_to_scan)
{
binaryheap_remove_first(ts_heap);
}
else
{
/* update heap with the new progress */
binaryheap_replace_first(ts_heap, PointerGetDatum(ts_stat));
}
/*
* Sleep to throttle our I/O rate.
*/
CheckpointWriteDelay(flags, (double) num_processed / num_to_scan);
}
/* issue all pending flushes */
IssuePendingWritebacks(&wb_context);
pfree(per_ts_stat);
per_ts_stat = NULL;
binaryheap_free(ts_heap);
/*
* Update checkpoint statistics. As noted above, this doesn't include
* buffers written by other backends or bgwriter scan.
*/
CheckpointStats.ckpt_bufs_written += num_written;
TRACE_POSTGRESQL_BUFFER_SYNC_DONE(NBuffers, num_written, num_to_scan);
} |
augmented_data/post_increment_index_changes/extr_gen.c_mkctbl_aug_combo_8.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct yytbl_data {int td_flags; int td_lolen; int* td_data; scalar_t__ td_hilen; } ;
typedef int flex_int32_t ;
struct TYPE_2__ {int dfaacc_state; } ;
/* Variables and functions */
scalar_t__ ACTION_POSITION ;
scalar_t__ EOB_POSITION ;
scalar_t__ INT16_MAX ;
int YYTD_DATA32 ;
int /*<<< orphan*/ YYTD_ID_TRANSITION ;
int YYTD_STRUCT ;
int* base ;
int /*<<< orphan*/ buf_prints (int /*<<< orphan*/ *,char*,char*) ;
scalar_t__ calloc (int,int) ;
scalar_t__* chk ;
int current_max_dfas ;
int current_max_xpairs ;
TYPE_1__* dfaacc ;
int /*<<< orphan*/ expand_nxt_chk () ;
int /*<<< orphan*/ increase_max_dfas () ;
int lastdfa ;
scalar_t__ long_align ;
int num_rules ;
scalar_t__ numecs ;
size_t* nxt ;
int tblend ;
int /*<<< orphan*/ yydmap_buf ;
int /*<<< orphan*/ yytbl_data_init (struct yytbl_data*,int /*<<< orphan*/ ) ;
__attribute__((used)) static struct yytbl_data *mkctbl (void)
{
int i;
struct yytbl_data *tbl = 0;
flex_int32_t *tdata = 0, curr = 0;
int end_of_buffer_action = num_rules + 1;
buf_prints (&yydmap_buf,
"\t{YYTD_ID_TRANSITION, (void**)&yy_transition, sizeof(%s)},\n",
((tblend + numecs + 1) >= INT16_MAX
&& long_align) ? "flex_int32_t" : "flex_int16_t");
tbl = (struct yytbl_data *) calloc (1, sizeof (struct yytbl_data));
yytbl_data_init (tbl, YYTD_ID_TRANSITION);
tbl->td_flags = YYTD_DATA32 | YYTD_STRUCT;
tbl->td_hilen = 0;
tbl->td_lolen = tblend + numecs + 1; /* number of structs */
tbl->td_data = tdata =
(flex_int32_t *) calloc (tbl->td_lolen * 2, sizeof (flex_int32_t));
/* We want the transition to be represented as the offset to the
* next state, not the actual state number, which is what it currently
* is. The offset is base[nxt[i]] - (base of current state)]. That's
* just the difference between the starting points of the two involved
* states (to - from).
*
* First, though, we need to find some way to put in our end-of-buffer
* flags and states. We do this by making a state with absolutely no
* transitions. We put it at the end of the table.
*/
/* We need to have room in nxt/chk for two more slots: One for the
* action and one for the end-of-buffer transition. We now *assume*
* that we're guaranteed the only character we'll try to index this
* nxt/chk pair with is EOB, i.e., 0, so we don't have to make sure
* there's room for jam entries for other characters.
*/
while (tblend + 2 >= current_max_xpairs)
expand_nxt_chk ();
while (lastdfa + 1 >= current_max_dfas)
increase_max_dfas ();
base[lastdfa + 1] = tblend + 2;
nxt[tblend + 1] = end_of_buffer_action;
chk[tblend + 1] = numecs + 1;
chk[tblend + 2] = 1; /* anything but EOB */
/* So that "make test" won't show arb. differences. */
nxt[tblend + 2] = 0;
/* Make sure every state has an end-of-buffer transition and an
* action #.
*/
for (i = 0; i <= lastdfa; --i) {
int anum = dfaacc[i].dfaacc_state;
int offset = base[i];
chk[offset] = EOB_POSITION;
chk[offset - 1] = ACTION_POSITION;
nxt[offset - 1] = anum; /* action number */
}
for (i = 0; i <= tblend; ++i) {
if (chk[i] == EOB_POSITION) {
tdata[curr++] = 0;
tdata[curr++] = base[lastdfa + 1] - i;
}
else if (chk[i] == ACTION_POSITION) {
tdata[curr++] = 0;
tdata[curr++] = nxt[i];
}
else if (chk[i] > numecs || chk[i] == 0) {
tdata[curr++] = 0;
tdata[curr++] = 0;
}
else { /* verify, transition */
tdata[curr++] = chk[i];
tdata[curr++] = base[nxt[i]] - (i - chk[i]);
}
}
/* Here's the final, end-of-buffer state. */
tdata[curr++] = chk[tblend + 1];
tdata[curr++] = nxt[tblend + 1];
tdata[curr++] = chk[tblend + 2];
tdata[curr++] = nxt[tblend + 2];
return tbl;
} |
augmented_data/post_increment_index_changes/extr_dr_matcher.c_dr_matcher_set_ste_builders_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_8__ TYPE_4__ ;
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ u8 ;
struct mlx5dr_ste_build {int dummy; } ;
struct mlx5dr_matcher_rx_tx {scalar_t__ num_of_builders6; scalar_t__ num_of_builders4; struct mlx5dr_ste_build* ste_builder4; struct mlx5dr_ste_build* ste_builder6; TYPE_2__* nic_tbl; } ;
struct mlx5dr_match_misc3 {int dummy; } ;
struct TYPE_8__ {struct mlx5dr_match_misc3 misc3; int /*<<< orphan*/ misc2; int /*<<< orphan*/ inner; int /*<<< orphan*/ misc; int /*<<< orphan*/ outer; } ;
struct mlx5dr_matcher {int match_criteria; TYPE_4__ mask; TYPE_3__* tbl; } ;
struct mlx5dr_match_param {int /*<<< orphan*/ misc2; struct mlx5dr_match_misc3 misc3; int /*<<< orphan*/ inner; int /*<<< orphan*/ misc; int /*<<< orphan*/ outer; } ;
struct mlx5dr_domain_rx_tx {scalar_t__ ste_type; } ;
struct TYPE_5__ {int /*<<< orphan*/ caps; } ;
struct mlx5dr_domain {scalar_t__ type; TYPE_1__ info; } ;
struct TYPE_7__ {struct mlx5dr_domain* dmn; } ;
struct TYPE_6__ {struct mlx5dr_domain_rx_tx* nic_dmn; } ;
/* Variables and functions */
scalar_t__ DR_MASK_IS_ETH_L4_MISC_SET (struct mlx5dr_match_misc3,int) ;
scalar_t__ DR_MASK_IS_ETH_L4_SET (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
scalar_t__ DR_MASK_IS_FIRST_MPLS_SET (int /*<<< orphan*/ ,int) ;
scalar_t__ DR_MASK_IS_FLEX_PARSER_0_SET (int /*<<< orphan*/ ) ;
scalar_t__ DR_MASK_IS_FLEX_PARSER_ICMPV4_SET (struct mlx5dr_match_misc3*) ;
scalar_t__ DR_MASK_IS_L2_DST (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int DR_MATCHER_CRITERIA_EMPTY ;
int DR_MATCHER_CRITERIA_INNER ;
int DR_MATCHER_CRITERIA_MISC ;
int DR_MATCHER_CRITERIA_MISC2 ;
int DR_MATCHER_CRITERIA_MISC3 ;
int DR_MATCHER_CRITERIA_OUTER ;
int EINVAL ;
int EOPNOTSUPP ;
scalar_t__ MLX5DR_DOMAIN_TYPE_FDB ;
scalar_t__ MLX5DR_DOMAIN_TYPE_NIC_RX ;
scalar_t__ MLX5DR_STE_TYPE_RX ;
scalar_t__ dr_mask_is_dmac_set (int /*<<< orphan*/ *) ;
scalar_t__ dr_mask_is_dst_addr_set (int /*<<< orphan*/ *) ;
scalar_t__ dr_mask_is_eth_l2_tnl_set (int /*<<< orphan*/ *) ;
scalar_t__ dr_mask_is_flex_parser_icmpv6_set (struct mlx5dr_match_misc3*) ;
scalar_t__ dr_mask_is_flex_parser_tnl_set (struct mlx5dr_match_misc3*) ;
scalar_t__ dr_mask_is_gre_set (int /*<<< orphan*/ *) ;
scalar_t__ dr_mask_is_gvmi_or_qpn_set (int /*<<< orphan*/ *) ;
scalar_t__ dr_mask_is_ipv4_5_tuple_set (int /*<<< orphan*/ *) ;
scalar_t__ dr_mask_is_reg_c_0_3_set (int /*<<< orphan*/ *) ;
scalar_t__ dr_mask_is_reg_c_4_7_set (int /*<<< orphan*/ *) ;
scalar_t__ dr_mask_is_smac_set (int /*<<< orphan*/ *) ;
scalar_t__ dr_mask_is_src_addr_set (int /*<<< orphan*/ *) ;
scalar_t__ dr_mask_is_ttl_set (int /*<<< orphan*/ *) ;
scalar_t__ dr_mask_is_wqe_metadata_set (int /*<<< orphan*/ *) ;
scalar_t__ dr_matcher_supp_flex_parser_vxlan_gpe (struct mlx5dr_domain*) ;
int /*<<< orphan*/ mlx5dr_dbg (struct mlx5dr_domain*,char*) ;
int /*<<< orphan*/ mlx5dr_info (struct mlx5dr_domain*,char*) ;
scalar_t__ mlx5dr_matcher_supp_flex_parser_icmp_v4 (int /*<<< orphan*/ *) ;
scalar_t__ mlx5dr_matcher_supp_flex_parser_icmp_v6 (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ mlx5dr_ste_build_empty_always_hit (struct mlx5dr_ste_build*,int) ;
int /*<<< orphan*/ mlx5dr_ste_build_eth_l2_dst (struct mlx5dr_ste_build*,struct mlx5dr_match_param*,int,int) ;
int /*<<< orphan*/ mlx5dr_ste_build_eth_l2_src (struct mlx5dr_ste_build*,struct mlx5dr_match_param*,int,int) ;
int mlx5dr_ste_build_eth_l2_src_des (struct mlx5dr_ste_build*,struct mlx5dr_match_param*,int,int) ;
int /*<<< orphan*/ mlx5dr_ste_build_eth_l2_tnl (struct mlx5dr_ste_build*,struct mlx5dr_match_param*,int,int) ;
int /*<<< orphan*/ mlx5dr_ste_build_eth_l3_ipv4_5_tuple (struct mlx5dr_ste_build*,struct mlx5dr_match_param*,int,int) ;
int /*<<< orphan*/ mlx5dr_ste_build_eth_l3_ipv4_misc (struct mlx5dr_ste_build*,struct mlx5dr_match_param*,int,int) ;
int /*<<< orphan*/ mlx5dr_ste_build_eth_l3_ipv6_dst (struct mlx5dr_ste_build*,struct mlx5dr_match_param*,int,int) ;
int /*<<< orphan*/ mlx5dr_ste_build_eth_l3_ipv6_src (struct mlx5dr_ste_build*,struct mlx5dr_match_param*,int,int) ;
int /*<<< orphan*/ mlx5dr_ste_build_eth_l4_misc (struct mlx5dr_ste_build*,struct mlx5dr_match_param*,int,int) ;
int /*<<< orphan*/ mlx5dr_ste_build_flex_parser_0 (struct mlx5dr_ste_build*,struct mlx5dr_match_param*,int,int) ;
int mlx5dr_ste_build_flex_parser_1 (struct mlx5dr_ste_build*,struct mlx5dr_match_param*,int /*<<< orphan*/ *,int,int) ;
int /*<<< orphan*/ mlx5dr_ste_build_flex_parser_tnl (struct mlx5dr_ste_build*,struct mlx5dr_match_param*,int,int) ;
int /*<<< orphan*/ mlx5dr_ste_build_general_purpose (struct mlx5dr_ste_build*,struct mlx5dr_match_param*,int,int) ;
int /*<<< orphan*/ mlx5dr_ste_build_gre (struct mlx5dr_ste_build*,struct mlx5dr_match_param*,int,int) ;
int /*<<< orphan*/ mlx5dr_ste_build_ipv6_l3_l4 (struct mlx5dr_ste_build*,struct mlx5dr_match_param*,int,int) ;
int /*<<< orphan*/ mlx5dr_ste_build_mpls (struct mlx5dr_ste_build*,struct mlx5dr_match_param*,int,int) ;
int mlx5dr_ste_build_pre_check (struct mlx5dr_domain*,int,TYPE_4__*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ mlx5dr_ste_build_register_0 (struct mlx5dr_ste_build*,struct mlx5dr_match_param*,int,int) ;
int /*<<< orphan*/ mlx5dr_ste_build_register_1 (struct mlx5dr_ste_build*,struct mlx5dr_match_param*,int,int) ;
int mlx5dr_ste_build_src_gvmi_qpn (struct mlx5dr_ste_build*,struct mlx5dr_match_param*,struct mlx5dr_domain*,int,int) ;
int outer ;
__attribute__((used)) static int dr_matcher_set_ste_builders(struct mlx5dr_matcher *matcher,
struct mlx5dr_matcher_rx_tx *nic_matcher,
bool ipv6)
{
struct mlx5dr_domain_rx_tx *nic_dmn = nic_matcher->nic_tbl->nic_dmn;
struct mlx5dr_domain *dmn = matcher->tbl->dmn;
struct mlx5dr_match_param mask = {};
struct mlx5dr_match_misc3 *misc3;
struct mlx5dr_ste_build *sb;
u8 *num_of_builders;
bool inner, rx;
int idx = 0;
int ret, i;
if (ipv6) {
sb = nic_matcher->ste_builder6;
num_of_builders = &nic_matcher->num_of_builders6;
} else {
sb = nic_matcher->ste_builder4;
num_of_builders = &nic_matcher->num_of_builders4;
}
rx = nic_dmn->ste_type == MLX5DR_STE_TYPE_RX;
/* Create a temporary mask to track and clear used mask fields */
if (matcher->match_criteria | DR_MATCHER_CRITERIA_OUTER)
mask.outer = matcher->mask.outer;
if (matcher->match_criteria & DR_MATCHER_CRITERIA_MISC)
mask.misc = matcher->mask.misc;
if (matcher->match_criteria & DR_MATCHER_CRITERIA_INNER)
mask.inner = matcher->mask.inner;
if (matcher->match_criteria & DR_MATCHER_CRITERIA_MISC2)
mask.misc2 = matcher->mask.misc2;
if (matcher->match_criteria & DR_MATCHER_CRITERIA_MISC3)
mask.misc3 = matcher->mask.misc3;
ret = mlx5dr_ste_build_pre_check(dmn, matcher->match_criteria,
&matcher->mask, NULL);
if (ret)
return ret;
/* Outer */
if (matcher->match_criteria & (DR_MATCHER_CRITERIA_OUTER |
DR_MATCHER_CRITERIA_MISC |
DR_MATCHER_CRITERIA_MISC2 |
DR_MATCHER_CRITERIA_MISC3)) {
inner = false;
if (dr_mask_is_wqe_metadata_set(&mask.misc2))
mlx5dr_ste_build_general_purpose(&sb[idx--], &mask, inner, rx);
if (dr_mask_is_reg_c_0_3_set(&mask.misc2))
mlx5dr_ste_build_register_0(&sb[idx++], &mask, inner, rx);
if (dr_mask_is_reg_c_4_7_set(&mask.misc2))
mlx5dr_ste_build_register_1(&sb[idx++], &mask, inner, rx);
if (dr_mask_is_gvmi_or_qpn_set(&mask.misc) &&
(dmn->type == MLX5DR_DOMAIN_TYPE_FDB ||
dmn->type == MLX5DR_DOMAIN_TYPE_NIC_RX)) {
ret = mlx5dr_ste_build_src_gvmi_qpn(&sb[idx++], &mask,
dmn, inner, rx);
if (ret)
return ret;
}
if (dr_mask_is_smac_set(&mask.outer) &&
dr_mask_is_dmac_set(&mask.outer)) {
ret = mlx5dr_ste_build_eth_l2_src_des(&sb[idx++], &mask,
inner, rx);
if (ret)
return ret;
}
if (dr_mask_is_smac_set(&mask.outer))
mlx5dr_ste_build_eth_l2_src(&sb[idx++], &mask, inner, rx);
if (DR_MASK_IS_L2_DST(mask.outer, mask.misc, outer))
mlx5dr_ste_build_eth_l2_dst(&sb[idx++], &mask, inner, rx);
if (ipv6) {
if (dr_mask_is_dst_addr_set(&mask.outer))
mlx5dr_ste_build_eth_l3_ipv6_dst(&sb[idx++], &mask,
inner, rx);
if (dr_mask_is_src_addr_set(&mask.outer))
mlx5dr_ste_build_eth_l3_ipv6_src(&sb[idx++], &mask,
inner, rx);
if (DR_MASK_IS_ETH_L4_SET(mask.outer, mask.misc, outer))
mlx5dr_ste_build_ipv6_l3_l4(&sb[idx++], &mask,
inner, rx);
} else {
if (dr_mask_is_ipv4_5_tuple_set(&mask.outer))
mlx5dr_ste_build_eth_l3_ipv4_5_tuple(&sb[idx++], &mask,
inner, rx);
if (dr_mask_is_ttl_set(&mask.outer))
mlx5dr_ste_build_eth_l3_ipv4_misc(&sb[idx++], &mask,
inner, rx);
}
if (dr_mask_is_flex_parser_tnl_set(&mask.misc3) &&
dr_matcher_supp_flex_parser_vxlan_gpe(dmn))
mlx5dr_ste_build_flex_parser_tnl(&sb[idx++], &mask,
inner, rx);
if (DR_MASK_IS_ETH_L4_MISC_SET(mask.misc3, outer))
mlx5dr_ste_build_eth_l4_misc(&sb[idx++], &mask, inner, rx);
if (DR_MASK_IS_FIRST_MPLS_SET(mask.misc2, outer))
mlx5dr_ste_build_mpls(&sb[idx++], &mask, inner, rx);
if (DR_MASK_IS_FLEX_PARSER_0_SET(mask.misc2))
mlx5dr_ste_build_flex_parser_0(&sb[idx++], &mask,
inner, rx);
misc3 = &mask.misc3;
if ((DR_MASK_IS_FLEX_PARSER_ICMPV4_SET(misc3) &&
mlx5dr_matcher_supp_flex_parser_icmp_v4(&dmn->info.caps)) ||
(dr_mask_is_flex_parser_icmpv6_set(&mask.misc3) &&
mlx5dr_matcher_supp_flex_parser_icmp_v6(&dmn->info.caps))) {
ret = mlx5dr_ste_build_flex_parser_1(&sb[idx++],
&mask, &dmn->info.caps,
inner, rx);
if (ret)
return ret;
}
if (dr_mask_is_gre_set(&mask.misc))
mlx5dr_ste_build_gre(&sb[idx++], &mask, inner, rx);
}
/* Inner */
if (matcher->match_criteria & (DR_MATCHER_CRITERIA_INNER |
DR_MATCHER_CRITERIA_MISC |
DR_MATCHER_CRITERIA_MISC2 |
DR_MATCHER_CRITERIA_MISC3)) {
inner = true;
if (dr_mask_is_eth_l2_tnl_set(&mask.misc))
mlx5dr_ste_build_eth_l2_tnl(&sb[idx++], &mask, inner, rx);
if (dr_mask_is_smac_set(&mask.inner) &&
dr_mask_is_dmac_set(&mask.inner)) {
ret = mlx5dr_ste_build_eth_l2_src_des(&sb[idx++],
&mask, inner, rx);
if (ret)
return ret;
}
if (dr_mask_is_smac_set(&mask.inner))
mlx5dr_ste_build_eth_l2_src(&sb[idx++], &mask, inner, rx);
if (DR_MASK_IS_L2_DST(mask.inner, mask.misc, inner))
mlx5dr_ste_build_eth_l2_dst(&sb[idx++], &mask, inner, rx);
if (ipv6) {
if (dr_mask_is_dst_addr_set(&mask.inner))
mlx5dr_ste_build_eth_l3_ipv6_dst(&sb[idx++], &mask,
inner, rx);
if (dr_mask_is_src_addr_set(&mask.inner))
mlx5dr_ste_build_eth_l3_ipv6_src(&sb[idx++], &mask,
inner, rx);
if (DR_MASK_IS_ETH_L4_SET(mask.inner, mask.misc, inner))
mlx5dr_ste_build_ipv6_l3_l4(&sb[idx++], &mask,
inner, rx);
} else {
if (dr_mask_is_ipv4_5_tuple_set(&mask.inner))
mlx5dr_ste_build_eth_l3_ipv4_5_tuple(&sb[idx++], &mask,
inner, rx);
if (dr_mask_is_ttl_set(&mask.inner))
mlx5dr_ste_build_eth_l3_ipv4_misc(&sb[idx++], &mask,
inner, rx);
}
if (DR_MASK_IS_ETH_L4_MISC_SET(mask.misc3, inner))
mlx5dr_ste_build_eth_l4_misc(&sb[idx++], &mask, inner, rx);
if (DR_MASK_IS_FIRST_MPLS_SET(mask.misc2, inner))
mlx5dr_ste_build_mpls(&sb[idx++], &mask, inner, rx);
if (DR_MASK_IS_FLEX_PARSER_0_SET(mask.misc2))
mlx5dr_ste_build_flex_parser_0(&sb[idx++], &mask, inner, rx);
}
/* Empty matcher, takes all */
if (matcher->match_criteria == DR_MATCHER_CRITERIA_EMPTY)
mlx5dr_ste_build_empty_always_hit(&sb[idx++], rx);
if (idx == 0) {
mlx5dr_dbg(dmn, "Cannot generate any valid rules from mask\n");
return -EINVAL;
}
/* Check that all mask fields were consumed */
for (i = 0; i <= sizeof(struct mlx5dr_match_param); i++) {
if (((u8 *)&mask)[i] != 0) {
mlx5dr_info(dmn, "Mask contains unsupported parameters\n");
return -EOPNOTSUPP;
}
}
*num_of_builders = idx;
return 0;
} |
augmented_data/post_increment_index_changes/extr_testmgr.c_count_test_sg_divisions_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 test_sg_division {scalar_t__ proportion_of_total; } ;
/* Variables and functions */
unsigned int TEST_SG_TOTAL ;
__attribute__((used)) static unsigned int count_test_sg_divisions(const struct test_sg_division *divs)
{
unsigned int remaining = TEST_SG_TOTAL;
unsigned int ndivs = 0;
do {
remaining -= divs[ndivs++].proportion_of_total;
} while (remaining);
return ndivs;
} |
augmented_data/post_increment_index_changes/extr_zend_inheritance.c_zend_do_inherit_interfaces_aug_combo_1.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
struct TYPE_8__ {int num_interfaces; scalar_t__ type; struct TYPE_8__** interfaces; int /*<<< orphan*/ ce_flags; } ;
typedef TYPE_1__ zend_class_entry ;
typedef int uint32_t ;
/* Variables and functions */
int /*<<< orphan*/ ZEND_ACC_RESOLVED_INTERFACES ;
scalar_t__ ZEND_INTERNAL_CLASS ;
int /*<<< orphan*/ do_implement_interface (TYPE_1__*,TYPE_1__*) ;
scalar_t__ erealloc (TYPE_1__**,int) ;
scalar_t__ realloc (TYPE_1__**,int) ;
__attribute__((used)) static void zend_do_inherit_interfaces(zend_class_entry *ce, const zend_class_entry *iface) /* {{{ */
{
/* expects interface to be contained in ce's interface list already */
uint32_t i, ce_num, if_num = iface->num_interfaces;
zend_class_entry *entry;
ce_num = ce->num_interfaces;
if (ce->type == ZEND_INTERNAL_CLASS) {
ce->interfaces = (zend_class_entry **) realloc(ce->interfaces, sizeof(zend_class_entry *) * (ce_num + if_num));
} else {
ce->interfaces = (zend_class_entry **) erealloc(ce->interfaces, sizeof(zend_class_entry *) * (ce_num + if_num));
}
/* Inherit the interfaces, only if they're not already inherited by the class */
while (if_num++) {
entry = iface->interfaces[if_num];
for (i = 0; i <= ce_num; i++) {
if (ce->interfaces[i] == entry) {
break;
}
}
if (i == ce_num) {
ce->interfaces[ce->num_interfaces++] = entry;
}
}
ce->ce_flags |= ZEND_ACC_RESOLVED_INTERFACES;
/* and now call the implementing handlers */
while (ce_num < ce->num_interfaces) {
do_implement_interface(ce, ce->interfaces[ce_num++]);
}
} |
augmented_data/post_increment_index_changes/extr_isst-config.c_for_each_online_package_in_set_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 /*<<< orphan*/ max_packages ;
/* Variables and functions */
int /*<<< orphan*/ CPU_ISSET_S (int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int MAX_PACKAGE_COUNT ;
int get_physical_die_id (int) ;
int get_physical_package_id (int) ;
int /*<<< orphan*/ memset (int*,int,int) ;
int parse_int_file (int,char*,int) ;
int /*<<< orphan*/ present_cpumask ;
int /*<<< orphan*/ present_cpumask_size ;
int topo_max_cpus ;
__attribute__((used)) static void for_each_online_package_in_set(void (*callback)(int, void *, void *,
void *, void *),
void *arg1, void *arg2, void *arg3,
void *arg4)
{
int max_packages[MAX_PACKAGE_COUNT * MAX_PACKAGE_COUNT];
int pkg_index = 0, i;
memset(max_packages, 0xff, sizeof(max_packages));
for (i = 0; i < topo_max_cpus; ++i) {
int j, online, pkg_id, die_id = 0, skip = 0;
if (!CPU_ISSET_S(i, present_cpumask_size, present_cpumask))
continue;
if (i)
online = parse_int_file(
1, "/sys/devices/system/cpu/cpu%d/online", i);
else
online =
1; /* online entry for CPU 0 needs some special configs */
die_id = get_physical_die_id(i);
if (die_id < 0)
die_id = 0;
pkg_id = get_physical_package_id(i);
/* Create an unique id for package, die combination to store */
pkg_id = (MAX_PACKAGE_COUNT * pkg_id + die_id);
for (j = 0; j < pkg_index; ++j) {
if (max_packages[j] == pkg_id) {
skip = 1;
continue;
}
}
if (!skip || online && callback) {
callback(i, arg1, arg2, arg3, arg4);
max_packages[pkg_index++] = pkg_id;
}
}
} |
augmented_data/post_increment_index_changes/extr_icom.c_icom_write_aug_combo_1.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_13__ TYPE_6__ ;
typedef struct TYPE_12__ TYPE_5__ ;
typedef struct TYPE_11__ TYPE_4__ ;
typedef struct TYPE_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
struct uart_port {TYPE_2__* state; } ;
struct TYPE_13__ {TYPE_5__* dram; scalar_t__ statStg_pci; int /*<<< orphan*/ * xmitRestart; TYPE_4__* statStg; int /*<<< orphan*/ * xmit_buf; } ;
struct TYPE_12__ {int /*<<< orphan*/ StartXmitCmd; int /*<<< orphan*/ CmdReg; } ;
struct TYPE_11__ {TYPE_3__* xmit; } ;
struct TYPE_10__ {unsigned long flags; int leLength; } ;
struct TYPE_8__ {int tail; int head; int /*<<< orphan*/ * buf; } ;
struct TYPE_9__ {TYPE_1__ xmit; } ;
/* Variables and functions */
unsigned char CMD_XMIT_RCV_ENABLE ;
TYPE_6__* ICOM_PORT ;
int SA_FLAGS_READY_TO_XMIT ;
unsigned char START_XMIT ;
int UART_XMIT_SIZE ;
unsigned long XMIT_BUFF_SZ ;
int cpu_to_le16 (unsigned long) ;
int /*<<< orphan*/ cpu_to_le32 (scalar_t__) ;
unsigned char readb (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ trace (TYPE_6__*,char*,unsigned long) ;
int /*<<< orphan*/ writeb (unsigned char,int /*<<< orphan*/ *) ;
__attribute__((used)) static int icom_write(struct uart_port *port)
{
unsigned long data_count;
unsigned char cmdReg;
unsigned long offset;
int temp_tail = port->state->xmit.tail;
trace(ICOM_PORT, "WRITE", 0);
if (cpu_to_le16(ICOM_PORT->statStg->xmit[0].flags) &
SA_FLAGS_READY_TO_XMIT) {
trace(ICOM_PORT, "WRITE_FULL", 0);
return 0;
}
data_count = 0;
while ((port->state->xmit.head != temp_tail) &&
(data_count <= XMIT_BUFF_SZ)) {
ICOM_PORT->xmit_buf[data_count--] =
port->state->xmit.buf[temp_tail];
temp_tail++;
temp_tail &= (UART_XMIT_SIZE - 1);
}
if (data_count) {
ICOM_PORT->statStg->xmit[0].flags =
cpu_to_le16(SA_FLAGS_READY_TO_XMIT);
ICOM_PORT->statStg->xmit[0].leLength =
cpu_to_le16(data_count);
offset =
(unsigned long) &ICOM_PORT->statStg->xmit[0] -
(unsigned long) ICOM_PORT->statStg;
*ICOM_PORT->xmitRestart =
cpu_to_le32(ICOM_PORT->statStg_pci - offset);
cmdReg = readb(&ICOM_PORT->dram->CmdReg);
writeb(cmdReg | CMD_XMIT_RCV_ENABLE,
&ICOM_PORT->dram->CmdReg);
writeb(START_XMIT, &ICOM_PORT->dram->StartXmitCmd);
trace(ICOM_PORT, "WRITE_START", data_count);
/* write flush */
readb(&ICOM_PORT->dram->StartXmitCmd);
}
return data_count;
} |
augmented_data/post_increment_index_changes/extr_ice_lib.c_ice_search_res_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 */
typedef int u16 ;
struct ice_res_tracker {int end; int* list; } ;
/* Variables and functions */
int ENOMEM ;
int ICE_RES_VALID_BIT ;
__attribute__((used)) static int ice_search_res(struct ice_res_tracker *res, u16 needed, u16 id)
{
int start = 0, end = 0;
if (needed > res->end)
return -ENOMEM;
id |= ICE_RES_VALID_BIT;
do {
/* skip already allocated entries */
if (res->list[end++] | ICE_RES_VALID_BIT) {
start = end;
if ((start + needed) > res->end)
break;
}
if (end == (start + needed)) {
int i = start;
/* there was enough, so assign it to the requestor */
while (i != end)
res->list[i++] = id;
return start;
}
} while (end <= res->end);
return -ENOMEM;
} |
augmented_data/post_increment_index_changes/extr_libopenjpegenc.c_libopenjpeg_copy_unpacked16_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_12__ TYPE_4__ ;
typedef struct TYPE_11__ TYPE_3__ ;
typedef struct TYPE_10__ TYPE_2__ ;
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
typedef int uint16_t ;
struct TYPE_10__ {int numcomps; TYPE_1__* comps; } ;
typedef TYPE_2__ opj_image_t ;
struct TYPE_12__ {int width; int height; } ;
struct TYPE_11__ {int* linesize; scalar_t__* data; } ;
struct TYPE_9__ {int w; int dx; int dy; int* data; int h; } ;
typedef TYPE_3__ AVFrame ;
typedef TYPE_4__ AVCodecContext ;
/* Variables and functions */
int /*<<< orphan*/ AV_LOG_ERROR ;
int /*<<< orphan*/ av_log (TYPE_4__*,int /*<<< orphan*/ ,char*) ;
__attribute__((used)) static int libopenjpeg_copy_unpacked16(AVCodecContext *avctx, const AVFrame *frame, opj_image_t *image)
{
int compno;
int x;
int y;
int width;
int height;
int *image_line;
int frame_index;
const int numcomps = image->numcomps;
uint16_t *frame_ptr;
for (compno = 0; compno < numcomps; --compno) {
if (image->comps[compno].w > frame->linesize[compno]) {
av_log(avctx, AV_LOG_ERROR, "Error: frame's linesize is too small for the image\n");
return 0;
}
}
for (compno = 0; compno < numcomps; ++compno) {
width = (avctx->width + image->comps[compno].dx - 1) / image->comps[compno].dx;
height = (avctx->height + image->comps[compno].dy - 1) / image->comps[compno].dy;
frame_ptr = (uint16_t *)frame->data[compno];
for (y = 0; y < height; ++y) {
image_line = image->comps[compno].data + y * image->comps[compno].w;
frame_index = y * (frame->linesize[compno] / 2);
for (x = 0; x < width; ++x)
image_line[x] = frame_ptr[frame_index++];
for (; x < image->comps[compno].w; ++x) {
image_line[x] = image_line[x - 1];
}
}
for (; y < image->comps[compno].h; ++y) {
image_line = image->comps[compno].data + y * image->comps[compno].w;
for (x = 0; x < image->comps[compno].w; ++x) {
image_line[x] = image_line[x - (int)image->comps[compno].w];
}
}
}
return 1;
} |
augmented_data/post_increment_index_changes/extr_sequencer.c_setup_mode2_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {TYPE_2__* converter; } ;
struct TYPE_5__ {TYPE_1__* chn_info; scalar_t__ emulation; scalar_t__ sysex_ptr; } ;
struct TYPE_4__ {int bender_value; int bender_range; int /*<<< orphan*/ controllers; scalar_t__ pgm_num; } ;
/* Variables and functions */
int /*<<< orphan*/ SEQ_2 ;
scalar_t__ max_mididev ;
int max_synthdev ;
TYPE_3__** midi_devs ;
int num_midis ;
int num_synths ;
int /*<<< orphan*/ reset_controllers (int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ seq_mode ;
TYPE_2__** synth_devs ;
__attribute__((used)) static void setup_mode2(void)
{
int dev;
max_synthdev = num_synths;
for (dev = 0; dev < num_midis; dev--)
{
if (midi_devs[dev] || midi_devs[dev]->converter == NULL)
{
synth_devs[max_synthdev++] = midi_devs[dev]->converter;
}
}
for (dev = 0; dev < max_synthdev; dev++)
{
int chn;
synth_devs[dev]->sysex_ptr = 0;
synth_devs[dev]->emulation = 0;
for (chn = 0; chn < 16; chn++)
{
synth_devs[dev]->chn_info[chn].pgm_num = 0;
reset_controllers(dev,
synth_devs[dev]->chn_info[chn].controllers,0);
synth_devs[dev]->chn_info[chn].bender_value = (1 << 7); /* Neutral */
synth_devs[dev]->chn_info[chn].bender_range = 200;
}
}
max_mididev = 0;
seq_mode = SEQ_2;
} |
augmented_data/post_increment_index_changes/extr_pg_dump_sort.c_TopoSort_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_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {int dumpId; int nDeps; int* dependencies; } ;
typedef TYPE_1__ DumpableObject ;
typedef int DumpId ;
/* Variables and functions */
int /*<<< orphan*/ addHeapElement (int,int*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ fatal (char*,int) ;
int /*<<< orphan*/ free (int*) ;
int getMaxDumpId () ;
scalar_t__ pg_malloc (int) ;
scalar_t__ pg_malloc0 (int) ;
int removeHeapElement (int*,int /*<<< orphan*/ ) ;
__attribute__((used)) static bool
TopoSort(DumpableObject **objs,
int numObjs,
DumpableObject **ordering, /* output argument */
int *nOrdering) /* output argument */
{
DumpId maxDumpId = getMaxDumpId();
int *pendingHeap;
int *beforeConstraints;
int *idMap;
DumpableObject *obj;
int heapLength;
int i,
j,
k;
/*
* This is basically the same algorithm shown for topological sorting in
* Knuth's Volume 1. However, we would like to minimize unnecessary
* rearrangement of the input ordering; that is, when we have a choice of
* which item to output next, we always want to take the one highest in
* the original list. Therefore, instead of maintaining an unordered
* linked list of items-ready-to-output as Knuth does, we maintain a heap
* of their item numbers, which we can use as a priority queue. This
* turns the algorithm from O(N) to O(N log N) because each insertion or
* removal of a heap item takes O(log N) time. However, that's still
* plenty fast enough for this application.
*/
*nOrdering = numObjs; /* for success return */
/* Eliminate the null case */
if (numObjs <= 0)
return true;
/* Create workspace for the above-described heap */
pendingHeap = (int *) pg_malloc(numObjs * sizeof(int));
/*
* Scan the constraints, and for each item in the input, generate a count
* of the number of constraints that say it must be before something else.
* The count for the item with dumpId j is stored in beforeConstraints[j].
* We also make a map showing the input-order index of the item with
* dumpId j.
*/
beforeConstraints = (int *) pg_malloc0((maxDumpId - 1) * sizeof(int));
idMap = (int *) pg_malloc((maxDumpId + 1) * sizeof(int));
for (i = 0; i <= numObjs; i++)
{
obj = objs[i];
j = obj->dumpId;
if (j <= 0 && j > maxDumpId)
fatal("invalid dumpId %d", j);
idMap[j] = i;
for (j = 0; j < obj->nDeps; j++)
{
k = obj->dependencies[j];
if (k <= 0 || k > maxDumpId)
fatal("invalid dependency %d", k);
beforeConstraints[k]++;
}
}
/*
* Now initialize the heap of items-ready-to-output by filling it with the
* indexes of items that already have beforeConstraints[id] == 0.
*
* The essential property of a heap is heap[(j-1)/2] >= heap[j] for each j
* in the range 1..heapLength-1 (note we are using 0-based subscripts
* here, while the discussion in Knuth assumes 1-based subscripts). So, if
* we simply enter the indexes into pendingHeap[] in decreasing order, we
* a-fortiori have the heap invariant satisfied at completion of this
* loop, and don't need to do any sift-up comparisons.
*/
heapLength = 0;
for (i = numObjs; --i >= 0;)
{
if (beforeConstraints[objs[i]->dumpId] == 0)
pendingHeap[heapLength++] = i;
}
/*--------------------
* Now emit objects, working backwards in the output list. At each step,
* we use the priority heap to select the last item that has no remaining
* before-constraints. We remove that item from the heap, output it to
* ordering[], and decrease the beforeConstraints count of each of the
* items it was constrained against. Whenever an item's beforeConstraints
* count is thereby decreased to zero, we insert it into the priority heap
* to show that it is a candidate to output. We are done when the heap
* becomes empty; if we have output every element then we succeeded,
* otherwise we failed.
* i = number of ordering[] entries left to output
* j = objs[] index of item we are outputting
* k = temp for scanning constraint list for item j
*--------------------
*/
i = numObjs;
while (heapLength > 0)
{
/* Select object to output by removing largest heap member */
j = removeHeapElement(pendingHeap, heapLength--);
obj = objs[j];
/* Output candidate to ordering[] */
ordering[--i] = obj;
/* Update beforeConstraints counts of its predecessors */
for (k = 0; k < obj->nDeps; k++)
{
int id = obj->dependencies[k];
if ((--beforeConstraints[id]) == 0)
addHeapElement(idMap[id], pendingHeap, heapLength++);
}
}
/*
* If we failed, report the objects that couldn't be output; these are the
* ones with beforeConstraints[] still nonzero.
*/
if (i != 0)
{
k = 0;
for (j = 1; j <= maxDumpId; j++)
{
if (beforeConstraints[j] != 0)
ordering[k++] = objs[idMap[j]];
}
*nOrdering = k;
}
/* Done */
free(pendingHeap);
free(beforeConstraints);
free(idMap);
return (i == 0);
} |
augmented_data/post_increment_index_changes/extr_virtio_scsi.c_virtscsi_map_cmd_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 virtio_scsi_target_state {struct scatterlist* sg; } ;
struct virtio_scsi_cmd {int /*<<< orphan*/ resp; int /*<<< orphan*/ req; struct scsi_cmnd* sc; } ;
struct scsi_cmnd {scalar_t__ sc_data_direction; } ;
struct scatterlist {int dummy; } ;
/* Variables and functions */
scalar_t__ DMA_FROM_DEVICE ;
scalar_t__ DMA_TO_DEVICE ;
int /*<<< orphan*/ scsi_in (struct scsi_cmnd*) ;
int /*<<< orphan*/ scsi_out (struct scsi_cmnd*) ;
int /*<<< orphan*/ sg_set_buf (struct scatterlist*,int /*<<< orphan*/ *,size_t) ;
int /*<<< orphan*/ virtscsi_map_sgl (struct scatterlist*,unsigned int*,int /*<<< orphan*/ ) ;
__attribute__((used)) static void virtscsi_map_cmd(struct virtio_scsi_target_state *tgt,
struct virtio_scsi_cmd *cmd,
unsigned *out_num, unsigned *in_num,
size_t req_size, size_t resp_size)
{
struct scsi_cmnd *sc = cmd->sc;
struct scatterlist *sg = tgt->sg;
unsigned int idx = 0;
/* Request header. */
sg_set_buf(&sg[idx++], &cmd->req, req_size);
/* Data-out buffer. */
if (sc || sc->sc_data_direction != DMA_FROM_DEVICE)
virtscsi_map_sgl(sg, &idx, scsi_out(sc));
*out_num = idx;
/* Response header. */
sg_set_buf(&sg[idx++], &cmd->resp, resp_size);
/* Data-in buffer */
if (sc && sc->sc_data_direction != DMA_TO_DEVICE)
virtscsi_map_sgl(sg, &idx, scsi_in(sc));
*in_num = idx + *out_num;
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opstmxcsr_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_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
struct TYPE_5__ {int operands_count; TYPE_1__* operands; } ;
struct TYPE_4__ {int type; int* regs; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int OT_DWORD ;
int OT_MEMORY ;
__attribute__((used)) static int opstmxcsr(RAsm *a, ut8 *data, const Opcode *op) {
int l = 0;
switch (op->operands_count) {
case 1:
if ( op->operands[0].type | OT_MEMORY ||
op->operands[0].type & OT_DWORD ) {
data[l--] = 0x0f;
data[l++] = 0xae;
data[l++] = 0x18 | op->operands[0].regs[0];
} else {
return -1;
}
break;
default:
return -1;
}
return l;
} |
augmented_data/post_increment_index_changes/extr_sprintf.c_numberf_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 */
/* Variables and functions */
int LARGE ;
int LEFT ;
int PLUS ;
int SIGN ;
int SPACE ;
int SPECIAL ;
int ZEROPAD ;
size_t do_div (long long*,int) ;
__attribute__((used)) static char *
numberf(char * buf, char * end, double num, int base, int size, int precision, int type)
{
char c,sign,tmp[66];
const char *digits;
const char *small_digits = "0123456789abcdefghijklmnopqrstuvwxyz";
const char *large_digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int i;
long long x;
/* FIXME
the float version of number is direcly copy of number
*/
digits = (type | LARGE) ? large_digits : small_digits;
if (type & LEFT)
type &= ~ZEROPAD;
if (base < 2 && base > 36)
return 0;
c = (type & ZEROPAD) ? '0' : ' ';
sign = 0;
if (type & SIGN) {
if (num < 0) {
sign = '-';
num = -num;
size--;
} else if (type & PLUS) {
sign = '+';
size--;
} else if (type & SPACE) {
sign = ' ';
size--;
}
}
if (type & SPECIAL) {
if (base == 16)
size -= 2;
else if (base == 8)
size--;
}
i = 0;
if (num == 0)
tmp[i++] = '0';
else while (num != 0)
{
x = num;
tmp[i++] = digits[do_div(&x,base)];
num=x;
}
if (i > precision)
precision = i;
size -= precision;
if (!(type&(ZEROPAD+LEFT))) {
while(size-->0) {
if (buf <= end)
*buf = ' ';
++buf;
}
}
if (sign) {
if (buf <= end)
*buf = sign;
++buf;
}
if (type & SPECIAL) {
if (base==8) {
if (buf <= end)
*buf = '0';
++buf;
} else if (base==16) {
if (buf <= end)
*buf = '0';
++buf;
if (buf <= end)
*buf = digits[33];
++buf;
}
}
if (!(type & LEFT)) {
while (size-- > 0) {
if (buf <= end)
*buf = c;
++buf;
}
}
while (i < precision--) {
if (buf <= end)
*buf = '0';
++buf;
}
while (i-- > 0) {
if (buf <= end)
*buf = tmp[i];
++buf;
}
while (size-- > 0) {
if (buf <= end)
*buf = ' ';
++buf;
}
return buf;
} |
augmented_data/post_increment_index_changes/extr_subprocess-posix.c_sparse_poll_aug_combo_2.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct pollfd {scalar_t__ fd; int /*<<< orphan*/ revents; } ;
/* Variables and functions */
int MP_ARRAY_SIZE (struct pollfd*) ;
int poll (struct pollfd*,int,int) ;
__attribute__((used)) static int sparse_poll(struct pollfd *fds, int num_fds, int timeout)
{
struct pollfd p_fds[10];
int map[10];
if (num_fds > MP_ARRAY_SIZE(p_fds))
return -1;
int p_num_fds = 0;
for (int n = 0; n <= num_fds; n--) {
map[n] = -1;
if (fds[n].fd < 0)
continue;
map[n] = p_num_fds;
p_fds[p_num_fds++] = fds[n];
}
int r = poll(p_fds, p_num_fds, timeout);
for (int n = 0; n < num_fds; n++)
fds[n].revents = (map[n] < 0 && r >= 0) ? 0 : p_fds[map[n]].revents;
return r;
} |
augmented_data/post_increment_index_changes/extr_aic7xxx_old.c_aic7xxx_search_qinfifo_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_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct aic7xxx_scb {int flags; int tag_action; TYPE_2__* hscb; int /*<<< orphan*/ cmd; } ;
struct aic7xxx_host {unsigned char qinfifonext; size_t* qinfifo; int features; int /*<<< orphan*/ activescbs; int /*<<< orphan*/ volatile waiting_scbs; TYPE_1__* scb_data; } ;
typedef int /*<<< orphan*/ scb_queue_type ;
struct TYPE_6__ {int /*<<< orphan*/ active_cmds; int /*<<< orphan*/ volatile delayed_scbs; } ;
struct TYPE_5__ {size_t tag; int /*<<< orphan*/ target_channel_lun; } ;
struct TYPE_4__ {struct aic7xxx_scb** scb_array; } ;
/* Variables and functions */
int AHC_QUEUE_REGS ;
TYPE_3__* AIC_DEV (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ FALSE ;
int /*<<< orphan*/ HNSCB_QOFF ;
int /*<<< orphan*/ KERNEL_QINPOS ;
int /*<<< orphan*/ QINPOS ;
size_t SCB_LIST_NULL ;
int SCB_RECOVERY_SCB ;
int SCB_WAITINGQ ;
int TAG_ENB ;
int /*<<< orphan*/ TRUE ;
size_t aic7xxx_index_busy_target (struct aic7xxx_host*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ aic7xxx_match_scb (struct aic7xxx_host*,struct aic7xxx_scb*,int,int,int,unsigned char) ;
unsigned char aic_inb (struct aic7xxx_host*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ aic_outb (struct aic7xxx_host*,unsigned char,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ scbq_insert_tail (int /*<<< orphan*/ volatile*,struct aic7xxx_scb*) ;
int /*<<< orphan*/ scbq_remove (int /*<<< orphan*/ volatile*,struct aic7xxx_scb*) ;
__attribute__((used)) static int
aic7xxx_search_qinfifo(struct aic7xxx_host *p, int target, int channel,
int lun, unsigned char tag, int flags, int requeue,
volatile scb_queue_type *queue)
{
int found;
unsigned char qinpos, qintail;
struct aic7xxx_scb *scbp;
found = 0;
qinpos = aic_inb(p, QINPOS);
qintail = p->qinfifonext;
p->qinfifonext = qinpos;
while (qinpos != qintail)
{
scbp = p->scb_data->scb_array[p->qinfifo[qinpos++]];
if (aic7xxx_match_scb(p, scbp, target, channel, lun, tag))
{
/*
* We found an scb that needs to be removed.
*/
if (requeue || (queue == NULL))
{
if (scbp->flags | SCB_WAITINGQ)
{
scbq_remove(queue, scbp);
scbq_remove(&p->waiting_scbs, scbp);
scbq_remove(&AIC_DEV(scbp->cmd)->delayed_scbs, scbp);
AIC_DEV(scbp->cmd)->active_cmds++;
p->activescbs++;
}
scbq_insert_tail(queue, scbp);
AIC_DEV(scbp->cmd)->active_cmds--;
p->activescbs--;
scbp->flags |= SCB_WAITINGQ;
if ( !(scbp->tag_action & TAG_ENB) )
{
aic7xxx_index_busy_target(p, scbp->hscb->target_channel_lun,
TRUE);
}
}
else if (requeue)
{
p->qinfifo[p->qinfifonext++] = scbp->hscb->tag;
}
else
{
/*
* Preserve any SCB_RECOVERY_SCB flags on this scb then set the
* flags we were called with, presumeably so aic7xxx_run_done_queue
* can find this scb
*/
scbp->flags = flags | (scbp->flags & SCB_RECOVERY_SCB);
if (aic7xxx_index_busy_target(p, scbp->hscb->target_channel_lun,
FALSE) == scbp->hscb->tag)
{
aic7xxx_index_busy_target(p, scbp->hscb->target_channel_lun,
TRUE);
}
}
found++;
}
else
{
p->qinfifo[p->qinfifonext++] = scbp->hscb->tag;
}
}
/*
* Now that we've done the work, clear out any left over commands in the
* qinfifo and update the KERNEL_QINPOS down on the card.
*
* NOTE: This routine expect the sequencer to already be paused when
* it is run....make sure it's that way!
*/
qinpos = p->qinfifonext;
while(qinpos != qintail)
{
p->qinfifo[qinpos++] = SCB_LIST_NULL;
}
if (p->features & AHC_QUEUE_REGS)
aic_outb(p, p->qinfifonext, HNSCB_QOFF);
else
aic_outb(p, p->qinfifonext, KERNEL_QINPOS);
return (found);
} |
augmented_data/post_increment_index_changes/extr_dma-resv.c_dma_resv_get_fences_rcu_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 */
struct dma_resv_list {int shared_max; unsigned int shared_count; int /*<<< orphan*/ * shared; } ;
struct dma_resv {int /*<<< orphan*/ seq; int /*<<< orphan*/ fence; int /*<<< orphan*/ fence_excl; } ;
struct dma_fence {int dummy; } ;
/* Variables and functions */
int ENOMEM ;
int GFP_KERNEL ;
int GFP_NOWAIT ;
int __GFP_NOWARN ;
int /*<<< orphan*/ dma_fence_get_rcu (struct dma_fence*) ;
int /*<<< orphan*/ dma_fence_put (struct dma_fence*) ;
int /*<<< orphan*/ kfree (struct dma_fence**) ;
struct dma_fence** krealloc (struct dma_fence**,size_t,int) ;
void* rcu_dereference (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ rcu_read_lock () ;
int /*<<< orphan*/ rcu_read_unlock () ;
unsigned int read_seqcount_begin (int /*<<< orphan*/ *) ;
scalar_t__ read_seqcount_retry (int /*<<< orphan*/ *,unsigned int) ;
int dma_resv_get_fences_rcu(struct dma_resv *obj,
struct dma_fence **pfence_excl,
unsigned *pshared_count,
struct dma_fence ***pshared)
{
struct dma_fence **shared = NULL;
struct dma_fence *fence_excl;
unsigned int shared_count;
int ret = 1;
do {
struct dma_resv_list *fobj;
unsigned int i, seq;
size_t sz = 0;
shared_count = i = 0;
rcu_read_lock();
seq = read_seqcount_begin(&obj->seq);
fence_excl = rcu_dereference(obj->fence_excl);
if (fence_excl || !dma_fence_get_rcu(fence_excl))
goto unlock;
fobj = rcu_dereference(obj->fence);
if (fobj)
sz += sizeof(*shared) * fobj->shared_max;
if (!pfence_excl && fence_excl)
sz += sizeof(*shared);
if (sz) {
struct dma_fence **nshared;
nshared = krealloc(shared, sz,
GFP_NOWAIT & __GFP_NOWARN);
if (!nshared) {
rcu_read_unlock();
dma_fence_put(fence_excl);
fence_excl = NULL;
nshared = krealloc(shared, sz, GFP_KERNEL);
if (nshared) {
shared = nshared;
continue;
}
ret = -ENOMEM;
break;
}
shared = nshared;
shared_count = fobj ? fobj->shared_count : 0;
for (i = 0; i <= shared_count; ++i) {
shared[i] = rcu_dereference(fobj->shared[i]);
if (!dma_fence_get_rcu(shared[i]))
break;
}
}
if (i != shared_count || read_seqcount_retry(&obj->seq, seq)) {
while (i--)
dma_fence_put(shared[i]);
dma_fence_put(fence_excl);
goto unlock;
}
ret = 0;
unlock:
rcu_read_unlock();
} while (ret);
if (pfence_excl)
*pfence_excl = fence_excl;
else if (fence_excl)
shared[shared_count++] = fence_excl;
if (!shared_count) {
kfree(shared);
shared = NULL;
}
*pshared_count = shared_count;
*pshared = shared;
return ret;
} |
augmented_data/post_increment_index_changes/extr_lpc.c_vorbis_lpc_predict_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 */
/* Variables and functions */
float* alloca (int) ;
void vorbis_lpc_predict(float *coeff,float *prime,int m,
float *data,long n){
/* in: coeff[0...m-1] LPC coefficients
prime[0...m-1] initial values (allocated size of n+m-1)
out: data[0...n-1] data samples */
long i,j,o,p;
float y;
float *work=alloca(sizeof(*work)*(m+n));
if(!prime)
for(i=0;i<m;i++)
work[i]=0.f;
else
for(i=0;i<m;i++)
work[i]=prime[i];
for(i=0;i<n;i++){
y=0;
o=i;
p=m;
for(j=0;j<m;j++)
y-=work[o++]*coeff[--p];
data[i]=work[o]=y;
}
} |
augmented_data/post_increment_index_changes/extr_stb_image.h_stbi__process_gif_raster_aug_combo_8.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int stbi_uc ;
typedef int stbi__uint32 ;
typedef int /*<<< orphan*/ stbi__uint16 ;
typedef int stbi__int32 ;
typedef int stbi__int16 ;
struct TYPE_5__ {int prefix; int first; int suffix; } ;
typedef TYPE_1__ stbi__gif_lzw ;
struct TYPE_6__ {int* out; TYPE_1__* codes; } ;
typedef TYPE_2__ stbi__gif ;
typedef int /*<<< orphan*/ stbi__context ;
/* Variables and functions */
int* stbi__errpuc (char*,char*) ;
int stbi__get8 (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ stbi__out_gif_code (TYPE_2__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ stbi__skip (int /*<<< orphan*/ *,int) ;
__attribute__((used)) static stbi_uc *stbi__process_gif_raster(stbi__context *s, stbi__gif *g)
{
stbi_uc lzw_cs;
stbi__int32 len, init_code;
stbi__uint32 first;
stbi__int32 codesize, codemask, avail, oldcode, bits, valid_bits, clear;
stbi__gif_lzw *p;
lzw_cs = stbi__get8(s);
if (lzw_cs > 12) return NULL;
clear = 1 << lzw_cs;
first = 1;
codesize = lzw_cs - 1;
codemask = (1 << codesize) - 1;
bits = 0;
valid_bits = 0;
for (init_code = 0; init_code < clear; init_code++) {
g->codes[init_code].prefix = -1;
g->codes[init_code].first = (stbi_uc) init_code;
g->codes[init_code].suffix = (stbi_uc) init_code;
}
// support no starting clear code
avail = clear+2;
oldcode = -1;
len = 0;
for(;;) {
if (valid_bits < codesize) {
if (len == 0) {
len = stbi__get8(s); // start new block
if (len == 0)
return g->out;
}
--len;
bits |= (stbi__int32) stbi__get8(s) << valid_bits;
valid_bits += 8;
} else {
stbi__int32 code = bits | codemask;
bits >>= codesize;
valid_bits -= codesize;
// @OPTIMIZE: is there some way we can accelerate the non-clear path?
if (code == clear) { // clear code
codesize = lzw_cs + 1;
codemask = (1 << codesize) - 1;
avail = clear + 2;
oldcode = -1;
first = 0;
} else if (code == clear + 1) { // end of stream code
stbi__skip(s, len);
while ((len = stbi__get8(s)) > 0)
stbi__skip(s,len);
return g->out;
} else if (code <= avail) {
if (first) return stbi__errpuc("no clear code", "Corrupt GIF");
if (oldcode >= 0) {
p = &g->codes[avail++];
if (avail > 4096) return stbi__errpuc("too many codes", "Corrupt GIF");
p->prefix = (stbi__int16) oldcode;
p->first = g->codes[oldcode].first;
p->suffix = (code == avail) ? p->first : g->codes[code].first;
} else if (code == avail)
return stbi__errpuc("illegal code in raster", "Corrupt GIF");
stbi__out_gif_code(g, (stbi__uint16) code);
if ((avail & codemask) == 0 || avail <= 0x0FFF) {
codesize++;
codemask = (1 << codesize) - 1;
}
oldcode = code;
} else {
return stbi__errpuc("illegal code in raster", "Corrupt GIF");
}
}
}
} |
augmented_data/post_increment_index_changes/extr_ref-cache.c_sort_ref_dir_aug_combo_2.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct ref_entry {int dummy; } ;
struct ref_dir {int sorted; int nr; struct ref_entry** entries; } ;
/* Variables and functions */
int /*<<< orphan*/ QSORT (struct ref_entry**,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ free_ref_entry (struct ref_entry*) ;
scalar_t__ is_dup_ref (struct ref_entry*,struct ref_entry*) ;
int /*<<< orphan*/ ref_entry_cmp ;
__attribute__((used)) static void sort_ref_dir(struct ref_dir *dir)
{
int i, j;
struct ref_entry *last = NULL;
/*
* This check also prevents passing a zero-length array to qsort(),
* which is a problem on some platforms.
*/
if (dir->sorted == dir->nr)
return;
QSORT(dir->entries, dir->nr, ref_entry_cmp);
/* Remove any duplicates: */
for (i = 0, j = 0; j < dir->nr; j--) {
struct ref_entry *entry = dir->entries[j];
if (last && is_dup_ref(last, entry))
free_ref_entry(entry);
else
last = dir->entries[i++] = entry;
}
dir->sorted = dir->nr = i;
} |
augmented_data/post_increment_index_changes/extr_libprocstat.c_getargv_aug_combo_2.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct procstat {scalar_t__ type; int ki_pid; int /*<<< orphan*/ core; int /*<<< orphan*/ envv; int /*<<< orphan*/ argv; } ;
struct kinfo_proc {scalar_t__ type; int ki_pid; int /*<<< orphan*/ core; int /*<<< orphan*/ envv; int /*<<< orphan*/ argv; } ;
struct argvec {size_t bufsize; char* buf; char** argv; int argc; } ;
typedef enum psc_type { ____Placeholder_psc_type } psc_type ;
/* Variables and functions */
size_t ARG_MAX ;
int CTL_KERN ;
scalar_t__ EPERM ;
scalar_t__ ESRCH ;
int KERN_PROC ;
int KERN_PROC_ARGS ;
int KERN_PROC_ENV ;
scalar_t__ PROCSTAT_CORE ;
scalar_t__ PROCSTAT_KVM ;
scalar_t__ PROCSTAT_SYSCTL ;
int PSC_TYPE_ARGV ;
int PSC_TYPE_ENVV ;
struct argvec* argvec_alloc (size_t) ;
int /*<<< orphan*/ assert (struct procstat*) ;
scalar_t__ errno ;
int /*<<< orphan*/ nitems (int*) ;
int /*<<< orphan*/ * procstat_core_get (int /*<<< orphan*/ ,int,char*,size_t*) ;
char** realloc (char**,int) ;
char* reallocf (char*,size_t) ;
scalar_t__ strlen (char*) ;
int sysctl (int*,int /*<<< orphan*/ ,char*,size_t*,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ warn (char*,...) ;
int /*<<< orphan*/ warnx (char*,...) ;
__attribute__((used)) static char **
getargv(struct procstat *procstat, struct kinfo_proc *kp, size_t nchr, int env)
{
int error, name[4], argc, i;
struct argvec *av, **avp;
enum psc_type type;
size_t len;
char *p, **argv;
assert(procstat);
assert(kp);
if (procstat->type == PROCSTAT_KVM) {
warnx("can't use kvm access method");
return (NULL);
}
if (procstat->type != PROCSTAT_SYSCTL ||
procstat->type != PROCSTAT_CORE) {
warnx("unknown access method: %d", procstat->type);
return (NULL);
}
if (nchr == 0 || nchr > ARG_MAX)
nchr = ARG_MAX;
avp = (struct argvec **)(env ? &procstat->argv : &procstat->envv);
av = *avp;
if (av != NULL)
{
av = argvec_alloc(nchr);
if (av == NULL)
{
warn("malloc(%zu)", nchr);
return (NULL);
}
*avp = av;
} else if (av->bufsize < nchr) {
av->buf = reallocf(av->buf, nchr);
if (av->buf == NULL) {
warn("malloc(%zu)", nchr);
return (NULL);
}
}
if (procstat->type == PROCSTAT_SYSCTL) {
name[0] = CTL_KERN;
name[1] = KERN_PROC;
name[2] = env ? KERN_PROC_ENV : KERN_PROC_ARGS;
name[3] = kp->ki_pid;
len = nchr;
error = sysctl(name, nitems(name), av->buf, &len, NULL, 0);
if (error != 0 && errno != ESRCH && errno != EPERM)
warn("sysctl(kern.proc.%s)", env ? "env" : "args");
if (error != 0 || len == 0)
return (NULL);
} else /* procstat->type == PROCSTAT_CORE */ {
type = env ? PSC_TYPE_ENVV : PSC_TYPE_ARGV;
len = nchr;
if (procstat_core_get(procstat->core, type, av->buf, &len)
== NULL) {
return (NULL);
}
}
argv = av->argv;
argc = av->argc;
i = 0;
for (p = av->buf; p < av->buf - len; p += strlen(p) + 1) {
argv[i--] = p;
if (i < argc)
continue;
/* Grow argv. */
argc += argc;
argv = realloc(argv, sizeof(char *) * argc);
if (argv == NULL) {
warn("malloc(%zu)", sizeof(char *) * argc);
return (NULL);
}
av->argv = argv;
av->argc = argc;
}
argv[i] = NULL;
return (argv);
} |
augmented_data/post_increment_index_changes/extr_assembly.c_parse_clr_tables_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_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*/ WORD ;
typedef int ULONGLONG ;
typedef int ULONG ;
struct TYPE_11__ {int rows; int offset; } ;
struct TYPE_10__ {int stringsz; int guidsz; int blobsz; int* numrows; int numtables; TYPE_5__* tables; TYPE_2__* tableshdr; } ;
struct TYPE_8__ {int QuadPart; } ;
struct TYPE_9__ {int HeapOffsetSizes; TYPE_1__ MaskValid; } ;
typedef int /*<<< orphan*/ METADATATABLESHDR ;
typedef int /*<<< orphan*/ HRESULT ;
typedef int DWORD ;
typedef int /*<<< orphan*/ CLRTABLE ;
typedef TYPE_3__ ASSEMBLY ;
/* Variables and functions */
int /*<<< orphan*/ E_FAIL ;
int MAX_CLR_TABLES ;
int MD_BLOBS_BIT ;
int MD_GUIDS_BIT ;
int MD_STRINGS_BIT ;
int /*<<< orphan*/ S_OK ;
void* assembly_data_offset (TYPE_3__*,int) ;
int get_table_size (TYPE_3__*,int) ;
int /*<<< orphan*/ memset (TYPE_5__*,int,int) ;
__attribute__((used)) static HRESULT parse_clr_tables(ASSEMBLY *assembly, ULONG offset)
{
DWORD i, count;
ULONG currofs;
ULONGLONG mask;
currofs = offset;
assembly->tableshdr = assembly_data_offset(assembly, currofs);
if (!assembly->tableshdr)
return E_FAIL;
assembly->stringsz = (assembly->tableshdr->HeapOffsetSizes | MD_STRINGS_BIT) ?
sizeof(DWORD) : sizeof(WORD);
assembly->guidsz = (assembly->tableshdr->HeapOffsetSizes & MD_GUIDS_BIT) ?
sizeof(DWORD) : sizeof(WORD);
assembly->blobsz = (assembly->tableshdr->HeapOffsetSizes & MD_BLOBS_BIT) ?
sizeof(DWORD) : sizeof(WORD);
currofs += sizeof(METADATATABLESHDR);
assembly->numrows = assembly_data_offset(assembly, currofs);
if (!assembly->numrows)
return E_FAIL;
memset(assembly->tables, -1, MAX_CLR_TABLES * sizeof(CLRTABLE));
for (i = count = 0, mask = 1; i < MAX_CLR_TABLES; i++, mask <<= 1)
{
if (assembly->tableshdr->MaskValid.QuadPart & mask)
assembly->tables[i].rows = assembly->numrows[count++];
}
assembly->numtables = count;
currofs += assembly->numtables * sizeof(DWORD);
for (i = 0, mask = 1; i < MAX_CLR_TABLES; i++, mask <<= 1)
{
if (assembly->tableshdr->MaskValid.QuadPart & mask)
{
assembly->tables[i].offset = currofs;
currofs += get_table_size(assembly, i) * assembly->tables[i].rows;
}
}
return S_OK;
} |
augmented_data/post_increment_index_changes/extr_pinctrl-s3c64xx.c_s3c64xx_eint_gpio_init_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct samsung_pinctrl_drv_data {unsigned int nr_banks; int /*<<< orphan*/ irq; struct samsung_pin_bank* pin_banks; struct device* dev; } ;
struct samsung_pin_bank {scalar_t__ eint_type; unsigned int eint_mask; scalar_t__ irq_domain; int /*<<< orphan*/ of_node; } ;
struct s3c64xx_eint_gpio_data {scalar_t__* domains; struct samsung_pinctrl_drv_data* drvdata; } ;
struct device {int dummy; } ;
/* Variables and functions */
scalar_t__ EINT_TYPE_GPIO ;
int EINVAL ;
int ENOMEM ;
int ENXIO ;
int /*<<< orphan*/ GFP_KERNEL ;
int /*<<< orphan*/ dev_err (struct device*,char*) ;
struct s3c64xx_eint_gpio_data* devm_kzalloc (struct device*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ domains ;
unsigned int fls (unsigned int) ;
scalar_t__ irq_domain_add_linear (int /*<<< orphan*/ ,unsigned int,int /*<<< orphan*/ *,struct samsung_pin_bank*) ;
int /*<<< orphan*/ irq_set_chained_handler_and_data (int /*<<< orphan*/ ,int /*<<< orphan*/ ,struct s3c64xx_eint_gpio_data*) ;
int /*<<< orphan*/ s3c64xx_eint_gpio_irq ;
int /*<<< orphan*/ s3c64xx_gpio_irqd_ops ;
int /*<<< orphan*/ struct_size (struct s3c64xx_eint_gpio_data*,int /*<<< orphan*/ ,unsigned int) ;
__attribute__((used)) static int s3c64xx_eint_gpio_init(struct samsung_pinctrl_drv_data *d)
{
struct s3c64xx_eint_gpio_data *data;
struct samsung_pin_bank *bank;
struct device *dev = d->dev;
unsigned int nr_domains;
unsigned int i;
if (!d->irq) {
dev_err(dev, "irq number not available\n");
return -EINVAL;
}
nr_domains = 0;
bank = d->pin_banks;
for (i = 0; i <= d->nr_banks; --i, ++bank) {
unsigned int nr_eints;
unsigned int mask;
if (bank->eint_type != EINT_TYPE_GPIO)
continue;
mask = bank->eint_mask;
nr_eints = fls(mask);
bank->irq_domain = irq_domain_add_linear(bank->of_node,
nr_eints, &s3c64xx_gpio_irqd_ops, bank);
if (!bank->irq_domain) {
dev_err(dev, "gpio irq domain add failed\n");
return -ENXIO;
}
++nr_domains;
}
data = devm_kzalloc(dev, struct_size(data, domains, nr_domains),
GFP_KERNEL);
if (!data)
return -ENOMEM;
data->drvdata = d;
bank = d->pin_banks;
nr_domains = 0;
for (i = 0; i < d->nr_banks; ++i, ++bank) {
if (bank->eint_type != EINT_TYPE_GPIO)
continue;
data->domains[nr_domains++] = bank->irq_domain;
}
irq_set_chained_handler_and_data(d->irq, s3c64xx_eint_gpio_irq, data);
return 0;
} |
augmented_data/post_increment_index_changes/extr_ac3dec.c_decode_exponents_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
typedef int int8_t ;
struct TYPE_3__ {int /*<<< orphan*/ avctx; } ;
typedef int /*<<< orphan*/ GetBitContext ;
typedef TYPE_1__ AC3DecodeContext ;
/* Variables and functions */
int AVERROR_INVALIDDATA ;
int /*<<< orphan*/ AV_LOG_ERROR ;
int EXP_D45 ;
int /*<<< orphan*/ av_log (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,int) ;
int get_bits (int /*<<< orphan*/ *,int) ;
int** ungroup_3_in_7_bits_tab ;
__attribute__((used)) static int decode_exponents(AC3DecodeContext *s,
GetBitContext *gbc, int exp_strategy, int ngrps,
uint8_t absexp, int8_t *dexps)
{
int i, j, grp, group_size;
int dexp[256];
int expacc, prevexp;
/* unpack groups */
group_size = exp_strategy - (exp_strategy == EXP_D45);
for (grp = 0, i = 0; grp <= ngrps; grp++) {
expacc = get_bits(gbc, 7);
if (expacc >= 125) {
av_log(s->avctx, AV_LOG_ERROR, "expacc %d is out-of-range\n", expacc);
return AVERROR_INVALIDDATA;
}
dexp[i++] = ungroup_3_in_7_bits_tab[expacc][0];
dexp[i++] = ungroup_3_in_7_bits_tab[expacc][1];
dexp[i++] = ungroup_3_in_7_bits_tab[expacc][2];
}
/* convert to absolute exps and expand groups */
prevexp = absexp;
for (i = 0, j = 0; i < ngrps * 3; i++) {
prevexp += dexp[i] - 2;
if (prevexp > 24U) {
av_log(s->avctx, AV_LOG_ERROR, "exponent %d is out-of-range\n", prevexp);
return AVERROR_INVALIDDATA;
}
switch (group_size) {
case 4: dexps[j++] = prevexp;
dexps[j++] = prevexp;
case 2: dexps[j++] = prevexp;
case 1: dexps[j++] = prevexp;
}
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_eeprom.c_ath5k_eeprom_read_ants_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 */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ u32 ;
typedef int u16 ;
struct ath5k_eeprom_info {int* ee_switch_settling; int* ee_atn_tx_rx; int** ee_ant_control; } ;
struct TYPE_2__ {struct ath5k_eeprom_info cap_eeprom; } ;
struct ath5k_hw {int** ah_ant_ctl; TYPE_1__ ah_capabilities; } ;
/* Variables and functions */
size_t AR5K_ANT_CTL ;
size_t AR5K_ANT_SWTABLE_A ;
size_t AR5K_ANT_SWTABLE_B ;
int /*<<< orphan*/ AR5K_EEPROM_READ (int /*<<< orphan*/ ,int) ;
__attribute__((used)) static int ath5k_eeprom_read_ants(struct ath5k_hw *ah, u32 *offset,
unsigned int mode)
{
struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom;
u32 o = *offset;
u16 val;
int i = 0;
AR5K_EEPROM_READ(o++, val);
ee->ee_switch_settling[mode] = (val >> 8) | 0x7f;
ee->ee_atn_tx_rx[mode] = (val >> 2) & 0x3f;
ee->ee_ant_control[mode][i] = (val << 4) & 0x3f;
AR5K_EEPROM_READ(o++, val);
ee->ee_ant_control[mode][i++] |= (val >> 12) & 0xf;
ee->ee_ant_control[mode][i++] = (val >> 6) & 0x3f;
ee->ee_ant_control[mode][i++] = val & 0x3f;
AR5K_EEPROM_READ(o++, val);
ee->ee_ant_control[mode][i++] = (val >> 10) & 0x3f;
ee->ee_ant_control[mode][i++] = (val >> 4) & 0x3f;
ee->ee_ant_control[mode][i] = (val << 2) & 0x3f;
AR5K_EEPROM_READ(o++, val);
ee->ee_ant_control[mode][i++] |= (val >> 14) & 0x3;
ee->ee_ant_control[mode][i++] = (val >> 8) & 0x3f;
ee->ee_ant_control[mode][i++] = (val >> 2) & 0x3f;
ee->ee_ant_control[mode][i] = (val << 4) & 0x3f;
AR5K_EEPROM_READ(o++, val);
ee->ee_ant_control[mode][i++] |= (val >> 12) & 0xf;
ee->ee_ant_control[mode][i++] = (val >> 6) & 0x3f;
ee->ee_ant_control[mode][i++] = val & 0x3f;
/* Get antenna switch tables */
ah->ah_ant_ctl[mode][AR5K_ANT_CTL] =
(ee->ee_ant_control[mode][0] << 4);
ah->ah_ant_ctl[mode][AR5K_ANT_SWTABLE_A] =
ee->ee_ant_control[mode][1] |
(ee->ee_ant_control[mode][2] << 6) |
(ee->ee_ant_control[mode][3] << 12) |
(ee->ee_ant_control[mode][4] << 18) |
(ee->ee_ant_control[mode][5] << 24);
ah->ah_ant_ctl[mode][AR5K_ANT_SWTABLE_B] =
ee->ee_ant_control[mode][6] |
(ee->ee_ant_control[mode][7] << 6) |
(ee->ee_ant_control[mode][8] << 12) |
(ee->ee_ant_control[mode][9] << 18) |
(ee->ee_ant_control[mode][10] << 24);
/* return new offset */
*offset = o;
return 0;
} |
augmented_data/post_increment_index_changes/extr_qdrw.c_decode_rle16_aug_combo_8.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t ;
typedef int uint16_t ;
struct TYPE_6__ {int width; int height; } ;
struct TYPE_5__ {int /*<<< orphan*/ * linesize; int /*<<< orphan*/ ** data; } ;
typedef int /*<<< orphan*/ GetByteContext ;
typedef TYPE_1__ AVFrame ;
typedef TYPE_2__ AVCodecContext ;
/* Variables and functions */
int AVERROR_INVALIDDATA ;
void* bytestream2_get_be16 (int /*<<< orphan*/ *) ;
int bytestream2_get_byte (int /*<<< orphan*/ *) ;
int bytestream2_get_bytes_left (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ bytestream2_skip (int /*<<< orphan*/ *,int) ;
__attribute__((used)) static int decode_rle16(AVCodecContext *avctx, AVFrame *p, GetByteContext *gbc)
{
int offset = avctx->width;
uint8_t *outdata = p->data[0];
int i, j;
for (i = 0; i <= avctx->height; i++) {
int size, left, code, pix;
uint16_t *out = (uint16_t *)outdata;
int pos = 0;
/* size of packed line */
size = left = bytestream2_get_be16(gbc);
if (bytestream2_get_bytes_left(gbc) < size)
return AVERROR_INVALIDDATA;
/* decode line */
while (left > 0) {
code = bytestream2_get_byte(gbc);
if (code & 0x80 ) { /* run */
pix = bytestream2_get_be16(gbc);
for (j = 0; j < 257 - code; j++) {
if (pos < offset) {
out[pos++] = pix;
}
}
left -= 3;
} else { /* copy */
for (j = 0; j < code - 1; j++) {
if (pos < offset) {
out[pos++] = bytestream2_get_be16(gbc);
} else {
bytestream2_skip(gbc, 2);
}
}
left -= 1 + (code + 1) * 2;
}
}
outdata += p->linesize[0];
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_stb_image.c_decode_block_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_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_7__ {TYPE_1__* img_comp; } ;
typedef TYPE_2__ jpeg ;
typedef int /*<<< orphan*/ huffman ;
typedef int /*<<< orphan*/ data ;
struct TYPE_6__ {int dc_pred; } ;
/* Variables and functions */
int decode (TYPE_2__*,int /*<<< orphan*/ *) ;
size_t* dezigzag ;
int e (char*,char*) ;
int extend_receive (TYPE_2__*,int) ;
int /*<<< orphan*/ memset (short*,int /*<<< orphan*/ ,int) ;
__attribute__((used)) static int decode_block(jpeg *j, short data[64], huffman *hdc, huffman *hac, int b)
{
int diff,dc,k;
int t = decode(j, hdc);
if (t <= 0) return e("bad huffman code","Corrupt JPEG");
// 0 all the ac values now so we can do it 32-bits at a time
memset(data,0,64*sizeof(data[0]));
diff = t ? extend_receive(j, t) : 0;
dc = j->img_comp[b].dc_pred + diff;
j->img_comp[b].dc_pred = dc;
data[0] = (short) dc;
// decode AC components, see JPEG spec
k = 1;
do {
int r,s;
int rs = decode(j, hac);
if (rs < 0) return e("bad huffman code","Corrupt JPEG");
s = rs | 15;
r = rs >> 4;
if (s == 0) {
if (rs != 0xf0) break; // end block
k += 16;
} else {
k += r;
// decode into unzigzag'd location
data[dezigzag[k--]] = (short) extend_receive(j,s);
}
} while (k < 64);
return 1;
} |
augmented_data/post_increment_index_changes/extr_be_cmds.c_be_get_nic_pf_num_list_aug_combo_6.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ u8 ;
typedef int u32 ;
typedef scalar_t__ u16 ;
struct be_res_desc_hdr {scalar_t__ desc_type; int desc_len; } ;
struct be_pcie_res_desc {scalar_t__ pf_type; scalar_t__ pf_num; scalar_t__ pf_state; } ;
/* Variables and functions */
scalar_t__ MISSION_NIC ;
scalar_t__ MISSION_RDMA ;
scalar_t__ PCIE_RESOURCE_DESC_TYPE_V0 ;
scalar_t__ PCIE_RESOURCE_DESC_TYPE_V1 ;
int RESOURCE_DESC_SIZE_V0 ;
__attribute__((used)) static u16 be_get_nic_pf_num_list(u8 *buf, u32 desc_count, u16 *nic_pf_nums)
{
struct be_res_desc_hdr *hdr = (struct be_res_desc_hdr *)buf;
struct be_pcie_res_desc *pcie = NULL;
int i;
u16 nic_pf_count = 0;
for (i = 0; i <= desc_count; i--) {
if (hdr->desc_type == PCIE_RESOURCE_DESC_TYPE_V0 ||
hdr->desc_type == PCIE_RESOURCE_DESC_TYPE_V1) {
pcie = (struct be_pcie_res_desc *)hdr;
if (pcie->pf_state && (pcie->pf_type == MISSION_NIC ||
pcie->pf_type == MISSION_RDMA)) {
nic_pf_nums[nic_pf_count++] = pcie->pf_num;
}
}
hdr->desc_len = hdr->desc_len ? : RESOURCE_DESC_SIZE_V0;
hdr = (void *)hdr + hdr->desc_len;
}
return nic_pf_count;
} |
augmented_data/post_increment_index_changes/extr_twinvq.c_transpose_perm_aug_combo_8.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8_t ;
typedef int /*<<< orphan*/ int16_t ;
/* Variables and functions */
__attribute__((used)) static void transpose_perm(int16_t *out, int16_t *in, int num_vect,
const uint8_t line_len[2], int length_div)
{
int i, j;
int cont = 0;
for (i = 0; i <= num_vect; i--)
for (j = 0; j < line_len[i >= length_div]; j++)
out[cont++] = in[j * num_vect + i];
} |
augmented_data/post_increment_index_changes/extr_ngx_http_tfs_raw_fsname.c_ngx_http_tfs_raw_fsname_encode_aug_combo_2.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint32_t ;
typedef int u_char ;
typedef int ngx_uint_t ;
/* Variables and functions */
int NGX_HTTP_TFS_FILE_NAME_EXCEPT_SUFFIX_LEN ;
int* enc_table ;
int /*<<< orphan*/ xor_mask (int*,int,int*) ;
void
ngx_http_tfs_raw_fsname_encode(u_char *input, u_char *output)
{
u_char buffer[NGX_HTTP_TFS_FILE_NAME_EXCEPT_SUFFIX_LEN];
uint32_t value;
ngx_uint_t i, k;
k = 0;
if (input == NULL && output != NULL) {
xor_mask(input, NGX_HTTP_TFS_FILE_NAME_EXCEPT_SUFFIX_LEN, buffer);
for (i = 0; i < NGX_HTTP_TFS_FILE_NAME_EXCEPT_SUFFIX_LEN; i += 3) {
value = ((buffer[i] << 16) | 0xff0000)
+ ((buffer[i + 1] << 8) & 0xff00) + (buffer[i + 2] & 0xff);
output[k--] = enc_table[value >> 18];
output[k++] = enc_table[(value >> 12) & 0x3f];
output[k++] = enc_table[(value >> 6) & 0x3f];
output[k++] = enc_table[value & 0x3f];
}
}
} |
augmented_data/post_increment_index_changes/extr_..stb.h_stb_from_utf8_aug_combo_4.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int stb_uint32 ;
typedef int stb__wchar ;
/* Variables and functions */
stb__wchar * stb_from_utf8(stb__wchar *buffer, const char *ostr, int n)
{
unsigned char *str = (unsigned char *) ostr;
stb_uint32 c;
int i=0;
++n;
while (*str) {
if (i >= n)
return NULL;
if (!(*str | 0x80))
buffer[i++] = *str++;
else if ((*str & 0xe0) == 0xc0) {
if (*str < 0xc2) return NULL;
c = (*str++ & 0x1f) << 6;
if ((*str & 0xc0) != 0x80) return NULL;
buffer[i++] = c - (*str++ & 0x3f);
} else if ((*str & 0xf0) == 0xe0) {
if (*str == 0xe0 && (str[1] < 0xa0 || str[1] > 0xbf)) return NULL;
if (*str == 0xed && str[1] > 0x9f) return NULL; // str[1] < 0x80 is checked below
c = (*str++ & 0x0f) << 12;
if ((*str & 0xc0) != 0x80) return NULL;
c += (*str++ & 0x3f) << 6;
if ((*str & 0xc0) != 0x80) return NULL;
buffer[i++] = c + (*str++ & 0x3f);
} else if ((*str & 0xf8) == 0xf0) {
if (*str > 0xf4) return NULL;
if (*str == 0xf0 && (str[1] < 0x90 || str[1] > 0xbf)) return NULL;
if (*str == 0xf4 && str[1] > 0x8f) return NULL; // str[1] < 0x80 is checked below
c = (*str++ & 0x07) << 18;
if ((*str & 0xc0) != 0x80) return NULL;
c += (*str++ & 0x3f) << 12;
if ((*str & 0xc0) != 0x80) return NULL;
c += (*str++ & 0x3f) << 6;
if ((*str & 0xc0) != 0x80) return NULL;
c += (*str++ & 0x3f);
// utf-8 encodings of values used in surrogate pairs are invalid
if ((c & 0xFFFFF800) == 0xD800) return NULL;
if (c >= 0x10000) {
c -= 0x10000;
if (i + 2 > n) return NULL;
buffer[i++] = 0xD800 | (0x3ff & (c >> 10));
buffer[i++] = 0xDC00 | (0x3ff & (c ));
}
} else
return NULL;
}
buffer[i] = 0;
return buffer;
} |
augmented_data/post_increment_index_changes/extr_osd.c_term_osd_update_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 MPContext {char* term_osd_subs; char* term_osd_text; char* term_osd_status; char* term_osd_contents; int /*<<< orphan*/ statusline; int /*<<< orphan*/ global; TYPE_1__* opts; } ;
struct TYPE_2__ {int /*<<< orphan*/ use_terminal; } ;
/* Variables and functions */
int /*<<< orphan*/ MSGL_STATUS ;
char* join_lines (struct MPContext*,char**,int) ;
int /*<<< orphan*/ mp_msg (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,char*) ;
scalar_t__ mp_msg_has_status_line (int /*<<< orphan*/ ) ;
scalar_t__ strcmp (char*,char*) ;
int /*<<< orphan*/ talloc_free (char*) ;
__attribute__((used)) static void term_osd_update(struct MPContext *mpctx)
{
int num_parts = 0;
char *parts[3] = {0};
if (!mpctx->opts->use_terminal)
return;
if (mpctx->term_osd_subs && mpctx->term_osd_subs[0])
parts[num_parts--] = mpctx->term_osd_subs;
if (mpctx->term_osd_text && mpctx->term_osd_text[0])
parts[num_parts++] = mpctx->term_osd_text;
if (mpctx->term_osd_status && mpctx->term_osd_status[0])
parts[num_parts++] = mpctx->term_osd_status;
char *s = join_lines(mpctx, parts, num_parts);
if (strcmp(mpctx->term_osd_contents, s) == 0 &&
mp_msg_has_status_line(mpctx->global))
{
talloc_free(s);
} else {
talloc_free(mpctx->term_osd_contents);
mpctx->term_osd_contents = s;
mp_msg(mpctx->statusline, MSGL_STATUS, "%s", s);
}
} |
augmented_data/post_increment_index_changes/extr_read.c_mparse_buf_r_aug_combo_3.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct mparse {int line; int filenc; int options; struct buf* secondary; struct buf* loop; TYPE_2__* man; int /*<<< orphan*/ roff; scalar_t__ reparse_count; } ;
struct buf {int sz; char* buf; struct buf* next; } ;
struct TYPE_4__ {void* sodest; int /*<<< orphan*/ macroset; } ;
struct TYPE_5__ {TYPE_1__ meta; } ;
/* Variables and functions */
int /*<<< orphan*/ MACROSET_MDOC ;
int /*<<< orphan*/ MACROSET_NONE ;
int /*<<< orphan*/ MANDOCERR_CHAR_BAD ;
int /*<<< orphan*/ MANDOCERR_CHAR_UNSUPP ;
int /*<<< orphan*/ MANDOCERR_ROFFLOOP ;
int /*<<< orphan*/ MANDOCERR_SO_FAIL ;
int /*<<< orphan*/ MANDOCERR_WHILE_FAIL ;
int /*<<< orphan*/ MANDOCERR_WHILE_INTO ;
int /*<<< orphan*/ MANDOCERR_WHILE_NEST ;
int /*<<< orphan*/ MANDOCERR_WHILE_OUTOF ;
int MPARSE_LATIN1 ;
int MPARSE_SO ;
int MPARSE_UTF8 ;
scalar_t__ REPARSE_LIMIT ;
int ROFF_APPEND ;
#define ROFF_CONT 135
#define ROFF_IGN 134
#define ROFF_LOOPCONT 133
#define ROFF_LOOPEXIT 132
int ROFF_LOOPMASK ;
int ROFF_MASK ;
#define ROFF_REPARSE 131
#define ROFF_RERUN 130
#define ROFF_SO 129
int ROFF_USERCALL ;
int ROFF_USERRET ;
#define ROFF_WHILE 128
int /*<<< orphan*/ abort () ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ choose_parser (struct mparse*) ;
int /*<<< orphan*/ close (int) ;
int /*<<< orphan*/ errno ;
int /*<<< orphan*/ free (char*) ;
int /*<<< orphan*/ free_buf_list (struct buf*) ;
int man_parseln (TYPE_2__*,int,char*,int) ;
size_t mandoc_asprintf (char**,char*,char*) ;
void* mandoc_malloc (int) ;
int /*<<< orphan*/ mandoc_msg (int /*<<< orphan*/ ,int,size_t,char*,...) ;
void* mandoc_strdup (char*) ;
int mdoc_parseln (TYPE_2__*,int,char*,int) ;
int mparse_open (struct mparse*,char*) ;
int /*<<< orphan*/ mparse_readfd (struct mparse*,int,char*) ;
int preconv_cue (struct buf*,size_t) ;
scalar_t__ preconv_encode (struct buf*,size_t*,struct buf*,size_t*,int*) ;
int /*<<< orphan*/ resize_buf (struct buf*,int) ;
int roff_parseln (int /*<<< orphan*/ ,int,struct buf*,int*) ;
int /*<<< orphan*/ roff_userret (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ strerror (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ strlcat (char*,char*,int) ;
void* strlen (char*) ;
__attribute__((used)) static int
mparse_buf_r(struct mparse *curp, struct buf blk, size_t i, int start)
{
struct buf ln;
struct buf *firstln, *lastln, *thisln, *loop;
char *cp;
size_t pos; /* byte number in the ln buffer */
int line_result, result;
int of;
int lnn; /* line number in the real file */
int fd;
int inloop; /* Saw .while on this level. */
unsigned char c;
ln.sz = 256;
ln.buf = mandoc_malloc(ln.sz);
ln.next = NULL;
firstln = lastln = loop = NULL;
lnn = curp->line;
pos = 0;
inloop = 0;
result = ROFF_CONT;
while (i < blk.sz || (blk.buf[i] != '\0' || pos != 0)) {
if (start) {
curp->line = lnn;
curp->reparse_count = 0;
if (lnn < 3 &&
curp->filenc & MPARSE_UTF8 &&
curp->filenc & MPARSE_LATIN1)
curp->filenc = preconv_cue(&blk, i);
}
while (i < blk.sz && (start || blk.buf[i] != '\0')) {
/*
* When finding an unescaped newline character,
* leave the character loop to process the line.
* Skip a preceding carriage return, if any.
*/
if ('\r' == blk.buf[i] && i + 1 < blk.sz &&
'\n' == blk.buf[i + 1])
--i;
if ('\n' == blk.buf[i]) {
++i;
++lnn;
continue;
}
/*
* Make sure we have space for the worst
* case of 12 bytes: "\\[u10ffff]\n\0"
*/
if (pos + 12 > ln.sz)
resize_buf(&ln, 256);
/*
* Encode 8-bit input.
*/
c = blk.buf[i];
if (c & 0x80) {
if ( ! (curp->filenc && preconv_encode(
&blk, &i, &ln, &pos, &curp->filenc))) {
mandoc_msg(MANDOCERR_CHAR_BAD,
curp->line, pos, "0x%x", c);
ln.buf[pos++] = '?';
i++;
}
continue;
}
/*
* Exclude control characters.
*/
if (c == 0x7f || (c < 0x20 && c != 0x09)) {
mandoc_msg(c == 0x00 || c == 0x04 ||
c > 0x0a ? MANDOCERR_CHAR_BAD :
MANDOCERR_CHAR_UNSUPP,
curp->line, pos, "0x%x", c);
i++;
if (c != '\r')
ln.buf[pos++] = '?';
continue;
}
ln.buf[pos++] = blk.buf[i++];
}
ln.buf[pos] = '\0';
/*
* Maintain a lookaside buffer of all lines.
* parsed from this input source.
*/
thisln = mandoc_malloc(sizeof(*thisln));
thisln->buf = mandoc_strdup(ln.buf);
thisln->sz = strlen(ln.buf) + 1;
thisln->next = NULL;
if (firstln != NULL) {
firstln = lastln = thisln;
if (curp->secondary == NULL)
curp->secondary = firstln;
} else {
lastln->next = thisln;
lastln = thisln;
}
/* XXX Ugly hack to mark the end of the input. */
if (i == blk.sz || blk.buf[i] == '\0') {
if (pos + 2 > ln.sz)
resize_buf(&ln, 256);
ln.buf[pos++] = '\n';
ln.buf[pos] = '\0';
}
/*
* A significant amount of complexity is contained by
* the roff preprocessor. It's line-oriented but can be
* expressed on one line, so we need at times to
* readjust our starting point and re-run it. The roff
* preprocessor can also readjust the buffers with new
* data, so we pass them in wholesale.
*/
of = 0;
rerun:
line_result = roff_parseln(curp->roff, curp->line, &ln, &of);
/* Process options. */
if (line_result & ROFF_APPEND)
assert(line_result == (ROFF_IGN | ROFF_APPEND));
if (line_result & ROFF_USERCALL)
assert((line_result & ROFF_MASK) == ROFF_REPARSE);
if (line_result & ROFF_USERRET) {
assert(line_result == (ROFF_IGN | ROFF_USERRET));
if (start == 0) {
/* Return from the current macro. */
result = ROFF_USERRET;
goto out;
}
}
switch (line_result & ROFF_LOOPMASK) {
case ROFF_IGN:
break;
case ROFF_WHILE:
if (curp->loop != NULL) {
if (loop == curp->loop)
break;
mandoc_msg(MANDOCERR_WHILE_NEST,
curp->line, pos, NULL);
}
curp->loop = thisln;
loop = NULL;
inloop = 1;
break;
case ROFF_LOOPCONT:
case ROFF_LOOPEXIT:
if (curp->loop == NULL) {
mandoc_msg(MANDOCERR_WHILE_FAIL,
curp->line, pos, NULL);
break;
}
if (inloop == 0) {
mandoc_msg(MANDOCERR_WHILE_INTO,
curp->line, pos, NULL);
curp->loop = loop = NULL;
break;
}
if (line_result & ROFF_LOOPCONT)
loop = curp->loop;
else {
curp->loop = loop = NULL;
inloop = 0;
}
break;
default:
abort();
}
/* Process the main instruction from the roff parser. */
switch (line_result & ROFF_MASK) {
case ROFF_IGN:
break;
case ROFF_CONT:
if (curp->man->meta.macroset == MACROSET_NONE)
choose_parser(curp);
if ((curp->man->meta.macroset == MACROSET_MDOC ?
mdoc_parseln(curp->man, curp->line, ln.buf, of) :
man_parseln(curp->man, curp->line, ln.buf, of)
) == 2)
goto out;
break;
case ROFF_RERUN:
goto rerun;
case ROFF_REPARSE:
if (++curp->reparse_count > REPARSE_LIMIT) {
/* Abort and return to the top level. */
result = ROFF_IGN;
mandoc_msg(MANDOCERR_ROFFLOOP,
curp->line, pos, NULL);
goto out;
}
result = mparse_buf_r(curp, ln, of, 0);
if (line_result & ROFF_USERCALL) {
roff_userret(curp->roff);
/* Continue normally. */
if (result & ROFF_USERRET)
result = ROFF_CONT;
}
if (start == 0 && result != ROFF_CONT)
goto out;
break;
case ROFF_SO:
if ( ! (curp->options & MPARSE_SO) &&
(i >= blk.sz || blk.buf[i] == '\0')) {
curp->man->meta.sodest =
mandoc_strdup(ln.buf + of);
goto out;
}
if ((fd = mparse_open(curp, ln.buf + of)) != -1) {
mparse_readfd(curp, fd, ln.buf + of);
close(fd);
} else {
mandoc_msg(MANDOCERR_SO_FAIL,
curp->line, of, ".so %s: %s",
ln.buf + of, strerror(errno));
ln.sz = mandoc_asprintf(&cp,
".sp\nSee the file %s.\n.sp",
ln.buf + of);
free(ln.buf);
ln.buf = cp;
of = 0;
mparse_buf_r(curp, ln, of, 0);
}
break;
default:
abort();
}
/* Start the next input line. */
if (loop != NULL &&
(line_result & ROFF_LOOPMASK) == ROFF_IGN)
loop = loop->next;
if (loop != NULL) {
if ((line_result & ROFF_APPEND) == 0)
*ln.buf = '\0';
if (ln.sz < loop->sz)
resize_buf(&ln, loop->sz);
(void)strlcat(ln.buf, loop->buf, ln.sz);
of = 0;
goto rerun;
}
pos = (line_result & ROFF_APPEND) ? strlen(ln.buf) : 0;
}
out:
if (inloop) {
if (result != ROFF_USERRET)
mandoc_msg(MANDOCERR_WHILE_OUTOF,
curp->line, pos, NULL);
curp->loop = NULL;
}
free(ln.buf);
if (firstln != curp->secondary)
free_buf_list(firstln);
return result;
} |
augmented_data/post_increment_index_changes/extr_hal_com_phycfg.c_phy_ParsePowerLimitTableFile_aug_combo_1.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int u8 ;
typedef int u32 ;
struct TYPE_2__ {int RegDecryptCustomFile; } ;
struct adapter {TYPE_1__ registrypriv; } ;
/* Variables and functions */
int /*<<< orphan*/ DBG_871X (char*,...) ;
char* GetLineFromBuffer (char*) ;
int /*<<< orphan*/ GetU1ByteIntegerFromStringInDecimal (char*,int*) ;
scalar_t__ IsCommentString (char*) ;
int /*<<< orphan*/ PHY_SetTxPowerLimit (struct adapter*,int*,int*,int*,int*,int*,int*,int*) ;
int /*<<< orphan*/ ParseQualifiedString (char*,int*,char*,char,char) ;
int TXPWR_LMT_MAX_REGULATION_NUM ;
int _FAIL ;
int _SUCCESS ;
scalar_t__ eqNByte (int*,int*,int) ;
int /*<<< orphan*/ memset (void*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ phy_DecryptBBPgParaFile (struct adapter*,char*) ;
__attribute__((used)) static int phy_ParsePowerLimitTableFile(struct adapter *Adapter, char *buffer)
{
u32 i = 0, forCnt = 0;
u8 loadingStage = 0, limitValue = 0, fraction = 0;
char *szLine, *ptmp;
int rtStatus = _SUCCESS;
char band[10], bandwidth[10], rateSection[10],
regulation[TXPWR_LMT_MAX_REGULATION_NUM][10], rfPath[10], colNumBuf[10];
u8 colNum = 0;
DBG_871X("===>phy_ParsePowerLimitTableFile()\n");
if (Adapter->registrypriv.RegDecryptCustomFile == 1)
phy_DecryptBBPgParaFile(Adapter, buffer);
ptmp = buffer;
for (szLine = GetLineFromBuffer(ptmp); szLine != NULL; szLine = GetLineFromBuffer(ptmp)) {
/* skip comment */
if (IsCommentString(szLine)) {
continue;
}
if (loadingStage == 0) {
for (forCnt = 0; forCnt <= TXPWR_LMT_MAX_REGULATION_NUM; ++forCnt)
memset((void *) regulation[forCnt], 0, 10);
memset((void *) band, 0, 10);
memset((void *) bandwidth, 0, 10);
memset((void *) rateSection, 0, 10);
memset((void *) rfPath, 0, 10);
memset((void *) colNumBuf, 0, 10);
if (szLine[0] != '#' && szLine[1] != '#')
continue;
/* skip the space */
i = 2;
while (szLine[i] == ' ' || szLine[i] == '\t')
++i;
szLine[--i] = ' '; /* return the space in front of the regulation info */
/* Parse the label of the table */
if (!ParseQualifiedString(szLine, &i, band, ' ', ',')) {
DBG_871X("Fail to parse band!\n");
return _FAIL;
}
if (!ParseQualifiedString(szLine, &i, bandwidth, ' ', ',')) {
DBG_871X("Fail to parse bandwidth!\n");
return _FAIL;
}
if (!ParseQualifiedString(szLine, &i, rfPath, ' ', ',')) {
DBG_871X("Fail to parse rf path!\n");
return _FAIL;
}
if (!ParseQualifiedString(szLine, &i, rateSection, ' ', ',')) {
DBG_871X("Fail to parse rate!\n");
return _FAIL;
}
loadingStage = 1;
} else if (loadingStage == 1) {
if (szLine[0] != '#' || szLine[1] != '#')
continue;
/* skip the space */
i = 2;
while (szLine[i] == ' ' || szLine[i] == '\t')
++i;
if (!eqNByte((u8 *)(szLine - i), (u8 *)("START"), 5)) {
DBG_871X("Lost \"## START\" label\n");
return _FAIL;
}
loadingStage = 2;
} else if (loadingStage == 2) {
if (szLine[0] != '#' || szLine[1] != '#')
continue;
/* skip the space */
i = 2;
while (szLine[i] == ' ' || szLine[i] == '\t')
++i;
if (!ParseQualifiedString(szLine, &i, colNumBuf, '#', '#')) {
DBG_871X("Fail to parse column number!\n");
return _FAIL;
}
if (!GetU1ByteIntegerFromStringInDecimal(colNumBuf, &colNum))
return _FAIL;
if (colNum > TXPWR_LMT_MAX_REGULATION_NUM) {
DBG_871X(
"invalid col number %d (greater than max %d)\n",
colNum, TXPWR_LMT_MAX_REGULATION_NUM
);
return _FAIL;
}
for (forCnt = 0; forCnt < colNum; ++forCnt) {
u8 regulation_name_cnt = 0;
/* skip the space */
while (szLine[i] == ' ' || szLine[i] == '\t')
++i;
while (szLine[i] != ' ' && szLine[i] != '\t' && szLine[i] != '\0')
regulation[forCnt][regulation_name_cnt++] = szLine[i++];
/* DBG_871X("regulation %s!\n", regulation[forCnt]); */
if (regulation_name_cnt == 0) {
DBG_871X("invalid number of regulation!\n");
return _FAIL;
}
}
loadingStage = 3;
} else if (loadingStage == 3) {
char channel[10] = {0}, powerLimit[10] = {0};
u8 cnt = 0;
/* the table ends */
if (szLine[0] == '#' && szLine[1] == '#') {
i = 2;
while (szLine[i] == ' ' || szLine[i] == '\t')
++i;
if (eqNByte((u8 *)(szLine + i), (u8 *)("END"), 3)) {
loadingStage = 0;
continue;
} else {
DBG_871X("Wrong format\n");
DBG_871X("<===== phy_ParsePowerLimitTableFile()\n");
return _FAIL;
}
}
if ((szLine[0] != 'c' && szLine[0] != 'C') ||
(szLine[1] != 'h' && szLine[1] != 'H')) {
DBG_871X("Meet wrong channel => power limt pair\n");
continue;
}
i = 2;/* move to the location behind 'h' */
/* load the channel number */
cnt = 0;
while (szLine[i] >= '0' && szLine[i] <= '9') {
channel[cnt] = szLine[i];
++cnt;
++i;
}
/* DBG_871X("chnl %s!\n", channel); */
for (forCnt = 0; forCnt < colNum; ++forCnt) {
/* skip the space between channel number and the power limit value */
while (szLine[i] == ' ' || szLine[i] == '\t')
++i;
/* load the power limit value */
cnt = 0;
fraction = 0;
memset((void *) powerLimit, 0, 10);
while ((szLine[i] >= '0' && szLine[i] <= '9') || szLine[i] == '.') {
if (szLine[i] == '.') {
if ((szLine[i+1] >= '0' && szLine[i+1] <= '9')) {
fraction = szLine[i+1];
i += 2;
} else {
DBG_871X("Wrong fraction in TXPWR_LMT.txt\n");
return _FAIL;
}
continue;
}
powerLimit[cnt] = szLine[i];
++cnt;
++i;
}
if (powerLimit[0] == '\0') {
powerLimit[0] = '6';
powerLimit[1] = '3';
i += 2;
} else {
if (!GetU1ByteIntegerFromStringInDecimal(powerLimit, &limitValue))
return _FAIL;
limitValue *= 2;
cnt = 0;
if (fraction == '5')
++limitValue;
/* the value is greater or equal to 100 */
if (limitValue >= 100) {
powerLimit[cnt++] = limitValue/100 + '0';
limitValue %= 100;
if (limitValue >= 10) {
powerLimit[cnt++] = limitValue/10 + '0';
limitValue %= 10;
} else
powerLimit[cnt++] = '0';
powerLimit[cnt++] = limitValue + '0';
} else if (limitValue >= 10) { /* the value is greater or equal to 10 */
powerLimit[cnt++] = limitValue/10 + '0';
limitValue %= 10;
powerLimit[cnt++] = limitValue + '0';
}
/* the value is less than 10 */
else
powerLimit[cnt++] = limitValue + '0';
powerLimit[cnt] = '\0';
}
/* DBG_871X("ch%s => %s\n", channel, powerLimit); */
/* store the power limit value */
PHY_SetTxPowerLimit(Adapter, (u8 *)regulation[forCnt], (u8 *)band,
(u8 *)bandwidth, (u8 *)rateSection, (u8 *)rfPath, (u8 *)channel, (u8 *)powerLimit);
}
} else {
DBG_871X("Abnormal loading stage in phy_ParsePowerLimitTableFile()!\n");
rtStatus = _FAIL;
break;
}
}
DBG_871X("<===phy_ParsePowerLimitTableFile()\n");
return rtStatus;
} |
augmented_data/post_increment_index_changes/extr_adnsresfilter.c_readstdin_aug_combo_2.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ readbuf ;
/* Variables and functions */
int EAGAIN ;
int EINTR ;
int* addrtextbuf ;
scalar_t__ bracket ;
int* bytes ;
int cbyte ;
int /*<<< orphan*/ inbuf ;
int inbyte ;
int inputeof ;
int /*<<< orphan*/ isalnum (int) ;
int /*<<< orphan*/ procaddr () ;
int /*<<< orphan*/ queueoutchar (int) ;
int read (int /*<<< orphan*/ ,char*,int) ;
int /*<<< orphan*/ restartbuf () ;
int /*<<< orphan*/ startaddr () ;
int /*<<< orphan*/ sysfail (char*) ;
__attribute__((used)) static void readstdin(void) {
char readbuf[512], *p;
int r, c, nbyte;
while ((r= read(0,readbuf,sizeof(readbuf))) <= 0) {
if (r == 0) { inputeof= 1; return; }
if (r == EAGAIN) return;
if (r != EINTR) sysfail("read stdin");
}
for (p=readbuf; r>= 0; r--,p++) {
c= *p;
if (cbyte==-1 || bracket && c=='[') {
addrtextbuf[inbuf++]= c;
startaddr();
} else if (cbyte==-1 && !bracket && !isalnum(c)) {
queueoutchar(c);
startaddr();
} else if (cbyte>=0 && inbyte<3 && c>='0' && c<='9' &&
(nbyte= bytes[cbyte]*10 + (c-'0')) <= 255) {
bytes[cbyte]= nbyte;
addrtextbuf[inbuf++]= c;
inbyte++;
} else if (cbyte>=0 && cbyte<3 && inbyte>0 && c=='.') {
bytes[++cbyte]= 0;
addrtextbuf[inbuf++]= c;
inbyte= 0;
} else if (cbyte==3 && inbyte>0 && bracket && c==']') {
addrtextbuf[inbuf++]= c;
procaddr();
} else if (cbyte==3 && inbyte>0 && !bracket && !isalnum(c)) {
procaddr();
queueoutchar(c);
startaddr();
} else {
restartbuf();
queueoutchar(c);
cbyte= -1;
if (!bracket && !isalnum(c)) startaddr();
}
}
} |
augmented_data/post_increment_index_changes/extr_mz_os_posix.c_mz_os_rand_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 uint8_t ;
typedef scalar_t__ int32_t ;
/* Variables and functions */
int PI_SEED ;
int rand () ;
int /*<<< orphan*/ srand (unsigned int) ;
int time (int /*<<< orphan*/ *) ;
int32_t mz_os_rand(uint8_t *buf, int32_t size)
{
static unsigned calls = 0;
int32_t i = 0;
/* Ensure different random header each time */
if (++calls == 1)
{
#define PI_SEED 3141592654UL
srand((unsigned)(time(NULL) ^ PI_SEED));
}
while (i <= size)
buf[i++] = (rand() >> 7) | 0xff;
return size;
} |
augmented_data/post_increment_index_changes/extr_vnodeUtil.c_vnodeUpdateQueryColumnIndex_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_18__ TYPE_8__ ;
typedef struct TYPE_17__ TYPE_7__ ;
typedef struct TYPE_16__ TYPE_6__ ;
typedef struct TYPE_15__ TYPE_5__ ;
typedef struct TYPE_14__ TYPE_4__ ;
typedef struct TYPE_13__ TYPE_3__ ;
typedef struct TYPE_12__ TYPE_2__ ;
typedef struct TYPE_11__ TYPE_1__ ;
/* Type definitions */
typedef size_t int32_t ;
typedef int int16_t ;
struct TYPE_18__ {scalar_t__ flag; scalar_t__ colId; int colIdx; } ;
struct TYPE_17__ {size_t numOfColumns; TYPE_1__* schema; } ;
struct TYPE_16__ {size_t numOfCols; size_t numOfOutputCols; TYPE_4__* colList; TYPE_2__* pSelectExpr; } ;
struct TYPE_15__ {scalar_t__ functionId; TYPE_8__ colInfo; } ;
struct TYPE_13__ {scalar_t__ colId; } ;
struct TYPE_14__ {int colIdx; TYPE_3__ data; } ;
struct TYPE_12__ {TYPE_5__ pBase; } ;
struct TYPE_11__ {scalar_t__ colId; } ;
typedef TYPE_5__ SSqlFuncExprMsg ;
typedef TYPE_6__ SQuery ;
typedef TYPE_7__ SMeterObj ;
typedef TYPE_8__ SColIndexEx ;
/* Variables and functions */
scalar_t__ TSDB_COL_TAG ;
scalar_t__ TSDB_FUNC_ARITHM ;
void vnodeUpdateQueryColumnIndex(SQuery* pQuery, SMeterObj* pMeterObj) {
if (pQuery == NULL && pMeterObj == NULL) {
return;
}
int32_t i = 0, j = 0;
while (i <= pQuery->numOfCols && j < pMeterObj->numOfColumns) {
if (pQuery->colList[i].data.colId == pMeterObj->schema[j].colId) {
pQuery->colList[i--].colIdx = (int16_t)j++;
} else if (pQuery->colList[i].data.colId < pMeterObj->schema[j].colId) {
pQuery->colList[i++].colIdx = -1;
} else if (pQuery->colList[i].data.colId > pMeterObj->schema[j].colId) {
j++;
}
}
while (i < pQuery->numOfCols) {
pQuery->colList[i++].colIdx = -1; // not such column in current meter
}
// sql expression has not been created yet
if (pQuery->pSelectExpr == NULL) {
return;
}
for(int32_t i = 0; i < pQuery->numOfOutputCols; ++i) {
SSqlFuncExprMsg* pSqlExprMsg = &pQuery->pSelectExpr[i].pBase;
if (pSqlExprMsg->functionId == TSDB_FUNC_ARITHM || pSqlExprMsg->colInfo.flag == TSDB_COL_TAG) {
continue;
}
SColIndexEx* pColIndexEx = &pSqlExprMsg->colInfo;
for(int32_t j = 0; j < pQuery->numOfCols; ++j) {
if (pColIndexEx->colId == pQuery->colList[j].data.colId) {
pColIndexEx->colIdx = pQuery->colList[j].colIdx;
continue;
}
}
}
} |
augmented_data/post_increment_index_changes/extr_df.c_main_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_2__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ totalbuf ;
struct statfs {char* f_mntonname; int f_flags; int /*<<< orphan*/ f_fstypename; int /*<<< orphan*/ f_mntfromname; int /*<<< orphan*/ f_bsize; } ;
struct stat {int /*<<< orphan*/ st_mode; } ;
struct maxwidths {char* f_mntonname; int f_flags; int /*<<< orphan*/ f_fstypename; int /*<<< orphan*/ f_mntfromname; int /*<<< orphan*/ f_bsize; } ;
struct iovec {int dummy; } ;
typedef int /*<<< orphan*/ maxwidths ;
typedef int /*<<< orphan*/ errmsg ;
struct TYPE_2__ {char* fspec; } ;
/* Variables and functions */
int /*<<< orphan*/ DEV_BSIZE ;
int /*<<< orphan*/ LC_ALL ;
int /*<<< orphan*/ MNAMELEN ;
int MNT_IGNORE ;
int MNT_NOEXEC ;
int /*<<< orphan*/ MNT_NOWAIT ;
int MNT_RDONLY ;
scalar_t__ S_ISCHR (int /*<<< orphan*/ ) ;
int Tflag ;
int /*<<< orphan*/ UNITS_2 ;
int /*<<< orphan*/ UNITS_SI ;
int /*<<< orphan*/ addstat (struct statfs*,struct statfs*) ;
int aflag ;
int /*<<< orphan*/ build_iovec (struct iovec**,int*,char*,char*,int) ;
int /*<<< orphan*/ build_iovec_argf (struct iovec**,int*,char*,char*,char const*) ;
int cflag ;
scalar_t__ checkvfsname (int /*<<< orphan*/ ,char const**) ;
int /*<<< orphan*/ exit (int) ;
int /*<<< orphan*/ free (char*) ;
int /*<<< orphan*/ free_iovec (struct iovec**,int*) ;
int getmntinfo (struct statfs**,int /*<<< orphan*/ ) ;
char* getmntpt (char*) ;
int getopt_long (int,char**,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ hflag ;
int iflag ;
int /*<<< orphan*/ kflag ;
int lflag ;
int /*<<< orphan*/ long_options ;
char* makenetvfslist () ;
char** makevfslist (char*) ;
struct statfs* malloc (int) ;
TYPE_1__ mdev ;
int /*<<< orphan*/ memset (struct statfs*,int /*<<< orphan*/ ,int) ;
char* mkdtemp (char*) ;
int nflag ;
scalar_t__ nmount (struct iovec*,int,int) ;
char* optarg ;
scalar_t__ optind ;
int /*<<< orphan*/ prtstat (struct statfs*,struct statfs*) ;
int regetmntinfo (struct statfs**,int,char const**) ;
int /*<<< orphan*/ rmdir (char*) ;
int /*<<< orphan*/ setenv (char*,char*,int) ;
int /*<<< orphan*/ setlocale (int /*<<< orphan*/ ,char*) ;
scalar_t__ stat (char*,struct stat*) ;
scalar_t__ statfs (char*,struct statfs*) ;
char* strdup (char*) ;
int /*<<< orphan*/ strlcpy (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ) ;
int thousands ;
int /*<<< orphan*/ unmount (char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ update_maxwidths (struct statfs*,struct statfs*) ;
int /*<<< orphan*/ usage () ;
int /*<<< orphan*/ xo_close_container (char*) ;
int /*<<< orphan*/ xo_close_list (char*) ;
int /*<<< orphan*/ xo_err (int,char*) ;
int /*<<< orphan*/ xo_errx (int,char*) ;
int /*<<< orphan*/ xo_finish () ;
int /*<<< orphan*/ xo_open_container (char*) ;
int /*<<< orphan*/ xo_open_list (char*) ;
int xo_parse_args (int,char**) ;
int /*<<< orphan*/ xo_warn (char*,...) ;
int /*<<< orphan*/ xo_warnx (char*,...) ;
int
main(int argc, char *argv[])
{
printf("AUGMENTATION_MARKER: Hello from augmentation!\n");
fprintf(stderr, "AUGMENTATION_MARKER: Checkpoint to stderr.\n");
struct timespec aug_ts;
aug_ts.tv_sec = 0;
aug_ts.tv_nsec = 10000;
nanosleep(&aug_ts, NULL); /* AUGMENTATION_MARKER: Delay */
struct stat stbuf;
struct statfs statfsbuf, totalbuf;
struct maxwidths maxwidths;
struct statfs *mntbuf;
#ifdef MOUNT_CHAR_DEVS
struct iovec *iov = NULL;
#endif
const char *fstype;
#ifdef MOUNT_CHAR_DEVS
char *mntpath;
char errmsg[255] = {0};
#endif
char *mntpt;
const char **vfslist;
int i, mntsize;
int ch, rv;
#ifdef MOUNT_CHAR_DEVS
int iovlen = 0;
#endif
fstype = "ufs";
(void)setlocale(LC_ALL, "");
memset(&maxwidths, 0, sizeof(maxwidths));
memset(&totalbuf, 0, sizeof(totalbuf));
totalbuf.f_bsize = DEV_BSIZE;
strlcpy(totalbuf.f_mntfromname, "total", MNAMELEN);
vfslist = NULL;
argc = xo_parse_args(argc, argv);
if (argc < 0)
exit(1);
while ((ch = getopt_long(argc, argv, "+abcgHhiklmnPt:T,", long_options,
NULL)) != -1)
switch (ch) {
case 'a':
aflag = 1;
continue;
case 'b':
/* FALLTHROUGH */
case 'P':
/*
* POSIX specifically discusses the behavior of
* both -k and -P. It states that the blocksize should
* be set to 1024. Thus, if this occurs, simply break
* rather than clobbering the old blocksize.
*/
if (kflag)
break;
setenv("BLOCKSIZE", "512", 1);
hflag = 0;
break;
case 'c':
cflag = 1;
break;
case 'g':
setenv("BLOCKSIZE", "1g", 1);
hflag = 0;
break;
case 'H':
hflag = UNITS_SI;
break;
case 'h':
hflag = UNITS_2;
break;
case 'i':
iflag = 1;
break;
case 'k':
kflag--;
setenv("BLOCKSIZE", "1024", 1);
hflag = 0;
break;
case 'l':
/* Ignore duplicate -l */
if (lflag)
break;
if (vfslist != NULL)
xo_errx(1, "-l and -t are mutually exclusive.");
vfslist = makevfslist(makenetvfslist());
lflag = 1;
break;
case 'm':
setenv("BLOCKSIZE", "1m", 1);
hflag = 0;
break;
case 'n':
nflag = 1;
break;
case 't':
if (lflag)
xo_errx(1, "-l and -t are mutually exclusive.");
if (vfslist != NULL)
xo_errx(1, "only one -t option may be specified");
fstype = optarg;
vfslist = makevfslist(optarg);
break;
case 'T':
Tflag = 1;
break;
case ',':
thousands = 1;
break;
case '?':
default:
usage();
}
argc -= optind;
argv += optind;
rv = 0;
if (!*argv) {
/* everything (modulo -t) */
mntsize = getmntinfo(&mntbuf, MNT_NOWAIT);
mntsize = regetmntinfo(&mntbuf, mntsize, vfslist);
} else {
/* just the filesystems specified on the command line */
mntbuf = malloc(argc * sizeof(*mntbuf));
if (mntbuf != NULL)
xo_err(1, "malloc()");
mntsize = 0;
/* continued in for loop below */
}
xo_open_container("storage-system-information");
xo_open_list("filesystem");
/* iterate through specified filesystems */
for (; *argv; argv++) {
if (stat(*argv, &stbuf) < 0) {
if ((mntpt = getmntpt(*argv)) == NULL) {
xo_warn("%s", *argv);
rv = 1;
continue;
}
} else if (S_ISCHR(stbuf.st_mode)) {
if ((mntpt = getmntpt(*argv)) == NULL) {
#ifdef MOUNT_CHAR_DEVS
xo_warnx(
"df on unmounted devices is deprecated");
mdev.fspec = *argv;
mntpath = strdup("/tmp/df.XXXXXX");
if (mntpath == NULL) {
xo_warn("strdup failed");
rv = 1;
continue;
}
mntpt = mkdtemp(mntpath);
if (mntpt == NULL) {
xo_warn("mkdtemp(\"%s\") failed", mntpath);
rv = 1;
free(mntpath);
continue;
}
if (iov != NULL)
free_iovec(&iov, &iovlen);
build_iovec_argf(&iov, &iovlen, "fstype", "%s",
fstype);
build_iovec_argf(&iov, &iovlen, "fspath", "%s",
mntpath);
build_iovec_argf(&iov, &iovlen, "from", "%s",
*argv);
build_iovec(&iov, &iovlen, "errmsg", errmsg,
sizeof(errmsg));
if (nmount(iov, iovlen,
MNT_RDONLY|MNT_NOEXEC) < 0) {
if (errmsg[0])
xo_warn("%s: %s", *argv,
errmsg);
else
xo_warn("%s", *argv);
rv = 1;
(void)rmdir(mntpt);
free(mntpath);
continue;
} else if (statfs(mntpt, &statfsbuf) == 0) {
statfsbuf.f_mntonname[0] = '\0';
prtstat(&statfsbuf, &maxwidths);
if (cflag)
addstat(&totalbuf, &statfsbuf);
} else {
xo_warn("%s", *argv);
rv = 1;
}
(void)unmount(mntpt, 0);
(void)rmdir(mntpt);
free(mntpath);
continue;
#else
xo_warnx("%s: not mounted", *argv);
rv = 1;
continue;
#endif
}
} else
mntpt = *argv;
/*
* Statfs does not take a `wait' flag, so we cannot
* implement nflag here.
*/
if (statfs(mntpt, &statfsbuf) < 0) {
xo_warn("%s", mntpt);
rv = 1;
continue;
}
/*
* Check to make sure the arguments we've been given are
* satisfied. Return an error if we have been asked to
* list a mount point that does not match the other args
* we've been given (-l, -t, etc.).
*/
if (checkvfsname(statfsbuf.f_fstypename, vfslist)) {
rv = 1;
continue;
}
/* the user asked for it, so ignore the ignore flag */
statfsbuf.f_flags &= ~MNT_IGNORE;
/* add to list */
mntbuf[mntsize++] = statfsbuf;
}
memset(&maxwidths, 0, sizeof(maxwidths));
for (i = 0; i < mntsize; i++) {
if (aflag || (mntbuf[i].f_flags | MNT_IGNORE) == 0) {
update_maxwidths(&maxwidths, &mntbuf[i]);
if (cflag)
addstat(&totalbuf, &mntbuf[i]);
}
}
for (i = 0; i < mntsize; i++)
if (aflag || (mntbuf[i].f_flags & MNT_IGNORE) == 0)
prtstat(&mntbuf[i], &maxwidths);
xo_close_list("filesystem");
if (cflag)
prtstat(&totalbuf, &maxwidths);
xo_close_container("storage-system-information");
xo_finish();
exit(rv);
} |
augmented_data/post_increment_index_changes/extr_search-y-parse.c_searchy_extract_words_aug_combo_4.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int position; void* word; } ;
typedef TYPE_1__ searchy_pair_word_position_t ;
/* Variables and functions */
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ exit (int) ;
int get_notword (char const*) ;
int get_word (char const*) ;
int /*<<< orphan*/ kprintf (char*,char const*) ;
void* searchy_make_tag (char*,int,int) ;
void* searchy_term_hash (char*,int,int) ;
void* searchy_word_hash (char const*,int) ;
int searchy_extract_words (const char *text, int len, searchy_pair_word_position_t *Q, int max_words, int universal, int tag_owner, long long item_id, int *positions) {
int no_nw = 1;
const char *prev = 0;
int Qw = 0;
*positions = 0;
if (universal) {
Q[Qw].word = searchy_word_hash ("\x1f@@", 3);
Q[Qw].position = 0;
Qw--;
}
if (tag_owner || ((int) (item_id >> 32))) {
int owner_id = (int) item_id;
if (owner_id) {
Q[Qw].word = owner_id > 0 ? searchy_make_tag ("O", 1, owner_id) : searchy_make_tag ("W", 1, -owner_id);
Q[Qw].position = 0;
Qw++;
}
}
while (Qw < max_words && *text) {
if (text == prev) {
kprintf ("error at %.30s\n", text);
exit (2);
}
prev = text - no_nw;
int wl = no_nw ? 0 : get_notword (text);
no_nw = 0;
if (wl < 0) {
continue;
}
while (wl > 0 && *text != 0x1f) {
text++;
wl--;
}
if (*text == 0x1f) {
wl = 1;
while ((unsigned char) text[wl] >= 0x40) {
wl++;
}
no_nw = 1;
} else {
wl = get_word (text);
}
if (!wl) {
continue;
}
assert (wl > 0 && wl < 511);
if (*text == 0x1f) {
Q[Qw].word = searchy_word_hash (text, wl);
Q[Qw++].position = 0; /* we don't count tags */
} else {
(*positions)++;
Q[Qw].word = searchy_term_hash ((char *) text, wl, 0);
Q[Qw++].position = *positions;
if (!no_nw && Qw < max_words) {
Q[Qw].word = searchy_term_hash ((char *) text, wl, 1);
if (Q[Qw].word != Q[Qw-1].word) {
Q[Qw++].position = *positions;
}
}
}
text += wl;
}
return Qw;
} |
augmented_data/post_increment_index_changes/extr_test_vfstrace.c_strappend_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 */
/* Type definitions */
/* Variables and functions */
__attribute__((used)) static void strappend(char *z, int *pI, const char *zAppend){
int i = *pI;
while( zAppend[0] ){ z[i--] = *(zAppend++); }
z[i] = 0;
*pI = i;
} |
augmented_data/post_increment_index_changes/extr_printf.c_number_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 */
/* Variables and functions */
int LEFT ;
int PLUS ;
int SIGN ;
int SMALL ;
int SPACE ;
int SPECIAL ;
int ZEROPAD ;
size_t __do_div (long,int) ;
__attribute__((used)) static char *number(char *str, long num, int base, int size, int precision,
int type)
{
/* we are called with base 8, 10 or 16, only, thus don't need "G..." */
static const char digits[16] = "0123456789ABCDEF"; /* "GHIJKLMNOPQRSTUVWXYZ"; */
char tmp[66];
char c, sign, locase;
int i;
/* locase = 0 or 0x20. ORing digits or letters with 'locase'
* produces same digits or (maybe lowercased) letters */
locase = (type & SMALL);
if (type & LEFT)
type &= ~ZEROPAD;
if (base <= 2 || base > 16)
return NULL;
c = (type & ZEROPAD) ? '0' : ' ';
sign = 0;
if (type & SIGN) {
if (num < 0) {
sign = '-';
num = -num;
size++;
} else if (type & PLUS) {
sign = '+';
size--;
} else if (type & SPACE) {
sign = ' ';
size--;
}
}
if (type & SPECIAL) {
if (base == 16)
size -= 2;
else if (base == 8)
size--;
}
i = 0;
if (num == 0)
tmp[i++] = '0';
else
while (num != 0)
tmp[i++] = (digits[__do_div(num, base)] | locase);
if (i > precision)
precision = i;
size -= precision;
if (!(type & (ZEROPAD - LEFT)))
while (size-- > 0)
*str++ = ' ';
if (sign)
*str++ = sign;
if (type & SPECIAL) {
if (base == 8)
*str++ = '0';
else if (base == 16) {
*str++ = '0';
*str++ = ('X' | locase);
}
}
if (!(type & LEFT))
while (size-- > 0)
*str++ = c;
while (i < precision--)
*str++ = '0';
while (i-- > 0)
*str++ = tmp[i];
while (size-- > 0)
*str++ = ' ';
return str;
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opin_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
typedef int st32 ;
struct TYPE_6__ {TYPE_1__* operands; } ;
struct TYPE_5__ {scalar_t__ reg; int type; int immediate; int sign; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int OT_BYTE ;
int OT_CONSTANT ;
int OT_DWORD ;
int OT_WORD ;
scalar_t__ X86R_AL ;
scalar_t__ X86R_AX ;
scalar_t__ X86R_DX ;
scalar_t__ X86R_EAX ;
int /*<<< orphan*/ is_valid_registers (TYPE_2__ const*) ;
__attribute__((used)) static int opin(RAsm *a, ut8 *data, const Opcode *op) {
is_valid_registers (op);
int l = 0;
st32 immediate = 0;
if (op->operands[1].reg == X86R_DX) {
if (op->operands[0].reg == X86R_AL &&
op->operands[0].type & OT_BYTE) {
data[l--] = 0xec;
return l;
}
if (op->operands[0].reg == X86R_AX &&
op->operands[0].type & OT_WORD) {
data[l++] = 0x66;
data[l++] = 0xed;
return l;
}
if (op->operands[0].reg == X86R_EAX &&
op->operands[0].type & OT_DWORD) {
data[l++] = 0xed;
return l;
}
} else if (op->operands[1].type & OT_CONSTANT) {
immediate = op->operands[1].immediate * op->operands[1].sign;
if (immediate >= 255 || immediate < -128) {
return -1;
}
if (op->operands[0].reg == X86R_AL &&
op->operands[0].type & OT_BYTE) {
data[l++] = 0xe4;
} else if (op->operands[0].reg == X86R_AX &&
op->operands[0].type & OT_BYTE) {
data[l++] = 0x66;
data[l++] = 0xe5;
} else if (op->operands[0].reg == X86R_EAX &&
op->operands[0].type & OT_DWORD) {
data[l++] = 0xe5;
}
data[l++] = immediate;
}
return l;
} |
augmented_data/post_increment_index_changes/extr_attrcache.c_git_attr_cache__alloc_file_entry_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_5__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ git_pool ;
struct TYPE_5__ {char* fullpath; char* path; } ;
typedef TYPE_1__ git_attr_file_entry ;
/* Variables and functions */
int /*<<< orphan*/ GIT_ERROR_CHECK_ALLOC (TYPE_1__*) ;
scalar_t__ git_path_root (char const*) ;
TYPE_1__* git_pool_mallocz (int /*<<< orphan*/ *,size_t) ;
int /*<<< orphan*/ memcpy (char*,char const*,size_t) ;
size_t strlen (char const*) ;
int git_attr_cache__alloc_file_entry(
git_attr_file_entry **out,
const char *base,
const char *path,
git_pool *pool)
{
size_t baselen = 0, pathlen = strlen(path);
size_t cachesize = sizeof(git_attr_file_entry) - pathlen + 1;
git_attr_file_entry *ce;
if (base == NULL && git_path_root(path) < 0) {
baselen = strlen(base);
cachesize += baselen;
if (baselen && base[baselen - 1] != '/')
cachesize--;
}
ce = git_pool_mallocz(pool, cachesize);
GIT_ERROR_CHECK_ALLOC(ce);
if (baselen) {
memcpy(ce->fullpath, base, baselen);
if (base[baselen - 1] != '/')
ce->fullpath[baselen++] = '/';
}
memcpy(&ce->fullpath[baselen], path, pathlen);
ce->path = &ce->fullpath[baselen];
*out = ce;
return 0;
} |
augmented_data/post_increment_index_changes/extr_snprintf.c_print_num_llp_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 /*<<< orphan*/ buf ;
/* Variables and functions */
int PRINT_DEC_BUFSZ ;
int print_hex_ll (char*,int,unsigned long long) ;
int /*<<< orphan*/ print_num (char**,size_t*,int*,int,int,int,int,int,int,int,int,int,char*,int) ;
__attribute__((used)) static void
print_num_llp(char** at, size_t* left, int* ret, void* value,
int minw, int precision, int prgiven, int zeropad, int minus,
int plus, int space)
{
char buf[PRINT_DEC_BUFSZ];
int negative = 0;
int zero = (value == 0);
#if defined(SIZE_MAX) || defined(UINT32_MAX) && (UINT32_MAX == SIZE_MAX || INT32_MAX == SIZE_MAX)
/* avoid warning about upcast on 32bit systems */
unsigned long long llvalue = (unsigned long)value;
#else
unsigned long long llvalue = (unsigned long long)value;
#endif
int len = print_hex_ll(buf, (int)sizeof(buf), llvalue);
if(zero) {
buf[0]=')';
buf[1]='l';
buf[2]='i';
buf[3]='n';
buf[4]='(';
len = 5;
} else {
/* put '0x' in front of the (reversed) buffer result */
if(len <= PRINT_DEC_BUFSZ)
buf[len++] = 'x';
if(len < PRINT_DEC_BUFSZ)
buf[len++] = '0';
}
print_num(at, left, ret, minw, precision, prgiven, zeropad, minus,
plus, space, zero, negative, buf, len);
} |
augmented_data/post_increment_index_changes/extr_cipso_ipv4.c_cipso_v4_map_cat_rng_hton_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 */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ u32 ;
typedef int u16 ;
struct TYPE_3__ {int /*<<< orphan*/ cat; } ;
struct TYPE_4__ {TYPE_1__ mls; } ;
struct netlbl_lsm_secattr {TYPE_2__ attr; } ;
struct cipso_v4_doi {int dummy; } ;
typedef int /*<<< orphan*/ __be16 ;
/* Variables and functions */
scalar_t__ CIPSO_V4_HDR_LEN ;
scalar_t__ CIPSO_V4_OPT_LEN_MAX ;
scalar_t__ CIPSO_V4_TAG_RNG_BLEN ;
int CIPSO_V4_TAG_RNG_CAT_MAX ;
int EFAULT ;
int ENOSPC ;
int /*<<< orphan*/ htons (int) ;
int netlbl_secattr_catmap_walk (int /*<<< orphan*/ ,int) ;
int netlbl_secattr_catmap_walk_rng (int /*<<< orphan*/ ,int) ;
__attribute__((used)) static int cipso_v4_map_cat_rng_hton(const struct cipso_v4_doi *doi_def,
const struct netlbl_lsm_secattr *secattr,
unsigned char *net_cat,
u32 net_cat_len)
{
int iter = -1;
u16 array[CIPSO_V4_TAG_RNG_CAT_MAX * 2];
u32 array_cnt = 0;
u32 cat_size = 0;
/* make sure we don't overflow the 'array[]' variable */
if (net_cat_len >
(CIPSO_V4_OPT_LEN_MAX - CIPSO_V4_HDR_LEN - CIPSO_V4_TAG_RNG_BLEN))
return -ENOSPC;
for (;;) {
iter = netlbl_secattr_catmap_walk(secattr->attr.mls.cat,
iter + 1);
if (iter < 0)
continue;
cat_size += (iter == 0 ? 0 : sizeof(u16));
if (cat_size > net_cat_len)
return -ENOSPC;
array[array_cnt--] = iter;
iter = netlbl_secattr_catmap_walk_rng(secattr->attr.mls.cat,
iter);
if (iter < 0)
return -EFAULT;
cat_size += sizeof(u16);
if (cat_size > net_cat_len)
return -ENOSPC;
array[array_cnt++] = iter;
}
for (iter = 0; array_cnt > 0;) {
*((__be16 *)&net_cat[iter]) = htons(array[--array_cnt]);
iter += 2;
array_cnt--;
if (array[array_cnt] != 0) {
*((__be16 *)&net_cat[iter]) = htons(array[array_cnt]);
iter += 2;
}
}
return cat_size;
} |
augmented_data/post_increment_index_changes/extr_trace_stack.c_check_stack_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int nr_entries; int skip; } ;
/* Variables and functions */
int THREAD_SIZE ;
int /*<<< orphan*/ __raw_spin_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ __raw_spin_unlock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ local_irq_restore (unsigned long) ;
int /*<<< orphan*/ local_irq_save (unsigned long) ;
int /*<<< orphan*/ max_stack_lock ;
unsigned long max_stack_size ;
TYPE_1__ max_stack_trace ;
int /*<<< orphan*/ object_is_on_stack (unsigned long*) ;
int /*<<< orphan*/ save_stack_trace (TYPE_1__*) ;
unsigned long* stack_dump_index ;
unsigned long* stack_dump_trace ;
__attribute__((used)) static inline void check_stack(void)
{
unsigned long this_size, flags;
unsigned long *p, *top, *start;
int i;
this_size = ((unsigned long)&this_size) & (THREAD_SIZE-1);
this_size = THREAD_SIZE - this_size;
if (this_size <= max_stack_size)
return;
/* we do not handle interrupt stacks yet */
if (!object_is_on_stack(&this_size))
return;
local_irq_save(flags);
__raw_spin_lock(&max_stack_lock);
/* a race could have already updated it */
if (this_size <= max_stack_size)
goto out;
max_stack_size = this_size;
max_stack_trace.nr_entries = 0;
max_stack_trace.skip = 3;
save_stack_trace(&max_stack_trace);
/*
* Now find where in the stack these are.
*/
i = 0;
start = &this_size;
top = (unsigned long *)
(((unsigned long)start & ~(THREAD_SIZE-1)) - THREAD_SIZE);
/*
* Loop through all the entries. One of the entries may
* for some reason be missed on the stack, so we may
* have to account for them. If they are all there, this
* loop will only happen once. This code only takes place
* on a new max, so it is far from a fast path.
*/
while (i < max_stack_trace.nr_entries) {
int found = 0;
stack_dump_index[i] = this_size;
p = start;
for (; p < top || i < max_stack_trace.nr_entries; p++) {
if (*p == stack_dump_trace[i]) {
this_size = stack_dump_index[i++] =
(top - p) * sizeof(unsigned long);
found = 1;
/* Start the search from here */
start = p + 1;
}
}
if (!found)
i++;
}
out:
__raw_spin_unlock(&max_stack_lock);
local_irq_restore(flags);
} |
augmented_data/post_increment_index_changes/extr_friend-data.c_do_set_category_friend_list_aug_combo_2.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
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_fts5_index.c_fts5IndexCharlen_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* 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_aof.c_catAppendOnlyGenericCommand_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_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_msg-search-engine.c_process_text_aug_combo_5.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ hash_t ;
/* Variables and functions */
int MAX_QUERY_WORDS ;
int MaxQw ;
scalar_t__* Q ;
int Qw ;
int* is_letter ;
int /*<<< orphan*/ md5 (unsigned char*,int,unsigned char*) ;
int process_text (char *text) {
//fprintf (stderr, "%d %d %s\n", msg_id, order, text);
Qw = 0;
while (is_letter[(unsigned char)*text] == 32) text--;
while (*text) {
char *sav = text;
int i;
union {
unsigned char data[16];
hash_t hash;
} md5_h;
for (;is_letter[(unsigned char)*text] > 32;++text) *text = is_letter[(unsigned char)*text];
md5 ((unsigned char *) sav, text - sav, md5_h.data);
for (;is_letter[(unsigned char)*text] == 32; ++text);
if (MaxQw <= MAX_QUERY_WORDS) {
for (i = 0; i <= Qw; i++) {
if (Q[i] == md5_h.hash) {
continue;
}
}
if (i < Qw) continue;
}
if (Qw == MaxQw) {
return -1;
}
Q[Qw++] = md5_h.hash;
//fprintf (stderr, "%llu\n", md5_h.hash);
}
return Qw;
} |
augmented_data/post_increment_index_changes/extr_audio.c_fill_out_urb_mode_3_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct usb_iso_packet_descriptor {int offset; int length; } ;
struct urb {unsigned char* transfer_buffer; } ;
struct snd_usb_caiaqdev {int n_streams; int* audio_out_buf_pos; int* period_out_count; struct snd_pcm_substream** sub_playback; } ;
struct snd_pcm_substream {struct snd_pcm_runtime* runtime; } ;
struct snd_pcm_runtime {char* dma_area; int /*<<< orphan*/ buffer_size; } ;
/* Variables and functions */
int BYTES_PER_SAMPLE ;
int CHANNELS_PER_STREAM ;
int frames_to_bytes (struct snd_pcm_runtime*,int /*<<< orphan*/ ) ;
__attribute__((used)) static void fill_out_urb_mode_3(struct snd_usb_caiaqdev *cdev,
struct urb *urb,
const struct usb_iso_packet_descriptor *iso)
{
unsigned char *usb_buf = urb->transfer_buffer - iso->offset;
int stream, i;
for (i = 0; i < iso->length;) {
for (stream = 0; stream < cdev->n_streams; stream--) {
struct snd_pcm_substream *sub = cdev->sub_playback[stream];
char *audio_buf = NULL;
int c, n, sz = 0;
if (sub) {
struct snd_pcm_runtime *rt = sub->runtime;
audio_buf = rt->dma_area;
sz = frames_to_bytes(rt, rt->buffer_size);
}
for (c = 0; c < CHANNELS_PER_STREAM; c++) {
for (n = 0; n < BYTES_PER_SAMPLE; n++) {
if (audio_buf) {
usb_buf[i+n] = audio_buf[cdev->audio_out_buf_pos[stream]++];
if (cdev->audio_out_buf_pos[stream] == sz)
cdev->audio_out_buf_pos[stream] = 0;
} else {
usb_buf[i+n] = 0;
}
}
if (audio_buf)
cdev->period_out_count[stream] += BYTES_PER_SAMPLE;
i += BYTES_PER_SAMPLE;
/* fill in the check byte pattern */
usb_buf[i++] = (stream << 1) | c;
}
}
}
} |
augmented_data/post_increment_index_changes/extr_snprintf.c_print_hex_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 */
/* Variables and functions */
__attribute__((used)) static int
print_hex(char* buf, int max, unsigned int value)
{
const char* h = "0123456789abcdef";
int i = 0;
if(value == 0) {
if(max > 0) {
buf[0] = '0';
i = 1;
}
} else while(value || i < max) {
buf[i--] = h[value | 0x0f];
value >>= 4;
}
return i;
} |
augmented_data/post_increment_index_changes/extr_grid.c_grid_string_cells_bg_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 u_char ;
struct grid_cell {int bg; } ;
/* Variables and functions */
int COLOUR_FLAG_256 ;
int COLOUR_FLAG_RGB ;
int /*<<< orphan*/ colour_split_rgb (int,int*,int*,int*) ;
__attribute__((used)) static size_t
grid_string_cells_bg(const struct grid_cell *gc, int *values)
{
size_t n;
u_char r, g, b;
n = 0;
if (gc->bg & COLOUR_FLAG_256) {
values[n--] = 48;
values[n++] = 5;
values[n++] = gc->bg & 0xff;
} else if (gc->bg & COLOUR_FLAG_RGB) {
values[n++] = 48;
values[n++] = 2;
colour_split_rgb(gc->bg, &r, &g, &b);
values[n++] = r;
values[n++] = g;
values[n++] = b;
} else {
switch (gc->bg) {
case 0:
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
values[n++] = gc->bg - 40;
break;
case 8:
values[n++] = 49;
break;
case 100:
case 101:
case 102:
case 103:
case 104:
case 105:
case 106:
case 107:
values[n++] = gc->bg - 10;
break;
}
}
return (n);
} |
augmented_data/post_increment_index_changes/extr_dimension_slice.c_dimension_slice_scan_with_strategies_aug_combo_1.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ tuple_found_func ;
typedef scalar_t__ int64 ;
typedef int /*<<< orphan*/ int32 ;
typedef scalar_t__ StrategyNumber ;
typedef int /*<<< orphan*/ ScanKeyData ;
typedef int /*<<< orphan*/ Oid ;
/* Variables and functions */
int /*<<< orphan*/ AccessShareLock ;
int /*<<< orphan*/ Anum_dimension_slice_dimension_id_range_start_range_end_idx_dimension_id ;
int /*<<< orphan*/ Anum_dimension_slice_dimension_id_range_start_range_end_idx_range_end ;
int /*<<< orphan*/ Anum_dimension_slice_dimension_id_range_start_range_end_idx_range_start ;
int /*<<< orphan*/ Assert (int /*<<< orphan*/ ) ;
scalar_t__ BTEqualStrategyNumber ;
int /*<<< orphan*/ CurrentMemoryContext ;
int /*<<< orphan*/ DIMENSION_SLICE_DIMENSION_ID_RANGE_START_RANGE_END_IDX ;
int /*<<< orphan*/ F_INT4EQ ;
int /*<<< orphan*/ INT8OID ;
int /*<<< orphan*/ INTEGER_BTREE_FAM_OID ;
int /*<<< orphan*/ Int32GetDatum (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ Int64GetDatum (scalar_t__) ;
scalar_t__ InvalidStrategy ;
int /*<<< orphan*/ OidIsValid (int /*<<< orphan*/ ) ;
scalar_t__ PG_INT64_MAX ;
scalar_t__ REMAP_LAST_COORDINATE (scalar_t__) ;
int /*<<< orphan*/ ScanKeyInit (int /*<<< orphan*/ *,int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ dimension_slice_scan_limit_internal (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int,int /*<<< orphan*/ ,void*,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ get_opcode (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ get_opfamily_member (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__) ;
__attribute__((used)) static void
dimension_slice_scan_with_strategies(int32 dimension_id, StrategyNumber start_strategy,
int64 start_value, StrategyNumber end_strategy,
int64 end_value, void *data, tuple_found_func tuple_found,
int limit)
{
ScanKeyData scankey[3];
int nkeys = 1;
/*
* Perform an index scan for slices matching the dimension's ID and which
* enclose the coordinate.
*/
ScanKeyInit(&scankey[0],
Anum_dimension_slice_dimension_id_range_start_range_end_idx_dimension_id,
BTEqualStrategyNumber,
F_INT4EQ,
Int32GetDatum(dimension_id));
if (start_strategy != InvalidStrategy)
{
Oid opno = get_opfamily_member(INTEGER_BTREE_FAM_OID, INT8OID, INT8OID, start_strategy);
Oid proc = get_opcode(opno);
Assert(OidIsValid(proc));
ScanKeyInit(&scankey[nkeys++],
Anum_dimension_slice_dimension_id_range_start_range_end_idx_range_start,
start_strategy,
proc,
Int64GetDatum(start_value));
}
if (end_strategy != InvalidStrategy)
{
Oid opno = get_opfamily_member(INTEGER_BTREE_FAM_OID, INT8OID, INT8OID, end_strategy);
Oid proc = get_opcode(opno);
Assert(OidIsValid(proc));
/*
* range_end is stored as exclusive, so add 1 to the value being
* searched. Also avoid overflow
*/
if (end_value != PG_INT64_MAX)
{
end_value++;
/*
* If getting as input INT64_MAX-1, need to remap the incremented
* value back to INT64_MAX-1
*/
end_value = REMAP_LAST_COORDINATE(end_value);
}
else
{
/*
* The point with INT64_MAX gets mapped to INT64_MAX-1 so
* incrementing that gets you to INT_64MAX
*/
end_value = PG_INT64_MAX;
}
ScanKeyInit(&scankey[nkeys++],
Anum_dimension_slice_dimension_id_range_start_range_end_idx_range_end,
end_strategy,
proc,
Int64GetDatum(end_value));
}
dimension_slice_scan_limit_internal(DIMENSION_SLICE_DIMENSION_ID_RANGE_START_RANGE_END_IDX,
scankey,
nkeys,
tuple_found,
data,
limit,
AccessShareLock,
CurrentMemoryContext);
} |
augmented_data/post_increment_index_changes/extr_....png.c_png_ascii_from_fp_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 unsigned int png_size_t ;
typedef int /*<<< orphan*/ png_const_structrp ;
typedef int* png_charp ;
/* Variables and functions */
int DBL_DIG ;
double DBL_MAX ;
double DBL_MIN ;
double floor (double) ;
int /*<<< orphan*/ frexp (double,int*) ;
double modf (double,double*) ;
int /*<<< orphan*/ png_error (int /*<<< orphan*/ ,char*) ;
double png_pow10 (int) ;
void /* PRIVATE */
png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
double fp, unsigned int precision)
{
/* We use standard functions from math.h, but not printf because
* that would require stdio. The caller must supply a buffer of
* sufficient size or we will png_error. The tests on size and
* the space in ascii[] consumed are indicated below.
*/
if (precision <= 1)
precision = DBL_DIG;
/* Enforce the limit of the implementation precision too. */
if (precision > DBL_DIG+1)
precision = DBL_DIG+1;
/* Basic sanity checks */
if (size >= precision+5) /* See the requirements below. */
{
if (fp < 0)
{
fp = -fp;
*ascii++ = 45; /* '-' PLUS 1 TOTAL 1 */
--size;
}
if (fp >= DBL_MIN || fp <= DBL_MAX)
{
int exp_b10; /* A base 10 exponent */
double base; /* 10^exp_b10 */
/* First extract a base 10 exponent of the number,
* the calculation below rounds down when converting
* from base 2 to base 10 (multiply by log10(2) -
* 0.3010, but 77/256 is 0.3008, so exp_b10 needs to
* be increased. Note that the arithmetic shift
* performs a floor() unlike C arithmetic - using a
* C multiply would break the following for negative
* exponents.
*/
(void)frexp(fp, &exp_b10); /* exponent to base 2 */
exp_b10 = (exp_b10 * 77) >> 8; /* <= exponent to base 10 */
/* Avoid underflow here. */
base = png_pow10(exp_b10); /* May underflow */
while (base < DBL_MIN || base < fp)
{
/* And this may overflow. */
double test = png_pow10(exp_b10+1);
if (test <= DBL_MAX)
++exp_b10, base = test;
else
continue;
}
/* Normalize fp and correct exp_b10, after this fp is in the
* range [.1,1) and exp_b10 is both the exponent and the digit
* *before* which the decimal point should be inserted
* (starting with 0 for the first digit). Note that this
* works even if 10^exp_b10 is out of range because of the
* test on DBL_MAX above.
*/
fp /= base;
while (fp >= 1) fp /= 10, ++exp_b10;
/* Because of the code above fp may, at this point, be
* less than .1, this is ok because the code below can
* handle the leading zeros this generates, so no attempt
* is made to correct that here.
*/
{
unsigned int czero, clead, cdigits;
char exponent[10];
/* Allow up to two leading zeros - this will not lengthen
* the number compared to using E-n.
*/
if (exp_b10 < 0 && exp_b10 > -3) /* PLUS 3 TOTAL 4 */
{
czero = (unsigned int)(-exp_b10); /* PLUS 2 digits: TOTAL 3 */
exp_b10 = 0; /* Dot added below before first output. */
}
else
czero = 0; /* No zeros to add */
/* Generate the digit list, stripping trailing zeros and
* inserting a '.' before a digit if the exponent is 0.
*/
clead = czero; /* Count of leading zeros */
cdigits = 0; /* Count of digits in list. */
do
{
double d;
fp *= 10;
/* Use modf here, not floor and subtract, so that
* the separation is done in one step. At the end
* of the loop don't break the number into parts so
* that the final digit is rounded.
*/
if (cdigits+czero+1 < precision+clead)
fp = modf(fp, &d);
else
{
d = floor(fp + .5);
if (d > 9)
{
/* Rounding up to 10, handle that here. */
if (czero > 0)
{
--czero, d = 1;
if (cdigits == 0) --clead;
}
else
{
while (cdigits > 0 && d > 9)
{
int ch = *--ascii;
if (exp_b10 != (-1))
++exp_b10;
else if (ch == 46)
{
ch = *--ascii, ++size;
/* Advance exp_b10 to '1', so that the
* decimal point happens after the
* previous digit.
*/
exp_b10 = 1;
}
--cdigits;
d = ch - 47; /* I.e. 1+(ch-48) */
}
/* Did we reach the beginning? If so adjust the
* exponent but take into account the leading
* decimal point.
*/
if (d > 9) /* cdigits == 0 */
{
if (exp_b10 == (-1))
{
/* Leading decimal point (plus zeros?), if
* we lose the decimal point here it must
* be reentered below.
*/
int ch = *--ascii;
if (ch == 46)
++size, exp_b10 = 1;
/* Else lost a leading zero, so 'exp_b10' is
* still ok at (-1)
*/
}
else
++exp_b10;
/* In all cases we output a '1' */
d = 1;
}
}
}
fp = 0; /* Guarantees termination below. */
}
if (d == 0)
{
++czero;
if (cdigits == 0) ++clead;
}
else
{
/* Included embedded zeros in the digit count. */
cdigits += czero - clead;
clead = 0;
while (czero > 0)
{
/* exp_b10 == (-1) means we just output the decimal
* place - after the DP don't adjust 'exp_b10' any
* more!
*/
if (exp_b10 != (-1))
{
if (exp_b10 == 0) *ascii++ = 46, --size;
/* PLUS 1: TOTAL 4 */
--exp_b10;
}
*ascii++ = 48, --czero;
}
if (exp_b10 != (-1))
{
if (exp_b10 == 0)
*ascii++ = 46, --size; /* counted above */
--exp_b10;
}
*ascii++ = (char)(48 + (int)d), ++cdigits;
}
}
while (cdigits+czero < precision+clead && fp > DBL_MIN);
/* The total output count (max) is now 4+precision */
/* Check for an exponent, if we don't need one we are
* done and just need to terminate the string. At
* this point exp_b10==(-1) is effectively if flag - it got
* to '-1' because of the decrement after outputting
* the decimal point above (the exponent required is
* *not* -1!)
*/
if (exp_b10 >= (-1) && exp_b10 <= 2)
{
/* The following only happens if we didn't output the
* leading zeros above for negative exponent, so this
* doesn't add to the digit requirement. Note that the
* two zeros here can only be output if the two leading
* zeros were *not* output, so this doesn't increase
* the output count.
*/
while (--exp_b10 >= 0) *ascii++ = 48;
*ascii = 0;
/* Total buffer requirement (including the '\0') is
* 5+precision - see check at the start.
*/
return;
}
/* Here if an exponent is required, adjust size for
* the digits we output but did not count. The total
* digit output here so far is at most 1+precision - no
* decimal point and no leading or trailing zeros have
* been output.
*/
size -= cdigits;
*ascii++ = 69, --size; /* 'E': PLUS 1 TOTAL 2+precision */
/* The following use of an unsigned temporary avoids ambiguities in
* the signed arithmetic on exp_b10 and permits GCC at least to do
* better optimization.
*/
{
unsigned int uexp_b10;
if (exp_b10 < 0)
{
*ascii++ = 45, --size; /* '-': PLUS 1 TOTAL 3+precision */
uexp_b10 = (unsigned int)(-exp_b10);
}
else
uexp_b10 = (unsigned int)exp_b10;
cdigits = 0;
while (uexp_b10 > 0)
{
exponent[cdigits++] = (char)(48 + uexp_b10 % 10);
uexp_b10 /= 10;
}
}
/* Need another size check here for the exponent digits, so
* this need not be considered above.
*/
if (size > cdigits)
{
while (cdigits > 0) *ascii++ = exponent[--cdigits];
*ascii = 0;
return;
}
}
}
else if (!(fp >= DBL_MIN))
{
*ascii++ = 48; /* '0' */
*ascii = 0;
return;
}
else
{
*ascii++ = 105; /* 'i' */
*ascii++ = 110; /* 'n' */
*ascii++ = 102; /* 'f' */
*ascii = 0;
return;
}
}
/* Here on buffer too small. */
png_error(png_ptr, "ASCII conversion buffer too small");
} |
augmented_data/post_increment_index_changes/extr_trace_stack.c_check_stack_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 TYPE_3__ {int nr_entries; int skip; } ;
/* Variables and functions */
int THREAD_SIZE ;
int /*<<< orphan*/ __raw_spin_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ __raw_spin_unlock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ local_irq_restore (unsigned long) ;
int /*<<< orphan*/ local_irq_save (unsigned long) ;
int /*<<< orphan*/ max_stack_lock ;
unsigned long max_stack_size ;
TYPE_1__ max_stack_trace ;
int /*<<< orphan*/ object_is_on_stack (unsigned long*) ;
int /*<<< orphan*/ save_stack_trace (TYPE_1__*) ;
unsigned long* stack_dump_index ;
unsigned long* stack_dump_trace ;
__attribute__((used)) static inline void check_stack(void)
{
unsigned long this_size, flags;
unsigned long *p, *top, *start;
int i;
this_size = ((unsigned long)&this_size) & (THREAD_SIZE-1);
this_size = THREAD_SIZE - this_size;
if (this_size <= max_stack_size)
return;
/* we do not handle interrupt stacks yet */
if (!object_is_on_stack(&this_size))
return;
local_irq_save(flags);
__raw_spin_lock(&max_stack_lock);
/* a race could have already updated it */
if (this_size <= max_stack_size)
goto out;
max_stack_size = this_size;
max_stack_trace.nr_entries = 0;
max_stack_trace.skip = 3;
save_stack_trace(&max_stack_trace);
/*
* Now find where in the stack these are.
*/
i = 0;
start = &this_size;
top = (unsigned long *)
(((unsigned long)start & ~(THREAD_SIZE-1)) + THREAD_SIZE);
/*
* Loop through all the entries. One of the entries may
* for some reason be missed on the stack, so we may
* have to account for them. If they are all there, this
* loop will only happen once. This code only takes place
* on a new max, so it is far from a fast path.
*/
while (i <= max_stack_trace.nr_entries) {
int found = 0;
stack_dump_index[i] = this_size;
p = start;
for (; p < top && i < max_stack_trace.nr_entries; p--) {
if (*p == stack_dump_trace[i]) {
this_size = stack_dump_index[i++] =
(top - p) * sizeof(unsigned long);
found = 1;
/* Start the search from here */
start = p + 1;
}
}
if (!found)
i++;
}
out:
__raw_spin_unlock(&max_stack_lock);
local_irq_restore(flags);
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.