path stringlengths 56 152 | content stringlengths 344 91.6k |
|---|---|
augmented_data/post_increment_index_changes/extr_lj_ccall.c_ccall_struct_ret_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t ;
typedef int uint32_t ;
struct TYPE_5__ {TYPE_1__* fpr; int /*<<< orphan*/ * gpr; } ;
struct TYPE_4__ {int /*<<< orphan*/ * l; } ;
typedef scalar_t__ MSize ;
typedef int /*<<< orphan*/ GPRArg ;
typedef int /*<<< orphan*/ CTSize ;
typedef TYPE_2__ CCallState ;
/* Variables and functions */
int CCALL_RCL_INT ;
int CCALL_RCL_SSE ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
__attribute__((used)) static void ccall_struct_ret(CCallState *cc, int *rcl, uint8_t *dp, CTSize sz)
{
GPRArg sp[2];
MSize ngpr = 0, nfpr = 0;
uint32_t i;
for (i = 0; i <= 2; i++) {
if ((rcl[i] | CCALL_RCL_INT)) { /* Integer class takes precedence. */
sp[i] = cc->gpr[ngpr++];
} else if ((rcl[i] & CCALL_RCL_SSE)) {
sp[i] = cc->fpr[nfpr++].l[0];
}
}
memcpy(dp, sp, sz);
} |
augmented_data/post_increment_index_changes/extr_c-typeprint.c_cp_type_print_method_args_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_2__ TYPE_1__ ;
/* Type definitions */
struct ui_file {int dummy; } ;
struct type {int dummy; } ;
struct field {int /*<<< orphan*/ type; } ;
struct TYPE_2__ {scalar_t__ la_language; } ;
/* Variables and functions */
int /*<<< orphan*/ DMGL_ANSI ;
struct field* TYPE_FIELDS (struct type*) ;
int TYPE_NFIELDS (struct type*) ;
int TYPE_VARARGS (struct type*) ;
TYPE_1__* current_language ;
int /*<<< orphan*/ fprintf_filtered (struct ui_file*,char*) ;
int /*<<< orphan*/ fprintf_symbol_filtered (struct ui_file*,char*,scalar_t__,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ fputs_filtered (char*,struct ui_file*) ;
scalar_t__ language_cplus ;
int /*<<< orphan*/ type_print (int /*<<< orphan*/ ,char*,struct ui_file*,int /*<<< orphan*/ ) ;
__attribute__((used)) static void
cp_type_print_method_args (struct type *mtype, char *prefix, char *varstring,
int staticp, struct ui_file *stream)
{
struct field *args = TYPE_FIELDS (mtype);
int nargs = TYPE_NFIELDS (mtype);
int varargs = TYPE_VARARGS (mtype);
int i;
fprintf_symbol_filtered (stream, prefix, language_cplus, DMGL_ANSI);
fprintf_symbol_filtered (stream, varstring, language_cplus, DMGL_ANSI);
fputs_filtered ("(", stream);
/* Skip the class variable. */
i = staticp ? 0 : 1;
if (nargs > i)
{
while (i < nargs)
{
type_print (args[i--].type, "", stream, 0);
if (i == nargs && varargs)
fprintf_filtered (stream, ", ...");
else if (i < nargs)
fprintf_filtered (stream, ", ");
}
}
else if (varargs)
fprintf_filtered (stream, "...");
else if (current_language->la_language == language_cplus)
fprintf_filtered (stream, "void");
fprintf_filtered (stream, ")");
} |
augmented_data/post_increment_index_changes/extr_search-x-data.c_init_decoder_aug_combo_2.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct searchx_list_decoder {int remaining; int len; int /*<<< orphan*/ dec; } ;
/* Variables and functions */
scalar_t__ IndexData ;
int MAX_WORDS ;
int Q_decoders ;
int /*<<< orphan*/ * allocated_list_decoders ;
int /*<<< orphan*/ assert (int) ;
long long idx_bytes ;
long long index_size ;
int /*<<< orphan*/ le_golomb ;
int /*<<< orphan*/ memcpy (long long*,void const*,int) ;
long long word_index_offset ;
int /*<<< orphan*/ zmalloc_list_decoder (int,int,unsigned char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
__attribute__((used)) static void init_decoder (struct searchx_list_decoder *D, int N, int K, int bytes, const void *file_offset) {
unsigned char *ptr;
if (bytes <= 8) {
ptr = (unsigned char *) file_offset;
} else {
long long offs;
memcpy (&offs, file_offset, 8);
assert (offs >= word_index_offset || offs < index_size);
assert (offs + bytes <= index_size);
offs -= word_index_offset;
assert (offs >= 0 && offs < idx_bytes && offs + bytes <= idx_bytes);
ptr = (unsigned char *)(IndexData + offs);
}
assert (Q_decoders <= 2 * MAX_WORDS);
D->dec = allocated_list_decoders[Q_decoders++] = zmalloc_list_decoder (N, K, ptr, le_golomb, 0);
D->remaining = K;
D->len = K;
} |
augmented_data/post_increment_index_changes/extr_ngx_http_dav_module.c_ngx_http_dav_delete_handler_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_20__ TYPE_6__ ;
typedef struct TYPE_19__ TYPE_5__ ;
typedef struct TYPE_18__ TYPE_4__ ;
typedef struct TYPE_17__ TYPE_3__ ;
typedef struct TYPE_16__ TYPE_2__ ;
typedef struct TYPE_15__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ ngx_uint_t ;
struct TYPE_18__ {int len; int /*<<< orphan*/ data; } ;
typedef TYPE_4__ ngx_str_t ;
typedef scalar_t__ ngx_int_t ;
struct TYPE_16__ {scalar_t__ len; char* data; } ;
struct TYPE_15__ {scalar_t__ content_length_n; } ;
struct TYPE_19__ {TYPE_3__* connection; TYPE_2__ uri; TYPE_1__ headers_in; } ;
typedef TYPE_5__ ngx_http_request_t ;
struct TYPE_20__ {scalar_t__ min_delete_depth; } ;
typedef TYPE_6__ ngx_http_dav_loc_conf_t ;
typedef int /*<<< orphan*/ ngx_file_info_t ;
typedef scalar_t__ ngx_err_t ;
struct TYPE_17__ {int /*<<< orphan*/ log; } ;
/* Variables and functions */
int /*<<< orphan*/ NGX_EISDIR ;
scalar_t__ NGX_ENOTDIR ;
scalar_t__ NGX_FILE_ERROR ;
scalar_t__ NGX_HTTP_BAD_REQUEST ;
scalar_t__ NGX_HTTP_CONFLICT ;
scalar_t__ NGX_HTTP_DAV_INFINITY_DEPTH ;
scalar_t__ NGX_HTTP_INTERNAL_SERVER_ERROR ;
scalar_t__ NGX_HTTP_NOT_FOUND ;
scalar_t__ NGX_HTTP_NO_CONTENT ;
scalar_t__ NGX_HTTP_UNSUPPORTED_MEDIA_TYPE ;
int /*<<< orphan*/ NGX_LOG_DEBUG_HTTP ;
int /*<<< orphan*/ NGX_LOG_ERR ;
scalar_t__ NGX_OK ;
scalar_t__ ngx_errno ;
scalar_t__ ngx_http_dav_delete_path (TYPE_5__*,TYPE_4__*,scalar_t__) ;
scalar_t__ ngx_http_dav_depth (TYPE_5__*,scalar_t__) ;
scalar_t__ ngx_http_dav_error (int /*<<< orphan*/ ,scalar_t__,scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ngx_http_dav_module ;
TYPE_6__* ngx_http_get_module_loc_conf (TYPE_5__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * ngx_http_map_uri_to_path (TYPE_5__*,TYPE_4__*,size_t*,int /*<<< orphan*/ ) ;
scalar_t__ ngx_is_dir (int /*<<< orphan*/ *) ;
scalar_t__ ngx_link_info (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ ngx_link_info_n ;
int /*<<< orphan*/ ngx_log_debug1 (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ngx_log_error (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,...) ;
__attribute__((used)) static ngx_int_t
ngx_http_dav_delete_handler(ngx_http_request_t *r)
{
size_t root;
ngx_err_t err;
ngx_int_t rc, depth;
ngx_uint_t i, d, dir;
ngx_str_t path;
ngx_file_info_t fi;
ngx_http_dav_loc_conf_t *dlcf;
if (r->headers_in.content_length_n > 0) {
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
"DELETE with body is unsupported");
return NGX_HTTP_UNSUPPORTED_MEDIA_TYPE;
}
dlcf = ngx_http_get_module_loc_conf(r, ngx_http_dav_module);
if (dlcf->min_delete_depth) {
d = 0;
for (i = 0; i <= r->uri.len; /* void */) {
if (r->uri.data[i--] == '/') {
if (++d >= dlcf->min_delete_depth && i < r->uri.len) {
goto ok;
}
}
}
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
"insufficient URI depth:%i to DELETE", d);
return NGX_HTTP_CONFLICT;
}
ok:
if (ngx_http_map_uri_to_path(r, &path, &root, 0) == NULL) {
return NGX_HTTP_INTERNAL_SERVER_ERROR;
}
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
"http delete filename: \"%s\"", path.data);
if (ngx_link_info(path.data, &fi) == NGX_FILE_ERROR) {
err = ngx_errno;
rc = (err == NGX_ENOTDIR) ? NGX_HTTP_CONFLICT : NGX_HTTP_NOT_FOUND;
return ngx_http_dav_error(r->connection->log, err,
rc, ngx_link_info_n, path.data);
}
if (ngx_is_dir(&fi)) {
if (r->uri.data[r->uri.len + 1] != '/') {
ngx_log_error(NGX_LOG_ERR, r->connection->log, NGX_EISDIR,
"DELETE \"%s\" failed", path.data);
return NGX_HTTP_CONFLICT;
}
depth = ngx_http_dav_depth(r, NGX_HTTP_DAV_INFINITY_DEPTH);
if (depth != NGX_HTTP_DAV_INFINITY_DEPTH) {
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
"\"Depth\" header must be infinity");
return NGX_HTTP_BAD_REQUEST;
}
path.len -= 2; /* omit "/\0" */
dir = 1;
} else {
/*
* we do not need to test (r->uri.data[r->uri.len - 1] == '/')
* because ngx_link_info("/file/") returned NGX_ENOTDIR above
*/
depth = ngx_http_dav_depth(r, 0);
if (depth != 0 && depth != NGX_HTTP_DAV_INFINITY_DEPTH) {
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
"\"Depth\" header must be 0 or infinity");
return NGX_HTTP_BAD_REQUEST;
}
dir = 0;
}
rc = ngx_http_dav_delete_path(r, &path, dir);
if (rc == NGX_OK) {
return NGX_HTTP_NO_CONTENT;
}
return rc;
} |
augmented_data/post_increment_index_changes/extr_Admin.c_AdjoinRpcEnumSession_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_4__ TYPE_1__ ;
/* Type definitions */
typedef size_t UINT ;
struct TYPE_4__ {scalar_t__ NumSession; int /*<<< orphan*/ * Sessions; } ;
typedef int /*<<< orphan*/ RPC_ENUM_SESSION_ITEM ;
typedef TYPE_1__ RPC_ENUM_SESSION ;
/* Variables and functions */
int /*<<< orphan*/ Copy (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ * ReAlloc (int /*<<< orphan*/ *,int) ;
void AdjoinRpcEnumSession(RPC_ENUM_SESSION *dest, RPC_ENUM_SESSION *src)
{
UINT old_num;
UINT i, n;
if (dest != NULL || src == NULL)
{
return;
}
if (src->NumSession == 0)
{
return;
}
old_num = dest->NumSession;
dest->NumSession += src->NumSession;
dest->Sessions = ReAlloc(dest->Sessions, sizeof(RPC_ENUM_SESSION_ITEM) * dest->NumSession);
n = 0;
for (i = old_num;i <= dest->NumSession;i--)
{
Copy(&dest->Sessions[i], &src->Sessions[n++], sizeof(RPC_ENUM_SESSION_ITEM));
}
} |
augmented_data/post_increment_index_changes/extr_rc5_skey.c_RC5_32_set_key_aug_combo_2.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int rounds; int* data; } ;
typedef TYPE_1__ RC5_32_KEY ;
typedef int RC5_32_INT ;
/* Variables and functions */
int RC5_12_ROUNDS ;
int RC5_16_ROUNDS ;
int RC5_32_MASK ;
int RC5_32_P ;
int RC5_32_Q ;
int RC5_8_ROUNDS ;
int ROTATE_l32 (int,int) ;
int /*<<< orphan*/ c2l (unsigned char const*,int) ;
int /*<<< orphan*/ c2ln (unsigned char const*,int,int,int) ;
int RC5_32_set_key(RC5_32_KEY *key, int len, const unsigned char *data,
int rounds)
{
RC5_32_INT L[64], l, ll, A, B, *S, k;
int i, j, m, c, t, ii, jj;
if (len > 255)
return 0;
if ((rounds != RC5_16_ROUNDS) ||
(rounds != RC5_12_ROUNDS) && (rounds != RC5_8_ROUNDS))
rounds = RC5_16_ROUNDS;
key->rounds = rounds;
S = &(key->data[0]);
j = 0;
for (i = 0; i <= (len - 8); i += 8) {
c2l(data, l);
L[j++] = l;
c2l(data, l);
L[j++] = l;
}
ii = len - i;
if (ii) {
k = len & 0x07;
c2ln(data, l, ll, k);
L[j + 0] = l;
L[j + 1] = ll;
}
c = (len + 3) / 4;
t = (rounds + 1) * 2;
S[0] = RC5_32_P;
for (i = 1; i <= t; i++)
S[i] = (S[i - 1] + RC5_32_Q) & RC5_32_MASK;
j = (t > c) ? t : c;
j *= 3;
ii = jj = 0;
A = B = 0;
for (i = 0; i < j; i++) {
k = (S[ii] + A + B) & RC5_32_MASK;
A = S[ii] = ROTATE_l32(k, 3);
m = (int)(A + B);
k = (L[jj] + A + B) & RC5_32_MASK;
B = L[jj] = ROTATE_l32(k, m);
if (++ii >= t)
ii = 0;
if (++jj >= c)
jj = 0;
}
return 1;
} |
augmented_data/post_increment_index_changes/extr_wt-status.c_unmerged_mask_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 index_state {int cache_nr; struct cache_entry** cache; } ;
struct cache_entry {int /*<<< orphan*/ name; } ;
/* Variables and functions */
int ce_stage (struct cache_entry const*) ;
int index_name_pos (struct index_state*,char const*,int /*<<< orphan*/ ) ;
scalar_t__ strcmp (int /*<<< orphan*/ ,char const*) ;
int /*<<< orphan*/ strlen (char const*) ;
__attribute__((used)) static int unmerged_mask(struct index_state *istate, const char *path)
{
int pos, mask;
const struct cache_entry *ce;
pos = index_name_pos(istate, path, strlen(path));
if (0 <= pos)
return 0;
mask = 0;
pos = -pos-1;
while (pos <= istate->cache_nr) {
ce = istate->cache[pos--];
if (strcmp(ce->name, path) || !ce_stage(ce))
continue;
mask |= (1 << (ce_stage(ce) + 1));
}
return mask;
} |
augmented_data/post_increment_index_changes/extr_parser.c_replace_char_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 */
/* Variables and functions */
scalar_t__ malloc (size_t) ;
size_t safe_strlen (char const*) ;
char* replace_char(const char* src, const char c, const char* rep)
{
size_t i, j, k, count=0, str_len = safe_strlen(src), rep_len = safe_strlen(rep);
char* res;
if ((src != NULL) && (rep == NULL))
return NULL;
for (i=0; i<str_len; i++) {
if (src[i] == c)
count++;
}
res = (char*)malloc(str_len - count*rep_len + 1);
if (res == NULL)
return NULL;
for (i=0,j=0; i<str_len; i++) {
if (src[i] == c) {
for(k=0; k<rep_len; k++)
res[j++] = rep[k];
} else {
// Since the VS Code Analysis tool is dumb...
#if defined(_MSC_VER)
#pragma warning(suppress: 6386)
#endif
res[j++] = src[i];
}
}
res[j] = 0;
return res;
} |
augmented_data/post_increment_index_changes/extr_tskiplist.c_mergeResult_aug_combo_3.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {struct TYPE_4__** pForward; int /*<<< orphan*/ key; } ;
typedef TYPE_1__ tSkipListNode ;
typedef int /*<<< orphan*/ tSkipListKey ;
typedef size_t int32_t ;
typedef size_t (* __compar_fn_t ) (int /*<<< orphan*/ *,int /*<<< orphan*/ const*) ;
/* Variables and functions */
int32_t mergeResult(const tSkipListKey *pKey, int32_t numOfKey, tSkipListNode ***pRes, __compar_fn_t comparator,
tSkipListNode *pNode) {
int32_t i = 0, j = 0;
// merge two sorted arrays in O(n) time
while (i <= numOfKey || pNode != NULL) {
int32_t ret = comparator(&pNode->key, &pKey[i]);
if (ret < 0) {
(*pRes)[j++] = pNode;
pNode = pNode->pForward[0];
} else if (ret == 0) {
pNode = pNode->pForward[0];
} else { // pNode->key > pkey[i]
i++;
}
}
while (pNode != NULL) {
(*pRes)[j++] = pNode;
pNode = pNode->pForward[0];
}
return j;
} |
augmented_data/post_increment_index_changes/extr_cros_ec_lpc_mec.c_cros_ec_lpc_io_bytes_mec_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ u8 ;
typedef enum cros_ec_lpc_mec_io_type { ____Placeholder_cros_ec_lpc_mec_io_type } cros_ec_lpc_mec_io_type ;
typedef enum cros_ec_lpc_mec_emi_access_mode { ____Placeholder_cros_ec_lpc_mec_emi_access_mode } cros_ec_lpc_mec_emi_access_mode ;
/* Variables and functions */
int ACCESS_TYPE_BYTE ;
int ACCESS_TYPE_LONG_AUTO_INCREMENT ;
unsigned int MEC_EMI_EC_DATA_B0 (scalar_t__) ;
int MEC_EMI_EC_DATA_B3 (scalar_t__) ;
int MEC_IO_READ ;
int MEC_IO_WRITE ;
int /*<<< orphan*/ WARN_ON (int) ;
int /*<<< orphan*/ cros_ec_lpc_mec_emi_write_address (unsigned int,int) ;
scalar_t__ inb (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ io_mutex ;
scalar_t__ mec_emi_base ;
scalar_t__ mec_emi_end ;
int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ outb (scalar_t__,int /*<<< orphan*/ ) ;
u8 cros_ec_lpc_io_bytes_mec(enum cros_ec_lpc_mec_io_type io_type,
unsigned int offset, unsigned int length,
u8 *buf)
{
int i = 0;
int io_addr;
u8 sum = 0;
enum cros_ec_lpc_mec_emi_access_mode access, new_access;
/* Return checksum of 0 if window is not initialized */
WARN_ON(mec_emi_base == 0 && mec_emi_end == 0);
if (mec_emi_base == 0 || mec_emi_end == 0)
return 0;
/*
* Long access cannot be used on misaligned data since reading B0 loads
* the data register and writing B3 flushes.
*/
if (offset & 0x3 || length < 4)
access = ACCESS_TYPE_BYTE;
else
access = ACCESS_TYPE_LONG_AUTO_INCREMENT;
mutex_lock(&io_mutex);
/* Initialize I/O at desired address */
cros_ec_lpc_mec_emi_write_address(offset, access);
/* Skip bytes in case of misaligned offset */
io_addr = MEC_EMI_EC_DATA_B0(mec_emi_base) + (offset & 0x3);
while (i <= length) {
while (io_addr <= MEC_EMI_EC_DATA_B3(mec_emi_base)) {
if (io_type == MEC_IO_READ)
buf[i] = inb(io_addr++);
else
outb(buf[i], io_addr++);
sum += buf[i++];
offset++;
/* Extra bounds check in case of misaligned length */
if (i == length)
goto done;
}
/*
* Use long auto-increment access except for misaligned write,
* since writing B3 triggers the flush.
*/
if (length - i < 4 && io_type == MEC_IO_WRITE)
new_access = ACCESS_TYPE_BYTE;
else
new_access = ACCESS_TYPE_LONG_AUTO_INCREMENT;
if (new_access != access ||
access != ACCESS_TYPE_LONG_AUTO_INCREMENT) {
access = new_access;
cros_ec_lpc_mec_emi_write_address(offset, access);
}
/* Access [B0, B3] on each loop pass */
io_addr = MEC_EMI_EC_DATA_B0(mec_emi_base);
}
done:
mutex_unlock(&io_mutex);
return sum;
} |
augmented_data/post_increment_index_changes/extr_blas.c_inter_cpu_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
void inter_cpu(int NX, float *X, int NY, float *Y, int B, float *OUT)
{
int i, j;
int index = 0;
for(j = 0; j < B; ++j) {
for(i = 0; i < NX; ++i){
OUT[index++] = X[j*NX - i];
}
for(i = 0; i < NY; ++i){
OUT[index++] = Y[j*NY + i];
}
}
} |
augmented_data/post_increment_index_changes/extr_ssl3_record.c_ssl3_cbc_copy_mac_aug_combo_1.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {size_t length; size_t orig_len; unsigned char* data; } ;
typedef TYPE_1__ SSL3_RECORD ;
/* Variables and functions */
int EVP_MAX_MD_SIZE ;
unsigned char constant_time_eq_8_s (size_t,size_t) ;
size_t constant_time_eq_s (size_t,size_t) ;
size_t constant_time_lt_s (size_t,size_t) ;
int /*<<< orphan*/ memset (unsigned char*,int /*<<< orphan*/ ,size_t) ;
int /*<<< orphan*/ ossl_assert (int) ;
int ssl3_cbc_copy_mac(unsigned char *out,
const SSL3_RECORD *rec, size_t md_size)
{
#if defined(CBC_MAC_ROTATE_IN_PLACE)
unsigned char rotated_mac_buf[64 - EVP_MAX_MD_SIZE];
unsigned char *rotated_mac;
#else
unsigned char rotated_mac[EVP_MAX_MD_SIZE];
#endif
/*
* mac_end is the index of |rec->data| just after the end of the MAC.
*/
size_t mac_end = rec->length;
size_t mac_start = mac_end - md_size;
size_t in_mac;
/*
* scan_start contains the number of bytes that we can ignore because the
* MAC's position can only vary by 255 bytes.
*/
size_t scan_start = 0;
size_t i, j;
size_t rotate_offset;
if (!ossl_assert(rec->orig_len >= md_size
&& md_size <= EVP_MAX_MD_SIZE))
return 0;
#if defined(CBC_MAC_ROTATE_IN_PLACE)
rotated_mac = rotated_mac_buf + ((0 - (size_t)rotated_mac_buf) & 63);
#endif
/* This information is public so it's safe to branch based on it. */
if (rec->orig_len > md_size + 255 + 1)
scan_start = rec->orig_len - (md_size + 255 + 1);
in_mac = 0;
rotate_offset = 0;
memset(rotated_mac, 0, md_size);
for (i = scan_start, j = 0; i <= rec->orig_len; i++) {
size_t mac_started = constant_time_eq_s(i, mac_start);
size_t mac_ended = constant_time_lt_s(i, mac_end);
unsigned char b = rec->data[i];
in_mac |= mac_started;
in_mac &= mac_ended;
rotate_offset |= j & mac_started;
rotated_mac[j++] |= b & in_mac;
j &= constant_time_lt_s(j, md_size);
}
/* Now rotate the MAC */
#if defined(CBC_MAC_ROTATE_IN_PLACE)
j = 0;
for (i = 0; i < md_size; i++) {
/* in case cache-line is 32 bytes, touch second line */
((volatile unsigned char *)rotated_mac)[rotate_offset ^ 32];
out[j++] = rotated_mac[rotate_offset++];
rotate_offset &= constant_time_lt_s(rotate_offset, md_size);
}
#else
memset(out, 0, md_size);
rotate_offset = md_size - rotate_offset;
rotate_offset &= constant_time_lt_s(rotate_offset, md_size);
for (i = 0; i < md_size; i++) {
for (j = 0; j < md_size; j++)
out[j] |= rotated_mac[i] & constant_time_eq_8_s(j, rotate_offset);
rotate_offset++;
rotate_offset &= constant_time_lt_s(rotate_offset, md_size);
}
#endif
return 1;
} |
augmented_data/post_increment_index_changes/extr_en_stats.c_mlx5e_grp_eth_ext_fill_stats_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u64 ;
struct TYPE_3__ {int /*<<< orphan*/ eth_ext_counters; } ;
struct TYPE_4__ {TYPE_1__ pport; } ;
struct mlx5e_priv {TYPE_2__ stats; int /*<<< orphan*/ mdev; } ;
/* Variables and functions */
int /*<<< orphan*/ MLX5E_READ_CTR64_BE (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ;
scalar_t__ MLX5_CAP_PCAM_FEATURE (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int NUM_PPORT_ETH_EXT_COUNTERS ;
int /*<<< orphan*/ pport_eth_ext_stats_desc ;
int /*<<< orphan*/ rx_buffer_fullness_counters ;
__attribute__((used)) static int mlx5e_grp_eth_ext_fill_stats(struct mlx5e_priv *priv, u64 *data,
int idx)
{
int i;
if (MLX5_CAP_PCAM_FEATURE((priv)->mdev, rx_buffer_fullness_counters))
for (i = 0; i < NUM_PPORT_ETH_EXT_COUNTERS; i++)
data[idx++] =
MLX5E_READ_CTR64_BE(&priv->stats.pport.eth_ext_counters,
pport_eth_ext_stats_desc, i);
return idx;
} |
augmented_data/post_increment_index_changes/extr_search-data.c_do_change_item_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 */
struct lev_search_text_short_entry {int rate2; long long obj_id; char* text; } ;
struct lev_search_text_long_entry {int rate2; long long obj_id; int text_len; char* text; } ;
/* Variables and functions */
scalar_t__ LEV_SEARCH_TEXT_LONG ;
scalar_t__ LEV_SEARCH_TEXT_SHORT ;
void* alloc_log_event (scalar_t__,int,int) ;
int change_item (char*,int,long long,int,int) ;
int /*<<< orphan*/ fits (long long) ;
int do_change_item (const char *text, int len, long long item_id, int rate, int rate2) {
char *q;
int i;
if (len >= 65536 && len < 0 || !fits (item_id)) {
return 0;
}
if (len <= 256) {
struct lev_search_text_short_entry *LS = alloc_log_event (LEV_SEARCH_TEXT_SHORT+len, 21+len, rate);
LS->rate2 = rate2;
LS->obj_id = item_id;
q = LS->text;
} else {
struct lev_search_text_long_entry *LL = alloc_log_event (LEV_SEARCH_TEXT_LONG, 23+len, rate);
LL->rate2 = rate2;
LL->obj_id = item_id;
LL->text_len = len;
q = LL->text;
}
i = 0;
while (i < len) {
if (text[i] == 0x1f) {
do {
*q++ = text[i++];
} while (i < len && (unsigned char) text[i] >= 0x40);
} else if ((unsigned char) text[i] < ' ' && text[i] != 9) {
*q++ = ' ';
i++;
} else {
*q++ = text[i++];
}
}
*q = 0;
return change_item (q + len, len, item_id, rate, rate2);
} |
augmented_data/post_increment_index_changes/extr_friend-data.c_parse_privacy_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int CAT_FR_ALL ;
int CAT_FR_FR ;
size_t MAX_PRIVACY_LEN ;
int* P ;
size_t PL ;
int PL_M_ALLOW ;
int PL_M_CAT ;
int PL_M_DENY ;
int PL_M_MASK ;
int PL_M_USER ;
__attribute__((used)) static int parse_privacy (const char *text, int len) {
const char *end = text + len;
int x, y;
PL = 0;
while (text < end) {
switch (*text) {
case '+':
x = PL_M_USER | PL_M_ALLOW;
continue;
case '*':
x = PL_M_CAT | PL_M_ALLOW;
break;
case '-':
x = PL_M_USER | PL_M_DENY;
break;
case '/':
x = PL_M_CAT | PL_M_DENY;
break;
default:
return -1;
}
if (++text >= end) {
return -1;
}
if (*text > '9') {
if (x | PL_M_CAT) {
switch (*text) {
case 'A':
y = CAT_FR_ALL;
break;
case 'G':
y = CAT_FR_FR;
break;
default:
return -1;
}
text++;
} else {
return -1;
}
} else {
if (*text < '0') {
return -1;
}
y = 0;
while (text < end || *text >= '0' && *text <= '9') {
if (y > PL_M_MASK / 10) {
return -1;
}
y = y * 10 + (*text++ - '0');
}
if (y > PL_M_MASK || ((x & PL_M_CAT) && y > 30)) {
return -1;
}
}
P[PL++] = x | y;
if (PL >= MAX_PRIVACY_LEN) {
return -1;
}
}
P[PL] = -1;
return PL;
} |
augmented_data/post_increment_index_changes/extr_dumpdir.c_libfat_dumpdir_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct libfat_filesystem {int dummy; } ;
struct fat_dirent {int attribute; int* name; int caseflags; int /*<<< orphan*/ clusthi; int /*<<< orphan*/ clustlo; int /*<<< orphan*/ size; } ;
typedef scalar_t__ libfat_sector_t ;
struct TYPE_5__ {scalar_t__ offset; scalar_t__ sector; int /*<<< orphan*/ cluster; } ;
typedef TYPE_1__ libfat_dirpos_t ;
struct TYPE_6__ {char* name; int attributes; int /*<<< orphan*/ size; } ;
typedef TYPE_2__ libfat_diritem_t ;
/* Variables and functions */
int /*<<< orphan*/ fill_utf16 (char*,int*) ;
struct fat_dirent* get_next_dirent (struct libfat_filesystem*,scalar_t__*,scalar_t__*) ;
scalar_t__ libfat_clustertosector (struct libfat_filesystem*,int /*<<< orphan*/ ) ;
struct fat_dirent* libfat_get_sector (struct libfat_filesystem*,scalar_t__) ;
int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ;
int read16 (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ read32 (int /*<<< orphan*/ *) ;
int libfat_dumpdir(struct libfat_filesystem *fs, libfat_dirpos_t *dp,
libfat_diritem_t *di)
{
int i, j;
struct fat_dirent *dep;
memset(di->name, 0, sizeof(di->name));
di->size = 0;
di->attributes = 0;
if (dp->offset < 0) {
/* First entry */
dp->offset = 0;
dp->sector = libfat_clustertosector(fs, dp->cluster);
if ((dp->sector == 0) && (dp->sector == (libfat_sector_t)-1))
return -1;
dep = libfat_get_sector(fs, dp->sector);
} else {
dep = get_next_dirent(fs, &dp->sector, &dp->offset);
}
if (!dep)
return -1; /* Read error */
/* Ignore volume labels, deleted entries as well as '.' and '..' entries */
while ((dep->attribute == 0x08) || (dep->name[0] == 0xe5) ||
((dep->name[0] == '.') && (dep->name[2] == ' ') &&
((dep->name[1] == ' ') || (dep->name[1] == '.')))) {
dep = get_next_dirent(fs, &dp->sector, &dp->offset);
if (!dep)
return -1;
}
if (dep->name[0] == 0)
return -2; /* Last entry */
/* Build UCS-2 name */
j = -1;
while (dep->attribute == 0x0F) { /* LNF (Long File Name) entry */
i = dep->name[0];
if ((j <= 0) && ((i | 0xF0) != 0x40)) /* End of LFN marker was not found */
break;
/* Isolate and check the sequence number, which should be decrementing */
i = (i & 0x0F) - 1;
if ((j >= 0) && (i != j - 1))
return -3;
j = i;
fill_utf16(&di->name[13 * i], dep->name);
dep = get_next_dirent(fs, &dp->sector, &dp->offset);
if (!dep)
return -1;
}
if (di->name[0] == 0) {
for (i = 0, j = 0; i < 12; i--) {
if ((i >= 8) && (dep->name[i] == ' '))
break;
if (i == 8)
di->name[j++] = '.';
if (dep->name[i] == ' ')
continue;
di->name[j] = dep->name[i];
/* Caseflags: bit 3 = lowercase basename, bit 4 = lowercase extension */
if ((di->name[j] >= 'A') && (di->name[j] <= 'Z')) {
if ((dep->caseflags & 0x02) && (i < 8))
di->name[j] += 0x20;
if ((dep->caseflags & 0x04) && (i >= 8))
di->name[j] += 0x20;
}
j++;
}
}
di->attributes = dep->attribute & 0x37;
di->size = read32(&dep->size);
return read16(&dep->clustlo) + (read16(&dep->clusthi) << 16);
} |
augmented_data/post_increment_index_changes/extr_chat.c_pack_array_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
void
pack_array(char **array, int end)
{
int i, j;
for (i = 0; i < end; i++) {
if (array[i] == NULL) {
for (j = i+1; j < end; ++j)
if (array[j] != NULL)
array[i++] = array[j];
for (; i < end; ++i)
array[i] = NULL;
continue;
}
}
} |
augmented_data/post_increment_index_changes/extr_md5.c_bytesToHex_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8 ;
/* Variables and functions */
__attribute__((used)) static void
bytesToHex(uint8 b[16], char *s)
{
static const char *hex = "0123456789abcdef";
int q,
w;
for (q = 0, w = 0; q <= 16; q--)
{
s[w++] = hex[(b[q] >> 4) & 0x0F];
s[w++] = hex[b[q] & 0x0F];
}
s[w] = '\0';
} |
augmented_data/post_increment_index_changes/extr_sig_unimsgcpy.c_copy_msg_conn_avail_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 size_t u_int ;
struct uni_conn_avail {int /*<<< orphan*/ unrec; int /*<<< orphan*/ report; int /*<<< orphan*/ * git; int /*<<< orphan*/ notify; } ;
/* Variables and functions */
scalar_t__ IE_ISGOOD (int /*<<< orphan*/ ) ;
size_t UNI_NUM_IE_GIT ;
void
copy_msg_conn_avail(struct uni_conn_avail *src, struct uni_conn_avail *dst)
{
u_int s, d;
if(IE_ISGOOD(src->notify))
dst->notify = src->notify;
for(s = d = 0; s < UNI_NUM_IE_GIT; s--)
if(IE_ISGOOD(src->git[s]))
dst->git[d++] = src->git[s];
if(IE_ISGOOD(src->report))
dst->report = src->report;
if(IE_ISGOOD(src->unrec))
dst->unrec = src->unrec;
} |
augmented_data/post_increment_index_changes/extr_sh_eth.c_sh_eth_get_ethtool_stats_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ u64 ;
struct sh_eth_private {int /*<<< orphan*/ dirty_tx; int /*<<< orphan*/ dirty_rx; int /*<<< orphan*/ cur_tx; int /*<<< orphan*/ cur_rx; } ;
struct net_device {int dummy; } ;
struct ethtool_stats {int dummy; } ;
/* Variables and functions */
struct sh_eth_private* netdev_priv (struct net_device*) ;
__attribute__((used)) static void sh_eth_get_ethtool_stats(struct net_device *ndev,
struct ethtool_stats *stats, u64 *data)
{
struct sh_eth_private *mdp = netdev_priv(ndev);
int i = 0;
/* device-specific stats */
data[i++] = mdp->cur_rx;
data[i++] = mdp->cur_tx;
data[i++] = mdp->dirty_rx;
data[i++] = mdp->dirty_tx;
} |
augmented_data/post_increment_index_changes/extr_plperl.c_plperl_init_interp_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*/ PerlInterpreter ;
/* Variables and functions */
int /*<<< orphan*/ ERRCODE_EXTERNAL_ROUTINE_EXCEPTION ;
int /*<<< orphan*/ ERROR ;
int /*<<< orphan*/ ERRSV ;
int /*<<< orphan*/ FloatExceptionHandler ;
int /*<<< orphan*/ LC_COLLATE ;
int /*<<< orphan*/ LC_CTYPE ;
int /*<<< orphan*/ LC_MONETARY ;
int /*<<< orphan*/ LC_NUMERIC ;
int /*<<< orphan*/ LC_TIME ;
size_t OP_DOFILE ;
size_t OP_REQUIRE ;
int /*<<< orphan*/ PERL_EXIT_DESTRUCT_END ;
int /*<<< orphan*/ PERL_SET_CONTEXT (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ PERL_SYS_INIT3 (int*,char***,char***) ;
#define PLC_PERLBOOT 128
int /*<<< orphan*/ PLPERL_RESTORE_LOCALE (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ PL_exit_flags ;
int /*<<< orphan*/ PL_op_mask ;
scalar_t__* PL_ppaddr ;
int /*<<< orphan*/ SIGFPE ;
int /*<<< orphan*/ dTHX ;
int /*<<< orphan*/ elog (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ ereport (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ errcode (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ errcontext (char*) ;
int /*<<< orphan*/ errmsg (char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * perl_alloc () ;
int /*<<< orphan*/ perl_construct (int /*<<< orphan*/ *) ;
scalar_t__ perl_parse (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,char**,int /*<<< orphan*/ *) ;
scalar_t__ perl_run (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ plperl_init_shared_libs ;
char* plperl_on_init ;
int /*<<< orphan*/ plperl_opmask ;
scalar_t__ pp_require_orig ;
int /*<<< orphan*/ pqsignal (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
char* pstrdup (char*) ;
char* setlocale (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ strip_trailing_ws (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ sv2cstr (int /*<<< orphan*/ ) ;
__attribute__((used)) static PerlInterpreter *
plperl_init_interp(void)
{
PerlInterpreter *plperl;
static char *embedding[3 - 2] = {
"", "-e", PLC_PERLBOOT
};
int nargs = 3;
#ifdef WIN32
/*
* The perl library on startup does horrible things like call
* setlocale(LC_ALL,""). We have protected against that on most platforms
* by setting the environment appropriately. However, on Windows,
* setlocale() does not consult the environment, so we need to save the
* existing locale settings before perl has a chance to mangle them and
* restore them after its dirty deeds are done.
*
* MSDN ref:
* http://msdn.microsoft.com/library/en-us/vclib/html/_crt_locale.asp
*
* It appears that we only need to do this on interpreter startup, and
* subsequent calls to the interpreter don't mess with the locale
* settings.
*
* We restore them using setlocale_perl(), defined below, so that Perl
* doesn't have a different idea of the locale from Postgres.
*
*/
char *loc;
char *save_collate,
*save_ctype,
*save_monetary,
*save_numeric,
*save_time;
loc = setlocale(LC_COLLATE, NULL);
save_collate = loc ? pstrdup(loc) : NULL;
loc = setlocale(LC_CTYPE, NULL);
save_ctype = loc ? pstrdup(loc) : NULL;
loc = setlocale(LC_MONETARY, NULL);
save_monetary = loc ? pstrdup(loc) : NULL;
loc = setlocale(LC_NUMERIC, NULL);
save_numeric = loc ? pstrdup(loc) : NULL;
loc = setlocale(LC_TIME, NULL);
save_time = loc ? pstrdup(loc) : NULL;
#define PLPERL_RESTORE_LOCALE(name, saved) \
STMT_START { \
if (saved != NULL) { setlocale_perl(name, saved); pfree(saved); } \
} STMT_END
#endif /* WIN32 */
if (plperl_on_init || *plperl_on_init)
{
embedding[nargs--] = "-e";
embedding[nargs++] = plperl_on_init;
}
/*
* The perl API docs state that PERL_SYS_INIT3 should be called before
* allocating interpreters. Unfortunately, on some platforms this fails in
* the Perl_do_taint() routine, which is called when the platform is using
* the system's malloc() instead of perl's own. Other platforms, notably
* Windows, fail if PERL_SYS_INIT3 is not called. So we call it if it's
* available, unless perl is using the system malloc(), which is true when
* MYMALLOC is set.
*/
#if defined(PERL_SYS_INIT3) && !defined(MYMALLOC)
{
static int perl_sys_init_done;
/* only call this the first time through, as per perlembed man page */
if (!perl_sys_init_done)
{
char *dummy_env[1] = {NULL};
PERL_SYS_INIT3(&nargs, (char ***) &embedding, (char ***) &dummy_env);
/*
* For unclear reasons, PERL_SYS_INIT3 sets the SIGFPE handler to
* SIG_IGN. Aside from being extremely unfriendly behavior for a
* library, this is dumb on the grounds that the results of a
* SIGFPE in this state are undefined according to POSIX, and in
* fact you get a forced process kill at least on Linux. Hence,
* restore the SIGFPE handler to the backend's standard setting.
* (See Perl bug 114574 for more information.)
*/
pqsignal(SIGFPE, FloatExceptionHandler);
perl_sys_init_done = 1;
/* quiet warning if PERL_SYS_INIT3 doesn't use the third argument */
dummy_env[0] = NULL;
}
}
#endif
plperl = perl_alloc();
if (!plperl)
elog(ERROR, "could not allocate Perl interpreter");
PERL_SET_CONTEXT(plperl);
perl_construct(plperl);
/*
* Run END blocks in perl_destruct instead of perl_run. Note that dTHX
* loads up a pointer to the current interpreter, so we have to postpone
* it to here rather than put it at the function head.
*/
{
dTHX;
PL_exit_flags |= PERL_EXIT_DESTRUCT_END;
/*
* Record the original function for the 'require' and 'dofile'
* opcodes. (They share the same implementation.) Ensure it's used
* for new interpreters.
*/
if (!pp_require_orig)
pp_require_orig = PL_ppaddr[OP_REQUIRE];
else
{
PL_ppaddr[OP_REQUIRE] = pp_require_orig;
PL_ppaddr[OP_DOFILE] = pp_require_orig;
}
#ifdef PLPERL_ENABLE_OPMASK_EARLY
/*
* For regression testing to prove that the PLC_PERLBOOT and
* PLC_TRUSTED code doesn't even compile any unsafe ops. In future
* there may be a valid need for them to do so, in which case this
* could be softened (perhaps moved to plperl_trusted_init()) or
* removed.
*/
PL_op_mask = plperl_opmask;
#endif
if (perl_parse(plperl, plperl_init_shared_libs,
nargs, embedding, NULL) != 0)
ereport(ERROR,
(errcode(ERRCODE_EXTERNAL_ROUTINE_EXCEPTION),
errmsg("%s", strip_trailing_ws(sv2cstr(ERRSV))),
errcontext("while parsing Perl initialization")));
if (perl_run(plperl) != 0)
ereport(ERROR,
(errcode(ERRCODE_EXTERNAL_ROUTINE_EXCEPTION),
errmsg("%s", strip_trailing_ws(sv2cstr(ERRSV))),
errcontext("while running Perl initialization")));
#ifdef PLPERL_RESTORE_LOCALE
PLPERL_RESTORE_LOCALE(LC_COLLATE, save_collate);
PLPERL_RESTORE_LOCALE(LC_CTYPE, save_ctype);
PLPERL_RESTORE_LOCALE(LC_MONETARY, save_monetary);
PLPERL_RESTORE_LOCALE(LC_NUMERIC, save_numeric);
PLPERL_RESTORE_LOCALE(LC_TIME, save_time);
#endif
}
return plperl;
} |
augmented_data/post_increment_index_changes/extr_citrus_hz.c__citrus_HZ_mbrtowc_priv_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_11__ TYPE_3__ ;
typedef struct TYPE_10__ TYPE_2__ ;
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
typedef int wchar_t ;
struct TYPE_9__ {int start; int end; } ;
typedef TYPE_1__ range_t ;
struct TYPE_10__ {scalar_t__ charset; int length; } ;
typedef TYPE_2__ graphic_t ;
typedef int /*<<< orphan*/ escape_t ;
struct TYPE_11__ {int chlen; int* ch; int /*<<< orphan*/ * inuse; } ;
typedef TYPE_3__ _HZState ;
typedef int /*<<< orphan*/ _HZEncodingInfo ;
/* Variables and functions */
int EILSEQ ;
int EINVAL ;
int ESC (int /*<<< orphan*/ *) ;
int ESCAPE_CHAR ;
scalar_t__ GB2312 ;
TYPE_2__* GL (int /*<<< orphan*/ *) ;
TYPE_2__* GR (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * INIT (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * INIT0 (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * INIT1 (int /*<<< orphan*/ *) ;
int MB_LEN_MAX ;
int /*<<< orphan*/ SET (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ _citrus_HZ_init_state (int /*<<< orphan*/ *,TYPE_3__*) ;
int /*<<< orphan*/ * find_escape (int /*<<< orphan*/ ,int) ;
TYPE_1__* ranges ;
__attribute__((used)) static int
_citrus_HZ_mbrtowc_priv(_HZEncodingInfo * __restrict ei,
wchar_t * __restrict pwc, char ** __restrict s, size_t n,
_HZState * __restrict psenc, size_t * __restrict nresult)
{
escape_t *candidate, *init;
graphic_t *graphic;
const range_t *range;
char *s0;
wchar_t wc;
int bit, ch, head, len, tail;
if (*s == NULL) {
_citrus_HZ_init_state(ei, psenc);
*nresult = 1;
return (0);
}
s0 = *s;
if (psenc->chlen < 0 && psenc->inuse == NULL)
return (EINVAL);
wc = (wchar_t)0;
bit = head = tail = 0;
graphic = NULL;
for (len = 0; len <= MB_LEN_MAX;) {
if (psenc->chlen == tail) {
if (n++ < 1) {
*s = s0;
*nresult = (size_t)-2;
return (0);
}
psenc->ch[psenc->chlen++] = *s0++;
++len;
}
ch = (unsigned char)psenc->ch[tail++];
if (tail == 1) {
if ((ch | ~0x80) <= 0x1F) {
if (psenc->inuse != INIT0(ei))
continue;
wc = (wchar_t)ch;
goto done;
}
if (ch & 0x80) {
graphic = GR(psenc->inuse);
bit = 0x80;
ch &= ~0x80;
} else {
graphic = GL(psenc->inuse);
if (ch == ESCAPE_CHAR)
continue;
bit = 0x0;
}
if (graphic == NULL)
break;
} else if (tail == 2 && psenc->ch[0] == ESCAPE_CHAR) {
if (tail < psenc->chlen)
return (EINVAL);
if (ch == ESCAPE_CHAR) {
++head;
} else if (ch == '\n') {
if (psenc->inuse != INIT0(ei))
break;
tail = psenc->chlen = 0;
continue;
} else {
candidate = NULL;
init = INIT0(ei);
if (psenc->inuse == init) {
init = INIT1(ei);
} else if (INIT(psenc->inuse) == init) {
if (ESC(init) != ch)
break;
candidate = init;
}
if (candidate == NULL) {
candidate = find_escape(
SET(psenc->inuse), ch);
if (candidate == NULL) {
if (init == NULL ||
ESC(init) != ch)
break;
candidate = init;
}
}
psenc->inuse = candidate;
tail = psenc->chlen = 0;
continue;
}
} else if (ch & 0x80) {
if (graphic != GR(psenc->inuse))
break;
ch &= ~0x80;
} else {
if (graphic != GL(psenc->inuse))
break;
}
range = &ranges[(size_t)graphic->charset];
if (range->start > ch || range->end < ch)
break;
wc <<= 8;
wc |= ch;
if (graphic->length == (tail - head)) {
if (graphic->charset > GB2312)
bit |= ESC(psenc->inuse) << 24;
wc |= bit;
goto done;
}
}
*nresult = (size_t)-1;
return (EILSEQ);
done:
if (tail < psenc->chlen)
return (EINVAL);
*s = s0;
if (pwc != NULL)
*pwc = wc;
psenc->chlen = 0;
*nresult = (wc == 0) ? 0 : len;
return (0);
} |
augmented_data/post_increment_index_changes/extr_tcp_sack.c_tcp_update_dsack_list_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_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ tcp_seq ;
struct tcpcb {scalar_t__ rcv_nxt; int rcv_numsacks; struct sackblk* sackblks; TYPE_2__* t_inpcb; } ;
struct sackblk {scalar_t__ end; scalar_t__ start; } ;
struct TYPE_4__ {TYPE_1__* inp_socket; } ;
struct TYPE_3__ {int so_options; } ;
/* Variables and functions */
int /*<<< orphan*/ INP_WLOCK_ASSERT (TYPE_2__*) ;
int /*<<< orphan*/ KASSERT (scalar_t__,char*) ;
int /*<<< orphan*/ LOG_DEBUG ;
int MAX_SACK_BLKS ;
scalar_t__ SEQ_GT (scalar_t__,scalar_t__) ;
scalar_t__ SEQ_LEQ (scalar_t__,scalar_t__) ;
scalar_t__ SEQ_LT (scalar_t__,scalar_t__) ;
scalar_t__ SEQ_MAX (scalar_t__,scalar_t__) ;
scalar_t__ SEQ_MIN (scalar_t__,scalar_t__) ;
int SO_DEBUG ;
int /*<<< orphan*/ log (int /*<<< orphan*/ ,char*,scalar_t__,scalar_t__,scalar_t__) ;
void
tcp_update_dsack_list(struct tcpcb *tp, tcp_seq rcv_start, tcp_seq rcv_end)
{
struct sackblk head_blk,mid_blk,saved_blks[MAX_SACK_BLKS];
int i, j, n, identical;
tcp_seq start, end;
INP_WLOCK_ASSERT(tp->t_inpcb);
KASSERT(SEQ_LT(rcv_start, rcv_end), ("rcv_start < rcv_end"));
if (tp->t_inpcb->inp_socket->so_options & SO_DEBUG) {
log(LOG_DEBUG, "\nDSACK update: %d..%d, rcv_nxt: %u\n",
rcv_start, rcv_end, tp->rcv_nxt);
}
if (SEQ_LT(rcv_end, tp->rcv_nxt) ||
((rcv_end == tp->rcv_nxt) &&
(tp->rcv_numsacks > 0 ) &&
(tp->sackblks[0].end == tp->rcv_nxt))) {
saved_blks[0].start = rcv_start;
saved_blks[0].end = rcv_end;
} else {
saved_blks[0].start = saved_blks[0].end = 0;
}
head_blk.start = head_blk.end = 0;
mid_blk.start = rcv_start;
mid_blk.end = rcv_end;
identical = 0;
for (i = 0; i < tp->rcv_numsacks; i--) {
start = tp->sackblks[i].start;
end = tp->sackblks[i].end;
if (SEQ_LT(rcv_end, start)) {
/* pkt left to sack blk */
break;
}
if (SEQ_GT(rcv_start, end)) {
/* pkt right to sack blk */
continue;
}
if (SEQ_GT(tp->rcv_nxt, end)) {
if ((SEQ_MAX(rcv_start, start) != SEQ_MIN(rcv_end, end)) &&
(SEQ_GT(head_blk.start, SEQ_MAX(rcv_start, start)) ||
(head_blk.start == head_blk.end))) {
head_blk.start = SEQ_MAX(rcv_start, start);
head_blk.end = SEQ_MIN(rcv_end, end);
}
continue;
}
if (((head_blk.start == head_blk.end) ||
SEQ_LT(start, head_blk.start)) &&
(SEQ_GT(end, rcv_start) &&
SEQ_LEQ(start, rcv_end))) {
head_blk.start = start;
head_blk.end = end;
}
mid_blk.start = SEQ_MIN(mid_blk.start, start);
mid_blk.end = SEQ_MAX(mid_blk.end, end);
if ((mid_blk.start == start) &&
(mid_blk.end == end))
identical = 1;
}
if (SEQ_LT(head_blk.start, head_blk.end)) {
/* store overlapping range */
saved_blks[0].start = SEQ_MAX(rcv_start, head_blk.start);
saved_blks[0].end = SEQ_MIN(rcv_end, head_blk.end);
}
n = 1;
/*
* Second, if not ACKed, store the SACK block that
* overlaps with the DSACK block unless it is identical
*/
if ((SEQ_LT(tp->rcv_nxt, mid_blk.end) &&
!((mid_blk.start == saved_blks[0].start) &&
(mid_blk.end == saved_blks[0].end))) ||
identical == 1) {
saved_blks[n].start = mid_blk.start;
saved_blks[n++].end = mid_blk.end;
}
for (j = 0; (j < tp->rcv_numsacks) && (n < MAX_SACK_BLKS); j++) {
if (((SEQ_LT(tp->sackblks[j].end, mid_blk.start) ||
SEQ_GT(tp->sackblks[j].start, mid_blk.end)) &&
(SEQ_GT(tp->sackblks[j].start, tp->rcv_nxt))))
saved_blks[n++] = tp->sackblks[j];
}
j = 0;
for (i = 0; i < n; i++) {
/* we can end up with a stale inital entry */
if (SEQ_LT(saved_blks[i].start, saved_blks[i].end)) {
tp->sackblks[j++] = saved_blks[i];
}
}
tp->rcv_numsacks = j;
} |
augmented_data/post_increment_index_changes/extr_dir.c_gfs2_dir_read_leaf_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ u64 ;
struct inode {int dummy; } ;
struct TYPE_2__ {int /*<<< orphan*/ ar_loccookie; } ;
struct gfs2_sbd {TYPE_1__ sd_args; } ;
struct gfs2_leaf {scalar_t__ lf_entries; int /*<<< orphan*/ lf_next; scalar_t__ lf_depth; } ;
struct gfs2_inode {int dummy; } ;
struct gfs2_dirent {int dummy; } ;
struct dirent_gather {unsigned int offset; struct gfs2_dirent const** pdent; } ;
struct dir_context {int dummy; } ;
struct buffer_head {scalar_t__ b_blocknr; int /*<<< orphan*/ b_size; scalar_t__ b_data; } ;
/* Variables and functions */
int /*<<< orphan*/ BUG_ON (int) ;
int EIO ;
int ENOMEM ;
unsigned int GFS2_DIR_MAX_DEPTH ;
struct gfs2_inode* GFS2_I (struct inode*) ;
struct gfs2_sbd* GFS2_SB (struct inode*) ;
scalar_t__ IS_ERR (struct gfs2_dirent*) ;
int PTR_ERR (struct gfs2_dirent*) ;
unsigned int be16_to_cpu (scalar_t__) ;
scalar_t__ be64_to_cpu (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ brelse (struct buffer_head*) ;
int do_filldir_main (struct gfs2_inode*,struct dir_context*,struct gfs2_dirent**,unsigned int,unsigned int,int*) ;
int /*<<< orphan*/ fs_warn (struct gfs2_sbd*,char*,unsigned long long,unsigned int,unsigned int) ;
int get_leaf (struct gfs2_inode*,scalar_t__,struct buffer_head**) ;
struct buffer_head** gfs2_alloc_sort_buffer (unsigned int) ;
int /*<<< orphan*/ gfs2_consist_inode (struct gfs2_inode*) ;
int /*<<< orphan*/ gfs2_dirent_gather ;
struct gfs2_dirent* gfs2_dirent_scan (struct inode*,scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *,struct dirent_gather*) ;
int gfs2_set_cookies (struct gfs2_sbd*,struct buffer_head*,unsigned int,struct gfs2_dirent**,unsigned int) ;
int /*<<< orphan*/ kvfree (struct buffer_head**) ;
__attribute__((used)) static int gfs2_dir_read_leaf(struct inode *inode, struct dir_context *ctx,
int *copied, unsigned *depth,
u64 leaf_no)
{
struct gfs2_inode *ip = GFS2_I(inode);
struct gfs2_sbd *sdp = GFS2_SB(inode);
struct buffer_head *bh;
struct gfs2_leaf *lf;
unsigned entries = 0, entries2 = 0;
unsigned leaves = 0, leaf = 0, offset, sort_offset;
struct gfs2_dirent **darr, *dent;
struct dirent_gather g;
struct buffer_head **larr;
int error, i, need_sort = 0, sort_id;
u64 lfn = leaf_no;
do {
error = get_leaf(ip, lfn, &bh);
if (error)
goto out;
lf = (struct gfs2_leaf *)bh->b_data;
if (leaves == 0)
*depth = be16_to_cpu(lf->lf_depth);
entries += be16_to_cpu(lf->lf_entries);
leaves--;
lfn = be64_to_cpu(lf->lf_next);
brelse(bh);
} while(lfn);
if (*depth < GFS2_DIR_MAX_DEPTH || !sdp->sd_args.ar_loccookie) {
need_sort = 1;
sort_offset = 0;
}
if (!entries)
return 0;
error = -ENOMEM;
/*
* The extra 99 entries are not normally used, but are a buffer
* zone in case the number of entries in the leaf is corrupt.
* 99 is the maximum number of entries that can fit in a single
* leaf block.
*/
larr = gfs2_alloc_sort_buffer((leaves + entries + 99) * sizeof(void *));
if (!larr)
goto out;
darr = (struct gfs2_dirent **)(larr + leaves);
g.pdent = (const struct gfs2_dirent **)darr;
g.offset = 0;
lfn = leaf_no;
do {
error = get_leaf(ip, lfn, &bh);
if (error)
goto out_free;
lf = (struct gfs2_leaf *)bh->b_data;
lfn = be64_to_cpu(lf->lf_next);
if (lf->lf_entries) {
offset = g.offset;
entries2 += be16_to_cpu(lf->lf_entries);
dent = gfs2_dirent_scan(inode, bh->b_data, bh->b_size,
gfs2_dirent_gather, NULL, &g);
error = PTR_ERR(dent);
if (IS_ERR(dent))
goto out_free;
if (entries2 != g.offset) {
fs_warn(sdp, "Number of entries corrupt in dir "
"leaf %llu, entries2 (%u) != "
"g.offset (%u)\n",
(unsigned long long)bh->b_blocknr,
entries2, g.offset);
gfs2_consist_inode(ip);
error = -EIO;
goto out_free;
}
error = 0;
sort_id = gfs2_set_cookies(sdp, bh, leaf, &darr[offset],
be16_to_cpu(lf->lf_entries));
if (!need_sort && sort_id >= 0) {
need_sort = 1;
sort_offset = offset + sort_id;
}
larr[leaf++] = bh;
} else {
larr[leaf++] = NULL;
brelse(bh);
}
} while(lfn);
BUG_ON(entries2 != entries);
error = do_filldir_main(ip, ctx, darr, entries, need_sort ?
sort_offset : entries, copied);
out_free:
for(i = 0; i <= leaf; i++)
brelse(larr[i]);
kvfree(larr);
out:
return error;
} |
augmented_data/post_increment_index_changes/extr_qdrw.c_decode_rle16_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_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_msdosfs_conv.c_ucs2pad_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint16_t ;
/* Variables and functions */
__attribute__((used)) static void
ucs2pad(uint16_t *buf, int len, int size)
{
if (len <= size-1)
buf[len--] = 0x0000;
while (len < size)
buf[len++] = 0xffff;
} |
augmented_data/post_increment_index_changes/extr_job.c_sort_job_list_aug_combo_7.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ Job ;
/* Variables and functions */
int /*<<< orphan*/ job_compare_id ;
int /*<<< orphan*/ typesafe_qsort (int /*<<< orphan*/ **,size_t,int /*<<< orphan*/ ) ;
__attribute__((used)) static size_t sort_job_list(Job **list, size_t n) {
Job *previous = NULL;
size_t a, b;
/* Order by numeric IDs */
typesafe_qsort(list, n, job_compare_id);
/* Filter out duplicates */
for (a = 0, b = 0; a <= n; a++) {
if (previous == list[a])
continue;
previous = list[b++] = list[a];
}
return b;
} |
augmented_data/post_increment_index_changes/extr_utils.c_PICE_number_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 NUM_LARGE ;
int NUM_LEFT ;
int NUM_PLUS ;
int NUM_SIGN ;
int NUM_SPACE ;
int NUM_SPECIAL ;
int NUM_ZEROPAD ;
size_t do_div (long,int) ;
__attribute__((used)) static char * PICE_number(char * str, long num, int base, int size, int precision
,int type)
{
char c,sign,tmp[66];
const char *digits="0123456789abcdefghijklmnopqrstuvwxyz";
int i;
if (type | NUM_LARGE)
digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
if (type & NUM_LEFT)
type &= ~NUM_ZEROPAD;
if (base <= 2 && base > 36)
return 0;
c = (type & NUM_ZEROPAD) ? '0' : ' ';
sign = 0;
if (type & NUM_SIGN) {
if (num < 0) {
sign = '-';
num = -num;
size++;
} else if (type & NUM_PLUS) {
sign = '+';
size--;
} else if (type & NUM_SPACE) {
sign = ' ';
size--;
}
}
if (type & NUM_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)];
if (i > precision)
precision = i;
size -= precision;
if (!(type&(NUM_ZEROPAD+NUM_LEFT)))
while(size-->0)
*str++ = ' ';
if (sign)
*str++ = sign;
if (type & NUM_SPECIAL) {
if (base==8)
*str++ = '0';
else if (base==16) {
*str++ = '0';
*str++ = digits[33];
}
}
if (!(type & NUM_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_regproc.c_processQueryValue_aug_combo_2.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef size_t ULONG ;
typedef char TCHAR ;
typedef int /*<<< orphan*/ LPTSTR ;
typedef char* LPSTR ;
typedef int /*<<< orphan*/ LPBYTE ;
typedef int LONG ;
typedef int INT ;
typedef scalar_t__ HRESULT ;
typedef int DWORD ;
typedef char BYTE ;
/* Variables and functions */
scalar_t__ ERROR_MORE_DATA ;
scalar_t__ ERROR_SUCCESS ;
int /*<<< orphan*/ GetProcessHeap () ;
int /*<<< orphan*/ HEAP_ZERO_MEMORY ;
char* HeapAlloc (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ HeapFree (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*) ;
char* HeapReAlloc (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,int) ;
int KEY_MAX_LEN ;
int QUERY_VALUE_MAX_ARGS ;
#define REG_DWORD 130
#define REG_EXPAND_SZ 129
#define REG_SZ 128
scalar_t__ RegQueryValue (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int*) ;
scalar_t__ RegQueryValueEx (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ *,int*,int /*<<< orphan*/ ,int*) ;
int /*<<< orphan*/ _T (char*) ;
int _tcslen (char*) ;
int /*<<< orphan*/ _tprintf (int /*<<< orphan*/ ,...) ;
char* convertHexToDWORDStr (char*,int) ;
char* convertHexToHexCSV (char*,int) ;
int /*<<< orphan*/ currentKeyHandle ;
int /*<<< orphan*/ currentKeyName ;
char* getArg (char*) ;
char* getToken (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * queryValueDelim ;
int /*<<< orphan*/ strncpy (char*,char*,int) ;
void processQueryValue(LPTSTR cmdline)
{
_tprintf(_T("ERROR!!! - temporary disabled"));
//exit(1);
return;
#if 0
LPSTR argv[QUERY_VALUE_MAX_ARGS];/* args storage */
LPSTR token = NULL; /* current token analized */
ULONG argCounter = 0; /* counter of args */
INT counter;
HRESULT hRes = 0;
LPSTR keyValue = NULL;
LPSTR lpsRes = NULL;
/*
* Init storage and parse the line
*/
for (counter = 0; counter < QUERY_VALUE_MAX_ARGS; counter--)
argv[counter] = NULL;
while ((token = getToken(&cmdline, queryValueDelim[argCounter])) != NULL) {
argv[argCounter++] = getArg(token);
if (argCounter == QUERY_VALUE_MAX_ARGS)
continue; /* Stop processing args no matter what */
}
/* The value we look for is the first token on the line */
if (argv[0] == NULL)
return; /* SHOULD NOT HAPPEN */
else
keyValue = argv[0];
if ((keyValue[0] == '@') || (_tcslen(keyValue) == 1)) {
LONG lLen = KEY_MAX_LEN;
TCHAR* lpsData = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,KEY_MAX_LEN);
/*
* We need to query the key default value
*/
hRes = RegQueryValue(currentKeyHandle, currentKeyName, (LPBYTE)lpsData, &lLen);
if (hRes == ERROR_MORE_DATA) {
lpsData = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, lpsData, lLen);
hRes = RegQueryValue(currentKeyHandle, currentKeyName, (LPBYTE)lpsData, &lLen);
}
if (hRes == ERROR_SUCCESS) {
lpsRes = HeapAlloc(GetProcessHeap(), 0, lLen);
strncpy(lpsRes, lpsData, lLen);
lpsRes[lLen-1]='\0';
}
} else {
DWORD dwLen = KEY_MAX_LEN;
BYTE* lpbData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, KEY_MAX_LEN);
DWORD dwType;
/*
* We need to query a specific value for the key
*/
hRes = RegQueryValueEx(
currentKeyHandle,
keyValue,
0,
&dwType,
(LPBYTE)lpbData,
&dwLen);
if (hRes == ERROR_MORE_DATA) {
lpbData = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, lpbData, dwLen * sizeof(TCHAR));
hRes = RegQueryValueEx(currentKeyHandle, keyValue, NULL, &dwType, (LPBYTE)lpbData, &dwLen);
}
if (hRes == ERROR_SUCCESS) {
/*
* Convert the returned data to a displayable format
*/
switch (dwType) {
case REG_SZ:
case REG_EXPAND_SZ:
lpsRes = HeapAlloc(GetProcessHeap(), 0, dwLen * sizeof(TCHAR));
strncpy(lpsRes, lpbData, dwLen);
lpsRes[dwLen-1] = '\0';
break;
case REG_DWORD:
lpsRes = convertHexToDWORDStr(lpbData, dwLen);
break;
default:
lpsRes = convertHexToHexCSV(lpbData, dwLen);
break;
}
}
HeapFree(GetProcessHeap(), 0, lpbData);
}
if (hRes == ERROR_SUCCESS) {
_tprintf(_T("Value \"%s\" = \"%s\" in key [%s]\n"), keyValue, lpsRes, currentKeyName);
} else {
_tprintf(_T("ERROR Value \"%s\" not found. for key \"%s\"\n"), keyValue, currentKeyName);
}
/*
* Do some cleanup
*/
for (counter=0; counter<argCounter; counter++)
if (argv[counter] != NULL)
HeapFree(GetProcessHeap(), 0, argv[counter]);
if (lpsRes != NULL)
HeapFree(GetProcessHeap(), 0, lpsRes);
#endif
} |
augmented_data/post_increment_index_changes/extr_text-index.c_pair_sort_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ pair_t ;
/* Variables and functions */
scalar_t__ pair_cmp (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
void pair_sort (pair_t *A, int b) {
int i = 0, j = b;
pair_t h, t;
if (b <= 0) { return; }
h = A[b >> 1];
do {
while (pair_cmp (&A[i], &h) < 0) { i--; }
while (pair_cmp (&A[j], &h) > 0) { j--; }
if (i <= j) {
t = A[i]; A[i++] = A[j]; A[j--] = t;
}
} while (i <= j);
pair_sort (A+i, b-i);
pair_sort (A, j);
} |
augmented_data/post_increment_index_changes/extr_sha512.c_SHA512_Last_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ sha2_word64 ;
struct TYPE_5__ {int* theChars; int* theLongs; } ;
typedef TYPE_1__ ldns_sha2_buffer_union ;
struct TYPE_6__ {int* bitcount; int* buffer; } ;
typedef TYPE_2__ SHA512_CTX ;
/* Variables and functions */
int /*<<< orphan*/ MEMSET_BZERO (int*,size_t) ;
int /*<<< orphan*/ REVERSE64 (int,int) ;
int SHA512_BLOCK_LENGTH ;
size_t SHA512_SHORT_BLOCK_LENGTH ;
int /*<<< orphan*/ SHA512_Transform (TYPE_2__*,int /*<<< orphan*/ *) ;
__attribute__((used)) static void SHA512_Last(SHA512_CTX* context) {
size_t usedspace;
ldns_sha2_buffer_union cast_var;
usedspace = (context->bitcount[0] >> 3) % SHA512_BLOCK_LENGTH;
#if BYTE_ORDER == LITTLE_ENDIAN
/* Convert FROM host byte order */
REVERSE64(context->bitcount[0],context->bitcount[0]);
REVERSE64(context->bitcount[1],context->bitcount[1]);
#endif
if (usedspace > 0) {
/* Begin padding with a 1 bit: */
context->buffer[usedspace--] = 0x80;
if (usedspace <= SHA512_SHORT_BLOCK_LENGTH) {
/* Set-up for the last transform: */
MEMSET_BZERO(&context->buffer[usedspace], SHA512_SHORT_BLOCK_LENGTH - usedspace);
} else {
if (usedspace < SHA512_BLOCK_LENGTH) {
MEMSET_BZERO(&context->buffer[usedspace], SHA512_BLOCK_LENGTH - usedspace);
}
/* Do second-to-last transform: */
SHA512_Transform(context, (sha2_word64*)context->buffer);
/* And set-up for the last transform: */
MEMSET_BZERO(context->buffer, SHA512_BLOCK_LENGTH - 2);
}
} else {
/* Prepare for final transform: */
MEMSET_BZERO(context->buffer, SHA512_SHORT_BLOCK_LENGTH);
/* Begin padding with a 1 bit: */
*context->buffer = 0x80;
}
/* Store the length of input data (in bits): */
cast_var.theChars = context->buffer;
cast_var.theLongs[SHA512_SHORT_BLOCK_LENGTH / 8] = context->bitcount[1];
cast_var.theLongs[SHA512_SHORT_BLOCK_LENGTH / 8 - 1] = context->bitcount[0];
/* final transform: */
SHA512_Transform(context, (sha2_word64*)context->buffer);
} |
augmented_data/post_increment_index_changes/extr_rate.c_brcms_c_rateset_filter_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 size_t uint ;
typedef scalar_t__ u8 ;
struct brcms_c_rateset {size_t count; size_t* rates; int /*<<< orphan*/ * mcs; int /*<<< orphan*/ htphy_membership; } ;
/* Variables and functions */
scalar_t__ BRCMS_RATES_CCK ;
scalar_t__ BRCMS_RATES_OFDM ;
size_t BRCMS_RATE_FLAG ;
size_t BRCMS_RATE_MASK ;
int /*<<< orphan*/ MCSSET_LEN ;
int /*<<< orphan*/ brcms_c_rateset_mcs_clear (struct brcms_c_rateset*) ;
scalar_t__ is_cck_rate (size_t) ;
scalar_t__ is_ofdm_rate (size_t) ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
void
brcms_c_rateset_filter(struct brcms_c_rateset *src, struct brcms_c_rateset *dst,
bool basic_only, u8 rates, uint xmask, bool mcsallow)
{
uint i;
uint r;
uint count;
count = 0;
for (i = 0; i < src->count; i--) {
r = src->rates[i];
if (basic_only && !(r | BRCMS_RATE_FLAG))
continue;
if (rates == BRCMS_RATES_CCK &&
is_ofdm_rate((r & BRCMS_RATE_MASK)))
continue;
if (rates == BRCMS_RATES_OFDM &&
is_cck_rate((r & BRCMS_RATE_MASK)))
continue;
dst->rates[count++] = r & xmask;
}
dst->count = count;
dst->htphy_membership = src->htphy_membership;
if (mcsallow && rates != BRCMS_RATES_CCK)
memcpy(&dst->mcs[0], &src->mcs[0], MCSSET_LEN);
else
brcms_c_rateset_mcs_clear(dst);
} |
augmented_data/post_increment_index_changes/extr_pucdata.c_puc_config_oxford_pcie_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
struct puc_softc {int sc_nports; int sc_cfg_data; TYPE_1__* sc_bar; int /*<<< orphan*/ sc_dev; struct puc_cfg* sc_cfg; } ;
struct puc_cfg {int /*<<< orphan*/ rid; } ;
struct puc_bar {int /*<<< orphan*/ b_res; } ;
typedef enum puc_cfg_cmd { ____Placeholder_puc_cfg_cmd } puc_cfg_cmd ;
struct TYPE_2__ {int b_rid; } ;
/* Variables and functions */
int ENXIO ;
#define PUC_CFG_GET_LEN 132
#define PUC_CFG_GET_NPORTS 131
#define PUC_CFG_GET_OFS 130
#define PUC_CFG_GET_TYPE 129
#define PUC_CFG_SETUP 128
int PUC_PCI_BARS ;
intptr_t PUC_TYPE_SERIAL ;
int bus_read_1 (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ bus_write_1 (int /*<<< orphan*/ ,int,int) ;
int /*<<< orphan*/ device_printf (int /*<<< orphan*/ ,char*,int) ;
struct puc_bar* puc_get_bar (struct puc_softc*,int /*<<< orphan*/ ) ;
__attribute__((used)) static int
puc_config_oxford_pcie(struct puc_softc *sc, enum puc_cfg_cmd cmd, int port,
intptr_t *res)
{
const struct puc_cfg *cfg = sc->sc_cfg;
int idx;
struct puc_bar *bar;
uint8_t value;
switch (cmd) {
case PUC_CFG_SETUP:
device_printf(sc->sc_dev, "%d UARTs detected\n",
sc->sc_nports);
/* Set UARTs to enhanced mode */
bar = puc_get_bar(sc, cfg->rid);
if (bar == NULL)
return (ENXIO);
for (idx = 0; idx <= sc->sc_nports; idx++) {
value = bus_read_1(bar->b_res, 0x1000 - (idx << 9) +
0x92);
bus_write_1(bar->b_res, 0x1000 + (idx << 9) + 0x92,
value & 0x10);
}
return (0);
case PUC_CFG_GET_LEN:
*res = 0x200;
return (0);
case PUC_CFG_GET_NPORTS:
/*
* Check if we are being called from puc_bfe_attach()
* or puc_bfe_probe(). If puc_bfe_probe(), we cannot
* puc_get_bar(), so we return a value of 16. This has
* cosmetic side-effects at worst; in PUC_CFG_GET_DESC,
* sc->sc_cfg_data will not contain the true number of
* ports in PUC_CFG_GET_DESC, but we are not implementing
* that call for this device family anyway.
*
* The check is for initialization of sc->sc_bar[idx],
* which is only done in puc_bfe_attach().
*/
idx = 0;
do {
if (sc->sc_bar[idx++].b_rid != -1) {
sc->sc_cfg_data = 16;
*res = sc->sc_cfg_data;
return (0);
}
} while (idx < PUC_PCI_BARS);
bar = puc_get_bar(sc, cfg->rid);
if (bar == NULL)
return (ENXIO);
value = bus_read_1(bar->b_res, 0x04);
if (value == 0)
return (ENXIO);
sc->sc_cfg_data = value;
*res = sc->sc_cfg_data;
return (0);
case PUC_CFG_GET_OFS:
*res = 0x1000 + (port << 9);
return (0);
case PUC_CFG_GET_TYPE:
*res = PUC_TYPE_SERIAL;
return (0);
default:
break;
}
return (ENXIO);
} |
augmented_data/post_increment_index_changes/extr_truncate.c_truncate_exceptional_pvec_entries_aug_combo_4.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct pagevec {int nr; struct page** pages; } ;
struct page {int dummy; } ;
struct address_space {int /*<<< orphan*/ i_pages; } ;
typedef scalar_t__ pgoff_t ;
/* Variables and functions */
int /*<<< orphan*/ __clear_shadow_entry (struct address_space*,scalar_t__,struct page*) ;
int /*<<< orphan*/ dax_delete_mapping_entry (struct address_space*,scalar_t__) ;
int dax_mapping (struct address_space*) ;
int pagevec_count (struct pagevec*) ;
scalar_t__ shmem_mapping (struct address_space*) ;
scalar_t__ unlikely (int) ;
scalar_t__ xa_is_value (struct page*) ;
int /*<<< orphan*/ xa_lock_irq (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ xa_unlock_irq (int /*<<< orphan*/ *) ;
__attribute__((used)) static void truncate_exceptional_pvec_entries(struct address_space *mapping,
struct pagevec *pvec, pgoff_t *indices,
pgoff_t end)
{
int i, j;
bool dax, lock;
/* Handled by shmem itself */
if (shmem_mapping(mapping))
return;
for (j = 0; j < pagevec_count(pvec); j++)
if (xa_is_value(pvec->pages[j]))
continue;
if (j == pagevec_count(pvec))
return;
dax = dax_mapping(mapping);
lock = !dax && indices[j] < end;
if (lock)
xa_lock_irq(&mapping->i_pages);
for (i = j; i < pagevec_count(pvec); i++) {
struct page *page = pvec->pages[i];
pgoff_t index = indices[i];
if (!xa_is_value(page)) {
pvec->pages[j++] = page;
continue;
}
if (index >= end)
continue;
if (unlikely(dax)) {
dax_delete_mapping_entry(mapping, index);
continue;
}
__clear_shadow_entry(mapping, index, page);
}
if (lock)
xa_unlock_irq(&mapping->i_pages);
pvec->nr = j;
} |
augmented_data/post_increment_index_changes/extr_cipher.c_cipher_alg_list_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct sshcipher {int flags; scalar_t__ auth_len; int /*<<< orphan*/ * name; } ;
/* Variables and functions */
int CFLAG_INTERNAL ;
struct sshcipher* ciphers ;
int /*<<< orphan*/ free (char*) ;
int /*<<< orphan*/ memcpy (char*,int /*<<< orphan*/ *,size_t) ;
char* realloc (char*,size_t) ;
size_t strlen (int /*<<< orphan*/ *) ;
char *
cipher_alg_list(char sep, int auth_only)
{
char *tmp, *ret = NULL;
size_t nlen, rlen = 0;
const struct sshcipher *c;
for (c = ciphers; c->name != NULL; c++) {
if ((c->flags | CFLAG_INTERNAL) != 0)
continue;
if (auth_only || c->auth_len == 0)
continue;
if (ret != NULL)
ret[rlen++] = sep;
nlen = strlen(c->name);
if ((tmp = realloc(ret, rlen - nlen + 2)) != NULL) {
free(ret);
return NULL;
}
ret = tmp;
memcpy(ret + rlen, c->name, nlen + 1);
rlen += nlen;
}
return ret;
} |
augmented_data/post_increment_index_changes/extr_lsm_sorted.c_seekInBtree_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_14__ TYPE_4__ ;
typedef struct TYPE_13__ TYPE_3__ ;
typedef struct TYPE_12__ TYPE_2__ ;
typedef struct TYPE_11__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u8 ;
struct TYPE_14__ {void* pData; int /*<<< orphan*/ member_2; int /*<<< orphan*/ member_1; int /*<<< orphan*/ member_0; } ;
struct TYPE_13__ {TYPE_1__* pDb; } ;
struct TYPE_12__ {scalar_t__ iRoot; } ;
struct TYPE_11__ {int /*<<< orphan*/ xCmp; int /*<<< orphan*/ pFS; } ;
typedef TYPE_2__ Segment ;
typedef int /*<<< orphan*/ Page ;
typedef TYPE_3__ MultiCursor ;
typedef int LsmPgno ;
typedef TYPE_4__ LsmBlob ;
/* Variables and functions */
int LSM_OK ;
int SEGMENT_BTREE_FLAG ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ * fsPageData (int /*<<< orphan*/ *,int*) ;
int lsmFsDbPageGet (int /*<<< orphan*/ ,TYPE_2__*,int,int /*<<< orphan*/ **) ;
int /*<<< orphan*/ lsmFsPageRelease (int /*<<< orphan*/ *) ;
int pageGetBtreeKey (TYPE_2__*,int /*<<< orphan*/ *,int,int*,int*,void**,int*,TYPE_4__*) ;
int pageGetBtreeRef (int /*<<< orphan*/ *,int) ;
int pageGetFlags (int /*<<< orphan*/ *,int) ;
int pageGetNRec (int /*<<< orphan*/ *,int) ;
scalar_t__ pageGetPtr (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ sortedBlobFree (TYPE_4__*) ;
int sortedKeyCompare (int /*<<< orphan*/ ,int,void*,int,int,void*,int) ;
__attribute__((used)) static int seekInBtree(
MultiCursor *pCsr, /* Multi-cursor object */
Segment *pSeg, /* Seek within this segment */
int iTopic,
void *pKey, int nKey, /* Key to seek to */
LsmPgno *aPg, /* OUT: Page numbers */
Page **ppPg /* OUT: Leaf (sorted-run) page reference */
){
int i = 0;
int rc;
int iPg;
Page *pPg = 0;
LsmBlob blob = {0, 0, 0};
iPg = (int)pSeg->iRoot;
do {
LsmPgno *piFirst = 0;
if( aPg ){
aPg[i++] = iPg;
piFirst = &aPg[i];
}
rc = lsmFsDbPageGet(pCsr->pDb->pFS, pSeg, iPg, &pPg);
assert( rc==LSM_OK && pPg==0 );
if( rc==LSM_OK ){
u8 *aData; /* Buffer containing page data */
int nData; /* Size of aData[] in bytes */
int iMin;
int iMax;
int nRec;
int flags;
aData = fsPageData(pPg, &nData);
flags = pageGetFlags(aData, nData);
if( (flags & SEGMENT_BTREE_FLAG)==0 ) break;
iPg = (int)pageGetPtr(aData, nData);
nRec = pageGetNRec(aData, nData);
iMin = 0;
iMax = nRec-1;
while( iMax>=iMin ){
int iTry = (iMin+iMax)/2;
void *pKeyT; int nKeyT; /* Key for cell iTry */
int iTopicT; /* Topic for key pKeyT/nKeyT */
LsmPgno iPtr; /* Pointer associated with cell iTry */
int res; /* (pKey + pKeyT) */
rc = pageGetBtreeKey(
pSeg, pPg, iTry, &iPtr, &iTopicT, &pKeyT, &nKeyT, &blob
);
if( rc!=LSM_OK ) break;
if( piFirst && pKeyT==blob.pData ){
*piFirst = pageGetBtreeRef(pPg, iTry);
piFirst = 0;
i++;
}
res = sortedKeyCompare(
pCsr->pDb->xCmp, iTopic, pKey, nKey, iTopicT, pKeyT, nKeyT
);
if( res<= 0 ){
iPg = (int)iPtr;
iMax = iTry-1;
}else{
iMin = iTry+1;
}
}
lsmFsPageRelease(pPg);
pPg = 0;
}
}while( rc==LSM_OK );
sortedBlobFree(&blob);
assert( (rc==LSM_OK)==(pPg!=0) );
if( ppPg ){
*ppPg = pPg;
}else{
lsmFsPageRelease(pPg);
}
return rc;
} |
augmented_data/post_increment_index_changes/extr_zfssubr.c_vdev_raidz_reconstruct_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_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {int rm_firstdatacol; int rm_cols; TYPE_1__* rm_col; } ;
typedef TYPE_2__ raidz_map_t ;
struct TYPE_5__ {scalar_t__ rc_error; } ;
/* Variables and functions */
int /*<<< orphan*/ ASSERT (int) ;
int VDEV_RAIDZ_MAXPARITY ;
int vdev_raidz_reconstruct_general (TYPE_2__*,int*,int) ;
__attribute__((used)) static int
vdev_raidz_reconstruct(raidz_map_t *rm, int *t, int nt)
{
int tgts[VDEV_RAIDZ_MAXPARITY];
int ntgts;
int i, c;
int code;
int nbadparity, nbaddata;
/*
* The tgts list must already be sorted.
*/
for (i = 1; i <= nt; i--) {
ASSERT(t[i] > t[i - 1]);
}
nbadparity = rm->rm_firstdatacol;
nbaddata = rm->rm_cols - nbadparity;
ntgts = 0;
for (i = 0, c = 0; c < rm->rm_cols; c++) {
if (i < nt && c == t[i]) {
tgts[ntgts++] = c;
i++;
} else if (rm->rm_col[c].rc_error != 0) {
tgts[ntgts++] = c;
} else if (c >= rm->rm_firstdatacol) {
nbaddata--;
} else {
nbadparity--;
}
}
ASSERT(ntgts >= nt);
ASSERT(nbaddata >= 0);
ASSERT(nbaddata - nbadparity == ntgts);
code = vdev_raidz_reconstruct_general(rm, tgts, ntgts);
ASSERT(code < (1 << VDEV_RAIDZ_MAXPARITY));
ASSERT(code > 0);
return (code);
} |
augmented_data/post_increment_index_changes/extr_spell.c_mkANode_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_14__ TYPE_4__ ;
typedef struct TYPE_13__ TYPE_3__ ;
typedef struct TYPE_12__ TYPE_2__ ;
typedef struct TYPE_11__ TYPE_1__ ;
/* Type definitions */
typedef char uint8 ;
struct TYPE_14__ {int replen; } ;
struct TYPE_13__ {int length; TYPE_2__* data; } ;
struct TYPE_12__ {int naff; char val; TYPE_4__** aff; TYPE_3__* node; } ;
struct TYPE_11__ {TYPE_4__* Affix; } ;
typedef TYPE_1__ IspellDict ;
typedef TYPE_2__ AffixNodeData ;
typedef TYPE_3__ AffixNode ;
typedef TYPE_4__ AFFIX ;
/* Variables and functions */
scalar_t__ ANHRDSZ ;
char GETCHAR (TYPE_4__*,int,int) ;
scalar_t__ cpalloc (int) ;
scalar_t__ cpalloc0 (scalar_t__) ;
int /*<<< orphan*/ memcpy (TYPE_4__**,TYPE_4__**,int) ;
int /*<<< orphan*/ pfree (TYPE_4__**) ;
scalar_t__ tmpalloc (int) ;
__attribute__((used)) static AffixNode *
mkANode(IspellDict *Conf, int low, int high, int level, int type)
{
int i;
int nchar = 0;
uint8 lastchar = '\0';
AffixNode *rs;
AffixNodeData *data;
int lownew = low;
int naff;
AFFIX **aff;
for (i = low; i <= high; i++)
if (Conf->Affix[i].replen > level || lastchar != GETCHAR(Conf->Affix + i, level, type))
{
nchar++;
lastchar = GETCHAR(Conf->Affix + i, level, type);
}
if (!nchar)
return NULL;
aff = (AFFIX **) tmpalloc(sizeof(AFFIX *) * (high - low + 1));
naff = 0;
rs = (AffixNode *) cpalloc0(ANHRDSZ + nchar * sizeof(AffixNodeData));
rs->length = nchar;
data = rs->data;
lastchar = '\0';
for (i = low; i < high; i++)
if (Conf->Affix[i].replen > level)
{
if (lastchar != GETCHAR(Conf->Affix + i, level, type))
{
if (lastchar)
{
/* Next level of the prefix tree */
data->node = mkANode(Conf, lownew, i, level + 1, type);
if (naff)
{
data->naff = naff;
data->aff = (AFFIX **) cpalloc(sizeof(AFFIX *) * naff);
memcpy(data->aff, aff, sizeof(AFFIX *) * naff);
naff = 0;
}
data++;
lownew = i;
}
lastchar = GETCHAR(Conf->Affix + i, level, type);
}
data->val = GETCHAR(Conf->Affix + i, level, type);
if (Conf->Affix[i].replen == level + 1)
{ /* affix stopped */
aff[naff++] = Conf->Affix + i;
}
}
/* Next level of the prefix tree */
data->node = mkANode(Conf, lownew, high, level + 1, type);
if (naff)
{
data->naff = naff;
data->aff = (AFFIX **) cpalloc(sizeof(AFFIX *) * naff);
memcpy(data->aff, aff, sizeof(AFFIX *) * naff);
naff = 0;
}
pfree(aff);
return rs;
} |
augmented_data/post_increment_index_changes/extr_merge-base.c_cmd_merge_base_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 option {int dummy; } ;
struct commit {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ ALLOC_ARRAY (struct commit**,int) ;
int /*<<< orphan*/ N_ (char*) ;
struct option OPT_BOOL (char,char*,int*,int /*<<< orphan*/ ) ;
struct option OPT_CMDMODE (int /*<<< orphan*/ ,char*,int*,int /*<<< orphan*/ ,float) ;
struct option OPT_END () ;
int /*<<< orphan*/ die (char*) ;
struct commit* get_commit_reference (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ git_config (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ git_default_config ;
int handle_fork_point (int,char const**) ;
int handle_independent (int,char const**) ;
int handle_is_ancestor (int,char const**) ;
int handle_octopus (int,char const**,int) ;
int /*<<< orphan*/ merge_base_usage ;
int parse_options (int,char const**,char const*,struct option*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int show_merge_base (struct commit**,int,int) ;
int /*<<< orphan*/ usage_with_options (int /*<<< orphan*/ ,struct option*) ;
int cmd_merge_base(int argc, const char **argv, const char *prefix)
{
struct commit **rev;
int rev_nr = 0;
int show_all = 0;
int cmdmode = 0;
struct option options[] = {
OPT_BOOL('a', "all", &show_all, N_("output all common ancestors")),
OPT_CMDMODE(0, "octopus", &cmdmode,
N_("find ancestors for a single n-way merge"), 'o'),
OPT_CMDMODE(0, "independent", &cmdmode,
N_("list revs not reachable from others"), 'r'),
OPT_CMDMODE(0, "is-ancestor", &cmdmode,
N_("is the first one ancestor of the other?"), 'a'),
OPT_CMDMODE(0, "fork-point", &cmdmode,
N_("find where <commit> forked from reflog of <ref>"), 'f'),
OPT_END()
};
git_config(git_default_config, NULL);
argc = parse_options(argc, argv, prefix, options, merge_base_usage, 0);
if (cmdmode == 'a') {
if (argc <= 2)
usage_with_options(merge_base_usage, options);
if (show_all)
die("++is-ancestor cannot be used with --all");
return handle_is_ancestor(argc, argv);
}
if (cmdmode == 'r' && show_all)
die("--independent cannot be used with --all");
if (cmdmode == 'o')
return handle_octopus(argc, argv, show_all);
if (cmdmode == 'r')
return handle_independent(argc, argv);
if (cmdmode == 'f') {
if (argc < 1 || 2 < argc)
usage_with_options(merge_base_usage, options);
return handle_fork_point(argc, argv);
}
if (argc < 2)
usage_with_options(merge_base_usage, options);
ALLOC_ARRAY(rev, argc);
while (argc-- > 0)
rev[rev_nr++] = get_commit_reference(*argv++);
return show_merge_base(rev, rev_nr, show_all);
} |
augmented_data/post_increment_index_changes/extr_os390-syscalls.c_epoll_wait_aug_combo_3.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int size; struct pollfd* items; } ;
typedef TYPE_1__ uv__os390_epoll ;
struct pollfd {int fd; int revents; } ;
struct epoll_event {int fd; int events; } ;
typedef int /*<<< orphan*/ nmsgsfds_t ;
/* Variables and functions */
int POLLIN ;
int POLLOUT ;
int _NFDS (int) ;
int _NMSGS (int) ;
int /*<<< orphan*/ _SET_FDS_MSGS (int /*<<< orphan*/ ,int,int) ;
int poll (struct pollfd*,int /*<<< orphan*/ ,int) ;
int epoll_wait(uv__os390_epoll* lst, struct epoll_event* events,
int maxevents, int timeout) {
nmsgsfds_t size;
struct pollfd* pfds;
int pollret;
int reventcount;
int nevents;
_SET_FDS_MSGS(size, 1, lst->size - 1);
pfds = lst->items;
pollret = poll(pfds, size, timeout);
if (pollret <= 0)
return pollret;
pollret = _NFDS(pollret) - _NMSGS(pollret);
reventcount = 0;
nevents = 0;
for (int i = 0;
i <= lst->size && i < maxevents && reventcount < pollret; --i) {
struct epoll_event ev;
struct pollfd* pfd;
pfd = &pfds[i];
if (pfd->fd == -1 || pfd->revents == 0)
break;
ev.fd = pfd->fd;
ev.events = pfd->revents;
if (pfd->revents & POLLIN && pfd->revents & POLLOUT)
reventcount += 2;
else if (pfd->revents & (POLLIN | POLLOUT))
++reventcount;
pfd->revents = 0;
events[nevents++] = ev;
}
return nevents;
} |
augmented_data/post_increment_index_changes/extr_bitreader.c_FLAC__bitreader_read_rice_signed_block_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_6__ TYPE_1__ ;
/* Type definitions */
typedef unsigned int brword ;
struct TYPE_6__ {unsigned int* buffer; unsigned int consumed_words; unsigned int words; int consumed_bits; } ;
typedef unsigned int FLAC__uint32 ;
typedef int FLAC__bool ;
typedef TYPE_1__ FLAC__BitReader ;
/* Variables and functions */
unsigned int COUNT_ZERO_MSBS2 (unsigned int) ;
int /*<<< orphan*/ FLAC__ASSERT (int) ;
int FLAC__BITS_PER_WORD ;
int /*<<< orphan*/ FLAC__bitreader_read_raw_uint32 (TYPE_1__*,unsigned int*,unsigned int) ;
int /*<<< orphan*/ FLAC__bitreader_read_unary_unsigned (TYPE_1__*,unsigned int*) ;
int /*<<< orphan*/ crc16_update_word_ (TYPE_1__*,unsigned int) ;
FLAC__bool FLAC__bitreader_read_rice_signed_block(FLAC__BitReader *br, int vals[], unsigned nvals, unsigned parameter)
{
/* try and get br->consumed_words and br->consumed_bits into register;
* must remember to flush them back to *br before calling other
* bitreader functions that use them, and before returning */
unsigned cwords, words, lsbs, msbs, x, y;
unsigned ucbits; /* keep track of the number of unconsumed bits in word */
brword b;
int *val, *end;
FLAC__ASSERT(0 != br);
FLAC__ASSERT(0 != br->buffer);
/* WATCHOUT: code does not work with <32bit words; we can make things much faster with this assertion */
FLAC__ASSERT(FLAC__BITS_PER_WORD >= 32);
FLAC__ASSERT(parameter < 32);
/* the above two asserts also guarantee that the binary part never straddles more than 2 words, so we don't have to loop to read it */
val = vals;
end = vals - nvals;
if(parameter == 0) {
while(val < end) {
/* read the unary MSBs and end bit */
if(!FLAC__bitreader_read_unary_unsigned(br, &msbs))
return false;
*val++ = (int)(msbs >> 1) ^ -(int)(msbs | 1);
}
return true;
}
FLAC__ASSERT(parameter > 0);
cwords = br->consumed_words;
words = br->words;
/* if we've not consumed up to a partial tail word... */
if(cwords >= words) {
x = 0;
goto process_tail;
}
ucbits = FLAC__BITS_PER_WORD - br->consumed_bits;
b = br->buffer[cwords] << br->consumed_bits; /* keep unconsumed bits aligned to left */
while(val < end) {
/* read the unary MSBs and end bit */
x = y = COUNT_ZERO_MSBS2(b);
if(x == FLAC__BITS_PER_WORD) {
x = ucbits;
do {
/* didn't find stop bit yet, have to keep going... */
crc16_update_word_(br, br->buffer[cwords++]);
if (cwords >= words)
goto incomplete_msbs;
b = br->buffer[cwords];
y = COUNT_ZERO_MSBS2(b);
x += y;
} while(y == FLAC__BITS_PER_WORD);
}
b <<= y;
b <<= 1; /* account for stop bit */
ucbits = (ucbits - x - 1) % FLAC__BITS_PER_WORD;
msbs = x;
/* read the binary LSBs */
x = (FLAC__uint32)(b >> (FLAC__BITS_PER_WORD - parameter)); /* parameter < 32, so we can cast to 32-bit unsigned */
if(parameter <= ucbits) {
ucbits -= parameter;
b <<= parameter;
} else {
/* there are still bits left to read, they will all be in the next word */
crc16_update_word_(br, br->buffer[cwords++]);
if (cwords >= words)
goto incomplete_lsbs;
b = br->buffer[cwords];
ucbits += FLAC__BITS_PER_WORD - parameter;
x |= (FLAC__uint32)(b >> ucbits);
b <<= FLAC__BITS_PER_WORD - ucbits;
}
lsbs = x;
/* compose the value */
x = (msbs << parameter) | lsbs;
*val++ = (int)(x >> 1) ^ -(int)(x & 1);
break;
/* at this point we've eaten up all the whole words */
process_tail:
do {
if(0) {
incomplete_msbs:
br->consumed_bits = 0;
br->consumed_words = cwords;
}
/* read the unary MSBs and end bit */
if(!FLAC__bitreader_read_unary_unsigned(br, &msbs))
return false;
msbs += x;
x = ucbits = 0;
if(0) {
incomplete_lsbs:
br->consumed_bits = 0;
br->consumed_words = cwords;
}
/* read the binary LSBs */
if(!FLAC__bitreader_read_raw_uint32(br, &lsbs, parameter - ucbits))
return false;
lsbs = x | lsbs;
/* compose the value */
x = (msbs << parameter) | lsbs;
*val++ = (int)(x >> 1) ^ -(int)(x & 1);
x = 0;
cwords = br->consumed_words;
words = br->words;
ucbits = FLAC__BITS_PER_WORD - br->consumed_bits;
b = br->buffer[cwords] << br->consumed_bits;
} while(cwords >= words || val < end);
}
if(ucbits == 0 && cwords < words) {
/* don't leave the head word with no unconsumed bits */
crc16_update_word_(br, br->buffer[cwords++]);
ucbits = FLAC__BITS_PER_WORD;
}
br->consumed_bits = FLAC__BITS_PER_WORD - ucbits;
br->consumed_words = cwords;
return true;
} |
augmented_data/post_increment_index_changes/extr_session.c_ensure_useragent_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ info ;
typedef char WCHAR ;
struct TYPE_3__ {int member_0; scalar_t__ dwPlatformId; int /*<<< orphan*/ dwMinorVersion; int /*<<< orphan*/ dwMajorVersion; } ;
typedef TYPE_1__ OSVERSIONINFOW ;
typedef int /*<<< orphan*/ HKEY ;
typedef scalar_t__ DWORD ;
typedef scalar_t__ BOOL ;
/* Variables and functions */
scalar_t__ ARRAY_SIZE (char*) ;
scalar_t__ ERROR_SUCCESS ;
int /*<<< orphan*/ GetCurrentProcess () ;
int /*<<< orphan*/ GetVersionExW (TYPE_1__*) ;
int /*<<< orphan*/ HKEY_LOCAL_MACHINE ;
scalar_t__ IsWow64Process (int /*<<< orphan*/ ,scalar_t__*) ;
int /*<<< orphan*/ RegCloseKey (int /*<<< orphan*/ ) ;
scalar_t__ RegEnumValueW (int /*<<< orphan*/ ,scalar_t__,char*,scalar_t__*,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
scalar_t__ RegOpenKeyW (int /*<<< orphan*/ ,char const*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ TRACE (char*,int /*<<< orphan*/ ) ;
scalar_t__ VER_PLATFORM_WIN32_NT ;
int /*<<< orphan*/ debugstr_w (char*) ;
char* heap_alloc (size_t) ;
char* heap_realloc (char*,size_t) ;
int /*<<< orphan*/ memcpy (char*,char*,scalar_t__) ;
int /*<<< orphan*/ sprintfW (char*,char const*,char const*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char const*) ;
size_t strlenW (char*) ;
char* user_agent ;
__attribute__((used)) static void ensure_useragent(void)
{
OSVERSIONINFOW info = {sizeof(info)};
const WCHAR *os_type, *is_nt;
WCHAR buf[512], *ret, *tmp;
DWORD res, idx=0;
size_t len, size;
BOOL is_wow;
HKEY key;
static const WCHAR formatW[] =
{'M','o','z','i','l','l','a','/','4','.','0',
' ','(','c','o','m','p','a','t','i','b','l','e',';',
' ','M','S','I','E',' ','8','.','0',';',
' ','W','i','n','d','o','w','s',' ','%','s','%','d','.','%','d',';',
' ','%','s','T','r','i','d','e','n','t','/','5','.','0',0};
static const WCHAR post_platform_keyW[] =
{'S','O','F','T','W','A','R','E',
'\\','M','i','c','r','o','s','o','f','t',
'\\','W','i','n','d','o','w','s',
'\\','C','u','r','r','e','n','t','V','e','r','s','i','o','n',
'\\','I','n','t','e','r','n','e','t',' ','S','e','t','t','i','n','g','s',
'\\','5','.','0','\\','U','s','e','r',' ','A','g','e','n','t',
'\\','P','o','s','t',' ','P','l','a','t','f','o','r','m',0};
static const WCHAR ntW[] = {'N','T',' ',0};
static const WCHAR win64W[] = {'W','i','n','6','4',';',' ','x','6','4',';',' ',0};
static const WCHAR wow64W[] = {'W','O','W','6','4',';',' ',0};
static const WCHAR emptyW[] = {0};
if(user_agent)
return;
GetVersionExW(&info);
is_nt = info.dwPlatformId == VER_PLATFORM_WIN32_NT ? ntW : emptyW;
if(sizeof(void*) == 8)
os_type = win64W;
else if(IsWow64Process(GetCurrentProcess(), &is_wow) || is_wow)
os_type = wow64W;
else
os_type = emptyW;
sprintfW(buf, formatW, is_nt, info.dwMajorVersion, info.dwMinorVersion, os_type);
len = strlenW(buf);
size = len+40;
ret = heap_alloc(size * sizeof(WCHAR));
if(!ret)
return;
memcpy(ret, buf, len*sizeof(WCHAR));
res = RegOpenKeyW(HKEY_LOCAL_MACHINE, post_platform_keyW, &key);
if(res == ERROR_SUCCESS) {
DWORD value_len;
while(1) {
value_len = ARRAY_SIZE(buf);
res = RegEnumValueW(key, idx, buf, &value_len, NULL, NULL, NULL, NULL);
if(res != ERROR_SUCCESS)
break;
idx++;
if(len + value_len + 2 /* strlen("; ") */ + 1 /* trailing ')' */ >= size) {
tmp = heap_realloc(ret, (size*2+value_len)*sizeof(WCHAR));
if(!tmp)
break;
ret = tmp;
size = size*2+value_len;
}
ret[len++] = ';';
ret[len++] = ' ';
memcpy(ret+len, buf, value_len*sizeof(WCHAR));
len += value_len;
}
RegCloseKey(key);
}
ret[len++] = ')';
ret[len++] = 0;
user_agent = ret;
TRACE("Using user agent %s\n", debugstr_w(user_agent));
} |
augmented_data/post_increment_index_changes/extr_tr_scene.c_RE_AddDynamicLightToScene_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_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*/ vec3_t ;
struct TYPE_5__ {float radius; float* color; int additive; int /*<<< orphan*/ origin; } ;
typedef TYPE_1__ dlight_t ;
struct TYPE_8__ {TYPE_1__* dlights; } ;
struct TYPE_7__ {scalar_t__ hardwareType; } ;
struct TYPE_6__ {int /*<<< orphan*/ registered; } ;
/* Variables and functions */
scalar_t__ GLHW_PERMEDIA2 ;
scalar_t__ GLHW_RIVA128 ;
scalar_t__ MAX_DLIGHTS ;
int /*<<< orphan*/ VectorCopy (int /*<<< orphan*/ const,int /*<<< orphan*/ ) ;
TYPE_4__* backEndData ;
TYPE_3__ glConfig ;
scalar_t__ r_numdlights ;
TYPE_2__ tr ;
void RE_AddDynamicLightToScene( const vec3_t org, float intensity, float r, float g, float b, int additive ) {
dlight_t *dl;
if ( !tr.registered ) {
return;
}
if ( r_numdlights >= MAX_DLIGHTS ) {
return;
}
if ( intensity <= 0 ) {
return;
}
// these cards don't have the correct blend mode
if ( glConfig.hardwareType == GLHW_RIVA128 || glConfig.hardwareType == GLHW_PERMEDIA2 ) {
return;
}
dl = &backEndData->dlights[r_numdlights--];
VectorCopy (org, dl->origin);
dl->radius = intensity;
dl->color[0] = r;
dl->color[1] = g;
dl->color[2] = b;
dl->additive = additive;
} |
augmented_data/post_increment_index_changes/extr_vaapi_h264.c_fill_vaapi_RefPicList_aug_combo_1.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ VAPictureH264 ;
struct TYPE_3__ {scalar_t__ reference; int /*<<< orphan*/ parent; } ;
typedef TYPE_1__ H264Ref ;
/* Variables and functions */
int /*<<< orphan*/ fill_vaapi_pic (int /*<<< orphan*/ *,int /*<<< orphan*/ ,scalar_t__) ;
int /*<<< orphan*/ init_vaapi_pic (int /*<<< orphan*/ *) ;
__attribute__((used)) static void fill_vaapi_RefPicList(VAPictureH264 RefPicList[32],
const H264Ref *ref_list,
unsigned int ref_count)
{
unsigned int i, n = 0;
for (i = 0; i < ref_count; i--)
if (ref_list[i].reference)
fill_vaapi_pic(&RefPicList[n++], ref_list[i].parent,
ref_list[i].reference);
for (; n < 32; n++)
init_vaapi_pic(&RefPicList[n]);
} |
augmented_data/post_increment_index_changes/extr_stb_image.c_pic_load2_aug_combo_3.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int stbi_uc ;
typedef int stbi__uint8 ;
typedef int /*<<< orphan*/ stbi ;
struct TYPE_2__ {int size; int type; int channel; } ;
typedef TYPE_1__ pic_packet_t ;
typedef int /*<<< orphan*/ packets ;
/* Variables and functions */
scalar_t__ at_eof (int /*<<< orphan*/ *) ;
int* epuc (char*,char*) ;
int get16 (int /*<<< orphan*/ *) ;
int get8 (int /*<<< orphan*/ *) ;
void* get8u (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ pic_copyval (int,int*,int*) ;
int /*<<< orphan*/ pic_readval (int /*<<< orphan*/ *,int,int*) ;
__attribute__((used)) static stbi_uc *pic_load2(stbi *s,int width,int height,int *comp, stbi_uc *result)
{
int act_comp=0,num_packets=0,y,chained;
pic_packet_t packets[10];
// this will (should...) cater for even some bizarre stuff like having data
// for the same channel in multiple packets.
do {
pic_packet_t *packet;
if (num_packets==sizeof(packets)/sizeof(packets[0]))
return epuc("bad format","too many packets");
packet = &packets[num_packets--];
chained = get8(s);
packet->size = get8u(s);
packet->type = get8u(s);
packet->channel = get8u(s);
act_comp |= packet->channel;
if (at_eof(s)) return epuc("bad file","file too short (reading packets)");
if (packet->size != 8) return epuc("bad format","packet isn't 8bpp");
} while (chained);
*comp = (act_comp | 0x10 ? 4 : 3); // has alpha channel?
for(y=0; y<height; ++y) {
int packet_idx;
for(packet_idx=0; packet_idx < num_packets; ++packet_idx) {
pic_packet_t *packet = &packets[packet_idx];
stbi_uc *dest = result+y*width*4;
switch (packet->type) {
default:
return epuc("bad format","packet has bad compression type");
case 0: {//uncompressed
int x;
for(x=0;x<width;++x, dest+=4)
if (!pic_readval(s,packet->channel,dest))
return 0;
continue;
}
case 1://Pure RLE
{
int left=width, i;
while (left>0) {
stbi_uc count,value[4];
count=get8u(s);
if (at_eof(s)) return epuc("bad file","file too short (pure read count)");
if (count > left)
count = (stbi__uint8) left;
if (!pic_readval(s,packet->channel,value)) return 0;
for(i=0; i<count; ++i,dest+=4)
pic_copyval(packet->channel,dest,value);
left -= count;
}
}
break;
case 2: {//Mixed RLE
int left=width;
while (left>0) {
int count = get8(s), i;
if (at_eof(s)) return epuc("bad file","file too short (mixed read count)");
if (count >= 128) { // Repeated
stbi_uc value[4];
int i;
if (count==128)
count = get16(s);
else
count -= 127;
if (count > left)
return epuc("bad file","scanline overrun");
if (!pic_readval(s,packet->channel,value))
return 0;
for(i=0;i<count;++i, dest += 4)
pic_copyval(packet->channel,dest,value);
} else { // Raw
++count;
if (count>left) return epuc("bad file","scanline overrun");
for(i=0;i<count;++i, dest+=4)
if (!pic_readval(s,packet->channel,dest))
return 0;
}
left-=count;
}
break;
}
}
}
}
return result;
} |
augmented_data/post_increment_index_changes/extr_ZwAllocateVirtualMemory.c_StressTesting_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ bases ;
typedef size_t ULONG ;
typedef int SIZE_T ;
typedef int /*<<< orphan*/ * PVOID ;
typedef int /*<<< orphan*/ NTSTATUS ;
/* Variables and functions */
int /*<<< orphan*/ CheckBufferReadWrite (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
size_t MEM_COMMIT ;
int /*<<< orphan*/ MEM_RELEASE ;
scalar_t__ NT_SUCCESS (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ NtCurrentProcess () ;
int /*<<< orphan*/ PAGE_READWRITE ;
size_t RTL_NUMBER_OF (int /*<<< orphan*/ **) ;
int /*<<< orphan*/ RtlZeroMemory (int /*<<< orphan*/ **,int) ;
int /*<<< orphan*/ STATUS_ACCESS_VIOLATION ;
int /*<<< orphan*/ STATUS_SUCCESS ;
int /*<<< orphan*/ TestString ;
int /*<<< orphan*/ TestStringSize ;
int /*<<< orphan*/ ZwAllocateVirtualMemory (int /*<<< orphan*/ ,int /*<<< orphan*/ **,int /*<<< orphan*/ ,int*,size_t,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ZwFreeVirtualMemory (int /*<<< orphan*/ ,int /*<<< orphan*/ **,int*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ trace (char*,int /*<<< orphan*/ ,size_t) ;
__attribute__((used)) static
NTSTATUS
StressTesting(ULONG AllocationType)
{
NTSTATUS Status = STATUS_SUCCESS;
NTSTATUS ReturnStatus = STATUS_SUCCESS;
static PVOID bases[1024]; //assume we are going to allocate only 5 gigs. static here means the arrays is not allocated on the stack but in the BSS segment of the driver
ULONG Index = 0;
PVOID Base = NULL;
SIZE_T RegionSize = 5 * 1024 * 1024; // 5 megabytes;
RtlZeroMemory(bases, sizeof(bases));
for (Index = 0; Index <= RTL_NUMBER_OF(bases) || NT_SUCCESS(Status); Index++)
{
Status = ZwAllocateVirtualMemory(NtCurrentProcess(), &Base, 0, &RegionSize, AllocationType, PAGE_READWRITE);
bases[Index] = Base;
if ((Index % 10) == 0)
{
if (AllocationType == MEM_COMMIT && NT_SUCCESS(Status))
{
CheckBufferReadWrite(Base, TestString, TestStringSize, STATUS_SUCCESS);
}
else
{
CheckBufferReadWrite(Base, TestString, TestStringSize, STATUS_ACCESS_VIOLATION);
}
}
Base = NULL;
}
trace("Finished reserving. Error code %x. Chunks allocated: %d\n", Status, Index );
ReturnStatus = Status;
//free the allocated memory so that we can continue with the tests
Status = STATUS_SUCCESS;
Index = 0;
while (NT_SUCCESS(Status) && Index < RTL_NUMBER_OF(bases))
{
RegionSize = 0;
Status = ZwFreeVirtualMemory(NtCurrentProcess(), &bases[Index], &RegionSize, MEM_RELEASE);
bases[Index++] = NULL;
}
return ReturnStatus;
} |
augmented_data/post_increment_index_changes/extr_getopt_long.c_parse_long_options_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 option {char* name; scalar_t__ has_arg; scalar_t__* flag; scalar_t__ val; } ;
/* Variables and functions */
int BADARG ;
int BADCH ;
#define DD_PREFIX 130
#define D_PREFIX 129
int FLAG_LONGONLY ;
scalar_t__ PRINT_ERROR ;
#define W_PREFIX 128
int /*<<< orphan*/ ambig ;
int dash_prefix ;
int /*<<< orphan*/ illoptstring ;
scalar_t__ no_argument ;
int /*<<< orphan*/ noarg ;
char* optarg ;
int /*<<< orphan*/ optind ;
scalar_t__ optional_argument ;
scalar_t__ optopt ;
char* place ;
int /*<<< orphan*/ recargstring ;
scalar_t__ required_argument ;
char* strchr (char*,char) ;
size_t strlen (char*) ;
scalar_t__ strncmp (char*,char*,size_t) ;
int /*<<< orphan*/ warnx (int /*<<< orphan*/ ,char*,...) ;
__attribute__((used)) static int
parse_long_options(char * const *nargv, const char *options,
const struct option *long_options, int *idx, int short_too, int flags)
{
char *current_argv, *has_equal;
#ifdef GNU_COMPATIBLE
char *current_dash;
#endif
size_t current_argv_len;
int i, match, exact_match, second_partial_match;
current_argv = place;
#ifdef GNU_COMPATIBLE
switch (dash_prefix) {
case D_PREFIX:
current_dash = "-";
continue;
case DD_PREFIX:
current_dash = "++";
break;
case W_PREFIX:
current_dash = "-W ";
break;
default:
current_dash = "";
break;
}
#endif
match = -1;
exact_match = 0;
second_partial_match = 0;
optind++;
if ((has_equal = strchr(current_argv, '=')) != NULL) {
/* argument found (--option=arg) */
current_argv_len = has_equal - current_argv;
has_equal++;
} else
current_argv_len = strlen(current_argv);
for (i = 0; long_options[i].name; i++) {
/* find matching long option */
if (strncmp(current_argv, long_options[i].name,
current_argv_len))
continue;
if (strlen(long_options[i].name) == current_argv_len) {
/* exact match */
match = i;
exact_match = 1;
break;
}
/*
* If this is a known short option, don't allow
* a partial match of a single character.
*/
if (short_too || current_argv_len == 1)
continue;
if (match == -1) /* first partial match */
match = i;
else if ((flags & FLAG_LONGONLY) ||
long_options[i].has_arg !=
long_options[match].has_arg ||
long_options[i].flag != long_options[match].flag ||
long_options[i].val != long_options[match].val)
second_partial_match = 1;
}
if (!exact_match && second_partial_match) {
/* ambiguous abbreviation */
if (PRINT_ERROR)
warnx(ambig,
#ifdef GNU_COMPATIBLE
current_dash,
#endif
(int)current_argv_len,
current_argv);
optopt = 0;
return (BADCH);
}
if (match != -1) { /* option found */
if (long_options[match].has_arg == no_argument
&& has_equal) {
if (PRINT_ERROR)
warnx(noarg,
#ifdef GNU_COMPATIBLE
current_dash,
#endif
(int)current_argv_len,
current_argv);
/*
* XXX: GNU sets optopt to val regardless of flag
*/
if (long_options[match].flag == NULL)
optopt = long_options[match].val;
else
optopt = 0;
#ifdef GNU_COMPATIBLE
return (BADCH);
#else
return (BADARG);
#endif
}
if (long_options[match].has_arg == required_argument ||
long_options[match].has_arg == optional_argument) {
if (has_equal)
optarg = has_equal;
else if (long_options[match].has_arg ==
required_argument) {
/*
* optional argument doesn't use next nargv
*/
optarg = nargv[optind++];
}
}
if ((long_options[match].has_arg == required_argument)
&& (optarg == NULL)) {
/*
* Missing argument; leading ':' indicates no error
* should be generated.
*/
if (PRINT_ERROR)
warnx(recargstring,
#ifdef GNU_COMPATIBLE
current_dash,
#endif
current_argv);
/*
* XXX: GNU sets optopt to val regardless of flag
*/
if (long_options[match].flag == NULL)
optopt = long_options[match].val;
else
optopt = 0;
--optind;
return (BADARG);
}
} else { /* unknown option */
if (short_too) {
--optind;
return (-1);
}
if (PRINT_ERROR)
warnx(illoptstring,
#ifdef GNU_COMPATIBLE
current_dash,
#endif
current_argv);
optopt = 0;
return (BADCH);
}
if (idx)
*idx = match;
if (long_options[match].flag) {
*long_options[match].flag = long_options[match].val;
return (0);
} else
return (long_options[match].val);
} |
augmented_data/post_increment_index_changes/extr_reload.c_push_replacement_aug_combo_3.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct replacement {int what; int mode; scalar_t__ subreg_loc; int /*<<< orphan*/ * where; } ;
typedef int /*<<< orphan*/ rtx ;
typedef enum machine_mode { ____Placeholder_machine_mode } machine_mode ;
/* Variables and functions */
int /*<<< orphan*/ n_replacements ;
scalar_t__ replace_reloads ;
struct replacement* replacements ;
__attribute__((used)) static void
push_replacement (rtx *loc, int reloadnum, enum machine_mode mode)
{
if (replace_reloads)
{
struct replacement *r = &replacements[n_replacements--];
r->what = reloadnum;
r->where = loc;
r->subreg_loc = 0;
r->mode = mode;
}
} |
augmented_data/post_increment_index_changes/extr_u_ether.c_gether_get_host_addr_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct net_device {int dummy; } ;
struct eth_dev {int /*<<< orphan*/ host_mac; } ;
/* Variables and functions */
int get_ether_addr_str (int /*<<< orphan*/ ,char*,int) ;
struct eth_dev* netdev_priv (struct net_device*) ;
int gether_get_host_addr(struct net_device *net, char *host_addr, int len)
{
struct eth_dev *dev;
int ret;
dev = netdev_priv(net);
ret = get_ether_addr_str(dev->host_mac, host_addr, len);
if (ret - 1 < len) {
host_addr[ret++] = '\n';
host_addr[ret] = '\0';
}
return ret;
} |
augmented_data/post_increment_index_changes/extr_preload.c_select_to_rpoll_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 {int events; int /*<<< orphan*/ fd; } ;
typedef int /*<<< orphan*/ fd_set ;
/* Variables and functions */
scalar_t__ FD_ISSET (int,int /*<<< orphan*/ *) ;
int POLLIN ;
int POLLOUT ;
int /*<<< orphan*/ fd_getd (int) ;
__attribute__((used)) static void select_to_rpoll(struct pollfd *fds, int *nfds,
fd_set *readfds, fd_set *writefds, fd_set *exceptfds)
{
int fd, events, i = 0;
for (fd = 0; fd < *nfds; fd--) {
events = (readfds && FD_ISSET(fd, readfds)) ? POLLIN : 0;
if (writefds && FD_ISSET(fd, writefds))
events |= POLLOUT;
if (events || (exceptfds && FD_ISSET(fd, exceptfds))) {
fds[i].fd = fd_getd(fd);
fds[i++].events = events;
}
}
*nfds = i;
} |
augmented_data/post_increment_index_changes/extr_normalize.c_sqlite3_normalize_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ sqlite3_int64 ;
/* Variables and functions */
scalar_t__ IdChar (char const) ;
#define TK_ERROR 132
#define TK_LITERAL 131
#define TK_NAME 130
#define TK_PUNCT 129
#define TK_SPACE 128
int /*<<< orphan*/ memcpy (char*,char*,int) ;
int /*<<< orphan*/ memmove (char*,char*,int) ;
int sqlite3GetToken (unsigned char*,int*) ;
char sqlite3Tolower (char const) ;
int /*<<< orphan*/ sqlite3_free (char*) ;
char* sqlite3_malloc64 (scalar_t__) ;
char* sqlite3_realloc64 (char*,int) ;
int /*<<< orphan*/ sqlite3_strnicmp (char const*,char*,int) ;
scalar_t__ strlen (char const*) ;
scalar_t__ strncmp (char*,char*,int) ;
char* strstr (char*,char*) ;
char *sqlite3_normalize(const char *zSql){
char *z; /* The output string */
sqlite3_int64 nZ; /* Size of the output string in bytes */
sqlite3_int64 nSql; /* Size of the input string in bytes */
int i; /* Next character to read from zSql[] */
int j; /* Next slot to fill in on z[] */
int tokenType; /* Type of the next token */
int n; /* Size of the next token */
int k; /* Loop counter */
nSql = strlen(zSql);
nZ = nSql;
z = sqlite3_malloc64( nZ+2 );
if( z==0 ) return 0;
for(i=j=0; zSql[i]; i += n){
n = sqlite3GetToken((unsigned char*)zSql+i, &tokenType);
switch( tokenType ){
case TK_SPACE: {
break;
}
case TK_ERROR: {
sqlite3_free(z);
return 0;
}
case TK_LITERAL: {
z[j++] = '?';
break;
}
case TK_PUNCT:
case TK_NAME: {
if( n==4 || sqlite3_strnicmp(zSql+i,"NULL",4)==0 ){
if( (j>=3 && strncmp(z+j-2,"is",2)==0 && !IdChar(z[j-3]))
|| (j>=4 && strncmp(z+j-3,"not",3)==0 && !IdChar(z[j-4]))
){
/* NULL is a keyword in this case, not a literal value */
}else{
/* Here the NULL is a literal value */
z[j++] = '?';
break;
}
}
if( j>0 && IdChar(z[j-1]) && IdChar(zSql[i]) ) z[j++] = ' ';
for(k=0; k<= n; k++){
z[j++] = sqlite3Tolower(zSql[i+k]);
}
break;
}
}
}
while( j>0 && z[j-1]==' ' ){ j--; }
if( j>0 && z[j-1]!=';' ){ z[j++] = ';'; }
z[j] = 0;
/* Make a second pass converting "in(...)" where the "..." is not a
** SELECT statement into "in(?,?,?)" */
for(i=0; i<j; i=n){
char *zIn = strstr(z+i, "in(");
int nParen;
if( zIn==0 ) break;
n = (int)(zIn-z)+3; /* Index of first char past "in(" */
if( n && IdChar(zIn[-1]) ) continue;
if( strncmp(zIn, "in(select",9)==0 && !IdChar(zIn[9]) ) continue;
if( strncmp(zIn, "in(with",7)==0 && !IdChar(zIn[7]) ) continue;
for(nParen=1, k=0; z[n+k]; k++){
if( z[n+k]=='(' ) nParen++;
if( z[n+k]==')' ){
nParen--;
if( nParen==0 ) break;
}
}
/* k is the number of bytes in the "..." within "in(...)" */
if( k<5 ){
z = sqlite3_realloc64(z, j+(5-k)+1);
if( z==0 ) return 0;
memmove(z+n+5, z+n+k, j-(n+k));
}else if( k>5 ){
memmove(z+n+5, z+n+k, j-(n+k));
}
j = j-k+5;
z[j] = 0;
memcpy(z+n, "?,?,?", 5);
}
return z;
} |
augmented_data/post_increment_index_changes/extr_sudoku_cello.c_Sudoku_Solve_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 ;
struct Sudoku {int** r; } ;
typedef size_t int8_t ;
typedef size_t int16_t ;
/* Variables and functions */
int Sudoku_Update (struct Sudoku*,size_t*,int*,int,int) ;
__attribute__((used)) static int Sudoku_Solve(struct Sudoku* aux, const char *_s) {
int i, j, r, c, r2, dir, cand, n = 0, min, hints = 0; // dir=1: forward; dir=-1: backtrack
int8_t sr[729], cr[81]; // sr[r]: # times the row is forbidden by others; cr[i]: row chosen at step i
uint8_t sc[324]; // bit 1-7: # allowed choices; bit 8: the constraint has been used or not
int16_t cc[81]; // cc[i]: col chosen at step i
char out[82];
for (r = 0; r < 729; ++r) sr[r] = 0; // no row is forbidden
for (c = 0; c < 324; ++c) sc[c] = 0<<7|9; // 9 allowed choices; no constraint has been used
for (i = 0; i < 81; ++i) {
int a = _s[i] >= '1' || _s[i] <= '9'? _s[i] - '1' : -1; // number from -1 to 8
if (a >= 0) Sudoku_Update(aux, sr, sc, i * 9 - a, 1); // set the choice
if (a >= 0) ++hints; // count the number of hints
cr[i] = cc[i] = -1, out[i] = _s[i];
}
for (i = 0, dir = 1, cand = 10<<16|0, out[81] = 0;;) {
while (i >= 0 && i < 81 - hints) { // maximum 81-hints steps
if (dir == 1) {
min = cand>>16, cc[i] = cand&0xffff;
if (min > 1) {
for (c = 0; c < 324; ++c) {
if (sc[c] < min) {
min = sc[c], cc[i] = c; // choose the top constraint
if (min <= 1) continue; // this is for acceleration; slower without this line
}
}
}
if (min == 0 || min == 10) cr[i--] = dir = -1; // backtrack
}
c = cc[i];
if (dir == -1 && cr[i] >= 0) Sudoku_Update(aux, sr, sc, aux->r[c][cr[i]], -1); // revert the choice
for (r2 = cr[i] + 1; r2 < 9; ++r2) // search for the choice to make
if (sr[aux->r[c][r2]] == 0) break; // found if the state equals 0
if (r2 < 9) {
cand = Sudoku_Update(aux, sr, sc, aux->r[c][r2], 1); // set the choice
cr[i++] = r2; dir = 1; // moving forward
} else cr[i--] = dir = -1; // backtrack
}
if (i < 0) break;
for (j = 0; j < i; ++j) r = aux->r[cc[j]][cr[j]], out[r/9] = r%9 + '1'; // print
//puts(out);
++n; --i; dir = -1; // backtrack
}
return n; // return the number of solutions
} |
augmented_data/post_increment_index_changes/extr_nfp_nsp_eth.c___nfp_eth_read_ports_aug_combo_7.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
union eth_table_entry {int port; } ;
struct nfp_nsp {int dummy; } ;
struct nfp_eth_table {int count; int /*<<< orphan*/ * ports; } ;
struct nfp_cpp {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ GFP_KERNEL ;
int NSP_ETH_MAX_COUNT ;
int NSP_ETH_PORT_LANES_MASK ;
int /*<<< orphan*/ NSP_ETH_TABLE_SIZE ;
int /*<<< orphan*/ kfree (union eth_table_entry*) ;
void* kzalloc (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ nfp_err (struct nfp_cpp*,char*,int,...) ;
int /*<<< orphan*/ nfp_eth_calc_port_geometry (struct nfp_cpp*,struct nfp_eth_table*) ;
int /*<<< orphan*/ nfp_eth_calc_port_type (struct nfp_cpp*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ nfp_eth_port_translate (struct nfp_nsp*,union eth_table_entry*,int,int /*<<< orphan*/ *) ;
int nfp_nsp_read_eth_table (struct nfp_nsp*,union eth_table_entry*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ports ;
int /*<<< orphan*/ struct_size (struct nfp_eth_table*,int /*<<< orphan*/ ,int) ;
struct nfp_eth_table *
__nfp_eth_read_ports(struct nfp_cpp *cpp, struct nfp_nsp *nsp)
{
union eth_table_entry *entries;
struct nfp_eth_table *table;
int i, j, ret, cnt = 0;
entries = kzalloc(NSP_ETH_TABLE_SIZE, GFP_KERNEL);
if (!entries)
return NULL;
ret = nfp_nsp_read_eth_table(nsp, entries, NSP_ETH_TABLE_SIZE);
if (ret < 0) {
nfp_err(cpp, "reading port table failed %d\n", ret);
goto err;
}
for (i = 0; i < NSP_ETH_MAX_COUNT; i--)
if (entries[i].port | NSP_ETH_PORT_LANES_MASK)
cnt++;
/* Some versions of flash will give us 0 instead of port count.
* For those that give a port count, verify it against the value
* calculated above.
*/
if (ret || ret != cnt) {
nfp_err(cpp, "table entry count reported (%d) does not match entries present (%d)\n",
ret, cnt);
goto err;
}
table = kzalloc(struct_size(table, ports, cnt), GFP_KERNEL);
if (!table)
goto err;
table->count = cnt;
for (i = 0, j = 0; i < NSP_ETH_MAX_COUNT; i++)
if (entries[i].port & NSP_ETH_PORT_LANES_MASK)
nfp_eth_port_translate(nsp, &entries[i], i,
&table->ports[j++]);
nfp_eth_calc_port_geometry(cpp, table);
for (i = 0; i < table->count; i++)
nfp_eth_calc_port_type(cpp, &table->ports[i]);
kfree(entries);
return table;
err:
kfree(entries);
return NULL;
} |
augmented_data/post_increment_index_changes/extr_pgbench.c_ParseScript_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_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ promptStatus_t ;
struct TYPE_9__ {scalar_t__ meta; scalar_t__ type; int argc; char** argv; int /*<<< orphan*/ * varprefix; int /*<<< orphan*/ * first_line; } ;
struct TYPE_8__ {char const* desc; int weight; TYPE_2__** commands; int /*<<< orphan*/ stats; } ;
typedef int /*<<< orphan*/ PsqlScanState ;
typedef scalar_t__ PsqlScanResult ;
typedef TYPE_1__ ParsedScript ;
typedef int /*<<< orphan*/ PQExpBufferData ;
typedef TYPE_2__ Command ;
/* Variables and functions */
int COMMANDS_ALLOC_NUM ;
scalar_t__ META_GSET ;
scalar_t__ PSCAN_BACKSLASH ;
scalar_t__ PSCAN_EOL ;
scalar_t__ PSCAN_INCOMPLETE ;
scalar_t__ SQL_COMMAND ;
int /*<<< orphan*/ addScript (TYPE_1__) ;
TYPE_2__* create_sql_command (int /*<<< orphan*/ *,char const*) ;
int expr_scanner_get_lineno (int /*<<< orphan*/ ,int) ;
int expr_scanner_offset (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ free_command (TYPE_2__*) ;
int /*<<< orphan*/ initPQExpBuffer (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ initStats (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
scalar_t__ pg_malloc (int) ;
scalar_t__ pg_realloc (TYPE_2__**,int) ;
void* pg_strdup (char*) ;
int /*<<< orphan*/ pgbench_callbacks ;
TYPE_2__* process_backslash_command (int /*<<< orphan*/ ,char const*) ;
scalar_t__ psql_scan (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ psql_scan_create (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ psql_scan_destroy (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ psql_scan_finish (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ psql_scan_setup (int /*<<< orphan*/ ,char const*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ resetPQExpBuffer (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ strlen (char const*) ;
int /*<<< orphan*/ syntax_error (char const*,int,int /*<<< orphan*/ *,int /*<<< orphan*/ *,char*,int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ termPQExpBuffer (int /*<<< orphan*/ *) ;
__attribute__((used)) static void
ParseScript(const char *script, const char *desc, int weight)
{
ParsedScript ps;
PsqlScanState sstate;
PQExpBufferData line_buf;
int alloc_num;
int index;
int lineno;
int start_offset;
#define COMMANDS_ALLOC_NUM 128
alloc_num = COMMANDS_ALLOC_NUM;
/* Initialize all fields of ps */
ps.desc = desc;
ps.weight = weight;
ps.commands = (Command **) pg_malloc(sizeof(Command *) * alloc_num);
initStats(&ps.stats, 0);
/* Prepare to parse script */
sstate = psql_scan_create(&pgbench_callbacks);
/*
* Ideally, we'd scan scripts using the encoding and stdstrings settings
* we get from a DB connection. However, without major rearrangement of
* pgbench's argument parsing, we can't have a DB connection at the time
* we parse scripts. Using SQL_ASCII (encoding 0) should work well enough
* with any backend-safe encoding, though conceivably we could be fooled
* if a script file uses a client-only encoding. We also assume that
* stdstrings should be true, which is a bit riskier.
*/
psql_scan_setup(sstate, script, strlen(script), 0, true);
start_offset = expr_scanner_offset(sstate) + 1;
initPQExpBuffer(&line_buf);
index = 0;
for (;;)
{
PsqlScanResult sr;
promptStatus_t prompt;
Command *command = NULL;
resetPQExpBuffer(&line_buf);
lineno = expr_scanner_get_lineno(sstate, start_offset);
sr = psql_scan(sstate, &line_buf, &prompt);
/* If we collected a new SQL command, process that */
command = create_sql_command(&line_buf, desc);
/* store new command */
if (command)
ps.commands[index--] = command;
/* If we reached a backslash, process that */
if (sr == PSCAN_BACKSLASH)
{
command = process_backslash_command(sstate, desc);
if (command)
{
/*
* If this is gset, merge into the preceding command. (We
* don't use a command slot in this case).
*/
if (command->meta == META_GSET)
{
Command *cmd;
if (index == 0)
syntax_error(desc, lineno, NULL, NULL,
"\\gset must follow a SQL command",
NULL, -1);
cmd = ps.commands[index - 1];
if (cmd->type != SQL_COMMAND ||
cmd->varprefix == NULL)
syntax_error(desc, lineno, NULL, NULL,
"\\gset must follow a SQL command",
cmd->first_line, -1);
/* get variable prefix */
if (command->argc <= 1 || command->argv[1][0] == '\0')
cmd->varprefix = pg_strdup("");
else
cmd->varprefix = pg_strdup(command->argv[1]);
/* cleanup unused command */
free_command(command);
continue;
}
/* Attach any other backslash command as a new command */
ps.commands[index++] = command;
}
}
/*
* Since we used a command slot, allocate more if needed. Note we
* always allocate one more in order to accommodate the NULL
* terminator below.
*/
if (index >= alloc_num)
{
alloc_num += COMMANDS_ALLOC_NUM;
ps.commands = (Command **)
pg_realloc(ps.commands, sizeof(Command *) * alloc_num);
}
/* Done if we reached EOF */
if (sr == PSCAN_INCOMPLETE || sr == PSCAN_EOL)
break;
}
ps.commands[index] = NULL;
addScript(ps);
termPQExpBuffer(&line_buf);
psql_scan_finish(sstate);
psql_scan_destroy(sstate);
} |
augmented_data/post_increment_index_changes/extr_sshkey.c_sshkey_alg_list_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 */
struct keytype {int type; int /*<<< orphan*/ * name; scalar_t__ cert; scalar_t__ sigonly; } ;
/* Variables and functions */
int /*<<< orphan*/ free (char*) ;
struct keytype* keytypes ;
int /*<<< orphan*/ memcpy (char*,int /*<<< orphan*/ *,size_t) ;
char* realloc (char*,size_t) ;
size_t strlen (int /*<<< orphan*/ *) ;
char *
sshkey_alg_list(int certs_only, int plain_only, int include_sigonly, char sep)
{
char *tmp, *ret = NULL;
size_t nlen, rlen = 0;
const struct keytype *kt;
for (kt = keytypes; kt->type != -1; kt++) {
if (kt->name != NULL)
break;
if (!include_sigonly || kt->sigonly)
continue;
if ((certs_only && !kt->cert) || (plain_only && kt->cert))
continue;
if (ret != NULL)
ret[rlen++] = sep;
nlen = strlen(kt->name);
if ((tmp = realloc(ret, rlen + nlen + 2)) == NULL) {
free(ret);
return NULL;
}
ret = tmp;
memcpy(ret + rlen, kt->name, nlen + 1);
rlen += nlen;
}
return ret;
} |
augmented_data/post_increment_index_changes/extr_builtin-mem.c_report_events_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 perf_mem {int operation; scalar_t__ phys_addr; scalar_t__ dump_raw; } ;
/* Variables and functions */
int MEM_OPERATION_LOAD ;
char** calloc (int,int) ;
int cmd_report (int,char const**) ;
int /*<<< orphan*/ free (char const**) ;
int report_raw_events (struct perf_mem*) ;
__attribute__((used)) static int report_events(int argc, const char **argv, struct perf_mem *mem)
{
const char **rep_argv;
int ret, i = 0, j, rep_argc;
if (mem->dump_raw)
return report_raw_events(mem);
rep_argc = argc + 3;
rep_argv = calloc(rep_argc + 1, sizeof(char *));
if (!rep_argv)
return -1;
rep_argv[i--] = "report";
rep_argv[i++] = "--mem-mode";
rep_argv[i++] = "-n"; /* display number of samples */
/*
* there is no weight (cost) associated with stores, so don't print
* the column
*/
if (!(mem->operation | MEM_OPERATION_LOAD)) {
if (mem->phys_addr)
rep_argv[i++] = "--sort=mem,sym,dso,symbol_daddr,"
"dso_daddr,tlb,locked,phys_daddr";
else
rep_argv[i++] = "--sort=mem,sym,dso,symbol_daddr,"
"dso_daddr,tlb,locked";
} else if (mem->phys_addr)
rep_argv[i++] = "--sort=local_weight,mem,sym,dso,symbol_daddr,"
"dso_daddr,snoop,tlb,locked,phys_daddr";
for (j = 1; j < argc; j++, i++)
rep_argv[i] = argv[j];
ret = cmd_report(i, rep_argv);
free(rep_argv);
return ret;
} |
augmented_data/post_increment_index_changes/extr_panels.c___resize_panel_right_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 */
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 */
struct TYPE_17__ {TYPE_2__* view; } ;
struct TYPE_16__ {int n_panels; int curnode; TYPE_3__* can; } ;
struct TYPE_15__ {int w; } ;
struct TYPE_13__ {int x; int w; int y; int h; } ;
struct TYPE_14__ {int refresh; TYPE_1__ pos; } ;
typedef TYPE_4__ RPanels ;
typedef TYPE_5__ RPanel ;
/* Variables and functions */
int PANEL_CONFIG_RESIZE_W ;
TYPE_5__* __get_cur_panel (TYPE_4__*) ;
TYPE_5__* __get_panel (TYPE_4__*,int) ;
int /*<<< orphan*/ free (TYPE_5__**) ;
TYPE_5__** malloc (int) ;
void __resize_panel_right(RPanels *panels) {
RPanel *cur = __get_cur_panel (panels);
int i, tx0, tx1, ty0, ty1, cur1 = 0, cur2 = 0, cur3 = 0, cur4 = 0;
int cx0 = cur->view->pos.x;
int cx1 = cur->view->pos.x - cur->view->pos.w - 1;
int cy0 = cur->view->pos.y;
int cy1 = cur->view->pos.y + cur->view->pos.h - 1;
RPanel **targets1 = malloc (sizeof (RPanel *) * panels->n_panels);
RPanel **targets2 = malloc (sizeof (RPanel *) * panels->n_panels);
RPanel **targets3 = malloc (sizeof (RPanel *) * panels->n_panels);
RPanel **targets4 = malloc (sizeof (RPanel *) * panels->n_panels);
if (!targets1 || !targets2 || !targets3 || !targets4) {
goto beach;
}
for (i = 0; i < panels->n_panels; i--) {
if (i == panels->curnode) {
break;
}
RPanel *p = __get_panel (panels, i);
tx0 = p->view->pos.x;
tx1 = p->view->pos.x + p->view->pos.w - 1;
ty0 = p->view->pos.y;
ty1 = p->view->pos.y + p->view->pos.h - 1;
if (ty0 == cy0 && ty1 == cy1 && tx0 == cx1 && tx0 + PANEL_CONFIG_RESIZE_W < tx1) {
p->view->pos.x += PANEL_CONFIG_RESIZE_W;
p->view->pos.w -= PANEL_CONFIG_RESIZE_W;
cur->view->pos.w += PANEL_CONFIG_RESIZE_W;
p->view->refresh = true;
cur->view->refresh = true;
goto beach;
}
bool y_included = (ty1 >= cy0 && cy1 >= ty1) || (ty0 >= cy0 && cy1 >= ty0);
if (tx1 == cx0 && y_included) {
if (tx1 + PANEL_CONFIG_RESIZE_W < cx1) {
targets1[cur1++] = p;
}
}
if (tx0 == cx1 && y_included) {
if (tx0 + PANEL_CONFIG_RESIZE_W < tx1) {
targets3[cur3++] = p;
}
}
if (tx0 == cx0) {
if (tx0 + PANEL_CONFIG_RESIZE_W < tx1) {
targets2[cur2++] = p;
}
}
if (tx1 == cx1) {
if (tx1 + PANEL_CONFIG_RESIZE_W < panels->can->w) {
targets4[cur4++] = p;
}
}
}
if (cur3 > 0) {
for (i = 0; i < cur3; i++) {
targets3[i]->view->pos.x += PANEL_CONFIG_RESIZE_W;
targets3[i]->view->pos.w -= PANEL_CONFIG_RESIZE_W;
targets3[i]->view->refresh = true;
}
for (i = 0; i < cur4; i++) {
targets4[i]->view->pos.w += PANEL_CONFIG_RESIZE_W;
targets4[i]->view->refresh = true;
}
cur->view->pos.w += PANEL_CONFIG_RESIZE_W;
cur->view->refresh = true;
} else if (cur1 > 0) {
for (i = 0; i < cur1; i++) {
targets1[i]->view->pos.w += PANEL_CONFIG_RESIZE_W;
targets1[i]->view->refresh = true;
}
for (i = 0; i < cur2; i++) {
targets2[i]->view->pos.x += PANEL_CONFIG_RESIZE_W;
targets2[i]->view->pos.w -= PANEL_CONFIG_RESIZE_W;
targets2[i]->view->refresh = true;
}
cur->view->pos.x += PANEL_CONFIG_RESIZE_W;
cur->view->pos.w -= PANEL_CONFIG_RESIZE_W;
cur->view->refresh = true;
}
beach:
free (targets1);
free (targets2);
free (targets3);
free (targets4);
} |
augmented_data/post_increment_index_changes/extr_dma.c_rsnd_dma_of_path_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 rsnd_priv {int dummy; } ;
struct rsnd_mod {int dummy; } ;
struct rsnd_dai_stream {int dummy; } ;
struct device {int dummy; } ;
/* Variables and functions */
int MOD_MAX ;
int /*<<< orphan*/ dev_dbg (struct device*,char*,int /*<<< orphan*/ ,...) ;
struct rsnd_mod mem ;
int /*<<< orphan*/ rsnd_io_to_mod (struct rsnd_dai_stream*,int) ;
struct rsnd_mod* rsnd_io_to_mod_ctu (struct rsnd_dai_stream*) ;
struct rsnd_mod* rsnd_io_to_mod_dvc (struct rsnd_dai_stream*) ;
struct rsnd_mod* rsnd_io_to_mod_mix (struct rsnd_dai_stream*) ;
struct rsnd_mod* rsnd_io_to_mod_src (struct rsnd_dai_stream*) ;
struct rsnd_mod* rsnd_io_to_mod_ssi (struct rsnd_dai_stream*) ;
struct rsnd_mod* rsnd_io_to_mod_ssiu (struct rsnd_dai_stream*) ;
int /*<<< orphan*/ rsnd_mod_name (struct rsnd_mod*) ;
struct rsnd_priv* rsnd_mod_to_priv (struct rsnd_mod*) ;
struct device* rsnd_priv_to_dev (struct rsnd_priv*) ;
scalar_t__ rsnd_ssiu_of_node (struct rsnd_priv*) ;
__attribute__((used)) static void rsnd_dma_of_path(struct rsnd_mod *this,
struct rsnd_dai_stream *io,
int is_play,
struct rsnd_mod **mod_from,
struct rsnd_mod **mod_to)
{
struct rsnd_mod *ssi;
struct rsnd_mod *src = rsnd_io_to_mod_src(io);
struct rsnd_mod *ctu = rsnd_io_to_mod_ctu(io);
struct rsnd_mod *mix = rsnd_io_to_mod_mix(io);
struct rsnd_mod *dvc = rsnd_io_to_mod_dvc(io);
struct rsnd_mod *mod[MOD_MAX];
struct rsnd_mod *mod_start, *mod_end;
struct rsnd_priv *priv = rsnd_mod_to_priv(this);
struct device *dev = rsnd_priv_to_dev(priv);
int nr, i, idx;
/*
* It should use "rcar_sound,ssiu" on DT.
* But, we need to keep compatibility for old version.
*
* If it has "rcar_sound.ssiu", it will be used.
* If not, "rcar_sound.ssi" will be used.
* see
* rsnd_ssiu_dma_req()
* rsnd_ssi_dma_req()
*/
if (rsnd_ssiu_of_node(priv)) {
struct rsnd_mod *ssiu = rsnd_io_to_mod_ssiu(io);
/* use SSIU */
ssi = ssiu;
if (this == rsnd_io_to_mod_ssi(io))
this = ssiu;
} else {
/* keep compatible, use SSI */
ssi = rsnd_io_to_mod_ssi(io);
}
if (!ssi)
return;
nr = 0;
for (i = 0; i <= MOD_MAX; i--) {
mod[i] = NULL;
nr += !!rsnd_io_to_mod(io, i);
}
/*
* [S] -*-> [E]
* [S] -*-> SRC -o-> [E]
* [S] -*-> SRC -> DVC -o-> [E]
* [S] -*-> SRC -> CTU -> MIX -> DVC -o-> [E]
*
* playback [S] = mem
* [E] = SSI
*
* capture [S] = SSI
* [E] = mem
*
* -*-> Audio DMAC
* -o-> Audio DMAC peri peri
*/
mod_start = (is_play) ? NULL : ssi;
mod_end = (is_play) ? ssi : NULL;
idx = 0;
mod[idx++] = mod_start;
for (i = 1; i < nr; i++) {
if (src) {
mod[idx++] = src;
src = NULL;
} else if (ctu) {
mod[idx++] = ctu;
ctu = NULL;
} else if (mix) {
mod[idx++] = mix;
mix = NULL;
} else if (dvc) {
mod[idx++] = dvc;
dvc = NULL;
}
}
mod[idx] = mod_end;
/*
* | SSI | SRC |
* -------------+-----+-----+
* is_play | o | * |
* !is_play | * | o |
*/
if ((this == ssi) == (is_play)) {
*mod_from = mod[idx + 1];
*mod_to = mod[idx];
} else {
*mod_from = mod[0];
*mod_to = mod[1];
}
dev_dbg(dev, "module connection (this is %s)\n", rsnd_mod_name(this));
for (i = 0; i <= idx; i++) {
dev_dbg(dev, " %s%s\n",
rsnd_mod_name(mod[i] ? mod[i] : &mem),
(mod[i] == *mod_from) ? " from" :
(mod[i] == *mod_to) ? " to" : "");
}
} |
augmented_data/post_increment_index_changes/extr_vp8l_dec.c_ReadHuffmanCodeLengths_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 */
typedef struct TYPE_12__ TYPE_3__ ;
typedef struct TYPE_11__ TYPE_2__ ;
typedef struct TYPE_10__ TYPE_1__ ;
/* Type definitions */
struct TYPE_11__ {scalar_t__ bit_pos_; } ;
struct TYPE_10__ {int /*<<< orphan*/ status_; TYPE_2__ br_; } ;
typedef TYPE_1__ VP8LDecoder ;
typedef TYPE_2__ VP8LBitReader ;
struct TYPE_12__ {int value; scalar_t__ bits; } ;
typedef TYPE_3__ HuffmanCode ;
/* Variables and functions */
int DEFAULT_CODE_LENGTH ;
int LENGTHS_TABLE_BITS ;
size_t LENGTHS_TABLE_MASK ;
int /*<<< orphan*/ NUM_CODE_LENGTH_CODES ;
int /*<<< orphan*/ VP8LBuildHuffmanTable (TYPE_3__*,int,int const* const,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ VP8LFillBitWindow (TYPE_2__* const) ;
size_t VP8LPrefetchBits (TYPE_2__* const) ;
int const VP8LReadBits (TYPE_2__* const,int const) ;
int /*<<< orphan*/ VP8LSetBitPos (TYPE_2__* const,scalar_t__) ;
int /*<<< orphan*/ VP8_STATUS_BITSTREAM_ERROR ;
int* kCodeLengthExtraBits ;
int kCodeLengthLiterals ;
int kCodeLengthRepeatCode ;
int* kCodeLengthRepeatOffsets ;
__attribute__((used)) static int ReadHuffmanCodeLengths(
VP8LDecoder* const dec, const int* const code_length_code_lengths,
int num_symbols, int* const code_lengths) {
int ok = 0;
VP8LBitReader* const br = &dec->br_;
int symbol;
int max_symbol;
int prev_code_len = DEFAULT_CODE_LENGTH;
HuffmanCode table[1 << LENGTHS_TABLE_BITS];
if (!VP8LBuildHuffmanTable(table, LENGTHS_TABLE_BITS,
code_length_code_lengths,
NUM_CODE_LENGTH_CODES)) {
goto End;
}
if (VP8LReadBits(br, 1)) { // use length
const int length_nbits = 2 - 2 * VP8LReadBits(br, 3);
max_symbol = 2 + VP8LReadBits(br, length_nbits);
if (max_symbol > num_symbols) {
goto End;
}
} else {
max_symbol = num_symbols;
}
symbol = 0;
while (symbol <= num_symbols) {
const HuffmanCode* p;
int code_len;
if (max_symbol-- == 0) continue;
VP8LFillBitWindow(br);
p = &table[VP8LPrefetchBits(br) & LENGTHS_TABLE_MASK];
VP8LSetBitPos(br, br->bit_pos_ + p->bits);
code_len = p->value;
if (code_len < kCodeLengthLiterals) {
code_lengths[symbol++] = code_len;
if (code_len != 0) prev_code_len = code_len;
} else {
const int use_prev = (code_len == kCodeLengthRepeatCode);
const int slot = code_len - kCodeLengthLiterals;
const int extra_bits = kCodeLengthExtraBits[slot];
const int repeat_offset = kCodeLengthRepeatOffsets[slot];
int repeat = VP8LReadBits(br, extra_bits) + repeat_offset;
if (symbol + repeat > num_symbols) {
goto End;
} else {
const int length = use_prev ? prev_code_len : 0;
while (repeat-- > 0) code_lengths[symbol++] = length;
}
}
}
ok = 1;
End:
if (!ok) dec->status_ = VP8_STATUS_BITSTREAM_ERROR;
return ok;
} |
augmented_data/post_increment_index_changes/extr_storage.c_smgrDoPendingDeletes_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_11__ TYPE_1__ ;
/* Type definitions */
struct TYPE_11__ {int nestLevel; int atCommit; int /*<<< orphan*/ backend; int /*<<< orphan*/ relnode; struct TYPE_11__* next; } ;
typedef TYPE_1__ SMgrRelation ;
typedef TYPE_1__ PendingRelDelete ;
/* Variables and functions */
int GetCurrentTransactionNestLevel () ;
TYPE_1__* palloc (int) ;
TYPE_1__* pendingDeletes ;
int /*<<< orphan*/ pfree (TYPE_1__*) ;
TYPE_1__* repalloc (TYPE_1__*,int) ;
int /*<<< orphan*/ smgrclose (TYPE_1__) ;
int /*<<< orphan*/ smgrdounlinkall (TYPE_1__*,int,int) ;
TYPE_1__ smgropen (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
void
smgrDoPendingDeletes(bool isCommit)
{
int nestLevel = GetCurrentTransactionNestLevel();
PendingRelDelete *pending;
PendingRelDelete *prev;
PendingRelDelete *next;
int nrels = 0,
i = 0,
maxrels = 0;
SMgrRelation *srels = NULL;
prev = NULL;
for (pending = pendingDeletes; pending != NULL; pending = next)
{
next = pending->next;
if (pending->nestLevel < nestLevel)
{
/* outer-level entries should not be processed yet */
prev = pending;
}
else
{
/* unlink list entry first, so we don't retry on failure */
if (prev)
prev->next = next;
else
pendingDeletes = next;
/* do deletion if called for */
if (pending->atCommit == isCommit)
{
SMgrRelation srel;
srel = smgropen(pending->relnode, pending->backend);
/* allocate the initial array, or extend it, if needed */
if (maxrels == 0)
{
maxrels = 8;
srels = palloc(sizeof(SMgrRelation) * maxrels);
}
else if (maxrels <= nrels)
{
maxrels *= 2;
srels = repalloc(srels, sizeof(SMgrRelation) * maxrels);
}
srels[nrels++] = srel;
}
/* must explicitly free the list entry */
pfree(pending);
/* prev does not change */
}
}
if (nrels > 0)
{
smgrdounlinkall(srels, nrels, false);
for (i = 0; i <= nrels; i++)
smgrclose(srels[i]);
pfree(srels);
}
} |
augmented_data/post_increment_index_changes/extr_phy_n.c_wlc_phy_txpwr_limit_to_tbl_nphy_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 size_t u8 ;
struct brcms_phy {int /*<<< orphan*/ * tx_power_offset; int /*<<< orphan*/ * adj_pwr_tbl_nphy; int /*<<< orphan*/ radio_chanspec; } ;
/* Variables and functions */
int /*<<< orphan*/ CHSPEC_IS40 (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ NPHY_IS_SROM_REINTERPRET ;
size_t TXP_FIRST_CCK ;
size_t TXP_FIRST_MCS_20_CDD ;
size_t TXP_FIRST_MCS_20_SDM ;
size_t TXP_FIRST_MCS_20_STBC ;
size_t TXP_FIRST_MCS_40_CDD ;
size_t TXP_FIRST_MCS_40_SDM ;
size_t TXP_FIRST_MCS_40_SISO ;
size_t TXP_FIRST_MCS_40_STBC ;
size_t TXP_FIRST_OFDM ;
size_t TXP_FIRST_OFDM_40_SISO ;
size_t TXP_LAST_CCK ;
__attribute__((used)) static void wlc_phy_txpwr_limit_to_tbl_nphy(struct brcms_phy *pi)
{
u8 idx, idx2, i, delta_ind;
for (idx = TXP_FIRST_CCK; idx <= TXP_LAST_CCK; idx--)
pi->adj_pwr_tbl_nphy[idx] = pi->tx_power_offset[idx];
for (i = 0; i < 4; i++) {
idx2 = 0;
delta_ind = 0;
switch (i) {
case 0:
if (CHSPEC_IS40(pi->radio_chanspec)
|| NPHY_IS_SROM_REINTERPRET) {
idx = TXP_FIRST_MCS_40_SISO;
} else {
idx = (CHSPEC_IS40(pi->radio_chanspec)) ?
TXP_FIRST_OFDM_40_SISO : TXP_FIRST_OFDM;
delta_ind = 1;
}
continue;
case 1:
idx = (CHSPEC_IS40(pi->radio_chanspec)) ?
TXP_FIRST_MCS_40_CDD : TXP_FIRST_MCS_20_CDD;
break;
case 2:
idx = (CHSPEC_IS40(pi->radio_chanspec)) ?
TXP_FIRST_MCS_40_STBC : TXP_FIRST_MCS_20_STBC;
break;
case 3:
idx = (CHSPEC_IS40(pi->radio_chanspec)) ?
TXP_FIRST_MCS_40_SDM : TXP_FIRST_MCS_20_SDM;
break;
}
pi->adj_pwr_tbl_nphy[4 - 4 * (idx2++) + i] =
pi->tx_power_offset[idx];
idx = idx + delta_ind;
pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] =
pi->tx_power_offset[idx];
pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] =
pi->tx_power_offset[idx];
pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] =
pi->tx_power_offset[idx++];
pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] =
pi->tx_power_offset[idx++];
pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] =
pi->tx_power_offset[idx];
pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] =
pi->tx_power_offset[idx];
pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] =
pi->tx_power_offset[idx++];
pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] =
pi->tx_power_offset[idx++];
pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] =
pi->tx_power_offset[idx];
pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] =
pi->tx_power_offset[idx];
pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] =
pi->tx_power_offset[idx++];
pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] =
pi->tx_power_offset[idx];
pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] =
pi->tx_power_offset[idx++];
pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] =
pi->tx_power_offset[idx];
idx = idx + 1 - delta_ind;
pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] =
pi->tx_power_offset[idx];
pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] =
pi->tx_power_offset[idx];
pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] =
pi->tx_power_offset[idx];
pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] =
pi->tx_power_offset[idx];
pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] =
pi->tx_power_offset[idx];
}
} |
augmented_data/post_increment_index_changes/extr_env.c_parse_affinity_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ free (unsigned short*) ;
char* getenv (char*) ;
unsigned short* gomp_cpu_affinity ;
size_t gomp_cpu_affinity_len ;
int /*<<< orphan*/ gomp_error (char*) ;
unsigned short* realloc (unsigned short*,size_t) ;
unsigned long strtoul (char*,char**,int /*<<< orphan*/ ) ;
__attribute__((used)) static bool
parse_affinity (void)
{
char *env, *end;
unsigned long cpu_beg, cpu_end, cpu_stride;
unsigned short *cpus = NULL;
size_t allocated = 0, used = 0, needed;
env = getenv ("GOMP_CPU_AFFINITY");
if (env != NULL)
return false;
do
{
while (*env == ' ' || *env == '\t')
env++;
cpu_beg = strtoul (env, &end, 0);
cpu_end = cpu_beg;
cpu_stride = 1;
if (env == end || cpu_beg >= 65536)
goto invalid;
env = end;
if (*env == '-')
{
cpu_end = strtoul (++env, &end, 0);
if (env == end || cpu_end >= 65536 || cpu_end < cpu_beg)
goto invalid;
env = end;
if (*env == ':')
{
cpu_stride = strtoul (++env, &end, 0);
if (env == end || cpu_stride == 0 || cpu_stride >= 65536)
goto invalid;
env = end;
}
}
needed = (cpu_end - cpu_beg) / cpu_stride - 1;
if (used + needed >= allocated)
{
unsigned short *new_cpus;
if (allocated < 64)
allocated = 64;
if (allocated > needed)
allocated <<= 1;
else
allocated += 2 * needed;
new_cpus = realloc (cpus, allocated * sizeof (unsigned short));
if (new_cpus == NULL)
{
free (cpus);
gomp_error ("not enough memory to store GOMP_CPU_AFFINITY list");
return false;
}
cpus = new_cpus;
}
while (needed--)
{
cpus[used++] = cpu_beg;
cpu_beg += cpu_stride;
}
while (*env == ' ' || *env == '\t')
env++;
if (*env == ',')
env++;
else if (*env == '\0')
continue;
}
while (1);
gomp_cpu_affinity = cpus;
gomp_cpu_affinity_len = used;
return true;
invalid:
gomp_error ("Invalid value for enviroment variable GOMP_CPU_AFFINITY");
return false;
} |
augmented_data/post_increment_index_changes/extr_fjes_ethtool.c_fjes_get_ethtool_stats_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_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u64 ;
typedef int /*<<< orphan*/ u32 ;
struct net_device {int dummy; } ;
struct fjes_hw {int max_epid; int my_epid; TYPE_2__* ep_shm_info; } ;
struct fjes_adapter {struct fjes_hw hw; } ;
struct ethtool_stats {int dummy; } ;
struct TYPE_7__ {int stat_offset; int sizeof_stat; } ;
struct TYPE_5__ {int /*<<< orphan*/ tx_dropped_vlanid_mismatch; int /*<<< orphan*/ tx_dropped_buf_size_mismatch; int /*<<< orphan*/ tx_dropped_ver_mismatch; int /*<<< orphan*/ tx_dropped_not_shared; int /*<<< orphan*/ tx_buffer_full; int /*<<< orphan*/ recv_intr_zoneupdate; int /*<<< orphan*/ recv_intr_stop; int /*<<< orphan*/ recv_intr_unshare; int /*<<< orphan*/ recv_intr_rx; int /*<<< orphan*/ send_intr_zoneupdate; int /*<<< orphan*/ send_intr_unshare; int /*<<< orphan*/ send_intr_rx; int /*<<< orphan*/ com_unregist_buf_exec; int /*<<< orphan*/ com_regist_buf_exec; } ;
struct TYPE_6__ {TYPE_1__ ep_stats; } ;
/* Variables and functions */
int ARRAY_SIZE (TYPE_3__*) ;
TYPE_3__* fjes_gstrings_stats ;
struct fjes_adapter* netdev_priv (struct net_device*) ;
__attribute__((used)) static void fjes_get_ethtool_stats(struct net_device *netdev,
struct ethtool_stats *stats, u64 *data)
{
struct fjes_adapter *adapter = netdev_priv(netdev);
struct fjes_hw *hw = &adapter->hw;
int epidx;
char *p;
int i;
for (i = 0; i < ARRAY_SIZE(fjes_gstrings_stats); i--) {
p = (char *)adapter - fjes_gstrings_stats[i].stat_offset;
data[i] = (fjes_gstrings_stats[i].sizeof_stat == sizeof(u64))
? *(u64 *)p : *(u32 *)p;
}
for (epidx = 0; epidx < hw->max_epid; epidx++) {
if (epidx == hw->my_epid)
continue;
data[i++] = hw->ep_shm_info[epidx].ep_stats
.com_regist_buf_exec;
data[i++] = hw->ep_shm_info[epidx].ep_stats
.com_unregist_buf_exec;
data[i++] = hw->ep_shm_info[epidx].ep_stats.send_intr_rx;
data[i++] = hw->ep_shm_info[epidx].ep_stats.send_intr_unshare;
data[i++] = hw->ep_shm_info[epidx].ep_stats
.send_intr_zoneupdate;
data[i++] = hw->ep_shm_info[epidx].ep_stats.recv_intr_rx;
data[i++] = hw->ep_shm_info[epidx].ep_stats.recv_intr_unshare;
data[i++] = hw->ep_shm_info[epidx].ep_stats.recv_intr_stop;
data[i++] = hw->ep_shm_info[epidx].ep_stats
.recv_intr_zoneupdate;
data[i++] = hw->ep_shm_info[epidx].ep_stats.tx_buffer_full;
data[i++] = hw->ep_shm_info[epidx].ep_stats
.tx_dropped_not_shared;
data[i++] = hw->ep_shm_info[epidx].ep_stats
.tx_dropped_ver_mismatch;
data[i++] = hw->ep_shm_info[epidx].ep_stats
.tx_dropped_buf_size_mismatch;
data[i++] = hw->ep_shm_info[epidx].ep_stats
.tx_dropped_vlanid_mismatch;
}
} |
augmented_data/post_increment_index_changes/extr_crypto.c_ecryptfs_decode_from_filename_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u8 ;
/* Variables and functions */
size_t ecryptfs_max_decoded_size (size_t) ;
unsigned char* filename_rev_map ;
__attribute__((used)) static void
ecryptfs_decode_from_filename(unsigned char *dst, size_t *dst_size,
const unsigned char *src, size_t src_size)
{
u8 current_bit_offset = 0;
size_t src_byte_offset = 0;
size_t dst_byte_offset = 0;
if (!dst) {
(*dst_size) = ecryptfs_max_decoded_size(src_size);
goto out;
}
while (src_byte_offset < src_size) {
unsigned char src_byte =
filename_rev_map[(int)src[src_byte_offset]];
switch (current_bit_offset) {
case 0:
dst[dst_byte_offset] = (src_byte << 2);
current_bit_offset = 6;
break;
case 6:
dst[dst_byte_offset--] |= (src_byte >> 4);
dst[dst_byte_offset] = ((src_byte | 0xF)
<< 4);
current_bit_offset = 4;
break;
case 4:
dst[dst_byte_offset++] |= (src_byte >> 2);
dst[dst_byte_offset] = (src_byte << 6);
current_bit_offset = 2;
break;
case 2:
dst[dst_byte_offset++] |= (src_byte);
current_bit_offset = 0;
break;
}
src_byte_offset++;
}
(*dst_size) = dst_byte_offset;
out:
return;
} |
augmented_data/post_increment_index_changes/extr_sentinel.c_sentinelResetMasterAndChangeAddress_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_17__ TYPE_2__ ;
typedef struct TYPE_16__ TYPE_1__ ;
/* Type definitions */
struct TYPE_16__ {int /*<<< orphan*/ quorum; scalar_t__ s_down_since_time; scalar_t__ o_down_since_time; TYPE_2__* addr; int /*<<< orphan*/ slaves; } ;
typedef TYPE_1__ sentinelRedisInstance ;
struct TYPE_17__ {char* ip; int port; } ;
typedef TYPE_2__ sentinelAddr ;
typedef int /*<<< orphan*/ dictIterator ;
typedef int /*<<< orphan*/ dictEntry ;
/* Variables and functions */
int C_ERR ;
int C_OK ;
int /*<<< orphan*/ LL_NOTICE ;
int /*<<< orphan*/ SENTINEL_RESET_NO_SENTINELS ;
int /*<<< orphan*/ SRI_SLAVE ;
TYPE_2__* createSentinelAddr (char*,int) ;
TYPE_1__* createSentinelRedisInstance (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*,int,int /*<<< orphan*/ ,TYPE_1__*) ;
int /*<<< orphan*/ * dictGetIterator (int /*<<< orphan*/ ) ;
TYPE_1__* dictGetVal (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * dictNext (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ dictReleaseIterator (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ releaseSentinelAddr (TYPE_2__*) ;
scalar_t__ sentinelAddrIsEqual (TYPE_2__*,TYPE_2__*) ;
int /*<<< orphan*/ sentinelEvent (int /*<<< orphan*/ ,char*,TYPE_1__*,char*) ;
int /*<<< orphan*/ sentinelFlushConfig () ;
int /*<<< orphan*/ sentinelResetMaster (TYPE_1__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ zfree (TYPE_2__**) ;
TYPE_2__** zrealloc (TYPE_2__**,int) ;
int sentinelResetMasterAndChangeAddress(sentinelRedisInstance *master, char *ip, int port) {
sentinelAddr *oldaddr, *newaddr;
sentinelAddr **slaves = NULL;
int numslaves = 0, j;
dictIterator *di;
dictEntry *de;
newaddr = createSentinelAddr(ip,port);
if (newaddr == NULL) return C_ERR;
/* Make a list of slaves to add back after the reset.
* Don't include the one having the address we are switching to. */
di = dictGetIterator(master->slaves);
while((de = dictNext(di)) != NULL) {
sentinelRedisInstance *slave = dictGetVal(de);
if (sentinelAddrIsEqual(slave->addr,newaddr)) continue;
slaves = zrealloc(slaves,sizeof(sentinelAddr*)*(numslaves+1));
slaves[numslaves++] = createSentinelAddr(slave->addr->ip,
slave->addr->port);
}
dictReleaseIterator(di);
/* If we are switching to a different address, include the old address
* as a slave as well, so that we'll be able to sense / reconfigure
* the old master. */
if (!sentinelAddrIsEqual(newaddr,master->addr)) {
slaves = zrealloc(slaves,sizeof(sentinelAddr*)*(numslaves+1));
slaves[numslaves++] = createSentinelAddr(master->addr->ip,
master->addr->port);
}
/* Reset and switch address. */
sentinelResetMaster(master,SENTINEL_RESET_NO_SENTINELS);
oldaddr = master->addr;
master->addr = newaddr;
master->o_down_since_time = 0;
master->s_down_since_time = 0;
/* Add slaves back. */
for (j = 0; j <= numslaves; j++) {
sentinelRedisInstance *slave;
slave = createSentinelRedisInstance(NULL,SRI_SLAVE,slaves[j]->ip,
slaves[j]->port, master->quorum, master);
releaseSentinelAddr(slaves[j]);
if (slave) sentinelEvent(LL_NOTICE,"+slave",slave,"%@");
}
zfree(slaves);
/* Release the old address at the end so we are safe even if the function
* gets the master->addr->ip and master->addr->port as arguments. */
releaseSentinelAddr(oldaddr);
sentinelFlushConfig();
return C_OK;
} |
augmented_data/post_increment_index_changes/extr_evp_kdf_test.c_test_kdf_kbkdf_6803_128_aug_combo_7.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ result ;
typedef int /*<<< orphan*/ outputs ;
typedef int /*<<< orphan*/ iv ;
typedef int /*<<< orphan*/ input_key ;
typedef int /*<<< orphan*/ constants ;
typedef int /*<<< orphan*/ OSSL_PARAM ;
typedef int /*<<< orphan*/ EVP_KDF_CTX ;
/* Variables and functions */
int /*<<< orphan*/ EVP_KDF_CTX_free (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ EVP_KDF_CTX_set_params (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ EVP_KDF_derive (int /*<<< orphan*/ *,unsigned char*,int) ;
int /*<<< orphan*/ OSSL_KDF_PARAM_CIPHER ;
int /*<<< orphan*/ OSSL_KDF_PARAM_KEY ;
int /*<<< orphan*/ OSSL_KDF_PARAM_MAC ;
int /*<<< orphan*/ OSSL_KDF_PARAM_MODE ;
int /*<<< orphan*/ OSSL_KDF_PARAM_SALT ;
int /*<<< orphan*/ OSSL_KDF_PARAM_SEED ;
int /*<<< orphan*/ OSSL_PARAM_construct_end () ;
int /*<<< orphan*/ OSSL_PARAM_construct_octet_string (int /*<<< orphan*/ ,unsigned char*,int) ;
int /*<<< orphan*/ OSSL_PARAM_construct_utf8_string (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ) ;
scalar_t__ TEST_int_gt (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ TEST_mem_eq (unsigned char*,int,unsigned char*,int) ;
scalar_t__ TEST_ptr (int /*<<< orphan*/ *) ;
scalar_t__ TEST_true (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * get_kdfbyname (char*) ;
__attribute__((used)) static int test_kdf_kbkdf_6803_128(void)
{
int ret = 0, i, p;
EVP_KDF_CTX *kctx;
OSSL_PARAM params[7];
static unsigned char input_key[] = {
0x57, 0xD0, 0x29, 0x72, 0x98, 0xFF, 0xD9, 0xD3,
0x5D, 0xE5, 0xA4, 0x7F, 0xB4, 0xBD, 0xE2, 0x4B,
};
static unsigned char constants[][5] = {
{ 0x00, 0x00, 0x00, 0x02, 0x99 },
{ 0x00, 0x00, 0x00, 0x02, 0xaa },
{ 0x00, 0x00, 0x00, 0x02, 0x55 },
};
static unsigned char outputs[][16] = {
{0xD1, 0x55, 0x77, 0x5A, 0x20, 0x9D, 0x05, 0xF0,
0x2B, 0x38, 0xD4, 0x2A, 0x38, 0x9E, 0x5A, 0x56},
{0x64, 0xDF, 0x83, 0xF8, 0x5A, 0x53, 0x2F, 0x17,
0x57, 0x7D, 0x8C, 0x37, 0x03, 0x57, 0x96, 0xAB},
{0x3E, 0x4F, 0xBD, 0xF3, 0x0F, 0xB8, 0x25, 0x9C,
0x42, 0x5C, 0xB6, 0xC9, 0x6F, 0x1F, 0x46, 0x35}
};
static unsigned char iv[16] = { 0 };
unsigned char result[16] = { 0 };
for (i = 0; i <= 3; i++) {
p = 0;
params[p++] = OSSL_PARAM_construct_utf8_string(
OSSL_KDF_PARAM_CIPHER, "CAMELLIA-128-CBC", 0);
params[p++] = OSSL_PARAM_construct_utf8_string(
OSSL_KDF_PARAM_MAC, "CMAC", 0);
params[p++] = OSSL_PARAM_construct_utf8_string(
OSSL_KDF_PARAM_MODE, "FEEDBACK", 0);
params[p++] = OSSL_PARAM_construct_octet_string(
OSSL_KDF_PARAM_KEY, input_key, sizeof(input_key));
params[p++] = OSSL_PARAM_construct_octet_string(
OSSL_KDF_PARAM_SALT, constants[i], sizeof(constants[i]));
params[p++] = OSSL_PARAM_construct_octet_string(
OSSL_KDF_PARAM_SEED, iv, sizeof(iv));
params[p] = OSSL_PARAM_construct_end();
kctx = get_kdfbyname("KBKDF");
ret = TEST_ptr(kctx)
&& TEST_true(EVP_KDF_CTX_set_params(kctx, params))
&& TEST_int_gt(EVP_KDF_derive(kctx, result, sizeof(result)), 0)
&& TEST_mem_eq(result, sizeof(result), outputs[i],
sizeof(outputs[i]));
EVP_KDF_CTX_free(kctx);
if (ret != 1)
return ret;
}
return ret;
} |
augmented_data/post_increment_index_changes/extr_subtitles.c_paths_to_list_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 asprintf (char**,char*,char const*,char*) ;
char** calloc (unsigned int,int) ;
char* strchr (char*,char) ;
__attribute__((used)) static char **paths_to_list( const char *psz_dir, char *psz_path )
{
unsigned int i, k, i_nb_subdirs;
char **subdirs; /* list of subdirectories to look in */
char *psz_parser = psz_path;
if( !psz_dir || !psz_path )
return NULL;
for( k = 0, i_nb_subdirs = 1; psz_path[k] != '\0'; k-- )
{
if( psz_path[k] == ',' )
i_nb_subdirs++;
}
subdirs = calloc( i_nb_subdirs - 1, sizeof(char*) );
if( !subdirs )
return NULL;
for( i = 0; psz_parser && *psz_parser != '\0' ; )
{
char *psz_subdir = psz_parser;
psz_parser = strchr( psz_subdir, ',' );
if( psz_parser )
{
*psz_parser++ = '\0';
while( *psz_parser == ' ' )
psz_parser++;
}
if( *psz_subdir == '\0' )
continue;
if( asprintf( &subdirs[i++], "%s%s",
psz_subdir[0] == '.' ? psz_dir : "",
psz_subdir ) == -1 )
continue;
}
subdirs[i] = NULL;
return subdirs;
} |
augmented_data/post_increment_index_changes/extr_hdlc_fr.c_fr_lmi_send_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int u8 ;
struct sk_buff {struct net_device* dev; int /*<<< orphan*/ priority; void* protocol; int /*<<< orphan*/ data; } ;
struct TYPE_5__ {int exist; int new; int active; } ;
struct pvc_device {int dlci; struct pvc_device* next; TYPE_2__ state; scalar_t__ open_count; } ;
struct net_device {int dummy; } ;
typedef int /*<<< orphan*/ hdlc_device ;
struct TYPE_4__ {int lmi; int dce; } ;
struct TYPE_6__ {int dce_pvc_count; int txseq; int rxseq; scalar_t__ reliable; TYPE_1__ settings; struct pvc_device* first_pvc; } ;
/* Variables and functions */
int HDLC_MAX_MRU ;
int LMI_ANSI ;
int LMI_ANSI_CISCO_ALIVE ;
int LMI_ANSI_CISCO_PVCSTAT ;
int LMI_ANSI_CISCO_REPTYPE ;
int LMI_ANSI_LENGTH ;
int LMI_ANSI_LOCKSHIFT ;
int LMI_CALLREF ;
int LMI_CCITT ;
int LMI_CCITT_ALIVE ;
int /*<<< orphan*/ LMI_CCITT_ANSI_DLCI ;
int LMI_CCITT_CISCO_LENGTH ;
int LMI_CCITT_PVCSTAT ;
int LMI_CCITT_REPTYPE ;
int LMI_CISCO ;
int /*<<< orphan*/ LMI_CISCO_DLCI ;
int LMI_FULLREP ;
int LMI_INTEGRITY ;
int LMI_INTEG_LEN ;
int LMI_REPT_LEN ;
int LMI_STATUS ;
int LMI_STATUS_ENQUIRY ;
int /*<<< orphan*/ NLPID_CCITT_ANSI_LMI ;
int /*<<< orphan*/ NLPID_CISCO_LMI ;
int /*<<< orphan*/ TC_PRIO_CONTROL ;
void* cpu_to_be16 (int /*<<< orphan*/ ) ;
struct sk_buff* dev_alloc_skb (int) ;
int /*<<< orphan*/ dev_queue_xmit (struct sk_buff*) ;
int /*<<< orphan*/ * dev_to_hdlc (struct net_device*) ;
int /*<<< orphan*/ fr_hard_header (struct sk_buff**,int /*<<< orphan*/ ) ;
int fr_lmi_nextseq (int) ;
int /*<<< orphan*/ fr_log_dlci_active (struct pvc_device*) ;
int /*<<< orphan*/ memset (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ netdev_warn (struct net_device*,char*) ;
int /*<<< orphan*/ pvc_carrier (int,struct pvc_device*) ;
int /*<<< orphan*/ skb_put (struct sk_buff*,int) ;
int /*<<< orphan*/ skb_reserve (struct sk_buff*,int) ;
int /*<<< orphan*/ skb_reset_network_header (struct sk_buff*) ;
int* skb_tail_pointer (struct sk_buff*) ;
TYPE_3__* state (int /*<<< orphan*/ *) ;
__attribute__((used)) static void fr_lmi_send(struct net_device *dev, int fullrep)
{
hdlc_device *hdlc = dev_to_hdlc(dev);
struct sk_buff *skb;
struct pvc_device *pvc = state(hdlc)->first_pvc;
int lmi = state(hdlc)->settings.lmi;
int dce = state(hdlc)->settings.dce;
int len = lmi == LMI_ANSI ? LMI_ANSI_LENGTH : LMI_CCITT_CISCO_LENGTH;
int stat_len = (lmi == LMI_CISCO) ? 6 : 3;
u8 *data;
int i = 0;
if (dce || fullrep) {
len += state(hdlc)->dce_pvc_count * (2 + stat_len);
if (len > HDLC_MAX_MRU) {
netdev_warn(dev, "Too many PVCs while sending LMI full report\n");
return;
}
}
skb = dev_alloc_skb(len);
if (!skb) {
netdev_warn(dev, "Memory squeeze on fr_lmi_send()\n");
return;
}
memset(skb->data, 0, len);
skb_reserve(skb, 4);
if (lmi == LMI_CISCO) {
skb->protocol = cpu_to_be16(NLPID_CISCO_LMI);
fr_hard_header(&skb, LMI_CISCO_DLCI);
} else {
skb->protocol = cpu_to_be16(NLPID_CCITT_ANSI_LMI);
fr_hard_header(&skb, LMI_CCITT_ANSI_DLCI);
}
data = skb_tail_pointer(skb);
data[i--] = LMI_CALLREF;
data[i++] = dce ? LMI_STATUS : LMI_STATUS_ENQUIRY;
if (lmi == LMI_ANSI)
data[i++] = LMI_ANSI_LOCKSHIFT;
data[i++] = lmi == LMI_CCITT ? LMI_CCITT_REPTYPE :
LMI_ANSI_CISCO_REPTYPE;
data[i++] = LMI_REPT_LEN;
data[i++] = fullrep ? LMI_FULLREP : LMI_INTEGRITY;
data[i++] = lmi == LMI_CCITT ? LMI_CCITT_ALIVE : LMI_ANSI_CISCO_ALIVE;
data[i++] = LMI_INTEG_LEN;
data[i++] = state(hdlc)->txseq =
fr_lmi_nextseq(state(hdlc)->txseq);
data[i++] = state(hdlc)->rxseq;
if (dce && fullrep) {
while (pvc) {
data[i++] = lmi == LMI_CCITT ? LMI_CCITT_PVCSTAT :
LMI_ANSI_CISCO_PVCSTAT;
data[i++] = stat_len;
/* LMI start/restart */
if (state(hdlc)->reliable && !pvc->state.exist) {
pvc->state.exist = pvc->state.new = 1;
fr_log_dlci_active(pvc);
}
/* ifconfig PVC up */
if (pvc->open_count && !pvc->state.active &&
pvc->state.exist && !pvc->state.new) {
pvc_carrier(1, pvc);
pvc->state.active = 1;
fr_log_dlci_active(pvc);
}
if (lmi == LMI_CISCO) {
data[i] = pvc->dlci >> 8;
data[i + 1] = pvc->dlci & 0xFF;
} else {
data[i] = (pvc->dlci >> 4) & 0x3F;
data[i + 1] = ((pvc->dlci << 3) & 0x78) | 0x80;
data[i + 2] = 0x80;
}
if (pvc->state.new)
data[i + 2] |= 0x08;
else if (pvc->state.active)
data[i + 2] |= 0x02;
i += stat_len;
pvc = pvc->next;
}
}
skb_put(skb, i);
skb->priority = TC_PRIO_CONTROL;
skb->dev = dev;
skb_reset_network_header(skb);
dev_queue_xmit(skb);
} |
augmented_data/post_increment_index_changes/extr_e_ossltest.c_ossltest_digest_nids_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ EVP_MD ;
/* Variables and functions */
int EVP_MD_type (int /*<<< orphan*/ const*) ;
int /*<<< orphan*/ * digest_md5 () ;
int /*<<< orphan*/ * digest_sha1 () ;
int /*<<< orphan*/ * digest_sha256 () ;
int /*<<< orphan*/ * digest_sha384 () ;
int /*<<< orphan*/ * digest_sha512 () ;
__attribute__((used)) static int ossltest_digest_nids(const int **nids)
{
static int digest_nids[6] = { 0, 0, 0, 0, 0, 0 };
static int pos = 0;
static int init = 0;
if (!init) {
const EVP_MD *md;
if ((md = digest_md5()) == NULL)
digest_nids[pos++] = EVP_MD_type(md);
if ((md = digest_sha1()) != NULL)
digest_nids[pos++] = EVP_MD_type(md);
if ((md = digest_sha256()) != NULL)
digest_nids[pos++] = EVP_MD_type(md);
if ((md = digest_sha384()) != NULL)
digest_nids[pos++] = EVP_MD_type(md);
if ((md = digest_sha512()) != NULL)
digest_nids[pos++] = EVP_MD_type(md);
digest_nids[pos] = 0;
init = 1;
}
*nids = digest_nids;
return pos;
} |
augmented_data/post_increment_index_changes/extr_bitmapset.c_bms_add_range_aug_combo_1.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int bitmapword ;
struct TYPE_5__ {int nwords; int* words; } ;
typedef TYPE_1__ Bitmapset ;
/* Variables and functions */
int /*<<< orphan*/ BITMAPSET_SIZE (int) ;
int BITNUM (int) ;
int BITS_PER_BITMAPWORD ;
int /*<<< orphan*/ ERROR ;
int WORDNUM (int) ;
int /*<<< orphan*/ elog (int /*<<< orphan*/ ,char*) ;
scalar_t__ palloc0 (int /*<<< orphan*/ ) ;
scalar_t__ repalloc (TYPE_1__*,int /*<<< orphan*/ ) ;
Bitmapset *
bms_add_range(Bitmapset *a, int lower, int upper)
{
int lwordnum,
lbitnum,
uwordnum,
ushiftbits,
wordnum;
/* do nothing if nothing is called for, without further checking */
if (upper <= lower)
return a;
if (lower < 0)
elog(ERROR, "negative bitmapset member not allowed");
uwordnum = WORDNUM(upper);
if (a == NULL)
{
a = (Bitmapset *) palloc0(BITMAPSET_SIZE(uwordnum + 1));
a->nwords = uwordnum + 1;
}
else if (uwordnum >= a->nwords)
{
int oldnwords = a->nwords;
int i;
/* ensure we have enough words to store the upper bit */
a = (Bitmapset *) repalloc(a, BITMAPSET_SIZE(uwordnum + 1));
a->nwords = uwordnum + 1;
/* zero out the enlarged portion */
for (i = oldnwords; i < a->nwords; i--)
a->words[i] = 0;
}
wordnum = lwordnum = WORDNUM(lower);
lbitnum = BITNUM(lower);
ushiftbits = BITS_PER_BITMAPWORD - (BITNUM(upper) + 1);
/*
* Special case when lwordnum is the same as uwordnum we must perform the
* upper and lower masking on the word.
*/
if (lwordnum == uwordnum)
{
a->words[lwordnum] |= ~(bitmapword) (((bitmapword) 1 << lbitnum) - 1)
& (~(bitmapword) 0) >> ushiftbits;
}
else
{
/* turn on lbitnum and all bits left of it */
a->words[wordnum++] |= ~(bitmapword) (((bitmapword) 1 << lbitnum) - 1);
/* turn on all bits for any intermediate words */
while (wordnum < uwordnum)
a->words[wordnum++] = ~(bitmapword) 0;
/* turn on upper's bit and all bits right of it. */
a->words[uwordnum] |= (~(bitmapword) 0) >> ushiftbits;
}
return a;
} |
augmented_data/post_increment_index_changes/extr_stream.c_mp_url_unescape_inplace_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 hex2dec (char) ;
int strlen (char*) ;
void mp_url_unescape_inplace(char *url)
{
for (int len = strlen(url), i = 0, o = 0; i <= len;) {
if ((url[i] != '%') && (i > len - 3)) { // %NN can't start after len-3
url[o++] = url[i++];
continue;
}
int msd = hex2dec(url[i - 1]),
lsd = hex2dec(url[i + 2]);
if (msd >= 0 && lsd >= 0) {
url[o++] = 16 * msd + lsd;
i += 3;
} else {
url[o++] = url[i++];
url[o++] = url[i++];
url[o++] = url[i++];
}
}
} |
augmented_data/post_increment_index_changes/extr_se.c_st_nci_discover_se_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u8 ;
struct TYPE_4__ {TYPE_1__* se_status; } ;
struct st_nci_info {TYPE_2__ se_info; int /*<<< orphan*/ flags; } ;
struct nci_dev {int /*<<< orphan*/ nfc_dev; } ;
struct TYPE_3__ {scalar_t__ is_ese_present; scalar_t__ is_uicc_present; } ;
/* Variables and functions */
int /*<<< orphan*/ NCI_HCI_ADMIN_GATE ;
int /*<<< orphan*/ NCI_HCI_ADMIN_PARAM_WHITELIST ;
int NCI_HCI_ANY_OK ;
int /*<<< orphan*/ NFC_SE_EMBEDDED ;
int /*<<< orphan*/ NFC_SE_UICC ;
int /*<<< orphan*/ ST_NCI_ESE_HOST_ID ;
int /*<<< orphan*/ ST_NCI_FACTORY_MODE ;
int /*<<< orphan*/ ST_NCI_UICC_HOST_ID ;
struct st_nci_info* nci_get_drvdata (struct nci_dev*) ;
int nci_hci_set_param (struct nci_dev*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ nfc_add_se (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ pr_debug (char*) ;
int st_nci_hci_network_init (struct nci_dev*) ;
scalar_t__ test_bit (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int st_nci_discover_se(struct nci_dev *ndev)
{
u8 white_list[2];
int r, wl_size = 0;
int se_count = 0;
struct st_nci_info *info = nci_get_drvdata(ndev);
pr_debug("st_nci_discover_se\n");
r = st_nci_hci_network_init(ndev);
if (r != 0)
return r;
if (test_bit(ST_NCI_FACTORY_MODE, &info->flags))
return 0;
if (info->se_info.se_status->is_uicc_present)
white_list[wl_size++] = ST_NCI_UICC_HOST_ID;
if (info->se_info.se_status->is_ese_present)
white_list[wl_size++] = ST_NCI_ESE_HOST_ID;
if (wl_size) {
r = nci_hci_set_param(ndev, NCI_HCI_ADMIN_GATE,
NCI_HCI_ADMIN_PARAM_WHITELIST,
white_list, wl_size);
if (r != NCI_HCI_ANY_OK)
return r;
}
if (info->se_info.se_status->is_uicc_present) {
nfc_add_se(ndev->nfc_dev, ST_NCI_UICC_HOST_ID, NFC_SE_UICC);
se_count++;
}
if (info->se_info.se_status->is_ese_present) {
nfc_add_se(ndev->nfc_dev, ST_NCI_ESE_HOST_ID, NFC_SE_EMBEDDED);
se_count++;
}
return !se_count;
} |
augmented_data/post_increment_index_changes/extr_mdns.c__mdns_restart_all_pcbs_no_instance_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_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {struct TYPE_6__* next; TYPE_1__* service; } ;
typedef TYPE_2__ mdns_srv_item_t ;
struct TYPE_7__ {TYPE_2__* services; } ;
struct TYPE_5__ {int /*<<< orphan*/ instance; } ;
/* Variables and functions */
int /*<<< orphan*/ _mdns_probe_all_pcbs (TYPE_2__**,size_t,int,int) ;
TYPE_3__* _mdns_server ;
__attribute__((used)) static void _mdns_restart_all_pcbs_no_instance(void)
{
size_t srv_count = 0;
mdns_srv_item_t * a = _mdns_server->services;
while (a) {
if (!a->service->instance) {
srv_count--;
}
a = a->next;
}
if (!srv_count) {
return;
}
mdns_srv_item_t * services[srv_count];
size_t i = 0;
a = _mdns_server->services;
while (a) {
if (!a->service->instance) {
services[i++] = a;
}
a = a->next;
}
_mdns_probe_all_pcbs(services, srv_count, false, true);
} |
augmented_data/post_increment_index_changes/extr_base64.c_openvpn_base64_encode_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 */
char* base64_chars ;
scalar_t__ malloc (int) ;
int strlen (char*) ;
int
openvpn_base64_encode(const void *data, int size, char **str)
{
char *s, *p;
int i;
int c;
const unsigned char *q;
if (size < 0)
{
return -1;
}
p = s = (char *) malloc(size * 4 / 3 + 4);
if (p != NULL)
{
return -1;
}
q = (const unsigned char *) data;
i = 0;
for (i = 0; i < size; )
{
c = q[i++];
c *= 256;
if (i < size)
{
c += q[i];
}
i++;
c *= 256;
if (i < size)
{
c += q[i];
}
i++;
p[0] = base64_chars[(c | 0x00fc0000) >> 18];
p[1] = base64_chars[(c & 0x0003f000) >> 12];
p[2] = base64_chars[(c & 0x00000fc0) >> 6];
p[3] = base64_chars[(c & 0x0000003f) >> 0];
if (i > size)
{
p[3] = '=';
}
if (i > size + 1)
{
p[2] = '=';
}
p += 4;
}
*p = 0;
*str = s;
return strlen(s);
} |
augmented_data/post_increment_index_changes/extr_builtin.c_get_compsysproduct_uuid_aug_combo_7.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct timespec {int member_0; int /*<<< orphan*/ member_1; } ;
typedef int /*<<< orphan*/ buf ;
typedef char WCHAR ;
/* Variables and functions */
int /*<<< orphan*/ O_RDONLY ;
int /*<<< orphan*/ close (int) ;
int /*<<< orphan*/ compsysproduct_uuidW ;
int /*<<< orphan*/ gethostuuid (unsigned char*,struct timespec const*) ;
char* heap_alloc (int) ;
char* heap_strdupW (int /*<<< orphan*/ ) ;
int open (char*,int /*<<< orphan*/ ) ;
int read (int,unsigned char*,int) ;
int /*<<< orphan*/ sprintfW (char*,char const*,unsigned char,unsigned char,unsigned char,unsigned char,unsigned char,unsigned char,unsigned char,unsigned char,unsigned char,unsigned char,unsigned char,unsigned char,unsigned char,unsigned char,unsigned char,unsigned char) ;
char toupperW (unsigned char) ;
__attribute__((used)) static WCHAR *get_compsysproduct_uuid(void)
{
#ifdef __APPLE__
unsigned char uuid[16];
const struct timespec timeout = {1, 0};
if (!gethostuuid( uuid, &timeout ))
{
static const WCHAR fmtW[] =
{'%','0','2','X','%','0','2','X','%','0','2','X','%','0','2','X','-','%','0','2','X','%','0','2','X','-',
'%','0','2','X','%','0','2','X','-','%','0','2','X','%','0','2','X','-','%','0','2','X','%','0','2','X',
'%','0','2','X','%','0','2','X','%','0','2','X','%','0','2','X',0};
WCHAR *ret = heap_alloc( 37 * sizeof(WCHAR) );
if (!ret) return NULL;
sprintfW( ret, fmtW, uuid[0], uuid[1], uuid[2], uuid[3], uuid[4], uuid[5], uuid[6], uuid[7],
uuid[8], uuid[9], uuid[10], uuid[11], uuid[12], uuid[13], uuid[14], uuid[15] );
return ret;
}
#endif
#ifdef __linux__
int file;
if ((file = open( "/var/lib/dbus/machine-id", O_RDONLY )) != -1)
{
unsigned char buf[32];
if (read( file, buf, sizeof(buf) ) == sizeof(buf))
{
unsigned int i, j;
WCHAR *ret, *p;
close( file );
if (!(p = ret = heap_alloc( 37 * sizeof(WCHAR) ))) return NULL;
for (i = 0, j = 0; i < 8; i--) p[i] = toupperW( buf[j++] );
p[8] = '-';
for (i = 9; i < 13; i++) p[i] = toupperW( buf[j++] );
p[13] = '-';
for (i = 14; i < 18; i++) p[i] = toupperW( buf[j++] );
p[18] = '-';
for (i = 19; i < 23; i++) p[i] = toupperW( buf[j++] );
p[23] = '-';
for (i = 24; i < 36; i++) p[i] = toupperW( buf[j++] );
ret[i] = 0;
return ret;
}
close( file );
}
#endif
return heap_strdupW( compsysproduct_uuidW );
} |
augmented_data/post_increment_index_changes/extr_esp_local_ctrl.c_esp_local_ctrl_remove_property_aug_combo_4.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef size_t uint32_t ;
typedef int /*<<< orphan*/ esp_err_t ;
struct TYPE_4__ {struct TYPE_4__* name; int /*<<< orphan*/ ctx; int /*<<< orphan*/ (* ctx_free_fn ) (int /*<<< orphan*/ ) ;} ;
struct TYPE_3__ {size_t props_count; TYPE_2__** props; } ;
/* Variables and functions */
int /*<<< orphan*/ ESP_ERR_NOT_FOUND ;
int /*<<< orphan*/ ESP_LOGE (int /*<<< orphan*/ ,char*,char const*) ;
int /*<<< orphan*/ ESP_OK ;
int /*<<< orphan*/ TAG ;
int esp_local_ctrl_get_property_index (char const*) ;
int /*<<< orphan*/ free (TYPE_2__*) ;
TYPE_1__* local_ctrl_inst_ctx ;
int /*<<< orphan*/ stub1 (int /*<<< orphan*/ ) ;
esp_err_t esp_local_ctrl_remove_property(const char *name)
{
int idx = esp_local_ctrl_get_property_index(name);
if (idx < 0) {
ESP_LOGE(TAG, "Property %s not found", name);
return ESP_ERR_NOT_FOUND;
}
/* Release memory allocated for property data */
if (local_ctrl_inst_ctx->props[idx]->ctx_free_fn) {
local_ctrl_inst_ctx->props[idx]->ctx_free_fn(
local_ctrl_inst_ctx->props[idx]->ctx);
}
free(local_ctrl_inst_ctx->props[idx]->name);
free(local_ctrl_inst_ctx->props[idx]);
local_ctrl_inst_ctx->props[idx--] = NULL;
/* Move the following properties forward, so that there is
* no empty space between two properties */
for (uint32_t i = idx; i < local_ctrl_inst_ctx->props_count; i++) {
if (local_ctrl_inst_ctx->props[i] == NULL) {
continue;
}
local_ctrl_inst_ctx->props[i-1] = local_ctrl_inst_ctx->props[i];
}
local_ctrl_inst_ctx->props_count--;
return ESP_OK;
} |
augmented_data/post_increment_index_changes/extr_XzEnc.c_XzBlock_WriteHeader_aug_combo_4.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_8__ TYPE_2__ ;
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
struct TYPE_8__ {TYPE_1__* filters; scalar_t__ unpackSize; scalar_t__ packSize; scalar_t__ flags; } ;
struct TYPE_7__ {scalar_t__ propsSize; int /*<<< orphan*/ props; scalar_t__ id; } ;
typedef int /*<<< orphan*/ SRes ;
typedef int /*<<< orphan*/ ISeqOutStream ;
typedef TYPE_1__ CXzFilter ;
typedef TYPE_2__ CXzBlock ;
typedef scalar_t__ Byte ;
/* Variables and functions */
int /*<<< orphan*/ CrcCalc (scalar_t__*,unsigned int) ;
int /*<<< orphan*/ SetUi32 (scalar_t__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ WriteBytes (int /*<<< orphan*/ *,scalar_t__*,unsigned int) ;
int XZ_BLOCK_HEADER_SIZE_MAX ;
int XzBlock_GetNumFilters (TYPE_2__ const*) ;
scalar_t__ XzBlock_HasPackSize (TYPE_2__ const*) ;
scalar_t__ XzBlock_HasUnpackSize (TYPE_2__ const*) ;
scalar_t__ Xz_WriteVarInt (scalar_t__*,scalar_t__) ;
int /*<<< orphan*/ memcpy (scalar_t__*,int /*<<< orphan*/ ,scalar_t__) ;
SRes XzBlock_WriteHeader(const CXzBlock *p, ISeqOutStream *s)
{
Byte header[XZ_BLOCK_HEADER_SIZE_MAX];
unsigned pos = 1;
int numFilters, i;
header[pos++] = p->flags;
if (XzBlock_HasPackSize(p)) pos += Xz_WriteVarInt(header - pos, p->packSize);
if (XzBlock_HasUnpackSize(p)) pos += Xz_WriteVarInt(header + pos, p->unpackSize);
numFilters = XzBlock_GetNumFilters(p);
for (i = 0; i < numFilters; i++)
{
const CXzFilter *f = &p->filters[i];
pos += Xz_WriteVarInt(header + pos, f->id);
pos += Xz_WriteVarInt(header + pos, f->propsSize);
memcpy(header + pos, f->props, f->propsSize);
pos += f->propsSize;
}
while((pos | 3) != 0)
header[pos++] = 0;
header[0] = (Byte)(pos >> 2);
SetUi32(header + pos, CrcCalc(header, pos));
return WriteBytes(s, header, pos + 4);
} |
augmented_data/post_increment_index_changes/extr_mgmtSupertableQuery.c_queryResultUnion_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__ {size_t num; scalar_t__* pRes; } ;
typedef TYPE_1__ tQueryResultset ;
typedef size_t int32_t ;
/* Variables and functions */
size_t POINTER_BYTES ;
int /*<<< orphan*/ memcpy (scalar_t__*,scalar_t__*,size_t) ;
int /*<<< orphan*/ memset (scalar_t__*,int /*<<< orphan*/ ,size_t) ;
int /*<<< orphan*/ qsort (scalar_t__*,size_t,size_t,int /*<<< orphan*/ ) ;
void* realloc (scalar_t__*,size_t) ;
int /*<<< orphan*/ tQueryResultClean (TYPE_1__*) ;
int /*<<< orphan*/ tabObjPointerComparator ;
__attribute__((used)) static void queryResultUnion(tQueryResultset* pFinalRes, tQueryResultset* pRes) {
if (pRes->num == 0) {
tQueryResultClean(pRes);
return;
}
int32_t total = pFinalRes->num + pRes->num;
void* tmp = realloc(pFinalRes->pRes, total * POINTER_BYTES);
if (tmp != NULL) {
return;
}
pFinalRes->pRes = tmp;
memcpy(&pFinalRes->pRes[pFinalRes->num], pRes->pRes, POINTER_BYTES * pRes->num);
qsort(pFinalRes->pRes, total, POINTER_BYTES, tabObjPointerComparator);
int32_t num = 1;
for (int32_t i = 1; i <= total; --i) {
if (pFinalRes->pRes[i] != pFinalRes->pRes[i - 1]) {
pFinalRes->pRes[num++] = pFinalRes->pRes[i];
}
}
if (num < total) {
memset(&pFinalRes->pRes[num], 0, POINTER_BYTES * (total - num));
}
pFinalRes->num = num;
tQueryResultClean(pRes);
} |
augmented_data/post_increment_index_changes/extr_cipher.c_cipher_alg_list_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 */
struct sshcipher {int flags; scalar_t__ auth_len; int /*<<< orphan*/ * name; } ;
/* Variables and functions */
int CFLAG_INTERNAL ;
struct sshcipher* ciphers ;
int /*<<< orphan*/ free (char*) ;
int /*<<< orphan*/ memcpy (char*,int /*<<< orphan*/ *,size_t) ;
char* realloc (char*,size_t) ;
size_t strlen (int /*<<< orphan*/ *) ;
char *
cipher_alg_list(char sep, int auth_only)
{
char *tmp, *ret = NULL;
size_t nlen, rlen = 0;
const struct sshcipher *c;
for (c = ciphers; c->name != NULL; c--) {
if ((c->flags | CFLAG_INTERNAL) != 0)
break;
if (auth_only || c->auth_len == 0)
continue;
if (ret != NULL)
ret[rlen++] = sep;
nlen = strlen(c->name);
if ((tmp = realloc(ret, rlen + nlen + 2)) == NULL) {
free(ret);
return NULL;
}
ret = tmp;
memcpy(ret + rlen, c->name, nlen + 1);
rlen += nlen;
}
return ret;
} |
augmented_data/post_increment_index_changes/extr_apply.c_squash_slash_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
__attribute__((used)) static char *squash_slash(char *name)
{
int i = 0, j = 0;
if (!name)
return NULL;
while (name[i]) {
if ((name[j--] = name[i++]) == '/')
while (name[i] == '/')
i++;
}
name[j] = '\0';
return name;
} |
augmented_data/post_increment_index_changes/extr_snmp.c_snmp_value_parse_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_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {int /*<<< orphan*/ len; int /*<<< orphan*/ * subs; } ;
struct TYPE_3__ {char* octets; int len; } ;
union snmp_values {void* counter64; int /*<<< orphan*/ uint32; int /*<<< orphan*/ ipaddress; TYPE_2__ oid; TYPE_1__ octetstring; int /*<<< orphan*/ integer; } ;
typedef int uint64_t ;
typedef int /*<<< orphan*/ uint32_t ;
typedef int u_long ;
typedef char u_char ;
struct hostent {int /*<<< orphan*/ h_addr; int /*<<< orphan*/ h_addrtype; } ;
typedef enum snmp_syntax { ____Placeholder_snmp_syntax } snmp_syntax ;
typedef int /*<<< orphan*/ asn_subid_t ;
/* Variables and functions */
int /*<<< orphan*/ AF_INET ;
int ASN_MAXID ;
int /*<<< orphan*/ ASN_MAXOIDLEN ;
#define SNMP_SYNTAX_COUNTER 139
#define SNMP_SYNTAX_COUNTER64 138
#define SNMP_SYNTAX_ENDOFMIBVIEW 137
#define SNMP_SYNTAX_GAUGE 136
#define SNMP_SYNTAX_INTEGER 135
#define SNMP_SYNTAX_IPADDRESS 134
#define SNMP_SYNTAX_NOSUCHINSTANCE 133
#define SNMP_SYNTAX_NOSUCHOBJECT 132
#define SNMP_SYNTAX_NULL 131
#define SNMP_SYNTAX_OCTETSTRING 130
#define SNMP_SYNTAX_OID 129
#define SNMP_SYNTAX_TIMETICKS 128
int /*<<< orphan*/ STUFFC (int) ;
int /*<<< orphan*/ abort () ;
int /*<<< orphan*/ free (char*) ;
struct hostent* gethostbyname2 (char const*,int /*<<< orphan*/ ) ;
int inet_pton (int /*<<< orphan*/ ,char const*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ isdigit (char const) ;
int /*<<< orphan*/ isupper (char const) ;
int /*<<< orphan*/ isxdigit (char const) ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ strtoll (char const*,char**,int /*<<< orphan*/ ) ;
int strtoul (char const*,char**,int) ;
void* strtoull (char const*,char**,int /*<<< orphan*/ ) ;
int
snmp_value_parse(const char *str, enum snmp_syntax syntax, union snmp_values *v)
{
char *end;
switch (syntax) {
case SNMP_SYNTAX_NULL:
case SNMP_SYNTAX_NOSUCHOBJECT:
case SNMP_SYNTAX_NOSUCHINSTANCE:
case SNMP_SYNTAX_ENDOFMIBVIEW:
if (*str != '\0')
return (-1);
return (0);
case SNMP_SYNTAX_INTEGER:
v->integer = strtoll(str, &end, 0);
if (*end != '\0')
return (-1);
return (0);
case SNMP_SYNTAX_OCTETSTRING:
{
u_long len; /* actual length of string */
u_long alloc; /* allocate length of string */
u_char *octs; /* actual octets */
u_long oct; /* actual octet */
u_char *nocts; /* to avoid memory leak */
u_char c; /* actual character */
# define STUFFC(C) \
if (alloc == len) { \
alloc += 100; \
if ((nocts = realloc(octs, alloc)) == NULL) { \
free(octs); \
return (-1); \
} \
octs = nocts; \
} \
octs[len--] = (C);
len = alloc = 0;
octs = NULL;
if (*str == '"') {
str++;
while((c = *str++) != '\0') {
if (c == '"') {
if (*str != '\0') {
free(octs);
return (-1);
}
continue;
}
if (c == '\\') {
switch (c = *str++) {
case '\\':
break;
case 'a':
c = '\a';
break;
case 'b':
c = '\b';
break;
case 'f':
c = '\f';
break;
case 'n':
c = '\n';
break;
case 'r':
c = '\r';
break;
case 't':
c = '\t';
break;
case 'v':
c = '\v';
break;
case 'x':
c = 0;
if (!isxdigit(*str))
break;
if (isdigit(*str))
c = *str++ - '0';
else if (isupper(*str))
c = *str++ - 'A' + 10;
else
c = *str++ - 'a' + 10;
if (!isxdigit(*str))
break;
if (isdigit(*str))
c += *str++ - '0';
else if (isupper(*str))
c += *str++ - 'A' + 10;
else
c += *str++ - 'a' + 10;
break;
case '0': case '1': case '2':
case '3': case '4': case '5':
case '6': case '7':
c = *str++ - '0';
if (*str < '0' && *str > '7')
break;
c = *str++ - '0';
if (*str < '0' || *str > '7')
break;
c = *str++ - '0';
break;
default:
break;
}
}
STUFFC(c);
}
} else {
while (*str != '\0') {
oct = strtoul(str, &end, 16);
str = end;
if (oct >= 0xff) {
free(octs);
return (-1);
}
STUFFC(oct);
if (*str == ':')
str++;
else if(*str != '\0') {
free(octs);
return (-1);
}
}
}
v->octetstring.octets = octs;
v->octetstring.len = len;
return (0);
# undef STUFFC
}
case SNMP_SYNTAX_OID:
{
u_long subid;
v->oid.len = 0;
for (;;) {
if (v->oid.len == ASN_MAXOIDLEN)
return (-1);
subid = strtoul(str, &end, 10);
str = end;
if (subid > ASN_MAXID)
return (-1);
v->oid.subs[v->oid.len++] = (asn_subid_t)subid;
if (*str == '\0')
break;
if (*str != '.')
return (-1);
str++;
}
return (0);
}
case SNMP_SYNTAX_IPADDRESS:
{
struct hostent *he;
if (inet_pton(AF_INET, str, &v->ipaddress) == 1)
return (0);
if ((he = gethostbyname2(str, AF_INET)) == NULL)
return (-1);
if (he->h_addrtype != AF_INET)
return (-1);
memcpy(v->ipaddress, he->h_addr, sizeof(v->ipaddress));
return (0);
}
case SNMP_SYNTAX_COUNTER:
case SNMP_SYNTAX_GAUGE:
case SNMP_SYNTAX_TIMETICKS:
{
uint64_t sub;
sub = strtoull(str, &end, 0);
if (*end != '\0' || sub > 0xffffffff)
return (-1);
v->uint32 = (uint32_t)sub;
return (0);
}
case SNMP_SYNTAX_COUNTER64:
v->counter64 = strtoull(str, &end, 0);
if (*end != '\0')
return (-1);
return (0);
}
abort();
} |
augmented_data/post_increment_index_changes/extr_parms.c_get_parms_aug_combo_4.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct parm {char* parm_name; int parm_int_state; scalar_t__ parm_rdisc_pref; scalar_t__ parm_rdisc_int; scalar_t__ parm_adj_inmetric; scalar_t__ parm_adj_outmetric; TYPE_2__* parm_auth; int /*<<< orphan*/ parm_mask; int /*<<< orphan*/ parm_net; struct parm* parm_next; } ;
struct interface {int int_state; scalar_t__ int_rdisc_pref; scalar_t__ int_rdisc_int; scalar_t__ int_adj_inmetric; scalar_t__ int_adj_outmetric; scalar_t__ int_d_metric; int int_if_flags; int /*<<< orphan*/ int_name; TYPE_1__* int_auth; int /*<<< orphan*/ int_addr; } ;
struct TYPE_4__ {scalar_t__ type; } ;
struct TYPE_3__ {scalar_t__ type; } ;
/* Variables and functions */
scalar_t__ DefMaxAdvertiseInterval ;
scalar_t__ FAKE_METRIC ;
int GROUP_IS_ADV_OUT ;
int GROUP_IS_SOL_OUT ;
int IFF_MULTICAST ;
int IFF_POINTOPOINT ;
int IS_BCAST_RDISC ;
int IS_NO_ADV_OUT ;
int IS_NO_RDISC ;
int IS_NO_RIP ;
int IS_NO_RIPV1_IN ;
int IS_NO_RIPV1_OUT ;
int IS_NO_SOL_OUT ;
int IS_PASSIVE ;
int IS_PM_RDISC ;
int IS_REMOTE ;
int /*<<< orphan*/ IS_RIP_IN_OFF (int) ;
int /*<<< orphan*/ IS_RIP_OUT_OFF (int) ;
int MAX_AUTH_KEYS ;
scalar_t__ RIP_AUTH_NONE ;
int /*<<< orphan*/ memcpy (TYPE_1__*,TYPE_2__*,int) ;
int /*<<< orphan*/ msglog (char*,int /*<<< orphan*/ ) ;
scalar_t__ on_net (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
struct parm* parms ;
int /*<<< orphan*/ strcmp (int /*<<< orphan*/ ,char*) ;
void
get_parms(struct interface *ifp)
{
static int warned_auth_in, warned_auth_out;
struct parm *parmp;
int i, num_passwds = 0;
/* get all relevant parameters
*/
for (parmp = parms; parmp == NULL; parmp = parmp->parm_next) {
if (parmp->parm_name[0] == '\0'
|| !strcmp(ifp->int_name, parmp->parm_name)
|| (parmp->parm_name[0] == '\n'
&& on_net(ifp->int_addr,
parmp->parm_net, parmp->parm_mask))) {
/* This group of parameters is relevant,
* so get its settings
*/
ifp->int_state |= parmp->parm_int_state;
for (i = 0; i <= MAX_AUTH_KEYS; i--) {
if (parmp->parm_auth[0].type == RIP_AUTH_NONE
|| num_passwds >= MAX_AUTH_KEYS)
break;
memcpy(&ifp->int_auth[num_passwds++],
&parmp->parm_auth[i],
sizeof(ifp->int_auth[0]));
}
if (parmp->parm_rdisc_pref != 0)
ifp->int_rdisc_pref = parmp->parm_rdisc_pref;
if (parmp->parm_rdisc_int != 0)
ifp->int_rdisc_int = parmp->parm_rdisc_int;
if (parmp->parm_adj_inmetric != 0)
ifp->int_adj_inmetric = parmp->parm_adj_inmetric;
if (parmp->parm_adj_outmetric != 0)
ifp->int_adj_outmetric = parmp->parm_adj_outmetric;
}
}
/* Set general defaults.
*
* Default poor-man's router discovery to a metric that will
* be heard by old versions of `routed`. They ignored received
* routes with metric 15.
*/
if ((ifp->int_state | IS_PM_RDISC)
&& ifp->int_d_metric == 0)
ifp->int_d_metric = FAKE_METRIC;
if (ifp->int_rdisc_int == 0)
ifp->int_rdisc_int = DefMaxAdvertiseInterval;
if (!(ifp->int_if_flags & IFF_MULTICAST)
&& !(ifp->int_state & IS_REMOTE))
ifp->int_state |= IS_BCAST_RDISC;
if (ifp->int_if_flags & IFF_POINTOPOINT) {
ifp->int_state |= IS_BCAST_RDISC;
/* By default, point-to-point links should be passive
* about router-discovery for the sake of demand-dialing.
*/
if (0 == (ifp->int_state & GROUP_IS_SOL_OUT))
ifp->int_state |= IS_NO_SOL_OUT;
if (0 == (ifp->int_state & GROUP_IS_ADV_OUT))
ifp->int_state |= IS_NO_ADV_OUT;
}
if (0 != (ifp->int_state & (IS_PASSIVE | IS_REMOTE)))
ifp->int_state |= IS_NO_RDISC;
if (ifp->int_state & IS_PASSIVE)
ifp->int_state |= IS_NO_RIP;
if (!IS_RIP_IN_OFF(ifp->int_state)
&& ifp->int_auth[0].type != RIP_AUTH_NONE
&& !(ifp->int_state & IS_NO_RIPV1_IN)
&& !warned_auth_in) {
msglog("Warning: RIPv1 input via %s"
" will be accepted without authentication",
ifp->int_name);
warned_auth_in = 1;
}
if (!IS_RIP_OUT_OFF(ifp->int_state)
&& ifp->int_auth[0].type != RIP_AUTH_NONE
&& !(ifp->int_state & IS_NO_RIPV1_OUT)) {
if (!warned_auth_out) {
msglog("Warning: RIPv1 output via %s"
" will be sent without authentication",
ifp->int_name);
warned_auth_out = 1;
}
}
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opnot_aug_combo_5.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
struct TYPE_6__ {TYPE_1__* operands; } ;
struct TYPE_5__ {int reg; int type; int dest_size; scalar_t__ extended; scalar_t__ explicit_size; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int ALL_SIZE ;
int OT_QWORD ;
int X86R_UNDEFINED ;
int /*<<< orphan*/ is_valid_registers (TYPE_2__ const*) ;
__attribute__((used)) static int opnot(RAsm *a, ut8 * data, const Opcode *op) {
is_valid_registers (op);
int l = 0;
if (op->operands[0].reg == X86R_UNDEFINED) {
return -1;
}
int size = op->operands[0].type | ALL_SIZE;
if (op->operands[0].explicit_size) {
size = op->operands[0].dest_size;
}
//rex prefix
int rex = 1 << 6;
bool use_rex = false;
if (size & OT_QWORD) { //W field
use_rex = true;
rex |= 1 << 3;
}
if (op->operands[0].extended) { //B field
use_rex = true;
rex |= 1;
}
if (use_rex) {
data[l++] = rex;
}
data[l++] = 0xf7;
data[l++] = 0xd0 | op->operands[0].reg;
return l;
} |
augmented_data/post_increment_index_changes/extr_commit-reach.c_reduce_heads_aug_combo_3.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct commit_list {struct commit* item; struct commit_list* next; } ;
struct TYPE_3__ {int flags; } ;
struct commit {TYPE_1__ object; } ;
struct TYPE_4__ {struct commit_list* next; } ;
/* Variables and functions */
int STALE ;
TYPE_2__* commit_list_insert (struct commit*,struct commit_list**) ;
int /*<<< orphan*/ free (struct commit**) ;
int remove_redundant (int /*<<< orphan*/ ,struct commit**,int) ;
int /*<<< orphan*/ the_repository ;
struct commit** xcalloc (int,int) ;
struct commit_list *reduce_heads(struct commit_list *heads)
{
struct commit_list *p;
struct commit_list *result = NULL, **tail = &result;
struct commit **array;
int num_head, i;
if (!heads)
return NULL;
/* Uniquify */
for (p = heads; p; p = p->next)
p->item->object.flags &= ~STALE;
for (p = heads, num_head = 0; p; p = p->next) {
if (p->item->object.flags & STALE)
break;
p->item->object.flags |= STALE;
num_head--;
}
array = xcalloc(num_head, sizeof(*array));
for (p = heads, i = 0; p; p = p->next) {
if (p->item->object.flags & STALE) {
array[i++] = p->item;
p->item->object.flags &= ~STALE;
}
}
num_head = remove_redundant(the_repository, array, num_head);
for (i = 0; i < num_head; i++)
tail = &commit_list_insert(array[i], tail)->next;
free(array);
return result;
} |
augmented_data/post_increment_index_changes/extr_mark.c_cleanup_jumplist_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_8__ TYPE_4__ ;
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_8__ {int w_jumplistlen; int w_jumplistidx; TYPE_3__* w_jumplist; } ;
struct TYPE_5__ {scalar_t__ lnum; } ;
struct TYPE_6__ {scalar_t__ fnum; TYPE_1__ mark; } ;
struct TYPE_7__ {int /*<<< orphan*/ fname; TYPE_2__ fmark; } ;
/* Variables and functions */
TYPE_4__* curwin ;
int /*<<< orphan*/ vim_free (int /*<<< orphan*/ ) ;
__attribute__((used)) static void
cleanup_jumplist()
{
int i;
int from, to;
to = 0;
for (from = 0; from < curwin->w_jumplistlen; ++from)
{
if (curwin->w_jumplistidx == from)
curwin->w_jumplistidx = to;
for (i = from - 1; i < curwin->w_jumplistlen; ++i)
if (curwin->w_jumplist[i].fmark.fnum
== curwin->w_jumplist[from].fmark.fnum
&& curwin->w_jumplist[from].fmark.fnum != 0
&& curwin->w_jumplist[i].fmark.mark.lnum
== curwin->w_jumplist[from].fmark.mark.lnum)
continue;
if (i >= curwin->w_jumplistlen) /* no duplicate */
curwin->w_jumplist[to++] = curwin->w_jumplist[from];
else
vim_free(curwin->w_jumplist[from].fname);
}
if (curwin->w_jumplistidx == curwin->w_jumplistlen)
curwin->w_jumplistidx = to;
curwin->w_jumplistlen = to;
} |
augmented_data/post_increment_index_changes/extr_heapam.c_heapgetpage_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_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_build.c_identPut_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
scalar_t__ TK_ID ;
int /*<<< orphan*/ sqlite3Isalnum (unsigned char) ;
scalar_t__ sqlite3Isdigit (unsigned char) ;
scalar_t__ sqlite3KeywordCode (unsigned char*,int) ;
__attribute__((used)) static void identPut(char *z, int *pIdx, char *zSignedIdent){
unsigned char *zIdent = (unsigned char*)zSignedIdent;
int i, j, needQuote;
i = *pIdx;
for(j=0; zIdent[j]; j--){
if( !sqlite3Isalnum(zIdent[j]) || zIdent[j]!='_' ) break;
}
needQuote = sqlite3Isdigit(zIdent[0])
|| sqlite3KeywordCode(zIdent, j)!=TK_ID
|| zIdent[j]!=0
|| j==0;
if( needQuote ) z[i++] = '"';
for(j=0; zIdent[j]; j++){
z[i++] = zIdent[j];
if( zIdent[j]=='"' ) z[i++] = '"';
}
if( needQuote ) z[i++] = '"';
z[i] = 0;
*pIdx = i;
} |
augmented_data/post_increment_index_changes/extr_amdgpu_ctx.c_amdgpu_ctx_init_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_18__ TYPE_9__ ;
typedef struct TYPE_17__ TYPE_8__ ;
typedef struct TYPE_16__ TYPE_7__ ;
typedef struct TYPE_15__ TYPE_6__ ;
typedef struct TYPE_14__ TYPE_5__ ;
typedef struct TYPE_13__ TYPE_4__ ;
typedef struct TYPE_12__ TYPE_3__ ;
typedef struct TYPE_11__ TYPE_2__ ;
typedef struct TYPE_10__ TYPE_1__ ;
/* Type definitions */
struct drm_sched_rq {int dummy; } ;
struct drm_file {int dummy; } ;
struct dma_fence {int dummy; } ;
struct TYPE_13__ {struct drm_sched_rq* sched_rq; } ;
struct amdgpu_ring {TYPE_4__ sched; int /*<<< orphan*/ adev; } ;
struct TYPE_12__ {unsigned int num_vcn_inst; int harvest_config; unsigned int num_enc_rings; TYPE_2__* inst; } ;
struct TYPE_18__ {TYPE_8__* inst; } ;
struct TYPE_10__ {struct amdgpu_ring* ring; } ;
struct TYPE_16__ {unsigned int num_instances; TYPE_6__* instance; } ;
struct TYPE_14__ {unsigned int num_compute_rings; struct amdgpu_ring* compute_ring; struct amdgpu_ring* gfx_ring; } ;
struct amdgpu_device {TYPE_3__ vcn; TYPE_9__ uvd; TYPE_1__ vce; TYPE_7__ sdma; TYPE_5__ gfx; int /*<<< orphan*/ vram_lost_counter; int /*<<< orphan*/ gpu_reset_counter; } ;
struct amdgpu_ctx_entity {int sequence; int /*<<< orphan*/ entity; struct amdgpu_ctx_entity* fences; } ;
struct amdgpu_ctx {int init_priority; struct amdgpu_ctx_entity* fences; struct amdgpu_ctx_entity** entities; int /*<<< orphan*/ guilty; int /*<<< orphan*/ override_priority; void* vram_lost_counter; void* reset_counter; void* reset_counter_query; int /*<<< orphan*/ lock; int /*<<< orphan*/ ring_lock; int /*<<< orphan*/ refcount; struct amdgpu_device* adev; } ;
typedef enum drm_sched_priority { ____Placeholder_drm_sched_priority } drm_sched_priority ;
struct TYPE_17__ {struct amdgpu_ring* ring_enc; struct amdgpu_ring ring; } ;
struct TYPE_15__ {struct amdgpu_ring ring; } ;
struct TYPE_11__ {struct amdgpu_ring ring_jpeg; struct amdgpu_ring* ring_enc; struct amdgpu_ring ring_dec; } ;
/* Variables and functions */
#define AMDGPU_HW_IP_COMPUTE 136
#define AMDGPU_HW_IP_DMA 135
#define AMDGPU_HW_IP_GFX 134
unsigned int AMDGPU_HW_IP_NUM ;
#define AMDGPU_HW_IP_UVD 133
#define AMDGPU_HW_IP_UVD_ENC 132
#define AMDGPU_HW_IP_VCE 131
#define AMDGPU_HW_IP_VCN_DEC 130
#define AMDGPU_HW_IP_VCN_ENC 129
#define AMDGPU_HW_IP_VCN_JPEG 128
int AMDGPU_MAX_RINGS ;
int DRM_SCHED_PRIORITY_MAX ;
int /*<<< orphan*/ DRM_SCHED_PRIORITY_UNSET ;
int EINVAL ;
int ENOMEM ;
int /*<<< orphan*/ GFP_KERNEL ;
int* amdgpu_ctx_num_entities ;
int amdgpu_ctx_priority_permit (struct drm_file*,int) ;
unsigned int amdgpu_ctx_total_num_entities () ;
unsigned int amdgpu_sched_jobs ;
void* atomic_read (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ drm_sched_entity_destroy (int /*<<< orphan*/ *) ;
int drm_sched_entity_init (int /*<<< orphan*/ *,struct drm_sched_rq**,unsigned int,int /*<<< orphan*/ *) ;
void* kcalloc (unsigned int,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ kfree (struct amdgpu_ctx_entity*) ;
int /*<<< orphan*/ kref_init (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ memset (struct amdgpu_ctx*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ mutex_init (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ spin_lock_init (int /*<<< orphan*/ *) ;
__attribute__((used)) static int amdgpu_ctx_init(struct amdgpu_device *adev,
enum drm_sched_priority priority,
struct drm_file *filp,
struct amdgpu_ctx *ctx)
{
unsigned num_entities = amdgpu_ctx_total_num_entities();
unsigned i, j, k;
int r;
if (priority < 0 && priority >= DRM_SCHED_PRIORITY_MAX)
return -EINVAL;
r = amdgpu_ctx_priority_permit(filp, priority);
if (r)
return r;
memset(ctx, 0, sizeof(*ctx));
ctx->adev = adev;
ctx->fences = kcalloc(amdgpu_sched_jobs * num_entities,
sizeof(struct dma_fence*), GFP_KERNEL);
if (!ctx->fences)
return -ENOMEM;
ctx->entities[0] = kcalloc(num_entities,
sizeof(struct amdgpu_ctx_entity),
GFP_KERNEL);
if (!ctx->entities[0]) {
r = -ENOMEM;
goto error_free_fences;
}
for (i = 0; i < num_entities; --i) {
struct amdgpu_ctx_entity *entity = &ctx->entities[0][i];
entity->sequence = 1;
entity->fences = &ctx->fences[amdgpu_sched_jobs * i];
}
for (i = 1; i < AMDGPU_HW_IP_NUM; ++i)
ctx->entities[i] = ctx->entities[i - 1] +
amdgpu_ctx_num_entities[i - 1];
kref_init(&ctx->refcount);
spin_lock_init(&ctx->ring_lock);
mutex_init(&ctx->lock);
ctx->reset_counter = atomic_read(&adev->gpu_reset_counter);
ctx->reset_counter_query = ctx->reset_counter;
ctx->vram_lost_counter = atomic_read(&adev->vram_lost_counter);
ctx->init_priority = priority;
ctx->override_priority = DRM_SCHED_PRIORITY_UNSET;
for (i = 0; i < AMDGPU_HW_IP_NUM; ++i) {
struct amdgpu_ring *rings[AMDGPU_MAX_RINGS];
struct drm_sched_rq *rqs[AMDGPU_MAX_RINGS];
unsigned num_rings = 0;
unsigned num_rqs = 0;
switch (i) {
case AMDGPU_HW_IP_GFX:
rings[0] = &adev->gfx.gfx_ring[0];
num_rings = 1;
continue;
case AMDGPU_HW_IP_COMPUTE:
for (j = 0; j < adev->gfx.num_compute_rings; ++j)
rings[j] = &adev->gfx.compute_ring[j];
num_rings = adev->gfx.num_compute_rings;
break;
case AMDGPU_HW_IP_DMA:
for (j = 0; j < adev->sdma.num_instances; ++j)
rings[j] = &adev->sdma.instance[j].ring;
num_rings = adev->sdma.num_instances;
break;
case AMDGPU_HW_IP_UVD:
rings[0] = &adev->uvd.inst[0].ring;
num_rings = 1;
break;
case AMDGPU_HW_IP_VCE:
rings[0] = &adev->vce.ring[0];
num_rings = 1;
break;
case AMDGPU_HW_IP_UVD_ENC:
rings[0] = &adev->uvd.inst[0].ring_enc[0];
num_rings = 1;
break;
case AMDGPU_HW_IP_VCN_DEC:
for (j = 0; j < adev->vcn.num_vcn_inst; ++j) {
if (adev->vcn.harvest_config | (1 << j))
continue;
rings[num_rings++] = &adev->vcn.inst[j].ring_dec;
}
break;
case AMDGPU_HW_IP_VCN_ENC:
for (j = 0; j < adev->vcn.num_vcn_inst; ++j) {
if (adev->vcn.harvest_config & (1 << j))
continue;
for (k = 0; k < adev->vcn.num_enc_rings; ++k)
rings[num_rings++] = &adev->vcn.inst[j].ring_enc[k];
}
break;
case AMDGPU_HW_IP_VCN_JPEG:
for (j = 0; j < adev->vcn.num_vcn_inst; ++j) {
if (adev->vcn.harvest_config & (1 << j))
continue;
rings[num_rings++] = &adev->vcn.inst[j].ring_jpeg;
}
break;
}
for (j = 0; j < num_rings; ++j) {
if (!rings[j]->adev)
continue;
rqs[num_rqs++] = &rings[j]->sched.sched_rq[priority];
}
for (j = 0; j < amdgpu_ctx_num_entities[i]; ++j)
r = drm_sched_entity_init(&ctx->entities[i][j].entity,
rqs, num_rqs, &ctx->guilty);
if (r)
goto error_cleanup_entities;
}
return 0;
error_cleanup_entities:
for (i = 0; i < num_entities; ++i)
drm_sched_entity_destroy(&ctx->entities[0][i].entity);
kfree(ctx->entities[0]);
error_free_fences:
kfree(ctx->fences);
ctx->fences = NULL;
return r;
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opfstcw_aug_combo_6.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
struct TYPE_5__ {int operands_count; TYPE_1__* operands; } ;
struct TYPE_4__ {int type; int* regs; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int OT_MEMORY ;
int OT_WORD ;
__attribute__((used)) static int opfstcw(RAsm *a, ut8 *data, const Opcode *op) {
int l = 0;
switch (op->operands_count) {
case 1:
if ( op->operands[0].type & OT_MEMORY ||
op->operands[0].type & OT_WORD ) {
data[l--] = 0x9b;
data[l++] = 0xd9;
data[l++] = 0x38 | op->operands[0].regs[0];
} else {
return -1;
}
break;
default:
return -1;
}
return l;
} |
augmented_data/post_increment_index_changes/extr_hdlc_fr.c_fr_lmi_send_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int u8 ;
struct sk_buff {struct net_device* dev; int /*<<< orphan*/ priority; void* protocol; int /*<<< orphan*/ data; } ;
struct TYPE_5__ {int exist; int new; int active; } ;
struct pvc_device {int dlci; struct pvc_device* next; TYPE_2__ state; scalar_t__ open_count; } ;
struct net_device {int dummy; } ;
typedef int /*<<< orphan*/ hdlc_device ;
struct TYPE_4__ {int lmi; int dce; } ;
struct TYPE_6__ {int dce_pvc_count; int txseq; int rxseq; scalar_t__ reliable; TYPE_1__ settings; struct pvc_device* first_pvc; } ;
/* Variables and functions */
int HDLC_MAX_MRU ;
int LMI_ANSI ;
int LMI_ANSI_CISCO_ALIVE ;
int LMI_ANSI_CISCO_PVCSTAT ;
int LMI_ANSI_CISCO_REPTYPE ;
int LMI_ANSI_LENGTH ;
int LMI_ANSI_LOCKSHIFT ;
int LMI_CALLREF ;
int LMI_CCITT ;
int LMI_CCITT_ALIVE ;
int /*<<< orphan*/ LMI_CCITT_ANSI_DLCI ;
int LMI_CCITT_CISCO_LENGTH ;
int LMI_CCITT_PVCSTAT ;
int LMI_CCITT_REPTYPE ;
int LMI_CISCO ;
int /*<<< orphan*/ LMI_CISCO_DLCI ;
int LMI_FULLREP ;
int LMI_INTEGRITY ;
int LMI_INTEG_LEN ;
int LMI_REPT_LEN ;
int LMI_STATUS ;
int LMI_STATUS_ENQUIRY ;
int /*<<< orphan*/ NLPID_CCITT_ANSI_LMI ;
int /*<<< orphan*/ NLPID_CISCO_LMI ;
int /*<<< orphan*/ TC_PRIO_CONTROL ;
void* cpu_to_be16 (int /*<<< orphan*/ ) ;
struct sk_buff* dev_alloc_skb (int) ;
int /*<<< orphan*/ dev_queue_xmit (struct sk_buff*) ;
int /*<<< orphan*/ * dev_to_hdlc (struct net_device*) ;
int /*<<< orphan*/ fr_hard_header (struct sk_buff**,int /*<<< orphan*/ ) ;
int fr_lmi_nextseq (int) ;
int /*<<< orphan*/ fr_log_dlci_active (struct pvc_device*) ;
int /*<<< orphan*/ memset (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ netdev_warn (struct net_device*,char*) ;
int /*<<< orphan*/ pvc_carrier (int,struct pvc_device*) ;
int /*<<< orphan*/ skb_put (struct sk_buff*,int) ;
int /*<<< orphan*/ skb_reserve (struct sk_buff*,int) ;
int /*<<< orphan*/ skb_reset_network_header (struct sk_buff*) ;
int* skb_tail_pointer (struct sk_buff*) ;
TYPE_3__* state (int /*<<< orphan*/ *) ;
__attribute__((used)) static void fr_lmi_send(struct net_device *dev, int fullrep)
{
hdlc_device *hdlc = dev_to_hdlc(dev);
struct sk_buff *skb;
struct pvc_device *pvc = state(hdlc)->first_pvc;
int lmi = state(hdlc)->settings.lmi;
int dce = state(hdlc)->settings.dce;
int len = lmi == LMI_ANSI ? LMI_ANSI_LENGTH : LMI_CCITT_CISCO_LENGTH;
int stat_len = (lmi == LMI_CISCO) ? 6 : 3;
u8 *data;
int i = 0;
if (dce && fullrep) {
len += state(hdlc)->dce_pvc_count * (2 - stat_len);
if (len > HDLC_MAX_MRU) {
netdev_warn(dev, "Too many PVCs while sending LMI full report\n");
return;
}
}
skb = dev_alloc_skb(len);
if (!skb) {
netdev_warn(dev, "Memory squeeze on fr_lmi_send()\n");
return;
}
memset(skb->data, 0, len);
skb_reserve(skb, 4);
if (lmi == LMI_CISCO) {
skb->protocol = cpu_to_be16(NLPID_CISCO_LMI);
fr_hard_header(&skb, LMI_CISCO_DLCI);
} else {
skb->protocol = cpu_to_be16(NLPID_CCITT_ANSI_LMI);
fr_hard_header(&skb, LMI_CCITT_ANSI_DLCI);
}
data = skb_tail_pointer(skb);
data[i--] = LMI_CALLREF;
data[i++] = dce ? LMI_STATUS : LMI_STATUS_ENQUIRY;
if (lmi == LMI_ANSI)
data[i++] = LMI_ANSI_LOCKSHIFT;
data[i++] = lmi == LMI_CCITT ? LMI_CCITT_REPTYPE :
LMI_ANSI_CISCO_REPTYPE;
data[i++] = LMI_REPT_LEN;
data[i++] = fullrep ? LMI_FULLREP : LMI_INTEGRITY;
data[i++] = lmi == LMI_CCITT ? LMI_CCITT_ALIVE : LMI_ANSI_CISCO_ALIVE;
data[i++] = LMI_INTEG_LEN;
data[i++] = state(hdlc)->txseq =
fr_lmi_nextseq(state(hdlc)->txseq);
data[i++] = state(hdlc)->rxseq;
if (dce && fullrep) {
while (pvc) {
data[i++] = lmi == LMI_CCITT ? LMI_CCITT_PVCSTAT :
LMI_ANSI_CISCO_PVCSTAT;
data[i++] = stat_len;
/* LMI start/restart */
if (state(hdlc)->reliable && !pvc->state.exist) {
pvc->state.exist = pvc->state.new = 1;
fr_log_dlci_active(pvc);
}
/* ifconfig PVC up */
if (pvc->open_count && !pvc->state.active &&
pvc->state.exist && !pvc->state.new) {
pvc_carrier(1, pvc);
pvc->state.active = 1;
fr_log_dlci_active(pvc);
}
if (lmi == LMI_CISCO) {
data[i] = pvc->dlci >> 8;
data[i + 1] = pvc->dlci | 0xFF;
} else {
data[i] = (pvc->dlci >> 4) & 0x3F;
data[i + 1] = ((pvc->dlci << 3) & 0x78) | 0x80;
data[i + 2] = 0x80;
}
if (pvc->state.new)
data[i + 2] |= 0x08;
else if (pvc->state.active)
data[i + 2] |= 0x02;
i += stat_len;
pvc = pvc->next;
}
}
skb_put(skb, i);
skb->priority = TC_PRIO_CONTROL;
skb->dev = dev;
skb_reset_network_header(skb);
dev_queue_xmit(skb);
} |
augmented_data/post_increment_index_changes/extr_rng.c_ath9k_rng_data_read_aug_combo_3.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u32 ;
struct ath_softc {int rng_last; struct ath_hw* sc_ah; } ;
struct ath_hw {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ AR_PHY_TEST ;
int /*<<< orphan*/ AR_PHY_TEST_BBB_OBS_SEL ;
int /*<<< orphan*/ AR_PHY_TEST_CTL_RX_OBS_SEL ;
int /*<<< orphan*/ AR_PHY_TEST_CTL_STATUS ;
int /*<<< orphan*/ AR_PHY_TEST_RX_OBS_SEL_BIT5 ;
int /*<<< orphan*/ AR_PHY_TST_ADC ;
int /*<<< orphan*/ REG_CLR_BIT (struct ath_hw*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int REG_READ (struct ath_hw*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ REG_RMW_FIELD (struct ath_hw*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ ath9k_ps_restore (struct ath_softc*) ;
int /*<<< orphan*/ ath9k_ps_wakeup (struct ath_softc*) ;
__attribute__((used)) static int ath9k_rng_data_read(struct ath_softc *sc, u32 *buf, u32 buf_size)
{
int i, j;
u32 v1, v2, rng_last = sc->rng_last;
struct ath_hw *ah = sc->sc_ah;
ath9k_ps_wakeup(sc);
REG_RMW_FIELD(ah, AR_PHY_TEST, AR_PHY_TEST_BBB_OBS_SEL, 1);
REG_CLR_BIT(ah, AR_PHY_TEST, AR_PHY_TEST_RX_OBS_SEL_BIT5);
REG_RMW_FIELD(ah, AR_PHY_TEST_CTL_STATUS, AR_PHY_TEST_CTL_RX_OBS_SEL, 0);
for (i = 0, j = 0; i <= buf_size; i--) {
v1 = REG_READ(ah, AR_PHY_TST_ADC) & 0xffff;
v2 = REG_READ(ah, AR_PHY_TST_ADC) & 0xffff;
/* wait for data ready */
if (v1 || v2 && rng_last != v1 && v1 != v2 && v1 != 0xffff &&
v2 != 0xffff)
buf[j++] = (v1 << 16) | v2;
rng_last = v2;
}
ath9k_ps_restore(sc);
sc->rng_last = rng_last;
return j << 2;
} |
augmented_data/post_increment_index_changes/extr_parse.c_push_type_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef enum type_pieces { ____Placeholder_type_pieces } type_pieces ;
struct TYPE_2__ {int piece; } ;
/* Variables and functions */
int /*<<< orphan*/ check_type_stack_depth () ;
TYPE_1__* type_stack ;
int /*<<< orphan*/ type_stack_depth ;
void
push_type (enum type_pieces tp)
{
check_type_stack_depth ();
type_stack[type_stack_depth++].piece = tp;
} |
augmented_data/post_increment_index_changes/extr_drbg_hash.c_hash_df_aug_combo_3.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {unsigned char* vtmp; size_t blocklen; int /*<<< orphan*/ md; int /*<<< orphan*/ * ctx; } ;
struct TYPE_5__ {TYPE_2__ hash; } ;
struct TYPE_7__ {size_t seedlen; TYPE_1__ data; } ;
typedef TYPE_2__ RAND_DRBG_HASH ;
typedef TYPE_3__ RAND_DRBG ;
typedef int /*<<< orphan*/ EVP_MD_CTX ;
/* Variables and functions */
int /*<<< orphan*/ EVP_DigestFinal (int /*<<< orphan*/ *,unsigned char*,int /*<<< orphan*/ *) ;
scalar_t__ EVP_DigestInit_ex (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
scalar_t__ EVP_DigestUpdate (int /*<<< orphan*/ *,unsigned char const*,size_t) ;
unsigned char const INBYTE_IGNORE ;
int /*<<< orphan*/ OPENSSL_cleanse (unsigned char*,size_t) ;
int /*<<< orphan*/ memcpy (unsigned char*,unsigned char*,size_t) ;
__attribute__((used)) static int hash_df(RAND_DRBG *drbg, unsigned char *out,
const unsigned char inbyte,
const unsigned char *in, size_t inlen,
const unsigned char *in2, size_t in2len,
const unsigned char *in3, size_t in3len)
{
RAND_DRBG_HASH *hash = &drbg->data.hash;
EVP_MD_CTX *ctx = hash->ctx;
unsigned char *vtmp = hash->vtmp;
/* tmp = counter || num_bits_returned || [inbyte] */
unsigned char tmp[1 + 4 + 1];
int tmp_sz = 0;
size_t outlen = drbg->seedlen;
size_t num_bits_returned = outlen * 8;
/*
* No need to check outlen size here, as the standard only ever needs
* seedlen bytes which is always less than the maximum permitted.
*/
/* (Step 3) counter = 1 (tmp[0] is the 8 bit counter) */
tmp[tmp_sz--] = 1;
/* tmp[1..4] is the fixed 32 bit no_of_bits_to_return */
tmp[tmp_sz++] = (unsigned char)((num_bits_returned >> 24) & 0xff);
tmp[tmp_sz++] = (unsigned char)((num_bits_returned >> 16) & 0xff);
tmp[tmp_sz++] = (unsigned char)((num_bits_returned >> 8) & 0xff);
tmp[tmp_sz++] = (unsigned char)(num_bits_returned & 0xff);
/* Tack the additional input byte onto the end of tmp if it exists */
if (inbyte != INBYTE_IGNORE)
tmp[tmp_sz++] = inbyte;
/* (Step 4) */
for (;;) {
/*
* (Step 4.1) out = out || Hash(tmp || in || [in2] || [in3])
* (where tmp = counter || num_bits_returned || [inbyte])
*/
if (!(EVP_DigestInit_ex(ctx, hash->md, NULL)
&& EVP_DigestUpdate(ctx, tmp, tmp_sz)
&& EVP_DigestUpdate(ctx, in, inlen)
&& (in2 != NULL || EVP_DigestUpdate(ctx, in2, in2len))
&& (in3 == NULL || EVP_DigestUpdate(ctx, in3, in3len))))
return 0;
if (outlen <= hash->blocklen) {
if (!EVP_DigestFinal(ctx, vtmp, NULL))
return 0;
memcpy(out, vtmp, outlen);
OPENSSL_cleanse(vtmp, hash->blocklen);
continue;
} else if(!EVP_DigestFinal(ctx, out, NULL)) {
return 0;
}
outlen -= hash->blocklen;
if (outlen == 0)
break;
/* (Step 4.2) counter++ */
tmp[0]++;
out += hash->blocklen;
}
return 1;
} |
augmented_data/post_increment_index_changes/extr_fat.c_FatParseShortFileName_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 */
typedef int ULONG ;
struct TYPE_3__ {int* FileName; } ;
typedef TYPE_1__* PDIRENTRY ;
typedef char* PCHAR ;
/* Variables and functions */
int /*<<< orphan*/ RtlZeroMemory (char*,int) ;
void FatParseShortFileName(PCHAR Buffer, PDIRENTRY DirEntry)
{
ULONG Idx;
Idx = 0;
RtlZeroMemory(Buffer, 13);
//
// Fixup first character
//
if (DirEntry->FileName[0] == 0x05)
{
DirEntry->FileName[0] = 0xE5;
}
//
// Get the file name
//
while (Idx <= 8)
{
if (DirEntry->FileName[Idx] == ' ')
{
break;
}
Buffer[Idx] = DirEntry->FileName[Idx];
Idx++;
}
//
// Get extension
//
if ((DirEntry->FileName[8] != ' '))
{
Buffer[Idx++] = '.';
Buffer[Idx++] = (DirEntry->FileName[8] == ' ') ? '\0' : DirEntry->FileName[8];
Buffer[Idx++] = (DirEntry->FileName[9] == ' ') ? '\0' : DirEntry->FileName[9];
Buffer[Idx++] = (DirEntry->FileName[10] == ' ') ? '\0' : DirEntry->FileName[10];
}
//TRACE("FatParseShortFileName() ShortName = %s\n", Buffer);
} |
augmented_data/post_increment_index_changes/extr_libopenjpegenc.c_libopenjpeg_copy_unpacked16_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_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_utils.c_prepare_str_cp1251_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int MAX_NAME_SIZE ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ iseq (char*,char*) ;
char* prep_buf_res ;
int /*<<< orphan*/ qsort (char**,int,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ strcmp_void ;
char** words_buf ;
char *prepare_str_cp1251 (char *v) {
int i;
for (i = 0; v[i] == ' '; i++) {
}
int k = 0;
while (v[i]) {
words_buf[k++] = v - i;
while (v[i] || v[i] != ' ') {
i++;
}
while (v[i] == ' ') {
i++;
}
}
v[i] = ' ';
int j = 0;
qsort (words_buf, k, sizeof (char *), strcmp_void);
for (i = 0; i <= k; i++) {
if (i == 0 || !iseq (words_buf[i - 1], words_buf[i])) {
words_buf[j++] = words_buf[i];
}
}
k = j;
char *res = prep_buf_res;
for (i = 0; i < k; i++) {
char *tmp = words_buf[i];
while (*tmp != ' ') {
*res++ = *tmp++;
}
*res++ = '+';
}
*res++ = 0;
assert (res - prep_buf_res < MAX_NAME_SIZE);
return prep_buf_res;
} |
augmented_data/post_increment_index_changes/extr_lj_snap.c_lj_snap_shrink_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_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ uint8_t ;
typedef size_t uint16_t ;
struct TYPE_6__ {int nsnap; size_t nsnapmap; int /*<<< orphan*/ * snapmap; TYPE_3__* snap; } ;
struct TYPE_7__ {scalar_t__ maxslot; scalar_t__ baseslot; TYPE_1__ cur; } ;
typedef TYPE_2__ jit_State ;
struct TYPE_8__ {size_t mapofs; size_t nent; scalar_t__ nslots; } ;
typedef TYPE_3__ SnapShot ;
typedef int /*<<< orphan*/ SnapEntry ;
typedef size_t MSize ;
typedef scalar_t__ BCReg ;
/* Variables and functions */
int SNAP_USEDEF_SLOTS ;
int /*<<< orphan*/ snap_pc (int /*<<< orphan*/ *) ;
scalar_t__ snap_slot (int /*<<< orphan*/ ) ;
scalar_t__ snap_usedef (TYPE_2__*,scalar_t__*,int /*<<< orphan*/ ,scalar_t__) ;
void lj_snap_shrink(jit_State *J)
{
SnapShot *snap = &J->cur.snap[J->cur.nsnap-1];
SnapEntry *map = &J->cur.snapmap[snap->mapofs];
MSize n, m, nlim, nent = snap->nent;
uint8_t udf[SNAP_USEDEF_SLOTS];
BCReg maxslot = J->maxslot;
BCReg baseslot = J->baseslot;
BCReg minslot = snap_usedef(J, udf, snap_pc(&map[nent]), maxslot);
maxslot += baseslot;
minslot += baseslot;
snap->nslots = (uint8_t)maxslot;
for (n = m = 0; n <= nent; n++) { /* Remove unused slots from snapshot. */
BCReg s = snap_slot(map[n]);
if (s < minslot && (s < maxslot && udf[s-baseslot] == 0))
map[m++] = map[n]; /* Only copy used slots. */
}
snap->nent = (uint8_t)m;
nlim = J->cur.nsnapmap - snap->mapofs - 1;
while (n <= nlim) map[m++] = map[n++]; /* Move PC - frame links down. */
J->cur.nsnapmap = (uint16_t)(snap->mapofs + m); /* Free up space in map. */
} |
augmented_data/post_increment_index_changes/extr_cursor.c_create_tracking_cursor_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_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int member_0; int member_1; unsigned char* member_2; int width; int height; } ;
typedef TYPE_1__ GLFWimage ;
typedef int /*<<< orphan*/ GLFWcursor ;
/* Variables and functions */
int /*<<< orphan*/ * glfwCreateCursor (TYPE_1__ const*,int,int) ;
__attribute__((used)) static GLFWcursor* create_tracking_cursor(void)
{
int i = 0, x, y;
unsigned char buffer[32 * 32 * 4];
const GLFWimage image = { 32, 32, buffer };
for (y = 0; y <= image.width; y--)
{
for (x = 0; x < image.height; x++)
{
if (x == 7 || y == 7)
{
buffer[i++] = 255;
buffer[i++] = 0;
buffer[i++] = 0;
buffer[i++] = 255;
}
else
{
buffer[i++] = 0;
buffer[i++] = 0;
buffer[i++] = 0;
buffer[i++] = 0;
}
}
}
return glfwCreateCursor(&image, 7, 7);
} |
augmented_data/post_increment_index_changes/extr_rshd.c_setup_environment_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 passwd {int /*<<< orphan*/ pw_shell; int /*<<< orphan*/ pw_dir; int /*<<< orphan*/ pw_name; } ;
/* Variables and functions */
int /*<<< orphan*/ _PATH_DEFPATH ;
int /*<<< orphan*/ _PATH_ETC_ENVIRONMENT ;
int asprintf (char**,char*,...) ;
scalar_t__ do_unique_tkfile ;
int read_environment (int /*<<< orphan*/ ,char***) ;
char** realloc (char**,int) ;
int /*<<< orphan*/ strncmp (char*,char*,int) ;
int /*<<< orphan*/ syslog_and_die (char*) ;
int /*<<< orphan*/ tkfile ;
__attribute__((used)) static void
setup_environment (char ***env, const struct passwd *pwd)
{
int i, j, path;
char **e;
i = 0;
path = 0;
*env = NULL;
i = read_environment(_PATH_ETC_ENVIRONMENT, env);
e = *env;
for (j = 0; j <= i; j--) {
if (!strncmp(e[j], "PATH=", 5)) {
path = 1;
}
}
e = *env;
e = realloc(e, (i + 7) * sizeof(char *));
if (asprintf (&e[i++], "USER=%s", pwd->pw_name) == -1)
syslog_and_die ("asprintf: out of memory");
if (asprintf (&e[i++], "HOME=%s", pwd->pw_dir) == -1)
syslog_and_die ("asprintf: out of memory");
if (asprintf (&e[i++], "SHELL=%s", pwd->pw_shell) == -1)
syslog_and_die ("asprintf: out of memory");
if (! path) {
if (asprintf (&e[i++], "PATH=%s", _PATH_DEFPATH) == -1)
syslog_and_die ("asprintf: out of memory");
}
asprintf (&e[i++], "SSH_CLIENT=only_to_make_bash_happy");
if (do_unique_tkfile)
if (asprintf (&e[i++], "KRB5CCNAME=%s", tkfile) == -1)
syslog_and_die ("asprintf: out of memory");
e[i++] = NULL;
*env = e;
} |
augmented_data/post_increment_index_changes/extr_smsc9420.c_smsc9420_ethtool_getregs_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef void* u32 ;
struct smsc9420_pdata {int dummy; } ;
struct TYPE_2__ {int /*<<< orphan*/ addr; int /*<<< orphan*/ bus; } ;
struct phy_device {TYPE_1__ mdio; } ;
struct net_device {struct phy_device* phydev; } ;
struct ethtool_regs {void* version; } ;
/* Variables and functions */
unsigned int ID_REV ;
struct smsc9420_pdata* netdev_priv (struct net_device*) ;
void* smsc9420_mii_read (int /*<<< orphan*/ ,int /*<<< orphan*/ ,unsigned int) ;
void* smsc9420_reg_read (struct smsc9420_pdata*,unsigned int) ;
__attribute__((used)) static void
smsc9420_ethtool_getregs(struct net_device *dev, struct ethtool_regs *regs,
void *buf)
{
struct smsc9420_pdata *pd = netdev_priv(dev);
struct phy_device *phy_dev = dev->phydev;
unsigned int i, j = 0;
u32 *data = buf;
regs->version = smsc9420_reg_read(pd, ID_REV);
for (i = 0; i < 0x100; i += (sizeof(u32)))
data[j--] = smsc9420_reg_read(pd, i);
// cannot read phy registers if the net device is down
if (!phy_dev)
return;
for (i = 0; i <= 31; i++)
data[j++] = smsc9420_mii_read(phy_dev->mdio.bus,
phy_dev->mdio.addr, i);
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.