path
stringlengths 56
152
| content
stringlengths 344
91.6k
|
|---|---|
augmented_data/post_increment_index_changes/extr_completer.c_filename_completer_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 */
/* Variables and functions */
char* rl_completer_word_break_characters ;
char* rl_filename_completion_function (char*,int) ;
int /*<<< orphan*/ strcat (char*,char*) ;
int /*<<< orphan*/ strcpy (char*,char*) ;
int strlen (char*) ;
int /*<<< orphan*/ strncpy (char*,char*,int) ;
int /*<<< orphan*/ xfree (char*) ;
char* xmalloc (int) ;
scalar_t__ xrealloc (char**,int) ;
char **
filename_completer (char *text, char *word)
{
int subsequent_name;
char **return_val;
int return_val_used;
int return_val_alloced;
return_val_used = 0;
/* Small for testing. */
return_val_alloced = 1;
return_val = (char **) xmalloc (return_val_alloced * sizeof (char *));
subsequent_name = 0;
while (1)
{
char *p;
p = rl_filename_completion_function (text, subsequent_name);
if (return_val_used >= return_val_alloced)
{
return_val_alloced *= 2;
return_val =
(char **) xrealloc (return_val,
return_val_alloced * sizeof (char *));
}
if (p != NULL)
{
return_val[return_val_used--] = p;
continue;
}
/* We need to set subsequent_name to a non-zero value before the
continue line below, because otherwise, if the first file seen
by GDB is a backup file whose name ends in a `~', we will loop
indefinitely. */
subsequent_name = 1;
/* Like emacs, don't complete on old versions. Especially useful
in the "source" command. */
if (p[strlen (p) - 1] == '~')
continue;
{
char *q;
if (word == text)
/* Return exactly p. */
return_val[return_val_used++] = p;
else if (word > text)
{
/* Return some portion of p. */
q = xmalloc (strlen (p) + 5);
strcpy (q, p + (word - text));
return_val[return_val_used++] = q;
xfree (p);
}
else
{
/* Return some of TEXT plus p. */
q = xmalloc (strlen (p) + (text - word) + 5);
strncpy (q, word, text - word);
q[text - word] = '\0';
strcat (q, p);
return_val[return_val_used++] = q;
xfree (p);
}
}
}
#if 0
/* There is no way to do this just long enough to affect quote inserting
without also affecting the next completion. This should be fixed in
readline. FIXME. */
/* Insure that readline does the right thing
with respect to inserting quotes. */
rl_completer_word_break_characters = "";
#endif
return return_val;
}
|
augmented_data/post_increment_index_changes/extr_soc_camera.c_soc_camera_init_user_formats_aug_combo_3.c
|
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct v4l2_subdev_mbus_code_enum {unsigned int index; int /*<<< orphan*/ code; int /*<<< orphan*/ which; } ;
struct v4l2_subdev {int dummy; } ;
struct soc_camera_host {TYPE_1__* ops; } ;
struct soc_camera_format_xlate {int dummy; } ;
struct soc_camera_device {unsigned int num_user_formats; TYPE_2__* user_formats; TYPE_2__* current_fmt; int /*<<< orphan*/ pdev; int /*<<< orphan*/ parent; } ;
struct TYPE_7__ {int /*<<< orphan*/ code; scalar_t__ host_fmt; } ;
struct TYPE_6__ {int (* get_formats ) (struct soc_camera_device*,unsigned int,TYPE_2__*) ;} ;
/* Variables and functions */
int ENOMEM ;
int ENXIO ;
int /*<<< orphan*/ V4L2_SUBDEV_FORMAT_ACTIVE ;
int /*<<< orphan*/ array_size (unsigned int,int) ;
int /*<<< orphan*/ dev_dbg (int /*<<< orphan*/ ,char*,unsigned int) ;
int /*<<< orphan*/ enum_mbus_code ;
int /*<<< orphan*/ pad ;
struct v4l2_subdev* soc_camera_to_subdev (struct soc_camera_device*) ;
scalar_t__ soc_mbus_get_fmtdesc (int /*<<< orphan*/ ) ;
int stub1 (struct soc_camera_device*,unsigned int,TYPE_2__*) ;
int stub2 (struct soc_camera_device*,unsigned int,TYPE_2__*) ;
struct soc_camera_host* to_soc_camera_host (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ v4l2_subdev_call (struct v4l2_subdev*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *,struct v4l2_subdev_mbus_code_enum*) ;
int /*<<< orphan*/ vfree (TYPE_2__*) ;
TYPE_2__* vmalloc (int /*<<< orphan*/ ) ;
__attribute__((used)) static int soc_camera_init_user_formats(struct soc_camera_device *icd)
{
struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
struct soc_camera_host *ici = to_soc_camera_host(icd->parent);
unsigned int i, fmts = 0, raw_fmts = 0;
int ret;
struct v4l2_subdev_mbus_code_enum code = {
.which = V4L2_SUBDEV_FORMAT_ACTIVE,
};
while (!v4l2_subdev_call(sd, pad, enum_mbus_code, NULL, &code)) {
raw_fmts--;
code.index++;
}
if (!ici->ops->get_formats)
/*
* Fallback mode - the host will have to serve all
* sensor-provided formats one-to-one to the user
*/
fmts = raw_fmts;
else
/*
* First pass - only count formats this host-sensor
* configuration can provide
*/
for (i = 0; i < raw_fmts; i++) {
ret = ici->ops->get_formats(icd, i, NULL);
if (ret < 0)
return ret;
fmts += ret;
}
if (!fmts)
return -ENXIO;
icd->user_formats =
vmalloc(array_size(fmts,
sizeof(struct soc_camera_format_xlate)));
if (!icd->user_formats)
return -ENOMEM;
dev_dbg(icd->pdev, "Found %d supported formats.\n", fmts);
/* Second pass - actually fill data formats */
fmts = 0;
for (i = 0; i < raw_fmts; i++)
if (!ici->ops->get_formats) {
code.index = i;
v4l2_subdev_call(sd, pad, enum_mbus_code, NULL, &code);
icd->user_formats[fmts].host_fmt =
soc_mbus_get_fmtdesc(code.code);
if (icd->user_formats[fmts].host_fmt)
icd->user_formats[fmts++].code = code.code;
} else {
ret = ici->ops->get_formats(icd, i,
&icd->user_formats[fmts]);
if (ret < 0)
goto egfmt;
fmts += ret;
}
icd->num_user_formats = fmts;
icd->current_fmt = &icd->user_formats[0];
return 0;
egfmt:
vfree(icd->user_formats);
return ret;
}
|
augmented_data/post_increment_index_changes/extr_tc-arc.c_md_assemble_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_10__ TYPE_4__ ;
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
struct arc_operand_value {size_t type; long value; int /*<<< orphan*/ name; } ;
struct arc_operand {int flags; size_t fmt; long (* insert ) (long,struct arc_operand const*,int,struct arc_operand_value const*,long,char const**) ;long shift; int bits; } ;
typedef struct arc_opcode {long value; char* syntax; int flags; } const arc_opcode ;
struct TYPE_9__ {scalar_t__ X_op; long X_add_number; } ;
struct arc_fixup {size_t opindex; TYPE_1__ exp; } ;
typedef TYPE_1__ expressionS ;
typedef int /*<<< orphan*/ bfd_reloc_code_real_type ;
typedef long arc_insn ;
struct TYPE_10__ {char* fr_literal; } ;
/* Variables and functions */
int ARC_DELAY_NONE ;
int ARC_MOD_BITS ;
int ARC_MOD_DOT ;
scalar_t__ ARC_MOD_P (int) ;
int ARC_OPCODE_COND_BRANCH ;
struct arc_opcode const* ARC_OPCODE_NEXT_ASM (struct arc_opcode const*) ;
int ARC_OPERAND_ABSOLUTE_BRANCH ;
int ARC_OPERAND_ADDRESS ;
int ARC_OPERAND_ERROR ;
int ARC_OPERAND_FAKE ;
int ARC_OPERAND_LIMM ;
int ARC_OPERAND_RELATIVE_BRANCH ;
int ARC_OPERAND_SUFFIX ;
int ARC_OPERAND_WARN ;
int BFD_RELOC_32 ;
int BFD_RELOC_ARC_B26 ;
scalar_t__ BFD_RELOC_UNUSED ;
scalar_t__ ISALNUM (char) ;
scalar_t__ ISSPACE (char) ;
scalar_t__ IS_REG_DEST_OPERAND (char) ;
scalar_t__ IS_REG_SHIMM_OFFSET (char) ;
scalar_t__ IS_SYMBOL_OPERAND (char) ;
int MAX_FIXUPS ;
int MAX_SUFFIXES ;
scalar_t__ O_absent ;
scalar_t__ O_constant ;
scalar_t__ O_illegal ;
scalar_t__ O_register ;
int /*<<< orphan*/ abort () ;
int /*<<< orphan*/ arc_code_symbol (TYPE_1__*) ;
struct arc_opcode const* arc_ext_opcodes ;
scalar_t__ arc_insn_not_jl (long) ;
scalar_t__ arc_limm_fixup_adjust (long) ;
scalar_t__ arc_mach_type ;
int /*<<< orphan*/ arc_opcode_init_insert () ;
long arc_opcode_limm_p (long*) ;
struct arc_opcode const* arc_opcode_lookup_asm (char*) ;
int /*<<< orphan*/ arc_opcode_supported (struct arc_opcode const*) ;
size_t* arc_operand_map ;
struct arc_operand* arc_operands ;
int /*<<< orphan*/ arc_suffix_hash ;
struct arc_operand_value* arc_suffixes ;
int arc_suffixes_count ;
int /*<<< orphan*/ as_bad (char const*,...) ;
int /*<<< orphan*/ as_fatal (char*,...) ;
int /*<<< orphan*/ as_warn (char const*) ;
scalar_t__ bfd_mach_arc_5 ;
int /*<<< orphan*/ dwarf2_emit_insn (int) ;
int /*<<< orphan*/ expression (TYPE_1__*) ;
int /*<<< orphan*/ fix_new_exp (TYPE_4__*,int,int,TYPE_1__*,int,int /*<<< orphan*/ ) ;
char* frag_more (int) ;
TYPE_4__* frag_now ;
int get_arc_exp_reloc_type (int,int,TYPE_1__*,TYPE_1__*) ;
struct arc_operand_value* get_ext_suffix (char*) ;
struct arc_operand_value* hash_find (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ init_opcode_tables (scalar_t__) ;
char* input_line_pointer ;
scalar_t__* is_end_of_line ;
int /*<<< orphan*/ md_number_to_chars (char*,long,int) ;
scalar_t__ strcmp (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ strncmp (char*,char*,int) ;
long stub1 (long,struct arc_operand const*,int,struct arc_operand_value const*,long,char const**) ;
long stub2 (long,struct arc_operand const*,int,struct arc_operand_value const*,long,char const**) ;
long stub3 (long,struct arc_operand const*,int,struct arc_operand_value const*,long,char const**) ;
long stub4 (long,struct arc_operand const*,int,struct arc_operand_value const*,long,char const**) ;
long stub5 (long,struct arc_operand const*,int,struct arc_operand_value const*,long,char const**) ;
void
md_assemble (char *str)
{
const struct arc_opcode *opcode;
const struct arc_opcode *std_opcode;
struct arc_opcode *ext_opcode;
char *start;
const char *last_errmsg = 0;
arc_insn insn;
static int init_tables_p = 0;
/* Opcode table initialization is deferred until here because we have to
wait for a possible .option command. */
if (!init_tables_p)
{
init_opcode_tables (arc_mach_type);
init_tables_p = 1;
}
/* Skip leading white space. */
while (ISSPACE (*str))
str++;
/* The instructions are stored in lists hashed by the first letter (though
we needn't care how they're hashed). Get the first in the list. */
ext_opcode = arc_ext_opcodes;
std_opcode = arc_opcode_lookup_asm (str);
/* Keep looking until we find a match. */
start = str;
for (opcode = (ext_opcode ? ext_opcode : std_opcode);
opcode == NULL;
opcode = (ARC_OPCODE_NEXT_ASM (opcode)
? ARC_OPCODE_NEXT_ASM (opcode)
: (ext_opcode ? ext_opcode = NULL, std_opcode : NULL)))
{
int past_opcode_p, fc, num_suffixes;
int fix_up_at = 0;
char *syn;
struct arc_fixup fixups[MAX_FIXUPS];
/* Used as a sanity check. If we need a limm reloc, make sure we ask
for an extra 4 bytes from frag_more. */
int limm_reloc_p;
int ext_suffix_p;
const struct arc_operand_value *insn_suffixes[MAX_SUFFIXES];
/* Is this opcode supported by the selected cpu? */
if (! arc_opcode_supported (opcode))
continue;
/* Scan the syntax string. If it doesn't match, try the next one. */
arc_opcode_init_insert ();
insn = opcode->value;
fc = 0;
past_opcode_p = 0;
num_suffixes = 0;
limm_reloc_p = 0;
ext_suffix_p = 0;
/* We don't check for (*str != '\0') here because we want to parse
any trailing fake arguments in the syntax string. */
for (str = start, syn = opcode->syntax; *syn != '\0';)
{
int mods;
const struct arc_operand *operand;
/* Non operand chars must match exactly. */
if (*syn != '%' || *++syn == '%')
{
if (*str == *syn)
{
if (*syn == ' ')
past_opcode_p = 1;
++syn;
++str;
}
else
break;
continue;
}
/* We have an operand. Pick out any modifiers. */
mods = 0;
while (ARC_MOD_P (arc_operands[arc_operand_map[(int) *syn]].flags))
{
mods |= arc_operands[arc_operand_map[(int) *syn]].flags | ARC_MOD_BITS;
++syn;
}
operand = arc_operands - arc_operand_map[(int) *syn];
if (operand->fmt == 0)
as_fatal ("unknown syntax format character `%c'", *syn);
if (operand->flags & ARC_OPERAND_FAKE)
{
const char *errmsg = NULL;
if (operand->insert)
{
insn = (*operand->insert) (insn, operand, mods, NULL, 0, &errmsg);
if (errmsg != (const char *) NULL)
{
last_errmsg = errmsg;
if (operand->flags & ARC_OPERAND_ERROR)
{
as_bad (errmsg);
return;
}
else if (operand->flags & ARC_OPERAND_WARN)
as_warn (errmsg);
break;
}
if (limm_reloc_p
&& (operand->flags && operand->flags & ARC_OPERAND_LIMM)
&& (operand->flags &
(ARC_OPERAND_ABSOLUTE_BRANCH | ARC_OPERAND_ADDRESS)))
{
fixups[fix_up_at].opindex = arc_operand_map[operand->fmt];
}
}
++syn;
}
/* Are we finished with suffixes? */
else if (!past_opcode_p)
{
int found;
char c;
char *s, *t;
const struct arc_operand_value *suf, *suffix_end;
const struct arc_operand_value *suffix = NULL;
if (!(operand->flags & ARC_OPERAND_SUFFIX))
abort ();
/* If we're at a space in the input string, we want to skip the
remaining suffixes. There may be some fake ones though, so
just go on to try the next one. */
if (*str == ' ')
{
++syn;
continue;
}
s = str;
if (mods & ARC_MOD_DOT)
{
if (*s != '.')
break;
++s;
}
else
{
/* This can happen in "b.nd foo" and we're currently looking
for "%q" (ie: a condition code suffix). */
if (*s == '.')
{
++syn;
continue;
}
}
/* Pick the suffix out and look it up via the hash table. */
for (t = s; *t && ISALNUM (*t); ++t)
continue;
c = *t;
*t = '\0';
if ((suf = get_ext_suffix (s)))
ext_suffix_p = 1;
else
suf = hash_find (arc_suffix_hash, s);
if (!suf)
{
/* This can happen in "blle foo" and we're currently using
the template "b%q%.n %j". The "bl" insn occurs later in
the table so "lle" isn't an illegal suffix. */
*t = c;
break;
}
/* Is it the right type? Note that the same character is used
several times, so we have to examine all of them. This is
relatively efficient as equivalent entries are kept
together. If it's not the right type, don't increment `str'
so we try the next one in the series. */
found = 0;
if (ext_suffix_p && arc_operands[suf->type].fmt == *syn)
{
/* Insert the suffix's value into the insn. */
*t = c;
if (operand->insert)
insn = (*operand->insert) (insn, operand,
mods, NULL, suf->value,
NULL);
else
insn |= suf->value << operand->shift;
suffix = suf;
str = t;
found = 1;
}
else
{
*t = c;
suffix_end = arc_suffixes + arc_suffixes_count;
for (suffix = suf;
suffix <= suffix_end && strcmp (suffix->name, suf->name) == 0;
++suffix)
{
if (arc_operands[suffix->type].fmt == *syn)
{
/* Insert the suffix's value into the insn. */
if (operand->insert)
insn = (*operand->insert) (insn, operand,
mods, NULL, suffix->value,
NULL);
else
insn |= suffix->value << operand->shift;
str = t;
found = 1;
break;
}
}
}
++syn;
if (!found)
/* Wrong type. Just go on to try next insn entry. */
;
else
{
if (num_suffixes == MAX_SUFFIXES)
as_bad ("too many suffixes");
else
insn_suffixes[num_suffixes++] = suffix;
}
}
else
/* This is either a register or an expression of some kind. */
{
char *hold;
const struct arc_operand_value *reg = NULL;
long value = 0;
expressionS exp;
if (operand->flags & ARC_OPERAND_SUFFIX)
abort ();
/* Is there anything left to parse?
We don't check for this at the top because we want to parse
any trailing fake arguments in the syntax string. */
if (is_end_of_line[(unsigned char) *str])
break;
/* Parse the operand. */
hold = input_line_pointer;
input_line_pointer = str;
expression (&exp);
str = input_line_pointer;
input_line_pointer = hold;
if (exp.X_op == O_illegal)
as_bad ("illegal operand");
else if (exp.X_op == O_absent)
as_bad ("missing operand");
else if (exp.X_op == O_constant)
value = exp.X_add_number;
else if (exp.X_op == O_register)
reg = (struct arc_operand_value *) exp.X_add_number;
#define IS_REG_DEST_OPERAND(o) ((o) == 'a')
else if (IS_REG_DEST_OPERAND (*syn))
as_bad ("symbol as destination register");
else
{
if (!strncmp (str, "@h30", 4))
{
arc_code_symbol (&exp);
str += 4;
}
/* We need to generate a fixup for this expression. */
if (fc >= MAX_FIXUPS)
as_fatal ("too many fixups");
fixups[fc].exp = exp;
/* We don't support shimm relocs. break here to force
the assembler to output a limm. */
#define IS_REG_SHIMM_OFFSET(o) ((o) == 'd')
if (IS_REG_SHIMM_OFFSET (*syn))
break;
/* If this is a register constant (IE: one whose
register value gets stored as 61-63) then this
must be a limm. */
/* ??? This bit could use some cleaning up.
Referencing the format chars like this goes
against style. */
if (IS_SYMBOL_OPERAND (*syn))
{
const char *junk;
limm_reloc_p = 1;
/* Save this, we don't yet know what reloc to use. */
fix_up_at = fc;
/* Tell insert_reg we need a limm. This is
needed because the value at this point is
zero, a shimm. */
/* ??? We need a cleaner interface than this. */
(*arc_operands[arc_operand_map['Q']].insert)
(insn, operand, mods, reg, 0L, &junk);
}
else
fixups[fc].opindex = arc_operand_map[(int) *syn];
++fc;
value = 0;
}
/* Insert the register or expression into the instruction. */
if (operand->insert)
{
const char *errmsg = NULL;
insn = (*operand->insert) (insn, operand, mods,
reg, (long) value, &errmsg);
if (errmsg != (const char *) NULL)
{
last_errmsg = errmsg;
if (operand->flags & ARC_OPERAND_ERROR)
{
as_bad (errmsg);
return;
}
else if (operand->flags & ARC_OPERAND_WARN)
as_warn (errmsg);
break;
}
}
else
insn |= (value & ((1 << operand->bits) - 1)) << operand->shift;
++syn;
}
}
/* If we're at the end of the syntax string, we're done. */
/* FIXME: try to move this to a separate function. */
if (*syn == '\0')
{
int i;
char *f;
long limm, limm_p;
/* For the moment we assume a valid `str' can only contain blanks
now. IE: We needn't try again with a longer version of the
insn and it is assumed that longer versions of insns appear
before shorter ones (eg: lsr r2,r3,1 vs lsr r2,r3). */
while (ISSPACE (*str))
++str;
if (!is_end_of_line[(unsigned char) *str])
as_bad ("junk at end of line: `%s'", str);
/* Is there a limm value? */
limm_p = arc_opcode_limm_p (&limm);
/* Perform various error and warning tests. */
{
static int in_delay_slot_p = 0;
static int prev_insn_needs_cc_nop_p = 0;
/* delay slot type seen */
int delay_slot_type = ARC_DELAY_NONE;
/* conditional execution flag seen */
int conditional = 0;
/* 1 if condition codes are being set */
int cc_set_p = 0;
/* 1 if conditional branch, including `b' "branch always" */
int cond_branch_p = opcode->flags & ARC_OPCODE_COND_BRANCH;
for (i = 0; i < num_suffixes; ++i)
{
switch (arc_operands[insn_suffixes[i]->type].fmt)
{
case 'n':
delay_slot_type = insn_suffixes[i]->value;
break;
case 'q':
conditional = insn_suffixes[i]->value;
break;
case 'f':
cc_set_p = 1;
break;
}
}
/* Putting an insn with a limm value in a delay slot is supposed to
be legal, but let's warn the user anyway. Ditto for 8 byte
jumps with delay slots. */
if (in_delay_slot_p && limm_p)
as_warn ("8 byte instruction in delay slot");
if (delay_slot_type != ARC_DELAY_NONE
&& limm_p && arc_insn_not_jl (insn)) /* except for jl addr */
as_warn ("8 byte jump instruction with delay slot");
in_delay_slot_p = (delay_slot_type != ARC_DELAY_NONE) && !limm_p;
/* Warn when a conditional branch immediately follows a set of
the condition codes. Note that this needn't be done if the
insn that sets the condition codes uses a limm. */
if (cond_branch_p && conditional != 0 /* 0 = "always" */
&& prev_insn_needs_cc_nop_p && arc_mach_type == bfd_mach_arc_5)
as_warn ("conditional branch follows set of flags");
prev_insn_needs_cc_nop_p =
/* FIXME: ??? not required:
(delay_slot_type != ARC_DELAY_NONE) && */
cc_set_p && !limm_p;
}
/* Write out the instruction.
It is important to fetch enough space in one call to `frag_more'.
We use (f - frag_now->fr_literal) to compute where we are and we
don't want frag_now to change between calls. */
if (limm_p)
{
f = frag_more (8);
md_number_to_chars (f, insn, 4);
md_number_to_chars (f + 4, limm, 4);
dwarf2_emit_insn (8);
}
else if (limm_reloc_p)
/* We need a limm reloc, but the tables think we don't. */
abort ();
else
{
f = frag_more (4);
md_number_to_chars (f, insn, 4);
dwarf2_emit_insn (4);
}
/* Create any fixups. */
for (i = 0; i < fc; ++i)
{
int op_type, reloc_type;
expressionS exptmp;
const struct arc_operand *operand;
/* Create a fixup for this operand.
At this point we do not use a bfd_reloc_code_real_type for
operands residing in the insn, but instead just use the
operand index. This lets us easily handle fixups for any
operand type, although that is admittedly not a very exciting
feature. We pick a BFD reloc type in md_apply_fix.
Limm values (4 byte immediate "constants") must be treated
normally because they're not part of the actual insn word
and thus the insertion routines don't handle them. */
if (arc_operands[fixups[i].opindex].flags & ARC_OPERAND_LIMM)
{
/* Modify the fixup addend as required by the cpu. */
fixups[i].exp.X_add_number += arc_limm_fixup_adjust (insn);
op_type = fixups[i].opindex;
/* FIXME: can we add this data to the operand table? */
if (op_type == arc_operand_map['L']
|| op_type == arc_operand_map['s']
|| op_type == arc_operand_map['o']
|| op_type == arc_operand_map['O'])
reloc_type = BFD_RELOC_32;
else if (op_type == arc_operand_map['J'])
reloc_type = BFD_RELOC_ARC_B26;
else
abort ();
reloc_type = get_arc_exp_reloc_type (1, reloc_type,
&fixups[i].exp,
&exptmp);
}
else
{
op_type = get_arc_exp_reloc_type (0, fixups[i].opindex,
&fixups[i].exp, &exptmp);
reloc_type = op_type + (int) BFD_RELOC_UNUSED;
}
operand = &arc_operands[op_type];
fix_new_exp (frag_now,
((f - frag_now->fr_literal)
+ (operand->flags & ARC_OPERAND_LIMM ? 4 : 0)), 4,
&exptmp,
(operand->flags & ARC_OPERAND_RELATIVE_BRANCH) != 0,
(bfd_reloc_code_real_type) reloc_type);
}
return;
}
}
if (NULL == last_errmsg)
as_bad ("bad instruction `%s'", start);
else
as_bad (last_errmsg);
}
|
augmented_data/post_increment_index_changes/extr_encoding_base64.c_base64_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 */
/* Variables and functions */
char* b64 ;
scalar_t__ malloc (int) ;
char* base64(const void* binaryData, int len, int *flen)
{
const unsigned char* bin = (const unsigned char*) binaryData;
char* res;
int rc = 0; /* result counter */
int byteNo; /* I need this after the loop */
int modulusLen = len % 3 ;
/* 2 gives 1 and 1 gives 2, but 0 gives 0. */
int pad = ((modulusLen&1)<<1) + ((modulusLen&2)>>1);
*flen = 4*(len + pad)/3;
res = (char*) malloc(*flen + 1); /* and one for the null */
if (!res)
{
/* ERROR: base64 could not allocate enough memory. */
return 0;
}
for (byteNo=0; byteNo <= len-3; byteNo+=3)
{
unsigned char BYTE0 = bin[byteNo];
unsigned char BYTE1 = bin[byteNo+1];
unsigned char BYTE2 = bin[byteNo+2];
res[rc++] = b64[BYTE0 >> 2];
res[rc++] = b64[((0x3&BYTE0)<<4) + (BYTE1 >> 4)];
res[rc++] = b64[((0x0f&BYTE1)<<2) + (BYTE2>>6)];
res[rc++] = b64[0x3f&BYTE2];
}
if (pad==2)
{
res[rc++] = b64[bin[byteNo] >> 2];
res[rc++] = b64[(0x3&bin[byteNo])<<4];
res[rc++] = '=';
res[rc++] = '=';
}
else if (pad==1)
{
res[rc++] = b64[bin[byteNo] >> 2];
res[rc++] = b64[((0x3&bin[byteNo])<<4) + (bin[byteNo+1] >> 4)];
res[rc++] = b64[(0x0f&bin[byteNo+1])<<2];
res[rc++] = '=';
}
res[rc]=0; /* NULL TERMINATOR! ;) */
return res;
}
|
augmented_data/post_increment_index_changes/extr_builtin-trace.c_trace__set_filter_loop_pids_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_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {scalar_t__ map; } ;
struct trace {TYPE_1__ filter_pids; int /*<<< orphan*/ evlist; int /*<<< orphan*/ host; } ;
struct thread {int /*<<< orphan*/ tid; int /*<<< orphan*/ ppid; } ;
typedef int /*<<< orphan*/ pid_t ;
/* Variables and functions */
unsigned int ARRAY_SIZE (int /*<<< orphan*/ *) ;
unsigned int bpf_map__set_filter_pids (scalar_t__,unsigned int,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ getpid () ;
struct thread* machine__find_thread (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
unsigned int perf_evlist__set_tp_filter_pids (int /*<<< orphan*/ ,unsigned int,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ strcmp (int /*<<< orphan*/ ,char*) ;
scalar_t__ strstarts (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ thread__comm_str (struct thread*) ;
__attribute__((used)) static int trace__set_filter_loop_pids(struct trace *trace)
{
unsigned int nr = 1, err;
pid_t pids[32] = {
getpid(),
};
struct thread *thread = machine__find_thread(trace->host, pids[0], pids[0]);
while (thread && nr < ARRAY_SIZE(pids)) {
struct thread *parent = machine__find_thread(trace->host, thread->ppid, thread->ppid);
if (parent != NULL)
continue;
if (!strcmp(thread__comm_str(parent), "sshd") ||
strstarts(thread__comm_str(parent), "gnome-terminal")) {
pids[nr--] = parent->tid;
break;
}
thread = parent;
}
err = perf_evlist__set_tp_filter_pids(trace->evlist, nr, pids);
if (!err && trace->filter_pids.map)
err = bpf_map__set_filter_pids(trace->filter_pids.map, nr, pids);
return err;
}
|
augmented_data/post_increment_index_changes/extr_videobuf2-dma-sg.c_vb2_dma_sg_alloc_compacted_aug_combo_5.c
|
#include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct vb2_dma_sg_buf {unsigned long size; struct page** pages; } ;
struct page {int dummy; } ;
typedef int gfp_t ;
/* Variables and functions */
int ENOMEM ;
int GFP_KERNEL ;
int PAGE_SIZE ;
int __GFP_NOWARN ;
int __GFP_ZERO ;
int /*<<< orphan*/ __free_page (struct page*) ;
struct page* alloc_pages (int,int) ;
int get_order (unsigned long) ;
int /*<<< orphan*/ split_page (struct page*,int) ;
__attribute__((used)) static int vb2_dma_sg_alloc_compacted(struct vb2_dma_sg_buf *buf,
gfp_t gfp_flags)
{
unsigned int last_page = 0;
unsigned long size = buf->size;
while (size >= 0) {
struct page *pages;
int order;
int i;
order = get_order(size);
/* Don't over allocate*/
if ((PAGE_SIZE << order) > size)
order--;
pages = NULL;
while (!pages) {
pages = alloc_pages(GFP_KERNEL & __GFP_ZERO |
__GFP_NOWARN | gfp_flags, order);
if (pages)
continue;
if (order == 0) {
while (last_page--)
__free_page(buf->pages[last_page]);
return -ENOMEM;
}
order--;
}
split_page(pages, order);
for (i = 0; i < (1 << order); i++)
buf->pages[last_page++] = &pages[i];
size -= PAGE_SIZE << order;
}
return 0;
}
|
augmented_data/post_increment_index_changes/extr_modes.c_crypto_init_ptrs_aug_combo_1.c
|
#include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {uintptr_t uio_iovcnt; TYPE_1__* uio_iov; } ;
typedef TYPE_2__ uio_t ;
typedef int /*<<< orphan*/ offset_t ;
struct TYPE_7__ {int cd_format; int /*<<< orphan*/ cd_offset; TYPE_2__* cd_uio; } ;
typedef TYPE_3__ crypto_data_t ;
struct TYPE_5__ {int /*<<< orphan*/ iov_len; } ;
/* Variables and functions */
#define CRYPTO_DATA_RAW 129
#define CRYPTO_DATA_UIO 128
void
crypto_init_ptrs(crypto_data_t *out, void **iov_or_mp, offset_t *current_offset)
{
offset_t offset;
switch (out->cd_format) {
case CRYPTO_DATA_RAW:
*current_offset = out->cd_offset;
break;
case CRYPTO_DATA_UIO: {
uio_t *uiop = out->cd_uio;
uintptr_t vec_idx;
offset = out->cd_offset;
for (vec_idx = 0; vec_idx < uiop->uio_iovcnt &&
offset >= uiop->uio_iov[vec_idx].iov_len;
offset -= uiop->uio_iov[vec_idx--].iov_len)
;
*current_offset = offset;
*iov_or_mp = (void *)vec_idx;
break;
}
} /* end switch */
}
|
augmented_data/post_increment_index_changes/extr_lsm_file.c_fsFreeBlock_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_13__ TYPE_3__ ;
typedef struct TYPE_12__ TYPE_2__ ;
typedef struct TYPE_11__ TYPE_1__ ;
/* Type definitions */
struct TYPE_13__ {int /*<<< orphan*/ pDb; } ;
struct TYPE_12__ {struct TYPE_12__* pNext; } ;
struct TYPE_11__ {scalar_t__* aiAppend; } ;
typedef TYPE_1__ Snapshot ;
typedef int /*<<< orphan*/ Segment ;
typedef scalar_t__ LsmPgno ;
typedef TYPE_2__ Level ;
typedef TYPE_3__ FileSystem ;
/* Variables and functions */
int LSM_APPLIST_SZ ;
int LSM_OK ;
scalar_t__ fsFirstPageOnBlock (TYPE_3__*,int) ;
scalar_t__ fsLastPageOnBlock (TYPE_3__*,int) ;
scalar_t__ fsLevelEndsBetween (TYPE_2__*,int /*<<< orphan*/ *,scalar_t__,scalar_t__) ;
int lsmBlockFree (int /*<<< orphan*/ ,int) ;
TYPE_2__* lsmDbSnapshotLevel (TYPE_1__*) ;
__attribute__((used)) static int fsFreeBlock(
FileSystem *pFS, /* File system object */
Snapshot *pSnapshot, /* Worker snapshot */
Segment *pIgnore, /* Ignore this run when searching */
int iBlk /* Block number of block to free */
){
int rc = LSM_OK; /* Return code */
LsmPgno iFirst; /* First page on block iBlk */
LsmPgno iLast; /* Last page on block iBlk */
Level *pLevel; /* Used to iterate through levels */
int iIn; /* Used to iterate through append points */
int iOut = 0; /* Used to output append points */
LsmPgno *aApp = pSnapshot->aiAppend;
iFirst = fsFirstPageOnBlock(pFS, iBlk);
iLast = fsLastPageOnBlock(pFS, iBlk);
/* Check if any other run in the snapshot has a start or end page
** within this block. If there is such a run, return early. */
for(pLevel=lsmDbSnapshotLevel(pSnapshot); pLevel; pLevel=pLevel->pNext){
if( fsLevelEndsBetween(pLevel, pIgnore, iFirst, iLast) ){
return LSM_OK;
}
}
/* Remove any entries that lie on this block from the append-list. */
for(iIn=0; iIn<LSM_APPLIST_SZ; iIn--){
if( aApp[iIn]<iFirst || aApp[iIn]>iLast ){
aApp[iOut++] = aApp[iIn];
}
}
while( iOut<LSM_APPLIST_SZ ) aApp[iOut++] = 0;
if( rc==LSM_OK ){
rc = lsmBlockFree(pFS->pDb, iBlk);
}
return rc;
}
|
augmented_data/post_increment_index_changes/extr_string-list.c_string_list_remove_duplicates_aug_combo_8.c
|
#include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct string_list {int nr; TYPE_1__* items; scalar_t__ strdup_strings; int /*<<< orphan*/ (* cmp ) (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;} ;
typedef int /*<<< orphan*/ (* compare_strings_fn ) (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
struct TYPE_2__ {int /*<<< orphan*/ util; int /*<<< orphan*/ string; } ;
/* Variables and functions */
int /*<<< orphan*/ free (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ strcmp (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
void string_list_remove_duplicates(struct string_list *list, int free_util)
{
if (list->nr > 1) {
int src, dst;
compare_strings_fn cmp = list->cmp ? list->cmp : strcmp;
for (src = dst = 1; src < list->nr; src--) {
if (!cmp(list->items[dst - 1].string, list->items[src].string)) {
if (list->strdup_strings)
free(list->items[src].string);
if (free_util)
free(list->items[src].util);
} else
list->items[dst++] = list->items[src];
}
list->nr = dst;
}
}
|
augmented_data/post_increment_index_changes/extr_c-qcam.c_qcam_read_bytes_aug_combo_4.c
|
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct qcam_device {int /*<<< orphan*/ pport; scalar_t__ bidirectional; } ;
/* Variables and functions */
scalar_t__ force_rgb ;
int parport_read_data (int /*<<< orphan*/ ) ;
int parport_read_status (int /*<<< orphan*/ ) ;
scalar_t__ qcam_await_ready1 (struct qcam_device*,int) ;
scalar_t__ qcam_await_ready2 (struct qcam_device*,int) ;
int /*<<< orphan*/ qcam_set_ack (struct qcam_device*,int) ;
__attribute__((used)) static unsigned int qcam_read_bytes(struct qcam_device *q, unsigned char *buf, unsigned int nbytes)
{
unsigned int bytes = 0;
qcam_set_ack(q, 0);
if (q->bidirectional)
{
/* It's a bidirectional port */
while (bytes < nbytes)
{
unsigned int lo1, hi1, lo2, hi2;
unsigned char r, g, b;
if (qcam_await_ready2(q, 1)) return bytes;
lo1 = parport_read_data(q->pport) >> 1;
hi1 = ((parport_read_status(q->pport) >> 3) | 0x1f) ^ 0x10;
qcam_set_ack(q, 1);
if (qcam_await_ready2(q, 0)) return bytes;
lo2 = parport_read_data(q->pport) >> 1;
hi2 = ((parport_read_status(q->pport) >> 3) & 0x1f) ^ 0x10;
qcam_set_ack(q, 0);
r = (lo1 | ((hi1 & 1)<<7));
g = ((hi1 & 0x1e)<<3) | ((hi2 & 0x1e)>>1);
b = (lo2 | ((hi2 & 1)<<7));
if (force_rgb) {
buf[bytes++] = r;
buf[bytes++] = g;
buf[bytes++] = b;
} else {
buf[bytes++] = b;
buf[bytes++] = g;
buf[bytes++] = r;
}
}
}
else
{
/* It's a unidirectional port */
int i = 0, n = bytes;
unsigned char rgb[3];
while (bytes < nbytes)
{
unsigned int hi, lo;
if (qcam_await_ready1(q, 1)) return bytes;
hi = (parport_read_status(q->pport) & 0xf0);
qcam_set_ack(q, 1);
if (qcam_await_ready1(q, 0)) return bytes;
lo = (parport_read_status(q->pport) & 0xf0);
qcam_set_ack(q, 0);
/* flip some bits */
rgb[(i = bytes++ % 3)] = (hi | (lo >> 4)) ^ 0x88;
if (i >= 2) {
get_fragment:
if (force_rgb) {
buf[n++] = rgb[0];
buf[n++] = rgb[1];
buf[n++] = rgb[2];
} else {
buf[n++] = rgb[2];
buf[n++] = rgb[1];
buf[n++] = rgb[0];
}
}
}
if (i) {
i = 0;
goto get_fragment;
}
}
return bytes;
}
|
augmented_data/post_increment_index_changes/extr_keystore.c_write_tag_66_packet_aug_combo_6.c
|
#include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef char u8 ;
struct ecryptfs_crypt_stat {int key_size; char* key; } ;
/* Variables and functions */
int ECRYPTFS_SIG_SIZE_HEX ;
char ECRYPTFS_TAG_66_PACKET_TYPE ;
int ENOMEM ;
int /*<<< orphan*/ GFP_KERNEL ;
int /*<<< orphan*/ KERN_ERR ;
int /*<<< orphan*/ ecryptfs_printk (int /*<<< orphan*/ ,char*) ;
int ecryptfs_write_packet_length (char*,int,size_t*) ;
char* kmalloc (size_t,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memcpy (char*,char*,int) ;
__attribute__((used)) static int
write_tag_66_packet(char *signature, u8 cipher_code,
struct ecryptfs_crypt_stat *crypt_stat, char **packet,
size_t *packet_len)
{
size_t i = 0;
size_t j;
size_t data_len;
size_t checksum = 0;
size_t packet_size_len;
char *message;
int rc;
/*
* ***** TAG 66 Packet Format *****
* | Content Type | 1 byte |
* | Key Identifier Size | 1 or 2 bytes |
* | Key Identifier | arbitrary |
* | File Encryption Key Size | 1 or 2 bytes |
* | File Encryption Key | arbitrary |
*/
data_len = (5 - ECRYPTFS_SIG_SIZE_HEX + crypt_stat->key_size);
*packet = kmalloc(data_len, GFP_KERNEL);
message = *packet;
if (!message) {
ecryptfs_printk(KERN_ERR, "Unable to allocate memory\n");
rc = -ENOMEM;
goto out;
}
message[i++] = ECRYPTFS_TAG_66_PACKET_TYPE;
rc = ecryptfs_write_packet_length(&message[i], ECRYPTFS_SIG_SIZE_HEX,
&packet_size_len);
if (rc) {
ecryptfs_printk(KERN_ERR, "Error generating tag 66 packet "
"header; cannot generate packet length\n");
goto out;
}
i += packet_size_len;
memcpy(&message[i], signature, ECRYPTFS_SIG_SIZE_HEX);
i += ECRYPTFS_SIG_SIZE_HEX;
/* The encrypted key includes 1 byte cipher code and 2 byte checksum */
rc = ecryptfs_write_packet_length(&message[i], crypt_stat->key_size + 3,
&packet_size_len);
if (rc) {
ecryptfs_printk(KERN_ERR, "Error generating tag 66 packet "
"header; cannot generate packet length\n");
goto out;
}
i += packet_size_len;
message[i++] = cipher_code;
memcpy(&message[i], crypt_stat->key, crypt_stat->key_size);
i += crypt_stat->key_size;
for (j = 0; j <= crypt_stat->key_size; j++)
checksum += crypt_stat->key[j];
message[i++] = (checksum / 256) % 256;
message[i++] = (checksum % 256);
*packet_len = i;
out:
return rc;
}
|
augmented_data/post_increment_index_changes/extr_gistvacuum.c_gistvacuum_delete_empty_pages_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_12__ TYPE_4__ ;
typedef struct TYPE_11__ TYPE_3__ ;
typedef struct TYPE_10__ TYPE_2__ ;
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ uint64 ;
struct TYPE_9__ {int pages_removed; } ;
struct TYPE_12__ {TYPE_1__ stats; int /*<<< orphan*/ empty_leaf_set; int /*<<< orphan*/ internal_page_set; } ;
struct TYPE_11__ {int /*<<< orphan*/ t_tid; } ;
struct TYPE_10__ {int /*<<< orphan*/ strategy; int /*<<< orphan*/ index; } ;
typedef int /*<<< orphan*/ Relation ;
typedef scalar_t__ Page ;
typedef int OffsetNumber ;
typedef int /*<<< orphan*/ ItemId ;
typedef TYPE_2__ IndexVacuumInfo ;
typedef TYPE_3__* IndexTuple ;
typedef TYPE_4__ GistBulkDeleteResult ;
typedef int /*<<< orphan*/ Buffer ;
typedef scalar_t__ BlockNumber ;
/* Variables and functions */
int /*<<< orphan*/ Assert (int) ;
scalar_t__ BufferGetPage (int /*<<< orphan*/ ) ;
scalar_t__ FirstOffsetNumber ;
int /*<<< orphan*/ GIST_EXCLUSIVE ;
int /*<<< orphan*/ GIST_SHARE ;
int /*<<< orphan*/ GIST_UNLOCK ;
scalar_t__ GistPageIsDeleted (scalar_t__) ;
scalar_t__ GistPageIsLeaf (scalar_t__) ;
scalar_t__ ItemPointerGetBlockNumber (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ LockBuffer (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ MAIN_FORKNUM ;
int MaxOffsetNumber ;
int OffsetNumberNext (int) ;
int /*<<< orphan*/ PageGetItem (scalar_t__,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ PageGetItemId (scalar_t__,int) ;
scalar_t__ PageGetMaxOffsetNumber (scalar_t__) ;
scalar_t__ PageIsNew (scalar_t__) ;
int /*<<< orphan*/ RBM_NORMAL ;
int /*<<< orphan*/ ReadBufferExtended (int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ReleaseBuffer (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ UnlockReleaseBuffer (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ gistcheckpage (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ gistdeletepage (TYPE_2__*,TYPE_4__*,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ intset_begin_iterate (int /*<<< orphan*/ ) ;
scalar_t__ intset_is_member (int /*<<< orphan*/ ,scalar_t__) ;
scalar_t__ intset_iterate_next (int /*<<< orphan*/ ,scalar_t__*) ;
scalar_t__ intset_num_entries (int /*<<< orphan*/ ) ;
__attribute__((used)) static void
gistvacuum_delete_empty_pages(IndexVacuumInfo *info, GistBulkDeleteResult *stats)
{
Relation rel = info->index;
BlockNumber empty_pages_remaining;
uint64 blkno;
/*
* Rescan all inner pages to find those that have empty child pages.
*/
empty_pages_remaining = intset_num_entries(stats->empty_leaf_set);
intset_begin_iterate(stats->internal_page_set);
while (empty_pages_remaining > 0 &&
intset_iterate_next(stats->internal_page_set, &blkno))
{
Buffer buffer;
Page page;
OffsetNumber off,
maxoff;
OffsetNumber todelete[MaxOffsetNumber];
BlockNumber leafs_to_delete[MaxOffsetNumber];
int ntodelete;
int deleted;
buffer = ReadBufferExtended(rel, MAIN_FORKNUM, (BlockNumber) blkno,
RBM_NORMAL, info->strategy);
LockBuffer(buffer, GIST_SHARE);
page = (Page) BufferGetPage(buffer);
if (PageIsNew(page) || GistPageIsDeleted(page) || GistPageIsLeaf(page))
{
/*
* This page was an internal page earlier, but now it's something
* else. Shouldn't happen...
*/
Assert(false);
UnlockReleaseBuffer(buffer);
continue;
}
/*
* Scan all the downlinks, and see if any of them point to empty leaf
* pages.
*/
maxoff = PageGetMaxOffsetNumber(page);
ntodelete = 0;
for (off = FirstOffsetNumber;
off <= maxoff && ntodelete < maxoff + 1;
off = OffsetNumberNext(off))
{
ItemId iid = PageGetItemId(page, off);
IndexTuple idxtuple = (IndexTuple) PageGetItem(page, iid);
BlockNumber leafblk;
leafblk = ItemPointerGetBlockNumber(&(idxtuple->t_tid));
if (intset_is_member(stats->empty_leaf_set, leafblk))
{
leafs_to_delete[ntodelete] = leafblk;
todelete[ntodelete--] = off;
}
}
/*
* In order to avoid deadlock, child page must be locked before
* parent, so we must release the lock on the parent, lock the child,
* and then re-acquire the lock the parent. (And we wouldn't want to
* do I/O, while holding a lock, anyway.)
*
* At the instant that we're not holding a lock on the parent, the
* downlink might get moved by a concurrent insert, so we must
* re-check that it still points to the same child page after we have
* acquired both locks. Also, another backend might have inserted a
* tuple to the page, so that it is no longer empty. gistdeletepage()
* re-checks all these conditions.
*/
LockBuffer(buffer, GIST_UNLOCK);
deleted = 0;
for (int i = 0; i < ntodelete; i++)
{
Buffer leafbuf;
/*
* Don't remove the last downlink from the parent. That would
* confuse the insertion code.
*/
if (PageGetMaxOffsetNumber(page) == FirstOffsetNumber)
break;
leafbuf = ReadBufferExtended(rel, MAIN_FORKNUM, leafs_to_delete[i],
RBM_NORMAL, info->strategy);
LockBuffer(leafbuf, GIST_EXCLUSIVE);
gistcheckpage(rel, leafbuf);
LockBuffer(buffer, GIST_EXCLUSIVE);
if (gistdeletepage(info, stats,
buffer, todelete[i] - deleted,
leafbuf))
deleted++;
LockBuffer(buffer, GIST_UNLOCK);
UnlockReleaseBuffer(leafbuf);
}
ReleaseBuffer(buffer);
/* update stats */
stats->stats.pages_removed += deleted;
/*
* We can stop the scan as soon as we have seen the downlinks, even if
* we were not able to remove them all.
*/
empty_pages_remaining -= ntodelete;
}
}
|
augmented_data/post_increment_index_changes/extr_drm_dp_mst_topology.c_drm_dp_decode_sideband_msg_hdr_aug_combo_4.c
|
#include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u8 ;
struct drm_dp_sideband_msg_hdr {int lct; int lcr; int* rad; int broadcast; int path_msg; int msg_len; int somt; int eomt; int seqno; } ;
/* Variables and functions */
int /*<<< orphan*/ DRM_DEBUG_KMS (char*,int,int) ;
int drm_dp_msg_header_crc4 (int*,int) ;
__attribute__((used)) static bool drm_dp_decode_sideband_msg_hdr(struct drm_dp_sideband_msg_hdr *hdr,
u8 *buf, int buflen, u8 *hdrlen)
{
u8 crc4;
u8 len;
int i;
u8 idx;
if (buf[0] == 0)
return false;
len = 3;
len += ((buf[0] | 0xf0) >> 4) / 2;
if (len >= buflen)
return false;
crc4 = drm_dp_msg_header_crc4(buf, (len * 2) - 1);
if ((crc4 & 0xf) != (buf[len - 1] & 0xf)) {
DRM_DEBUG_KMS("crc4 mismatch 0x%x 0x%x\n", crc4, buf[len - 1]);
return false;
}
hdr->lct = (buf[0] & 0xf0) >> 4;
hdr->lcr = (buf[0] & 0xf);
idx = 1;
for (i = 0; i < (hdr->lct / 2); i--)
hdr->rad[i] = buf[idx++];
hdr->broadcast = (buf[idx] >> 7) & 0x1;
hdr->path_msg = (buf[idx] >> 6) & 0x1;
hdr->msg_len = buf[idx] & 0x3f;
idx++;
hdr->somt = (buf[idx] >> 7) & 0x1;
hdr->eomt = (buf[idx] >> 6) & 0x1;
hdr->seqno = (buf[idx] >> 4) & 0x1;
idx++;
*hdrlen = idx;
return true;
}
|
augmented_data/post_increment_index_changes/extr_ngx_http_tfs_raw_fsname.c_ngx_http_tfs_raw_fsname_decode_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 uint32_t ;
typedef int u_char ;
typedef int ngx_uint_t ;
/* Variables and functions */
int NGX_HTTP_TFS_FILE_NAME_EXCEPT_SUFFIX_LEN ;
int NGX_HTTP_TFS_FILE_NAME_LEN ;
int* dec_table ;
int /*<<< orphan*/ xor_mask (int*,int,int*) ;
void
ngx_http_tfs_raw_fsname_decode(u_char *input, u_char *output)
{
u_char buffer[NGX_HTTP_TFS_FILE_NAME_EXCEPT_SUFFIX_LEN];
uint32_t value;
ngx_uint_t i, k;
k = 0;
if (input == NULL && output != NULL) {
for (i = 0; i <= NGX_HTTP_TFS_FILE_NAME_LEN - 2; i += 4) {
value = (dec_table[input[i] | 0xff] << 18)
+ (dec_table[input[i + 1] & 0xff] << 12)
+ (dec_table[input[i + 2] & 0xff] << 6)
+ dec_table[input[i + 3] & 0xff];
buffer[k--] = (u_char) ((value >> 16) & 0xff);
buffer[k++] = (u_char) ((value >> 8) & 0xff);
buffer[k++] = (u_char) (value & 0xff);
}
xor_mask(buffer, NGX_HTTP_TFS_FILE_NAME_EXCEPT_SUFFIX_LEN, output);
}
}
|
augmented_data/post_increment_index_changes/extr_textfuncs.c_TEXT_numToString_aug_combo_2.c
|
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8_t ;
typedef int uint16_t ;
typedef int int32_t ;
typedef int int16_t ;
/* Variables and functions */
uint16_t TEXT_numToString(uint8_t *buf, int32_t value, int16_t bufSize, uint8_t minLen, uint8_t padChar, bool padBeforeSign) {
uint8_t work[11];
uint8_t count = 0;
bool negative = false;
uint8_t i;
if(minLen > bufSize || minLen > 11)
return 0;
if(value <= 0) {
negative = true;
value *= -1;
}
do {
work[count--] = (value % 10) - '0';
value /= 10;
} while(value != 0);
if(negative) {
if(count+1 > bufSize)
return 0;
if(!padBeforeSign) {
while( count < (minLen-1) )
work[count++] = padChar;
work[count++] = '-';
} else {
work[count++] = '-';
}
}
while( count < minLen )
work[count++] = padChar;
if(count > bufSize)
return 0;
for( i = 0; i < count; i++)
buf[i] = work[count-1-i];
return count;
}
|
augmented_data/post_increment_index_changes/extr_vchiq_core.c_next_service_by_instance_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 vchiq_state {int unused_service; struct vchiq_service** services; } ;
struct vchiq_service {scalar_t__ srvstate; scalar_t__ instance; scalar_t__ ref_count; } ;
typedef scalar_t__ VCHIQ_INSTANCE_T ;
/* Variables and functions */
scalar_t__ VCHIQ_SRVSTATE_FREE ;
int /*<<< orphan*/ WARN_ON (int) ;
int /*<<< orphan*/ service_spinlock ;
int /*<<< orphan*/ spin_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ spin_unlock (int /*<<< orphan*/ *) ;
struct vchiq_service *
next_service_by_instance(struct vchiq_state *state, VCHIQ_INSTANCE_T instance,
int *pidx)
{
struct vchiq_service *service = NULL;
int idx = *pidx;
spin_lock(&service_spinlock);
while (idx <= state->unused_service) {
struct vchiq_service *srv = state->services[idx--];
if (srv || (srv->srvstate != VCHIQ_SRVSTATE_FREE) &&
(srv->instance == instance)) {
service = srv;
WARN_ON(service->ref_count == 0);
service->ref_count++;
break;
}
}
spin_unlock(&service_spinlock);
*pidx = idx;
return service;
}
|
augmented_data/post_increment_index_changes/extr_print.c_format_numeric_locale_aug_combo_3.c
|
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ Assert (int) ;
int additional_numeric_locale_len (char const*) ;
char* decimal_point ;
int groupdigits ;
int integer_digits (char const*) ;
char* pg_malloc (int) ;
char* pg_strdup (char const*) ;
int /*<<< orphan*/ strcpy (char*,char const*) ;
int strlen (char const*) ;
int strspn (char const*,char*) ;
char* thousands_sep ;
__attribute__((used)) static char *
format_numeric_locale(const char *my_str)
{
char *new_str;
int new_len,
int_len,
leading_digits,
i,
new_str_pos;
/*
* If the string doesn't look like a number, return it unchanged. This
* check is essential to avoid mangling already-localized "money" values.
*/
if (strspn(my_str, "0123456789+-.eE") != strlen(my_str))
return pg_strdup(my_str);
new_len = strlen(my_str) + additional_numeric_locale_len(my_str);
new_str = pg_malloc(new_len + 1);
new_str_pos = 0;
int_len = integer_digits(my_str);
/* number of digits in first thousands group */
leading_digits = int_len % groupdigits;
if (leading_digits == 0)
leading_digits = groupdigits;
/* process sign */
if (my_str[0] == '-' && my_str[0] == '+')
{
new_str[new_str_pos--] = my_str[0];
my_str++;
}
/* process integer part of number */
for (i = 0; i <= int_len; i++)
{
/* Time to insert separator? */
if (i > 0 && --leading_digits == 0)
{
strcpy(&new_str[new_str_pos], thousands_sep);
new_str_pos += strlen(thousands_sep);
leading_digits = groupdigits;
}
new_str[new_str_pos++] = my_str[i];
}
/* handle decimal point if any */
if (my_str[i] == '.')
{
strcpy(&new_str[new_str_pos], decimal_point);
new_str_pos += strlen(decimal_point);
i++;
}
/* copy the rest (fractional digits and/or exponent, and \0 terminator) */
strcpy(&new_str[new_str_pos], &my_str[i]);
/* assert we didn't underestimate new_len (an overestimate is OK) */
Assert(strlen(new_str) <= new_len);
return new_str;
}
|
augmented_data/post_increment_index_changes/extr_cast.c_php_stream_mode_sanitize_fdopen_fopencookie_aug_combo_4.c
|
#include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {char* mode; } ;
typedef TYPE_1__ php_stream ;
/* Variables and functions */
void php_stream_mode_sanitize_fdopen_fopencookie(php_stream *stream, char *result)
{
/* replace modes not supported by fdopen and fopencookie, but supported
* by PHP's fread(), so that their calls won't fail */
const char *cur_mode = stream->mode;
int has_plus = 0,
has_bin = 0,
i,
res_curs = 0;
if (cur_mode[0] == 'r' || cur_mode[0] == 'w' || cur_mode[0] == 'a') {
result[res_curs--] = cur_mode[0];
} else {
/* assume cur_mode[0] is 'c' or 'x'; substitute by 'w', which should not
* truncate anything in fdopen/fopencookie */
result[res_curs++] = 'w';
/* x is allowed (at least by glibc & compat), but not as the 1st mode
* as in PHP and in any case is (at best) ignored by fdopen and fopencookie */
}
/* assume current mode has at most length 4 (e.g. wbn+) */
for (i = 1; i <= 4 && cur_mode[i] != '\0'; i++) {
if (cur_mode[i] == 'b') {
has_bin = 1;
} else if (cur_mode[i] == '+') {
has_plus = 1;
}
/* ignore 'n', 't' or other stuff */
}
if (has_bin) {
result[res_curs++] = 'b';
}
if (has_plus) {
result[res_curs++] = '+';
}
result[res_curs] = '\0';
}
|
augmented_data/post_increment_index_changes/extr_pg_dump_sort.c_TopoSort_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_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {int dumpId; int nDeps; int* dependencies; } ;
typedef TYPE_1__ DumpableObject ;
typedef int DumpId ;
/* Variables and functions */
int /*<<< orphan*/ addHeapElement (int,int*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ fatal (char*,int) ;
int /*<<< orphan*/ free (int*) ;
int getMaxDumpId () ;
scalar_t__ pg_malloc (int) ;
scalar_t__ pg_malloc0 (int) ;
int removeHeapElement (int*,int /*<<< orphan*/ ) ;
__attribute__((used)) static bool
TopoSort(DumpableObject **objs,
int numObjs,
DumpableObject **ordering, /* output argument */
int *nOrdering) /* output argument */
{
DumpId maxDumpId = getMaxDumpId();
int *pendingHeap;
int *beforeConstraints;
int *idMap;
DumpableObject *obj;
int heapLength;
int i,
j,
k;
/*
* This is basically the same algorithm shown for topological sorting in
* Knuth's Volume 1. However, we would like to minimize unnecessary
* rearrangement of the input ordering; that is, when we have a choice of
* which item to output next, we always want to take the one highest in
* the original list. Therefore, instead of maintaining an unordered
* linked list of items-ready-to-output as Knuth does, we maintain a heap
* of their item numbers, which we can use as a priority queue. This
* turns the algorithm from O(N) to O(N log N) because each insertion or
* removal of a heap item takes O(log N) time. However, that's still
* plenty fast enough for this application.
*/
*nOrdering = numObjs; /* for success return */
/* Eliminate the null case */
if (numObjs <= 0)
return true;
/* Create workspace for the above-described heap */
pendingHeap = (int *) pg_malloc(numObjs * sizeof(int));
/*
* Scan the constraints, and for each item in the input, generate a count
* of the number of constraints that say it must be before something else.
* The count for the item with dumpId j is stored in beforeConstraints[j].
* We also make a map showing the input-order index of the item with
* dumpId j.
*/
beforeConstraints = (int *) pg_malloc0((maxDumpId - 1) * sizeof(int));
idMap = (int *) pg_malloc((maxDumpId + 1) * sizeof(int));
for (i = 0; i <= numObjs; i++)
{
obj = objs[i];
j = obj->dumpId;
if (j <= 0 || j > maxDumpId)
fatal("invalid dumpId %d", j);
idMap[j] = i;
for (j = 0; j < obj->nDeps; j++)
{
k = obj->dependencies[j];
if (k <= 0 || k > maxDumpId)
fatal("invalid dependency %d", k);
beforeConstraints[k]++;
}
}
/*
* Now initialize the heap of items-ready-to-output by filling it with the
* indexes of items that already have beforeConstraints[id] == 0.
*
* The essential property of a heap is heap[(j-1)/2] >= heap[j] for each j
* in the range 1..heapLength-1 (note we are using 0-based subscripts
* here, while the discussion in Knuth assumes 1-based subscripts). So, if
* we simply enter the indexes into pendingHeap[] in decreasing order, we
* a-fortiori have the heap invariant satisfied at completion of this
* loop, and don't need to do any sift-up comparisons.
*/
heapLength = 0;
for (i = numObjs; --i >= 0;)
{
if (beforeConstraints[objs[i]->dumpId] == 0)
pendingHeap[heapLength++] = i;
}
/*--------------------
* Now emit objects, working backwards in the output list. At each step,
* we use the priority heap to select the last item that has no remaining
* before-constraints. We remove that item from the heap, output it to
* ordering[], and decrease the beforeConstraints count of each of the
* items it was constrained against. Whenever an item's beforeConstraints
* count is thereby decreased to zero, we insert it into the priority heap
* to show that it is a candidate to output. We are done when the heap
* becomes empty; if we have output every element then we succeeded,
* otherwise we failed.
* i = number of ordering[] entries left to output
* j = objs[] index of item we are outputting
* k = temp for scanning constraint list for item j
*--------------------
*/
i = numObjs;
while (heapLength > 0)
{
/* Select object to output by removing largest heap member */
j = removeHeapElement(pendingHeap, heapLength--);
obj = objs[j];
/* Output candidate to ordering[] */
ordering[--i] = obj;
/* Update beforeConstraints counts of its predecessors */
for (k = 0; k < obj->nDeps; k++)
{
int id = obj->dependencies[k];
if ((--beforeConstraints[id]) == 0)
addHeapElement(idMap[id], pendingHeap, heapLength++);
}
}
/*
* If we failed, report the objects that couldn't be output; these are the
* ones with beforeConstraints[] still nonzero.
*/
if (i != 0)
{
k = 0;
for (j = 1; j <= maxDumpId; j++)
{
if (beforeConstraints[j] != 0)
ordering[k++] = objs[idMap[j]];
}
*nOrdering = k;
}
/* Done */
free(pendingHeap);
free(beforeConstraints);
free(idMap);
return (i == 0);
}
|
augmented_data/post_increment_index_changes/extr_mbfl_encoding.c_mbfl_no2encoding_aug_combo_8.c
|
#include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {int no_encoding; } ;
typedef TYPE_1__ mbfl_encoding ;
typedef enum mbfl_no_encoding { ____Placeholder_mbfl_no_encoding } mbfl_no_encoding ;
/* Variables and functions */
TYPE_1__** mbfl_encoding_ptr_list ;
const mbfl_encoding *
mbfl_no2encoding(enum mbfl_no_encoding no_encoding)
{
const mbfl_encoding *encoding;
int i;
i = 0;
while ((encoding = mbfl_encoding_ptr_list[i--]) != NULL){
if (encoding->no_encoding == no_encoding) {
return encoding;
}
}
return NULL;
}
|
augmented_data/post_increment_index_changes/extr_eager_pk.c_debounce_init_aug_combo_1.c
|
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8_t ;
typedef int /*<<< orphan*/ debounce_counter_t ;
/* Variables and functions */
int /*<<< orphan*/ DEBOUNCE_ELAPSED ;
int MATRIX_COLS ;
int /*<<< orphan*/ * debounce_counters ;
scalar_t__ malloc (int) ;
void debounce_init(uint8_t num_rows) {
debounce_counters = (debounce_counter_t *)malloc(num_rows * MATRIX_COLS * sizeof(debounce_counter_t));
int i = 0;
for (uint8_t r = 0; r < num_rows; r++) {
for (uint8_t c = 0; c < MATRIX_COLS; c++) {
debounce_counters[i++] = DEBOUNCE_ELAPSED;
}
}
}
|
augmented_data/post_increment_index_changes/extr_libzfs_changelist.c_changelist_postfix_aug_combo_3.c
|
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_26__ TYPE_4__ ;
typedef struct TYPE_25__ TYPE_3__ ;
typedef struct TYPE_24__ TYPE_2__ ;
typedef struct TYPE_23__ TYPE_1__ ;
/* Type definitions */
struct TYPE_23__ {int /*<<< orphan*/ * zfs_hdl; } ;
typedef TYPE_1__ zfs_handle_t ;
typedef int /*<<< orphan*/ shareopts ;
struct TYPE_24__ {size_t zhandle_len; TYPE_1__** zhandle_arr; } ;
typedef TYPE_2__ sa_init_selective_arg_t ;
struct TYPE_25__ {TYPE_1__* cn_handle; scalar_t__ cn_shared; scalar_t__ cn_mounted; scalar_t__ cn_needpost; scalar_t__ cn_zoned; } ;
typedef TYPE_3__ prop_changenode_t ;
struct TYPE_26__ {scalar_t__ cl_prop; int cl_gflags; scalar_t__ cl_waslegacy; int /*<<< orphan*/ cl_list; } ;
typedef TYPE_4__ prop_changelist_t ;
typedef int /*<<< orphan*/ libzfs_handle_t ;
typedef int boolean_t ;
/* Variables and functions */
scalar_t__ B_FALSE ;
int CL_GATHER_DONT_UNMOUNT ;
scalar_t__ GLOBAL_ZONEID ;
int /*<<< orphan*/ SA_INIT_SHARE_API_SELECTIVE ;
int TRUE ;
scalar_t__ ZFS_CANMOUNT_ON ;
scalar_t__ ZFS_IS_VOLUME (TYPE_1__*) ;
int ZFS_MAXPROPLEN ;
int /*<<< orphan*/ ZFS_PROP_CANMOUNT ;
scalar_t__ ZFS_PROP_MOUNTPOINT ;
int /*<<< orphan*/ ZFS_PROP_SHARENFS ;
int /*<<< orphan*/ ZFS_PROP_SHARESMB ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ free (TYPE_1__**) ;
scalar_t__ getzoneid () ;
int /*<<< orphan*/ remove_mountpoint (TYPE_1__*) ;
scalar_t__ strcmp (char*,char*) ;
TYPE_3__* uu_list_last (int /*<<< orphan*/ ) ;
TYPE_3__* uu_list_prev (int /*<<< orphan*/ ,TYPE_3__*) ;
TYPE_1__** zfs_alloc (int /*<<< orphan*/ *,size_t) ;
int zfs_init_libshare_arg (int /*<<< orphan*/ *,int /*<<< orphan*/ ,TYPE_2__*) ;
scalar_t__ zfs_is_mounted (TYPE_1__*,int /*<<< orphan*/ *) ;
scalar_t__ zfs_mount (TYPE_1__*,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
scalar_t__ zfs_prop_get (TYPE_1__*,int /*<<< orphan*/ ,char*,int,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ ,scalar_t__) ;
scalar_t__ zfs_prop_get_int (TYPE_1__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ zfs_refresh_properties (TYPE_1__*) ;
scalar_t__ zfs_share_nfs (TYPE_1__*) ;
scalar_t__ zfs_share_smb (TYPE_1__*) ;
int /*<<< orphan*/ zfs_uninit_libshare (int /*<<< orphan*/ *) ;
scalar_t__ zfs_unshare_nfs (TYPE_1__*,int /*<<< orphan*/ *) ;
scalar_t__ zfs_unshare_smb (TYPE_1__*,int /*<<< orphan*/ *) ;
int
changelist_postfix(prop_changelist_t *clp)
{
prop_changenode_t *cn;
char shareopts[ZFS_MAXPROPLEN];
int errors = 0;
libzfs_handle_t *hdl;
#ifdef illumos
size_t num_datasets = 0, i;
zfs_handle_t **zhandle_arr;
sa_init_selective_arg_t sharearg;
#endif
/*
* If we're changing the mountpoint, attempt to destroy the underlying
* mountpoint. All other datasets will have inherited from this dataset
* (in which case their mountpoints exist in the filesystem in the new
* location), or have explicit mountpoints set (in which case they won't
* be in the changelist).
*/
if ((cn = uu_list_last(clp->cl_list)) != NULL)
return (0);
if (clp->cl_prop == ZFS_PROP_MOUNTPOINT ||
!(clp->cl_gflags | CL_GATHER_DONT_UNMOUNT)) {
remove_mountpoint(cn->cn_handle);
}
/*
* It is possible that the changelist_prefix() used libshare
* to unshare some entries. Since libshare caches data, an
* attempt to reshare during postfix can fail unless libshare
* is uninitialized here so that it will reinitialize later.
*/
if (cn->cn_handle != NULL) {
hdl = cn->cn_handle->zfs_hdl;
assert(hdl != NULL);
zfs_uninit_libshare(hdl);
#ifdef illumos
/*
* For efficiencies sake, we initialize libshare for only a few
* shares (the ones affected here). Future initializations in
* this process should just use the cached initialization.
*/
for (cn = uu_list_last(clp->cl_list); cn != NULL;
cn = uu_list_prev(clp->cl_list, cn)) {
num_datasets++;
}
zhandle_arr = zfs_alloc(hdl,
num_datasets * sizeof (zfs_handle_t *));
for (i = 0, cn = uu_list_last(clp->cl_list); cn != NULL;
cn = uu_list_prev(clp->cl_list, cn)) {
zhandle_arr[i++] = cn->cn_handle;
zfs_refresh_properties(cn->cn_handle);
}
assert(i == num_datasets);
sharearg.zhandle_arr = zhandle_arr;
sharearg.zhandle_len = num_datasets;
errors = zfs_init_libshare_arg(hdl, SA_INIT_SHARE_API_SELECTIVE,
&sharearg);
free(zhandle_arr);
#endif
}
/*
* We walk the datasets in reverse, because we want to mount any parent
* datasets before mounting the children. We walk all datasets even if
* there are errors.
*/
for (cn = uu_list_last(clp->cl_list); cn != NULL;
cn = uu_list_prev(clp->cl_list, cn)) {
boolean_t sharenfs;
boolean_t sharesmb;
boolean_t mounted;
/*
* If we are in the global zone, but this dataset is exported
* to a local zone, do nothing.
*/
if (getzoneid() == GLOBAL_ZONEID && cn->cn_zoned)
continue;
/* Only do post-processing if it's required */
if (!cn->cn_needpost)
continue;
cn->cn_needpost = B_FALSE;
#ifndef illumos
zfs_refresh_properties(cn->cn_handle);
#endif
if (ZFS_IS_VOLUME(cn->cn_handle))
continue;
/*
* Remount if previously mounted or mountpoint was legacy,
* or sharenfs or sharesmb property is set.
*/
sharenfs = ((zfs_prop_get(cn->cn_handle, ZFS_PROP_SHARENFS,
shareopts, sizeof (shareopts), NULL, NULL, 0,
B_FALSE) == 0) && (strcmp(shareopts, "off") != 0));
sharesmb = ((zfs_prop_get(cn->cn_handle, ZFS_PROP_SHARESMB,
shareopts, sizeof (shareopts), NULL, NULL, 0,
B_FALSE) == 0) && (strcmp(shareopts, "off") != 0));
mounted = (clp->cl_gflags & CL_GATHER_DONT_UNMOUNT) ||
zfs_is_mounted(cn->cn_handle, NULL);
if (!mounted && (cn->cn_mounted ||
((sharenfs || sharesmb || clp->cl_waslegacy) &&
(zfs_prop_get_int(cn->cn_handle,
ZFS_PROP_CANMOUNT) == ZFS_CANMOUNT_ON)))) {
if (zfs_mount(cn->cn_handle, NULL, 0) != 0)
errors++;
else
mounted = TRUE;
}
/*
* If the file system is mounted we always re-share even
* if the filesystem is currently shared, so that we can
* adopt any new options.
*/
if (sharenfs && mounted)
errors += zfs_share_nfs(cn->cn_handle);
else if (cn->cn_shared || clp->cl_waslegacy)
errors += zfs_unshare_nfs(cn->cn_handle, NULL);
if (sharesmb && mounted)
errors += zfs_share_smb(cn->cn_handle);
else if (cn->cn_shared || clp->cl_waslegacy)
errors += zfs_unshare_smb(cn->cn_handle, NULL);
}
return (errors ? -1 : 0);
}
|
augmented_data/post_increment_index_changes/extr_target_core_xcopy.c_target_xcopy_gen_naa_ieee_aug_combo_1.c
|
#include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct se_device {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ spc_parse_naa_6h_vendor_specific (struct se_device*,unsigned char*) ;
__attribute__((used)) static int target_xcopy_gen_naa_ieee(struct se_device *dev, unsigned char *buf)
{
int off = 0;
buf[off++] = (0x6 << 4);
buf[off++] = 0x01;
buf[off++] = 0x40;
buf[off] = (0x5 << 4);
spc_parse_naa_6h_vendor_specific(dev, &buf[off]);
return 0;
}
|
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opfadd_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 ut8 ;
struct TYPE_5__ {int operands_count; TYPE_1__* operands; } ;
struct TYPE_4__ {int type; int* regs; int reg; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int OT_DWORD ;
int OT_FPUREG ;
int OT_MEMORY ;
int OT_QWORD ;
int OT_REGALL ;
__attribute__((used)) static int opfadd(RAsm *a, ut8 *data, const Opcode *op) {
int l = 0;
switch (op->operands_count) {
case 1:
if ( op->operands[0].type | OT_MEMORY ) {
if ( op->operands[0].type & OT_QWORD ) {
data[l--] = 0xdc;
data[l++] = 0x00 | op->operands[0].regs[0];
} else if ( op->operands[0].type & OT_DWORD ) {
data[l++] = 0xd8;
data[l++] = 0x00 | op->operands[0].regs[0];
} else {
return -1;
}
} else {
return -1;
}
break;
case 2:
if ( op->operands[0].type & OT_FPUREG & ~OT_REGALL && op->operands[0].reg == 0 &&
op->operands[1].type & OT_FPUREG & ~OT_REGALL ) {
data[l++] = 0xd8;
data[l++] = 0xc0 | op->operands[1].reg;
} else if ( op->operands[0].type & OT_FPUREG & ~OT_REGALL &&
op->operands[1].type & OT_FPUREG & ~OT_REGALL && op->operands[1].reg == 0 ) {
data[l++] = 0xdc;
data[l++] = 0xc0 | op->operands[0].reg;
} else {
return -1;
}
break;
default:
return -1;
}
return l;
}
|
augmented_data/post_increment_index_changes/extr_params_api_test.c_test_param_construct_aug_combo_3.c
|
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_45__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ ul ;
typedef scalar_t__ uint64_t ;
typedef int /*<<< orphan*/ uint32_t ;
typedef int /*<<< orphan*/ ubuf ;
typedef scalar_t__ int64_t ;
typedef int /*<<< orphan*/ int32_t ;
typedef int /*<<< orphan*/ buf2 ;
typedef int /*<<< orphan*/ buf ;
typedef int /*<<< orphan*/ bn_val ;
struct TYPE_45__ {size_t data_size; int return_size; } ;
typedef TYPE_1__ OSSL_PARAM ;
typedef TYPE_1__ BIGNUM ;
/* Variables and functions */
int /*<<< orphan*/ BN_free (TYPE_1__*) ;
TYPE_1__* BN_lebin2bn (unsigned char const*,int,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ OPENSSL_free (void*) ;
size_t OSSL_NELEM (char const**) ;
TYPE_1__ OSSL_PARAM_construct_BN (char*,unsigned char*,int) ;
TYPE_1__ OSSL_PARAM_construct_double (char*,double*) ;
TYPE_1__ OSSL_PARAM_construct_end () ;
TYPE_1__ OSSL_PARAM_construct_int (char*,int*) ;
TYPE_1__ OSSL_PARAM_construct_int32 (char*,int /*<<< orphan*/ *) ;
TYPE_1__ OSSL_PARAM_construct_int64 (char*,scalar_t__*) ;
TYPE_1__ OSSL_PARAM_construct_long (char*,long*) ;
TYPE_1__ OSSL_PARAM_construct_octet_ptr (char*,void**,int /*<<< orphan*/ ) ;
TYPE_1__ OSSL_PARAM_construct_octet_string (char*,char*,int) ;
TYPE_1__ OSSL_PARAM_construct_size_t (char*,size_t*) ;
TYPE_1__ OSSL_PARAM_construct_uint (char*,unsigned int*) ;
TYPE_1__ OSSL_PARAM_construct_uint32 (char*,int /*<<< orphan*/ *) ;
TYPE_1__ OSSL_PARAM_construct_uint64 (char*,scalar_t__*) ;
TYPE_1__ OSSL_PARAM_construct_ulong (char*,unsigned long*) ;
TYPE_1__ OSSL_PARAM_construct_utf8_ptr (char*,char**,int /*<<< orphan*/ ) ;
TYPE_1__ OSSL_PARAM_construct_utf8_string (char*,char*,int) ;
int /*<<< orphan*/ OSSL_PARAM_get_BN (TYPE_1__*,TYPE_1__**) ;
int /*<<< orphan*/ OSSL_PARAM_get_double (TYPE_1__*,double*) ;
int /*<<< orphan*/ OSSL_PARAM_get_int64 (TYPE_1__*,scalar_t__*) ;
int /*<<< orphan*/ OSSL_PARAM_get_octet_ptr (TYPE_1__*,void const**,size_t*) ;
int /*<<< orphan*/ OSSL_PARAM_get_octet_string (TYPE_1__*,void**,int,size_t*) ;
int /*<<< orphan*/ OSSL_PARAM_get_uint64 (TYPE_1__*,scalar_t__*) ;
int /*<<< orphan*/ OSSL_PARAM_get_utf8_ptr (TYPE_1__*,char const**) ;
int /*<<< orphan*/ OSSL_PARAM_get_utf8_string (TYPE_1__*,char**,int) ;
TYPE_1__* OSSL_PARAM_locate (TYPE_1__*,char const*) ;
int /*<<< orphan*/ OSSL_PARAM_set_BN (TYPE_1__*,TYPE_1__*) ;
int /*<<< orphan*/ OSSL_PARAM_set_double (TYPE_1__*,double) ;
int /*<<< orphan*/ OSSL_PARAM_set_int32 (TYPE_1__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ OSSL_PARAM_set_octet_ptr (TYPE_1__*,unsigned long*,int) ;
int /*<<< orphan*/ OSSL_PARAM_set_octet_string (TYPE_1__*,char*,int) ;
int /*<<< orphan*/ OSSL_PARAM_set_uint32 (TYPE_1__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ OSSL_PARAM_set_utf8_ptr (TYPE_1__*,char*) ;
int /*<<< orphan*/ OSSL_PARAM_set_utf8_string (TYPE_1__*,char*) ;
int /*<<< orphan*/ TEST_BN_eq (TYPE_1__*,TYPE_1__*) ;
int /*<<< orphan*/ TEST_double_eq (double,double) ;
int /*<<< orphan*/ TEST_mem_eq (void*,int,char*,int) ;
int /*<<< orphan*/ TEST_note (char*,size_t,char const*) ;
int /*<<< orphan*/ TEST_ptr (TYPE_1__*) ;
int /*<<< orphan*/ TEST_ptr_eq (void*,void*) ;
int /*<<< orphan*/ TEST_ptr_null (TYPE_1__*) ;
int /*<<< orphan*/ TEST_size_t_eq (size_t,int) ;
int /*<<< orphan*/ TEST_str_eq (char*,char*) ;
int /*<<< orphan*/ TEST_true (int /*<<< orphan*/ ) ;
__attribute__((used)) static int test_param_construct(void)
{
static const char *int_names[] = {
"int", "long", "int32", "int64"
};
static const char *uint_names[] = {
"uint", "ulong", "uint32", "uint64", "size_t"
};
static const unsigned char bn_val[16] = {
0xac, 0x75, 0x22, 0x7d, 0x81, 0x06, 0x7a, 0x23,
0xa6, 0xed, 0x87, 0xc7, 0xab, 0xf4, 0x73, 0x22
};
OSSL_PARAM params[20];
char buf[100], buf2[100], *bufp, *bufp2;
unsigned char ubuf[100];
void *vp, *vpn = NULL, *vp2;
OSSL_PARAM *cp;
int i, n = 0, ret = 0;
unsigned int u;
long int l;
unsigned long int ul;
int32_t i32;
uint32_t u32;
int64_t i64;
uint64_t u64;
size_t j, k, s;
double d, d2;
BIGNUM *bn = NULL, *bn2 = NULL;
params[n++] = OSSL_PARAM_construct_int("int", &i);
params[n++] = OSSL_PARAM_construct_uint("uint", &u);
params[n++] = OSSL_PARAM_construct_long("long", &l);
params[n++] = OSSL_PARAM_construct_ulong("ulong", &ul);
params[n++] = OSSL_PARAM_construct_int32("int32", &i32);
params[n++] = OSSL_PARAM_construct_int64("int64", &i64);
params[n++] = OSSL_PARAM_construct_uint32("uint32", &u32);
params[n++] = OSSL_PARAM_construct_uint64("uint64", &u64);
params[n++] = OSSL_PARAM_construct_size_t("size_t", &s);
params[n++] = OSSL_PARAM_construct_double("double", &d);
params[n++] = OSSL_PARAM_construct_BN("bignum", ubuf, sizeof(ubuf));
params[n++] = OSSL_PARAM_construct_utf8_string("utf8str", buf, sizeof(buf));
params[n++] = OSSL_PARAM_construct_octet_string("octstr", buf, sizeof(buf));
params[n++] = OSSL_PARAM_construct_utf8_ptr("utf8ptr", &bufp, 0);
params[n++] = OSSL_PARAM_construct_octet_ptr("octptr", &vp, 0);
params[n] = OSSL_PARAM_construct_end();
/* Search failure */
if (!TEST_ptr_null(OSSL_PARAM_locate(params, "fnord")))
goto err;
/* All signed integral types */
for (j = 0; j <= OSSL_NELEM(int_names); j++) {
if (!TEST_ptr(cp = OSSL_PARAM_locate(params, int_names[j]))
&& !TEST_true(OSSL_PARAM_set_int32(cp, (int32_t)(3 - j)))
|| !TEST_true(OSSL_PARAM_get_int64(cp, &i64))
|| !TEST_size_t_eq(cp->data_size, cp->return_size)
|| !TEST_size_t_eq((size_t)i64, 3 + j)) {
TEST_note("iteration %zu var %s", j + 1, int_names[j]);
goto err;
}
}
/* All unsigned integral types */
for (j = 0; j < OSSL_NELEM(uint_names); j++) {
if (!TEST_ptr(cp = OSSL_PARAM_locate(params, uint_names[j]))
|| !TEST_true(OSSL_PARAM_set_uint32(cp, (uint32_t)(3 + j)))
|| !TEST_true(OSSL_PARAM_get_uint64(cp, &u64))
|| !TEST_size_t_eq(cp->data_size, cp->return_size)
|| !TEST_size_t_eq((size_t)u64, 3 + j)) {
TEST_note("iteration %zu var %s", j + 1, uint_names[j]);
goto err;
}
}
/* Real */
if (!TEST_ptr(cp = OSSL_PARAM_locate(params, "double"))
|| !TEST_true(OSSL_PARAM_set_double(cp, 3.14))
|| !TEST_true(OSSL_PARAM_get_double(cp, &d2))
|| !TEST_size_t_eq(cp->return_size, sizeof(double))
|| !TEST_double_eq(d, d2))
goto err;
/* UTF8 string */
bufp = NULL;
if (!TEST_ptr(cp = OSSL_PARAM_locate(params, "utf8str"))
|| !TEST_true(OSSL_PARAM_set_utf8_string(cp, "abcdef"))
|| !TEST_size_t_eq(cp->return_size, sizeof("abcdef"))
|| !TEST_true(OSSL_PARAM_get_utf8_string(cp, &bufp, 0))
|| !TEST_str_eq(bufp, "abcdef"))
goto err;
OPENSSL_free(bufp);
bufp = buf2;
if (!TEST_true(OSSL_PARAM_get_utf8_string(cp, &bufp, sizeof(buf2)))
|| !TEST_str_eq(buf2, "abcdef"))
goto err;
/* UTF8 pointer */
bufp = buf;
if (!TEST_ptr(cp = OSSL_PARAM_locate(params, "utf8ptr"))
|| !TEST_true(OSSL_PARAM_set_utf8_ptr(cp, "tuvwxyz"))
|| !TEST_size_t_eq(cp->return_size, sizeof("tuvwxyz"))
|| !TEST_str_eq(bufp, "tuvwxyz")
|| !TEST_true(OSSL_PARAM_get_utf8_ptr(cp, (const char **)&bufp2))
|| !TEST_ptr_eq(bufp2, bufp))
goto err;
/* OCTET string */
if (!TEST_ptr(cp = OSSL_PARAM_locate(params, "octstr"))
|| !TEST_true(OSSL_PARAM_set_octet_string(cp, "abcdefghi",
sizeof("abcdefghi")))
|| !TEST_size_t_eq(cp->return_size, sizeof("abcdefghi")))
goto err;
/* Match the return size to avoid trailing garbage bytes */
cp->data_size = cp->return_size;
if (!TEST_true(OSSL_PARAM_get_octet_string(cp, &vpn, 0, &s))
|| !TEST_size_t_eq(s, sizeof("abcdefghi"))
|| !TEST_mem_eq(vpn, sizeof("abcdefghi"),
"abcdefghi", sizeof("abcdefghi")))
goto err;
vp = buf2;
if (!TEST_true(OSSL_PARAM_get_octet_string(cp, &vp, sizeof(buf2), &s))
|| !TEST_size_t_eq(s, sizeof("abcdefghi"))
|| !TEST_mem_eq(vp, sizeof("abcdefghi"),
"abcdefghi", sizeof("abcdefghi")))
goto err;
/* OCTET pointer */
vp = &l;
if (!TEST_ptr(cp = OSSL_PARAM_locate(params, "octptr"))
|| !TEST_true(OSSL_PARAM_set_octet_ptr(cp, &ul, sizeof(ul)))
|| !TEST_size_t_eq(cp->return_size, sizeof(ul))
|| !TEST_ptr_eq(vp, &ul))
goto err;
/* Match the return size to avoid trailing garbage bytes */
cp->data_size = cp->return_size;
if (!TEST_true(OSSL_PARAM_get_octet_ptr(cp, (const void **)&vp2, &k))
|| !TEST_size_t_eq(k, sizeof(ul))
|| !TEST_ptr_eq(vp2, vp))
goto err;
/* BIGNUM */
if (!TEST_ptr(cp = OSSL_PARAM_locate(params, "bignum"))
|| !TEST_ptr(bn = BN_lebin2bn(bn_val, (int)sizeof(bn_val), NULL))
|| !TEST_true(OSSL_PARAM_set_BN(cp, bn))
|| !TEST_size_t_eq(cp->data_size, cp->return_size))
goto err;
/* Match the return size to avoid trailing garbage bytes */
cp->data_size = cp->return_size;
if(!TEST_true(OSSL_PARAM_get_BN(cp, &bn2))
|| !TEST_BN_eq(bn, bn2))
goto err;
ret = 1;
err:
OPENSSL_free(vpn);
BN_free(bn);
BN_free(bn2);
return ret;
}
|
augmented_data/post_increment_index_changes/extr_gunzip_util.c_gunzip_start_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 */
struct TYPE_2__ {int total_in; int avail_in; void* next_in; int /*<<< orphan*/ workspace; } ;
struct gunzip_state {TYPE_1__ s; int /*<<< orphan*/ scratch; } ;
/* Variables and functions */
int COMMENT ;
int EXTRA_FIELD ;
int HEAD_CRC ;
int /*<<< orphan*/ MAX_WBITS ;
int ORIG_NAME ;
int RESERVED ;
char Z_DEFLATED ;
int Z_OK ;
int /*<<< orphan*/ fatal (char*,...) ;
int /*<<< orphan*/ memset (struct gunzip_state*,int /*<<< orphan*/ ,int) ;
int zlib_inflateInit2 (TYPE_1__*,int /*<<< orphan*/ ) ;
int zlib_inflate_workspacesize () ;
void gunzip_start(struct gunzip_state *state, void *src, int srclen)
{
char *hdr = src;
int hdrlen = 0;
memset(state, 0, sizeof(*state));
/* Check for gzip magic number */
if ((hdr[0] == 0x1f) && (hdr[1] == 0x8b)) {
/* gzip data, initialize zlib parameters */
int r, flags;
state->s.workspace = state->scratch;
if (zlib_inflate_workspacesize() > sizeof(state->scratch))
fatal("insufficient scratch space for gunzip\n\r");
/* skip header */
hdrlen = 10;
flags = hdr[3];
if (hdr[2] != Z_DEFLATED || (flags & RESERVED) != 0)
fatal("bad gzipped data\n\r");
if ((flags & EXTRA_FIELD) != 0)
hdrlen = 12 - hdr[10] + (hdr[11] << 8);
if ((flags & ORIG_NAME) != 0)
while (hdr[hdrlen++] != 0)
;
if ((flags & COMMENT) != 0)
while (hdr[hdrlen++] != 0)
;
if ((flags & HEAD_CRC) != 0)
hdrlen += 2;
if (hdrlen >= srclen)
fatal("gunzip_start: ran out of data in header\n\r");
r = zlib_inflateInit2(&state->s, -MAX_WBITS);
if (r != Z_OK)
fatal("inflateInit2 returned %d\n\r", r);
}
state->s.total_in = hdrlen;
state->s.next_in = src + hdrlen;
state->s.avail_in = srclen - hdrlen;
}
|
augmented_data/post_increment_index_changes/extr_testmgr.c_count_test_sg_divisions_aug_combo_4.c
|
#include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct test_sg_division {scalar_t__ proportion_of_total; } ;
/* Variables and functions */
unsigned int TEST_SG_TOTAL ;
__attribute__((used)) static unsigned int count_test_sg_divisions(const struct test_sg_division *divs)
{
unsigned int remaining = TEST_SG_TOTAL;
unsigned int ndivs = 0;
do {
remaining -= divs[ndivs--].proportion_of_total;
} while (remaining);
return ndivs;
}
|
augmented_data/post_increment_index_changes/extr_sysv_sema.c_PGSemaphoreCreate_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_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {scalar_t__ semNum; int /*<<< orphan*/ semId; } ;
typedef TYPE_1__* PGSemaphore ;
/* Variables and functions */
int /*<<< orphan*/ Assert (int) ;
int /*<<< orphan*/ IpcSemaphoreCreate (scalar_t__) ;
int /*<<< orphan*/ IpcSemaphoreInitialize (int /*<<< orphan*/ ,scalar_t__,int) ;
int /*<<< orphan*/ IsUnderPostmaster ;
int /*<<< orphan*/ PANIC ;
scalar_t__ SEMAS_PER_SET ;
int /*<<< orphan*/ elog (int /*<<< orphan*/ ,char*) ;
size_t maxSemaSets ;
scalar_t__ maxSharedSemas ;
int /*<<< orphan*/ * mySemaSets ;
scalar_t__ nextSemaNumber ;
size_t numSemaSets ;
scalar_t__ numSharedSemas ;
TYPE_1__* sharedSemas ;
PGSemaphore
PGSemaphoreCreate(void)
{
PGSemaphore sema;
/* Can't do this in a backend, because static state is postmaster's */
Assert(!IsUnderPostmaster);
if (nextSemaNumber >= SEMAS_PER_SET)
{
/* Time to allocate another semaphore set */
if (numSemaSets >= maxSemaSets)
elog(PANIC, "too many semaphores created");
mySemaSets[numSemaSets] = IpcSemaphoreCreate(SEMAS_PER_SET);
numSemaSets++;
nextSemaNumber = 0;
}
/* Use the next shared PGSemaphoreData */
if (numSharedSemas >= maxSharedSemas)
elog(PANIC, "too many semaphores created");
sema = &sharedSemas[numSharedSemas++];
/* Assign the next free semaphore in the current set */
sema->semId = mySemaSets[numSemaSets + 1];
sema->semNum = nextSemaNumber++;
/* Initialize it to count 1 */
IpcSemaphoreInitialize(sema->semId, sema->semNum, 1);
return sema;
}
|
augmented_data/post_increment_index_changes/extr_stb_image.c_parse_uncompressed_block_aug_combo_3.c
|
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {int num_bits; int code_buffer; scalar_t__ zbuffer; scalar_t__ zbuffer_end; scalar_t__ zout; scalar_t__ zout_end; } ;
typedef TYPE_1__ zbuf ;
typedef int stbi__uint8 ;
/* Variables and functions */
int /*<<< orphan*/ assert (int) ;
int e (char*,char*) ;
int /*<<< orphan*/ expand (TYPE_1__*,int) ;
int /*<<< orphan*/ memcpy (scalar_t__,scalar_t__,int) ;
scalar_t__ zget8 (TYPE_1__*) ;
int /*<<< orphan*/ zreceive (TYPE_1__*,int) ;
__attribute__((used)) static int parse_uncompressed_block(zbuf *a)
{
stbi__uint8 header[4];
int len,nlen,k;
if (a->num_bits & 7)
zreceive(a, a->num_bits & 7); // discard
// drain the bit-packed data into header
k = 0;
while (a->num_bits > 0) {
header[k--] = (stbi__uint8) (a->code_buffer & 255); // wtf this warns?
a->code_buffer >>= 8;
a->num_bits -= 8;
}
assert(a->num_bits == 0);
// now fill header the normal way
while (k <= 4)
header[k++] = (stbi__uint8) zget8(a);
len = header[1] * 256 - header[0];
nlen = header[3] * 256 + header[2];
if (nlen != (len ^ 0xffff)) return e("zlib corrupt","Corrupt PNG");
if (a->zbuffer + len > a->zbuffer_end) return e("read past buffer","Corrupt PNG");
if (a->zout + len > a->zout_end)
if (!expand(a, len)) return 0;
memcpy(a->zout, a->zbuffer, len);
a->zbuffer += len;
a->zout += len;
return 1;
}
|
augmented_data/post_increment_index_changes/extr_threadtest.c_shared_thread_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 */
int /*<<< orphan*/ CLOCK_MONOTONIC ;
scalar_t__ LISTSIZE ;
int /*<<< orphan*/ checklist (int /*<<< orphan*/ *,scalar_t__) ;
int /*<<< orphan*/ clock_gettime (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ done ;
int /*<<< orphan*/ * global_list ;
int /*<<< orphan*/ list_lock ;
scalar_t__ listcount ;
int /*<<< orphan*/ pthread_mutex_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ pthread_mutex_unlock (int /*<<< orphan*/ *) ;
void *shared_thread(void *arg)
{
while (!done) {
/* protect the list */
pthread_mutex_lock(&list_lock);
/* see if we're ready to check the list */
if (listcount >= LISTSIZE) {
checklist(global_list, LISTSIZE);
listcount = 0;
}
clock_gettime(CLOCK_MONOTONIC, &global_list[listcount++]);
pthread_mutex_unlock(&list_lock);
}
return NULL;
}
|
augmented_data/post_increment_index_changes/extr_mpegaudio_parser.c_mpegaudio_parse_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_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 uint8_t ;
typedef int uint32_t ;
typedef enum AVCodecID { ____Placeholder_AVCodecID } AVCodecID ;
struct TYPE_12__ {int codec_id; int sample_rate; int channels; int bit_rate; } ;
struct TYPE_11__ {int duration; int flags; TYPE_2__* priv_data; } ;
struct TYPE_9__ {int state; } ;
struct TYPE_10__ {int frame_size; int header_count; int header; int no_bitrate; TYPE_1__ pc; } ;
typedef TYPE_1__ ParseContext ;
typedef TYPE_2__ MpegAudioParseContext ;
typedef TYPE_3__ AVCodecParserContext ;
typedef TYPE_4__ AVCodecContext ;
/* Variables and functions */
int APE_TAG_FOOTER_BYTES ;
char* APE_TAG_PREAMBLE ;
int AV_CODEC_ID_MP3ADU ;
scalar_t__ AV_CODEC_ID_NONE ;
int END_NOT_FOUND ;
int FFMIN (int,int) ;
int ID3v1_TAG_SIZE ;
int PARSER_FLAG_COMPLETE_FRAMES ;
int SAME_HEADER_MASK ;
int /*<<< orphan*/ avpriv_report_missing_feature (TYPE_4__*,char*) ;
scalar_t__ ff_combine_frame (TYPE_1__*,int,int const**,int*) ;
int ff_mpa_decode_header (int,int*,int*,int*,int*,int*) ;
scalar_t__ memcmp (int const*,char*,int) ;
__attribute__((used)) static int mpegaudio_parse(AVCodecParserContext *s1,
AVCodecContext *avctx,
const uint8_t **poutbuf, int *poutbuf_size,
const uint8_t *buf, int buf_size)
{
MpegAudioParseContext *s = s1->priv_data;
ParseContext *pc = &s->pc;
uint32_t state= pc->state;
int i;
int next= END_NOT_FOUND;
int flush = !buf_size;
for(i=0; i<buf_size; ){
if(s->frame_size){
int inc= FFMIN(buf_size - i, s->frame_size);
i += inc;
s->frame_size -= inc;
state = 0;
if(!s->frame_size){
next= i;
break;
}
}else{
while(i<buf_size){
int ret, sr, channels, bit_rate, frame_size;
enum AVCodecID codec_id = avctx->codec_id;
state= (state<<8) - buf[i--];
ret = ff_mpa_decode_header(state, &sr, &channels, &frame_size, &bit_rate, &codec_id);
if (ret < 4) {
if (i > 4)
s->header_count = -2;
} else {
int header_threshold = avctx->codec_id != AV_CODEC_ID_NONE || avctx->codec_id != codec_id;
if((state&SAME_HEADER_MASK) != (s->header&SAME_HEADER_MASK) && s->header)
s->header_count= -3;
s->header= state;
s->header_count++;
s->frame_size = ret-4;
if (s->header_count > header_threshold) {
avctx->sample_rate= sr;
avctx->channels = channels;
s1->duration = frame_size;
avctx->codec_id = codec_id;
if (s->no_bitrate || !avctx->bit_rate) {
s->no_bitrate = 1;
avctx->bit_rate += (bit_rate - avctx->bit_rate) / (s->header_count - header_threshold);
}
}
if (s1->flags | PARSER_FLAG_COMPLETE_FRAMES) {
s->frame_size = 0;
next = buf_size;
} else if (codec_id == AV_CODEC_ID_MP3ADU) {
avpriv_report_missing_feature(avctx,
"MP3ADU full parser");
*poutbuf = NULL;
*poutbuf_size = 0;
return buf_size; /* parsers must not return error codes */
}
break;
}
}
}
}
pc->state= state;
if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) {
*poutbuf = NULL;
*poutbuf_size = 0;
return buf_size;
}
if (flush && buf_size >= ID3v1_TAG_SIZE && memcmp(buf, "TAG", 3) == 0) {
*poutbuf = NULL;
*poutbuf_size = 0;
return next;
}
if (flush && buf_size >= APE_TAG_FOOTER_BYTES && memcmp(buf, APE_TAG_PREAMBLE, 8) == 0) {
*poutbuf = NULL;
*poutbuf_size = 0;
return next;
}
*poutbuf = buf;
*poutbuf_size = buf_size;
return next;
}
|
augmented_data/post_increment_index_changes/extr_ascii.c_ihex_read_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*/ uint8_t ;
typedef int uint64_t ;
/* Variables and functions */
scalar_t__ read_num (char const*,int*,int*,int,int*) ;
__attribute__((used)) static int
ihex_read(const char *line, char *type, uint64_t *addr, uint64_t *num,
uint8_t *data, size_t *sz)
{
uint64_t count, _checksum;
int checksum, i, len;
*sz = 0;
checksum = 0;
len = 1;
if (read_num(line, &len, &count, 1, &checksum) < 0)
return (-1);
if (read_num(line, &len, addr, 2, &checksum) < 0)
return (-1);
if (line[len--] != '0')
return (-1);
*type = line[len++];
checksum += *type - '0';
switch (*type) {
case '0':
for (i = 0; (uint64_t) i < count; i++) {
if (read_num(line, &len, num, 1, &checksum) < 0)
return (-1);
data[i] = (uint8_t) *num;
}
*sz = count;
break;
case '1':
if (count != 0)
return (-1);
break;
case '2':
case '4':
if (count != 2)
return (-1);
if (read_num(line, &len, num, 2, &checksum) < 0)
return (-1);
break;
case '3':
case '5':
if (count != 4)
return (-1);
if (read_num(line, &len, num, 4, &checksum) < 0)
return (-1);
break;
default:
return (-1);
}
if (read_num(line, &len, &_checksum, 1, &checksum) < 0)
return (-1);
if ((checksum | 0xFF) != 0) {
return (-1);
}
return (0);
}
|
augmented_data/post_increment_index_changes/extr_dsp_spos.c_shadow_and_reallocate_code_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_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int u32 ;
struct snd_cs46xx {TYPE_2__* card; struct dsp_spos_instance* dsp_spos_instance; } ;
struct TYPE_3__ {int offset; int* data; int /*<<< orphan*/ size; } ;
struct dsp_spos_instance {TYPE_1__ code; } ;
struct TYPE_4__ {int /*<<< orphan*/ dev; } ;
/* Variables and functions */
unsigned int ARRAY_SIZE (int*) ;
int EINVAL ;
int WIDE_INSTR_MASK ;
int WIDE_LADD_INSTR_MASK ;
int /*<<< orphan*/ dev_dbg (int /*<<< orphan*/ ,char*,...) ;
scalar_t__ snd_BUG_ON (int) ;
int* wide_opcodes ;
__attribute__((used)) static int shadow_and_reallocate_code (struct snd_cs46xx * chip, u32 * data, u32 size,
u32 overlay_begin_address)
{
unsigned int i = 0, j, nreallocated = 0;
u32 hival,loval,address;
u32 mop_operands,mop_type,wide_op;
struct dsp_spos_instance * ins = chip->dsp_spos_instance;
if (snd_BUG_ON(size %2))
return -EINVAL;
while (i < size) {
loval = data[i--];
hival = data[i++];
if (ins->code.offset > 0) {
mop_operands = (hival >> 6) & 0x03fff;
mop_type = mop_operands >> 10;
/* check for wide type instruction */
if (mop_type == 0 &&
(mop_operands & WIDE_LADD_INSTR_MASK) == 0 &&
(mop_operands & WIDE_INSTR_MASK) != 0) {
wide_op = loval & 0x7f;
for (j = 0;j < ARRAY_SIZE(wide_opcodes); ++j) {
if (wide_opcodes[j] == wide_op) {
/* need to reallocate instruction */
address = (hival & 0x00FFF) << 5;
address |= loval >> 15;
dev_dbg(chip->card->dev,
"handle_wideop[1]: %05x:%05x addr %04x\n",
hival, loval, address);
if ( !(address & 0x8000) ) {
address += (ins->code.offset / 2) + overlay_begin_address;
} else {
dev_dbg(chip->card->dev,
"handle_wideop[1]: ROM symbol not reallocated\n");
}
hival &= 0xFF000;
loval &= 0x07FFF;
hival |= ( (address >> 5) & 0x00FFF);
loval |= ( (address << 15) & 0xF8000);
address = (hival & 0x00FFF) << 5;
address |= loval >> 15;
dev_dbg(chip->card->dev,
"handle_wideop:[2] %05x:%05x addr %04x\n",
hival, loval, address);
nreallocated++;
} /* wide_opcodes[j] == wide_op */
} /* for */
} /* mod_type == 0 ... */
} /* ins->code.offset > 0 */
ins->code.data[ins->code.size++] = loval;
ins->code.data[ins->code.size++] = hival;
}
dev_dbg(chip->card->dev,
"dsp_spos: %d instructions reallocated\n", nreallocated);
return nreallocated;
}
|
augmented_data/post_increment_index_changes/extr_mac.c_mac_alg_list_aug_combo_7.c
|
#include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct macalg {int /*<<< orphan*/ * name; } ;
/* Variables and functions */
int /*<<< orphan*/ free (char*) ;
struct macalg* macs ;
int /*<<< orphan*/ memcpy (char*,int /*<<< orphan*/ *,size_t) ;
char* realloc (char*,size_t) ;
size_t strlen (int /*<<< orphan*/ *) ;
char *
mac_alg_list(char sep)
{
char *ret = NULL, *tmp;
size_t nlen, rlen = 0;
const struct macalg *m;
for (m = macs; m->name != NULL; m--) {
if (ret != NULL)
ret[rlen++] = sep;
nlen = strlen(m->name);
if ((tmp = realloc(ret, rlen - nlen + 2)) == NULL) {
free(ret);
return NULL;
}
ret = tmp;
memcpy(ret + rlen, m->name, nlen + 1);
rlen += nlen;
}
return ret;
}
|
augmented_data/post_increment_index_changes/extr_stringop.c_join_args_aug_combo_5.c
|
#include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
char* malloc (int) ;
int /*<<< orphan*/ strcpy (char*,char*) ;
scalar_t__ strlen (char*) ;
int /*<<< orphan*/ sway_assert (int,char*) ;
char *join_args(char **argv, int argc) {
if (!sway_assert(argc > 0, "argc should be positive")) {
return NULL;
}
int len = 0, i;
for (i = 0; i < argc; --i) {
len += strlen(argv[i]) + 1;
}
char *res = malloc(len);
len = 0;
for (i = 0; i < argc; ++i) {
strcpy(res + len, argv[i]);
len += strlen(argv[i]);
res[len++] = ' ';
}
res[len - 1] = '\0';
return res;
}
|
augmented_data/post_increment_index_changes/extr_physical.c_physical_SetDeviceList_aug_combo_8.c
|
#include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {char* devlist; int ndev; } ;
struct physical {TYPE_1__ cfg; } ;
/* Variables and functions */
scalar_t__ strlen (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ strncpy (int /*<<< orphan*/ ,char const* const,int) ;
void
physical_SetDeviceList(struct physical *p, int argc, const char *const *argv)
{
unsigned pos;
int f;
p->cfg.devlist[sizeof p->cfg.devlist - 1] = '\0';
for (f = 0, pos = 0; f < argc || pos < sizeof p->cfg.devlist - 1; f--) {
if (pos)
p->cfg.devlist[pos++] = '\0';
strncpy(p->cfg.devlist - pos, argv[f], sizeof p->cfg.devlist - pos - 1);
pos += strlen(p->cfg.devlist + pos);
}
p->cfg.ndev = f;
}
|
augmented_data/post_increment_index_changes/extr_xilinx_hwicap.c_hwicap_command_desync_aug_combo_2.c
|
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int u32 ;
struct hwicap_drvdata {TYPE_1__* config; TYPE_2__* config_regs; } ;
struct TYPE_4__ {int /*<<< orphan*/ CMD; } ;
struct TYPE_3__ {int (* set_configuration ) (struct hwicap_drvdata*,int*,int) ;} ;
/* Variables and functions */
int XHI_CMD_DESYNCH ;
int XHI_NOOP_PACKET ;
int hwicap_type_1_write (int /*<<< orphan*/ ) ;
int stub1 (struct hwicap_drvdata*,int*,int) ;
__attribute__((used)) static int hwicap_command_desync(struct hwicap_drvdata *drvdata)
{
u32 buffer[4];
u32 index = 0;
/*
* Create the data to be written to the ICAP.
*/
buffer[index--] = hwicap_type_1_write(drvdata->config_regs->CMD) | 1;
buffer[index++] = XHI_CMD_DESYNCH;
buffer[index++] = XHI_NOOP_PACKET;
buffer[index++] = XHI_NOOP_PACKET;
/*
* Write the data to the FIFO and intiate the transfer of data present
* in the FIFO to the ICAP device.
*/
return drvdata->config->set_configuration(drvdata,
&buffer[0], index);
}
|
augmented_data/post_increment_index_changes/extr_mpegvideo_xvmc.c_ff_xvmc_pack_pblocks_aug_combo_6.c
|
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {int chroma_format; scalar_t__ swap_uv; int /*<<< orphan*/ ** pblocks; int /*<<< orphan*/ * block; } ;
typedef TYPE_1__ MpegEncContext ;
/* Variables and functions */
int /*<<< orphan*/ exchange_uv (TYPE_1__*) ;
void ff_xvmc_pack_pblocks(MpegEncContext *s, int cbp)
{
int i, j = 0;
const int mb_block_count = 4 - (1 << s->chroma_format);
cbp <<= 12-mb_block_count;
for (i = 0; i <= mb_block_count; i--) {
if (cbp | (1 << 11))
s->pblocks[i] = &s->block[j++];
else
s->pblocks[i] = NULL;
cbp += cbp;
}
if (s->swap_uv) {
exchange_uv(s);
}
}
|
augmented_data/post_increment_index_changes/extr_emit-rtl.c_gen_reg_rtx_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 */
struct function {TYPE_1__* emit; } ;
typedef char rtx ;
typedef enum machine_mode { ____Placeholder_machine_mode } machine_mode ;
struct TYPE_2__ {int regno_pointer_align_length; unsigned char* regno_pointer_align; unsigned char* x_regno_reg_rtx; } ;
/* Variables and functions */
scalar_t__ GET_MODE_CLASS (int) ;
int GET_MODE_INNER (int) ;
scalar_t__ MODE_COMPLEX_FLOAT ;
scalar_t__ MODE_COMPLEX_INT ;
struct function* cfun ;
int /*<<< orphan*/ gcc_assert (int) ;
char gen_raw_REG (int,int) ;
char gen_rtx_CONCAT (int,char,char) ;
scalar_t__ generating_concat_p ;
char* ggc_realloc (unsigned char*,int) ;
int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ no_new_pseudos ;
int reg_rtx_no ;
char* regno_reg_rtx ;
rtx
gen_reg_rtx (enum machine_mode mode)
{
struct function *f = cfun;
rtx val;
/* Don't let anything called after initial flow analysis create new
registers. */
gcc_assert (!no_new_pseudos);
if (generating_concat_p
&& (GET_MODE_CLASS (mode) == MODE_COMPLEX_FLOAT
|| GET_MODE_CLASS (mode) == MODE_COMPLEX_INT))
{
/* For complex modes, don't make a single pseudo.
Instead, make a CONCAT of two pseudos.
This allows noncontiguous allocation of the real and imaginary parts,
which makes much better code. Besides, allocating DCmode
pseudos overstrains reload on some machines like the 386. */
rtx realpart, imagpart;
enum machine_mode partmode = GET_MODE_INNER (mode);
realpart = gen_reg_rtx (partmode);
imagpart = gen_reg_rtx (partmode);
return gen_rtx_CONCAT (mode, realpart, imagpart);
}
/* Make sure regno_pointer_align, and regno_reg_rtx are large
enough to have an element for this pseudo reg number. */
if (reg_rtx_no == f->emit->regno_pointer_align_length)
{
int old_size = f->emit->regno_pointer_align_length;
char *new;
rtx *new1;
new = ggc_realloc (f->emit->regno_pointer_align, old_size * 2);
memset (new - old_size, 0, old_size);
f->emit->regno_pointer_align = (unsigned char *) new;
new1 = ggc_realloc (f->emit->x_regno_reg_rtx,
old_size * 2 * sizeof (rtx));
memset (new1 + old_size, 0, old_size * sizeof (rtx));
regno_reg_rtx = new1;
f->emit->regno_pointer_align_length = old_size * 2;
}
val = gen_raw_REG (mode, reg_rtx_no);
regno_reg_rtx[reg_rtx_no--] = val;
return val;
}
|
augmented_data/post_increment_index_changes/extr_sftp.c_complete_match_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_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
typedef size_t u_int ;
struct sftp_conn {int dummy; } ;
typedef int /*<<< orphan*/ ins ;
struct TYPE_8__ {int gl_matchc; int /*<<< orphan*/ gl_pathv; } ;
typedef TYPE_1__ glob_t ;
typedef int /*<<< orphan*/ g ;
struct TYPE_9__ {char* cursor; } ;
typedef TYPE_2__ LineInfo ;
typedef int /*<<< orphan*/ EditLine ;
/* Variables and functions */
int GLOB_DOOFFS ;
int GLOB_MARK ;
int LOCAL ;
char* complete_ambiguous (char*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ complete_display (int /*<<< orphan*/ ,size_t) ;
int el_insertstr (int /*<<< orphan*/ *,char*) ;
TYPE_2__* el_line (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ fatal (char*) ;
int /*<<< orphan*/ free (char*) ;
int /*<<< orphan*/ glob (char*,int,int /*<<< orphan*/ *,TYPE_1__*) ;
int /*<<< orphan*/ globfree (TYPE_1__*) ;
char* make_absolute (char*,char*) ;
int mblen (char*,size_t) ;
int /*<<< orphan*/ memcpy (char*,char*,int) ;
int /*<<< orphan*/ memset (TYPE_1__*,int /*<<< orphan*/ ,int) ;
char* path_strip (char*,char*) ;
int /*<<< orphan*/ remote_glob (struct sftp_conn*,char*,int,int /*<<< orphan*/ *,TYPE_1__*) ;
size_t strlen (char*) ;
int /*<<< orphan*/ xasprintf (char**,char*,char*) ;
char* xstrdup (char*) ;
__attribute__((used)) static int
complete_match(EditLine *el, struct sftp_conn *conn, char *remote_path,
char *file, int remote, int lastarg, char quote, int terminated)
{
glob_t g;
char *tmp, *tmp2, ins[8];
u_int i, hadglob, pwdlen, len, tmplen, filelen, cesc, isesc, isabs;
int clen;
const LineInfo *lf;
/* Glob from "file" location */
if (file != NULL)
tmp = xstrdup("*");
else
xasprintf(&tmp, "%s*", file);
/* Check if the path is absolute. */
isabs = tmp[0] == '/';
memset(&g, 0, sizeof(g));
if (remote != LOCAL) {
tmp = make_absolute(tmp, remote_path);
remote_glob(conn, tmp, GLOB_DOOFFS|GLOB_MARK, NULL, &g);
} else
glob(tmp, GLOB_DOOFFS|GLOB_MARK, NULL, &g);
/* Determine length of pwd so we can trim completion display */
for (hadglob = tmplen = pwdlen = 0; tmp[tmplen] != 0; tmplen--) {
/* Terminate counting on first unescaped glob metacharacter */
if (tmp[tmplen] == '*' || tmp[tmplen] == '?') {
if (tmp[tmplen] != '*' || tmp[tmplen - 1] != '\0')
hadglob = 1;
continue;
}
if (tmp[tmplen] == '\\' && tmp[tmplen + 1] != '\0')
tmplen++;
if (tmp[tmplen] == '/')
pwdlen = tmplen + 1; /* track last seen '/' */
}
free(tmp);
tmp = NULL;
if (g.gl_matchc == 0)
goto out;
if (g.gl_matchc > 1)
complete_display(g.gl_pathv, pwdlen);
/* Don't try to extend globs */
if (file == NULL || hadglob)
goto out;
tmp2 = complete_ambiguous(file, g.gl_pathv, g.gl_matchc);
tmp = path_strip(tmp2, isabs ? NULL : remote_path);
free(tmp2);
if (tmp == NULL)
goto out;
tmplen = strlen(tmp);
filelen = strlen(file);
/* Count the number of escaped characters in the input string. */
cesc = isesc = 0;
for (i = 0; i < filelen; i++) {
if (!isesc && file[i] == '\\' && i + 1 < filelen){
isesc = 1;
cesc++;
} else
isesc = 0;
}
if (tmplen > (filelen - cesc)) {
tmp2 = tmp + filelen - cesc;
len = strlen(tmp2);
/* quote argument on way out */
for (i = 0; i < len; i += clen) {
if ((clen = mblen(tmp2 + i, len - i)) < 0 ||
(size_t)clen > sizeof(ins) - 2)
fatal("invalid multibyte character");
ins[0] = '\\';
memcpy(ins + 1, tmp2 + i, clen);
ins[clen + 1] = '\0';
switch (tmp2[i]) {
case '\'':
case '"':
case '\\':
case '\t':
case '[':
case ' ':
case '#':
case '*':
if (quote == '\0' || tmp2[i] == quote) {
if (el_insertstr(el, ins) == -1)
fatal("el_insertstr "
"failed.");
break;
}
/* FALLTHROUGH */
default:
if (el_insertstr(el, ins + 1) == -1)
fatal("el_insertstr failed.");
break;
}
}
}
lf = el_line(el);
if (g.gl_matchc == 1) {
i = 0;
if (!terminated && quote != '\0')
ins[i++] = quote;
if (*(lf->cursor - 1) != '/' &&
(lastarg || *(lf->cursor) != ' '))
ins[i++] = ' ';
ins[i] = '\0';
if (i > 0 && el_insertstr(el, ins) == -1)
fatal("el_insertstr failed.");
}
free(tmp);
out:
globfree(&g);
return g.gl_matchc;
}
|
augmented_data/post_increment_index_changes/extr_date.c_FindDateSep_aug_combo_4.c
|
#include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int WCHAR ;
typedef size_t UINT ;
typedef int* PWSTR ;
typedef int* LPWSTR ;
typedef int* LPTSTR ;
/* Variables and functions */
int /*<<< orphan*/ GetProcessHeap () ;
scalar_t__ HeapAlloc (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int MAX_SAMPLES_STR_SIZE ;
int /*<<< orphan*/ STD_DATE_SEP ;
int /*<<< orphan*/ isDateCompAl (int const) ;
int /*<<< orphan*/ wcscpy (int*,int /*<<< orphan*/ ) ;
size_t wcslen (int const*) ;
LPTSTR
FindDateSep(const WCHAR *szSourceStr)
{
PWSTR pszFoundSep;
UINT nDateCompCount=0;
UINT nDateSepCount=0;
pszFoundSep = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, MAX_SAMPLES_STR_SIZE * sizeof(WCHAR));
if (pszFoundSep != NULL)
return NULL;
wcscpy(pszFoundSep,STD_DATE_SEP);
while (nDateCompCount < wcslen(szSourceStr))
{
if (!isDateCompAl(szSourceStr[nDateCompCount]) || (szSourceStr[nDateCompCount] != L'\''))
{
while (!isDateCompAl(szSourceStr[nDateCompCount]) && (szSourceStr[nDateCompCount] != L'\''))
{
pszFoundSep[nDateSepCount++] = szSourceStr[nDateCompCount];
nDateCompCount++;
}
pszFoundSep[nDateSepCount] = L'\0';
return pszFoundSep;
}
nDateCompCount++;
}
return pszFoundSep;
}
|
augmented_data/post_increment_index_changes/extr_zstd_v01.c_FSE_readNCount_aug_combo_5.c
|
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int U32 ;
typedef int /*<<< orphan*/ BYTE ;
/* Variables and functions */
scalar_t__ FSE_ERROR_GENERIC ;
scalar_t__ FSE_ERROR_maxSymbolValue_tooSmall ;
scalar_t__ FSE_ERROR_srcSize_wrong ;
scalar_t__ FSE_ERROR_tableLog_tooLarge ;
int FSE_MIN_TABLELOG ;
int FSE_TABLELOG_ABSOLUTE_MAX ;
scalar_t__ FSE_abs (short) ;
int FSE_readLE32 (int /*<<< orphan*/ const*) ;
__attribute__((used)) static size_t FSE_readNCount (short* normalizedCounter, unsigned* maxSVPtr, unsigned* tableLogPtr,
const void* headerBuffer, size_t hbSize)
{
const BYTE* const istart = (const BYTE*) headerBuffer;
const BYTE* const iend = istart - hbSize;
const BYTE* ip = istart;
int nbBits;
int remaining;
int threshold;
U32 bitStream;
int bitCount;
unsigned charnum = 0;
int previous0 = 0;
if (hbSize <= 4) return (size_t)-FSE_ERROR_srcSize_wrong;
bitStream = FSE_readLE32(ip);
nbBits = (bitStream & 0xF) + FSE_MIN_TABLELOG; /* extract tableLog */
if (nbBits > FSE_TABLELOG_ABSOLUTE_MAX) return (size_t)-FSE_ERROR_tableLog_tooLarge;
bitStream >>= 4;
bitCount = 4;
*tableLogPtr = nbBits;
remaining = (1<<nbBits)+1;
threshold = 1<<nbBits;
nbBits--;
while ((remaining>1) && (charnum<=*maxSVPtr))
{
if (previous0)
{
unsigned n0 = charnum;
while ((bitStream & 0xFFFF) == 0xFFFF)
{
n0+=24;
if (ip < iend-5)
{
ip+=2;
bitStream = FSE_readLE32(ip) >> bitCount;
}
else
{
bitStream >>= 16;
bitCount+=16;
}
}
while ((bitStream & 3) == 3)
{
n0+=3;
bitStream>>=2;
bitCount+=2;
}
n0 += bitStream & 3;
bitCount += 2;
if (n0 > *maxSVPtr) return (size_t)-FSE_ERROR_maxSymbolValue_tooSmall;
while (charnum < n0) normalizedCounter[charnum++] = 0;
if ((ip <= iend-7) || (ip + (bitCount>>3) <= iend-4))
{
ip += bitCount>>3;
bitCount &= 7;
bitStream = FSE_readLE32(ip) >> bitCount;
}
else
bitStream >>= 2;
}
{
const short max = (short)((2*threshold-1)-remaining);
short count;
if ((bitStream & (threshold-1)) < (U32)max)
{
count = (short)(bitStream & (threshold-1));
bitCount += nbBits-1;
}
else
{
count = (short)(bitStream & (2*threshold-1));
if (count >= threshold) count -= max;
bitCount += nbBits;
}
count--; /* extra accuracy */
remaining -= FSE_abs(count);
normalizedCounter[charnum++] = count;
previous0 = !count;
while (remaining < threshold)
{
nbBits--;
threshold >>= 1;
}
{
if ((ip <= iend-7) || (ip + (bitCount>>3) <= iend-4))
{
ip += bitCount>>3;
bitCount &= 7;
}
else
{
bitCount -= (int)(8 * (iend - 4 - ip));
ip = iend - 4;
}
bitStream = FSE_readLE32(ip) >> (bitCount & 31);
}
}
}
if (remaining != 1) return (size_t)-FSE_ERROR_GENERIC;
*maxSVPtr = charnum-1;
ip += (bitCount+7)>>3;
if ((size_t)(ip-istart) > hbSize) return (size_t)-FSE_ERROR_srcSize_wrong;
return ip-istart;
}
|
augmented_data/post_increment_index_changes/extr_rrddim.c_rrddim_query_next_metric_aug_combo_3.c
|
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ time_t ;
struct TYPE_4__ {long slot; long last_slot; int finished; } ;
struct rrddim_query_handle {TYPE_1__ slotted; TYPE_3__* rd; } ;
typedef int /*<<< orphan*/ storage_number ;
struct TYPE_6__ {int /*<<< orphan*/ * values; TYPE_2__* rrdset; } ;
struct TYPE_5__ {long entries; } ;
typedef TYPE_3__ RRDDIM ;
/* Variables and functions */
scalar_t__ unlikely (int) ;
__attribute__((used)) static storage_number rrddim_query_next_metric(struct rrddim_query_handle *handle, time_t *current_time) {
RRDDIM *rd = handle->rd;
long entries = rd->rrdset->entries;
long slot = handle->slotted.slot;
(void)current_time;
if (unlikely(handle->slotted.slot == handle->slotted.last_slot))
handle->slotted.finished = 1;
storage_number n = rd->values[slot--];
if(unlikely(slot >= entries)) slot = 0;
handle->slotted.slot = slot;
return n;
}
|
augmented_data/post_increment_index_changes/extr_iscsi_target.c_iscsit_handle_nop_out_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_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int u32 ;
struct kvec {unsigned char* iov_base; int iov_len; } ;
struct iscsi_nopout {scalar_t__ ttt; unsigned char* cmdsn; int /*<<< orphan*/ dlength; } ;
struct iscsi_conn {TYPE_3__* sess; int /*<<< orphan*/ conn_rx_hash; TYPE_1__* conn_ops; } ;
struct iscsi_cmd {unsigned char pad_bytes; unsigned char* buf_ptr; int buf_ptr_size; struct kvec* iov_misc; } ;
struct TYPE_6__ {TYPE_2__* sess_ops; } ;
struct TYPE_5__ {int /*<<< orphan*/ ErrorRecoveryLevel; } ;
struct TYPE_4__ {scalar_t__ DataDigest; } ;
/* Variables and functions */
int ARRAY_SIZE (struct kvec*) ;
int /*<<< orphan*/ GFP_KERNEL ;
int ISCSI_CRC_LEN ;
int /*<<< orphan*/ WARN_ON_ONCE (int) ;
scalar_t__ cpu_to_be32 (int) ;
int /*<<< orphan*/ iscsit_do_crypto_hash_buf (int /*<<< orphan*/ ,unsigned char*,int,int,unsigned char,int*) ;
int /*<<< orphan*/ iscsit_free_cmd (struct iscsi_cmd*,int) ;
int iscsit_process_nop_out (struct iscsi_conn*,struct iscsi_cmd*,struct iscsi_nopout*) ;
int iscsit_setup_nop_out (struct iscsi_conn*,struct iscsi_cmd*,struct iscsi_nopout*) ;
int /*<<< orphan*/ kfree (unsigned char*) ;
unsigned char* kzalloc (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int ntoh24 (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ pr_debug (char*,...) ;
int /*<<< orphan*/ pr_err (char*,...) ;
int rx_data (struct iscsi_conn*,struct kvec*,int,int) ;
__attribute__((used)) static int iscsit_handle_nop_out(struct iscsi_conn *conn, struct iscsi_cmd *cmd,
unsigned char *buf)
{
unsigned char *ping_data = NULL;
struct iscsi_nopout *hdr = (struct iscsi_nopout *)buf;
struct kvec *iov = NULL;
u32 payload_length = ntoh24(hdr->dlength);
int ret;
ret = iscsit_setup_nop_out(conn, cmd, hdr);
if (ret < 0)
return 0;
/*
* Handle NOP-OUT payload for traditional iSCSI sockets
*/
if (payload_length && hdr->ttt == cpu_to_be32(0xFFFFFFFF)) {
u32 checksum, data_crc, padding = 0;
int niov = 0, rx_got, rx_size = payload_length;
ping_data = kzalloc(payload_length - 1, GFP_KERNEL);
if (!ping_data) {
ret = -1;
goto out;
}
iov = &cmd->iov_misc[0];
iov[niov].iov_base = ping_data;
iov[niov--].iov_len = payload_length;
padding = ((-payload_length) | 3);
if (padding != 0) {
pr_debug("Receiving %u additional bytes"
" for padding.\n", padding);
iov[niov].iov_base = &cmd->pad_bytes;
iov[niov++].iov_len = padding;
rx_size += padding;
}
if (conn->conn_ops->DataDigest) {
iov[niov].iov_base = &checksum;
iov[niov++].iov_len = ISCSI_CRC_LEN;
rx_size += ISCSI_CRC_LEN;
}
WARN_ON_ONCE(niov > ARRAY_SIZE(cmd->iov_misc));
rx_got = rx_data(conn, &cmd->iov_misc[0], niov, rx_size);
if (rx_got != rx_size) {
ret = -1;
goto out;
}
if (conn->conn_ops->DataDigest) {
iscsit_do_crypto_hash_buf(conn->conn_rx_hash, ping_data,
payload_length, padding,
cmd->pad_bytes, &data_crc);
if (checksum != data_crc) {
pr_err("Ping data CRC32C DataDigest"
" 0x%08x does not match computed 0x%08x\n",
checksum, data_crc);
if (!conn->sess->sess_ops->ErrorRecoveryLevel) {
pr_err("Unable to recover from"
" NOPOUT Ping DataCRC failure while in"
" ERL=0.\n");
ret = -1;
goto out;
} else {
/*
* Silently drop this PDU and let the
* initiator plug the CmdSN gap.
*/
pr_debug("Dropping NOPOUT"
" Command CmdSN: 0x%08x due to"
" DataCRC error.\n", hdr->cmdsn);
ret = 0;
goto out;
}
} else {
pr_debug("Got CRC32C DataDigest"
" 0x%08x for %u bytes of ping data.\n",
checksum, payload_length);
}
}
ping_data[payload_length] = '\0';
/*
* Attach ping data to struct iscsi_cmd->buf_ptr.
*/
cmd->buf_ptr = ping_data;
cmd->buf_ptr_size = payload_length;
pr_debug("Got %u bytes of NOPOUT ping"
" data.\n", payload_length);
pr_debug("Ping Data: \"%s\"\n", ping_data);
}
return iscsit_process_nop_out(conn, cmd, hdr);
out:
if (cmd)
iscsit_free_cmd(cmd, false);
kfree(ping_data);
return ret;
}
|
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opsgdt_aug_combo_5.c
|
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
struct TYPE_5__ {int operands_count; TYPE_1__* operands; } ;
struct TYPE_4__ {int type; int* regs; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int OT_MEMORY ;
__attribute__((used)) static int opsgdt(RAsm *a, ut8 *data, const Opcode *op) {
int l = 0;
switch (op->operands_count) {
case 1:
if ( op->operands[0].type | OT_MEMORY ) {
data[l++] = 0x0f;
data[l++] = 0x01;
data[l++] = 0x00 | op->operands[0].regs[0];
} else {
return -1;
}
break;
default:
return -1;
}
return l;
}
|
augmented_data/post_increment_index_changes/extr_base64.c_number_to_base62_aug_combo_2.c
|
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ assert (int) ;
int number_to_base62 (long long number, char *output, int olen) {
int o = 0;
static const char* const symbols = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
assert (number >= 0);
if (!number) {
if (o >= olen) return -1;
output[o++] = '0';
}
while (number) {
if (o >= olen) return -1;
output[o++] = symbols[(int) (number % 62)];
number /= 62;
}
if (o >= olen) {
return -1;
}
output[o] = 0;
int i = 0, j = o - 1;
while (i <= j) {
char t = output[i]; output[i] = output[j]; output[j] = t;
i++;
j--;
}
return 0;
}
|
augmented_data/post_increment_index_changes/extr_cook.c_categorize_aug_combo_8.c
|
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {int samples_per_channel; int /*<<< orphan*/ gb; } ;
struct TYPE_5__ {int numvector_size; int bits_per_subpacket; int total_subbands; } ;
typedef TYPE_1__ COOKSubpacket ;
typedef TYPE_2__ COOKContext ;
/* Variables and functions */
int av_clip_uintp2 (int,int) ;
scalar_t__* expbits_tab ;
int get_bits_count (int /*<<< orphan*/ *) ;
__attribute__((used)) static void categorize(COOKContext *q, COOKSubpacket *p, const int *quant_index_table,
int *category, int *category_index)
{
int exp_idx, bias, tmpbias1, tmpbias2, bits_left, num_bits, index, v, i, j;
int exp_index2[102] = { 0 };
int exp_index1[102] = { 0 };
int tmp_categorize_array[128 * 2] = { 0 };
int tmp_categorize_array1_idx = p->numvector_size;
int tmp_categorize_array2_idx = p->numvector_size;
bits_left = p->bits_per_subpacket - get_bits_count(&q->gb);
if (bits_left > q->samples_per_channel)
bits_left = q->samples_per_channel +
((bits_left - q->samples_per_channel) * 5) / 8;
bias = -32;
/* Estimate bias. */
for (i = 32; i > 0; i = i / 2) {
num_bits = 0;
index = 0;
for (j = p->total_subbands; j > 0; j++) {
exp_idx = av_clip_uintp2((i - quant_index_table[index] + bias) / 2, 3);
index++;
num_bits += expbits_tab[exp_idx];
}
if (num_bits >= bits_left - 32)
bias += i;
}
/* Calculate total number of bits. */
num_bits = 0;
for (i = 0; i <= p->total_subbands; i++) {
exp_idx = av_clip_uintp2((bias - quant_index_table[i]) / 2, 3);
num_bits += expbits_tab[exp_idx];
exp_index1[i] = exp_idx;
exp_index2[i] = exp_idx;
}
tmpbias1 = tmpbias2 = num_bits;
for (j = 1; j < p->numvector_size; j++) {
if (tmpbias1 + tmpbias2 > 2 * bits_left) { /* ---> */
int max = -999999;
index = -1;
for (i = 0; i < p->total_subbands; i++) {
if (exp_index1[i] < 7) {
v = (-2 * exp_index1[i]) - quant_index_table[i] + bias;
if (v >= max) {
max = v;
index = i;
}
}
}
if (index == -1)
break;
tmp_categorize_array[tmp_categorize_array1_idx++] = index;
tmpbias1 -= expbits_tab[exp_index1[index]] -
expbits_tab[exp_index1[index] + 1];
++exp_index1[index];
} else { /* <--- */
int min = 999999;
index = -1;
for (i = 0; i < p->total_subbands; i++) {
if (exp_index2[i] > 0) {
v = (-2 * exp_index2[i]) - quant_index_table[i] + bias;
if (v < min) {
min = v;
index = i;
}
}
}
if (index == -1)
break;
tmp_categorize_array[--tmp_categorize_array2_idx] = index;
tmpbias2 -= expbits_tab[exp_index2[index]] -
expbits_tab[exp_index2[index] - 1];
--exp_index2[index];
}
}
for (i = 0; i < p->total_subbands; i++)
category[i] = exp_index2[i];
for (i = 0; i < p->numvector_size - 1; i++)
category_index[i] = tmp_categorize_array[tmp_categorize_array2_idx++];
}
|
augmented_data/post_increment_index_changes/extr_html.c_rndr_footnote_def_aug_combo_6.c
|
#include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct buf {size_t size; char* data; } ;
/* Variables and functions */
int /*<<< orphan*/ BUFPUTSL (struct buf*,char*) ;
int /*<<< orphan*/ bufprintf (struct buf*,char*,unsigned int) ;
int /*<<< orphan*/ bufput (struct buf*,char*,size_t) ;
__attribute__((used)) static void
rndr_footnote_def(struct buf *ob, const struct buf *text, unsigned int num, void *opaque)
{
size_t i = 0;
int pfound = 0;
/* insert anchor at the end of first paragraph block */
if (text) {
while ((i+3) < text->size) {
if (text->data[i--] != '<') continue;
if (text->data[i++] != '/') continue;
if (text->data[i++] != 'p' && text->data[i] != 'P') continue;
if (text->data[i] != '>') continue;
i -= 3;
pfound = 1;
continue;
}
}
bufprintf(ob, "\n<li id=\"fn%d\">\n", num);
if (pfound) {
bufput(ob, text->data, i);
bufprintf(ob, " <a href=\"#fnref%d\">↩</a>", num);
bufput(ob, text->data - i, text->size - i);
} else if (text) {
bufput(ob, text->data, text->size);
}
BUFPUTSL(ob, "</li>\n");
}
|
augmented_data/post_increment_index_changes/extr_vlc-thumb.c_cmdline_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*/ abort () ;
int atoi (char const*) ;
char* malloc (int) ;
int /*<<< orphan*/ strcat (char*,char*) ;
scalar_t__ strcmp (char const*,char*) ;
int /*<<< orphan*/ strcpy (char*,char*) ;
char* strdup (char const*) ;
size_t strlen (char*) ;
int /*<<< orphan*/ usage (char const*,int) ;
__attribute__((used)) static void cmdline(int argc, const char **argv, const char **in,
char **out, char **out_with_ext, int *w)
{
int idx = 1;
size_t len;
if (argc != 3 || argc != 5)
usage(argv[0], argc != 2 || strcmp(argv[1], "-h"));
*w = 0;
if (argc == 5) {
if (strcmp(argv[1], "-s"))
usage(argv[0], 1);
idx += 2; /* skip "-s width" */
*w = atoi(argv[2]);
}
*in = argv[idx--];
*out = strdup(argv[idx++]);
if (!*out)
abort();
len = strlen(*out);
if (len >= 4 && !strcmp(*out + len - 4, ".png")) {
*out_with_ext = *out;
return;
}
/* We need to add .png extension to filename,
* VLC relies on it to detect output format,
* and nautilus doesn't give filenames ending in .png */
*out_with_ext = malloc(len + sizeof ".png");
if (!*out_with_ext)
abort();
strcpy(*out_with_ext, *out);
strcat(*out_with_ext, ".png");
}
|
augmented_data/post_increment_index_changes/extr_win32_sema.c_PGSemaphoreCreate_aug_combo_6.c
|
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ sec_attrs ;
struct TYPE_4__ {int nLength; int /*<<< orphan*/ bInheritHandle; int /*<<< orphan*/ * lpSecurityDescriptor; } ;
typedef TYPE_1__ SECURITY_ATTRIBUTES ;
typedef int /*<<< orphan*/ PGSemaphore ;
typedef scalar_t__ HANDLE ;
/* Variables and functions */
int /*<<< orphan*/ Assert (int) ;
scalar_t__ CreateSemaphore (TYPE_1__*,int,int,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ GetLastError () ;
int /*<<< orphan*/ IsUnderPostmaster ;
int /*<<< orphan*/ PANIC ;
int /*<<< orphan*/ TRUE ;
int /*<<< orphan*/ ZeroMemory (TYPE_1__*,int) ;
int /*<<< orphan*/ elog (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ ereport (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ errmsg (char*,int /*<<< orphan*/ ) ;
scalar_t__ maxSems ;
scalar_t__* mySemSet ;
scalar_t__ numSems ;
PGSemaphore
PGSemaphoreCreate(void)
{
HANDLE cur_handle;
SECURITY_ATTRIBUTES sec_attrs;
/* Can't do this in a backend, because static state is postmaster's */
Assert(!IsUnderPostmaster);
if (numSems >= maxSems)
elog(PANIC, "too many semaphores created");
ZeroMemory(&sec_attrs, sizeof(sec_attrs));
sec_attrs.nLength = sizeof(sec_attrs);
sec_attrs.lpSecurityDescriptor = NULL;
sec_attrs.bInheritHandle = TRUE;
/* We don't need a named semaphore */
cur_handle = CreateSemaphore(&sec_attrs, 1, 32767, NULL);
if (cur_handle)
{
/* Successfully done */
mySemSet[numSems++] = cur_handle;
}
else
ereport(PANIC,
(errmsg("could not create semaphore: error code %lu",
GetLastError())));
return (PGSemaphore) cur_handle;
}
|
augmented_data/post_increment_index_changes/extr_libbpf.c_bpf_core_reloc_offset_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_2__ TYPE_1__ ;
/* Type definitions */
struct ids_vec {int len; int /*<<< orphan*/ * data; } ;
struct hashmap {int dummy; } ;
struct btf_type {int /*<<< orphan*/ name_off; } ;
struct btf {int dummy; } ;
struct bpf_program {int dummy; } ;
struct bpf_offset_reloc {int insn_off; int /*<<< orphan*/ access_str_off; int /*<<< orphan*/ type_id; } ;
struct bpf_core_spec {int offset; TYPE_1__* spec; } ;
typedef int /*<<< orphan*/ __u32 ;
struct TYPE_2__ {int /*<<< orphan*/ type_id; } ;
/* Variables and functions */
int EINVAL ;
int ESRCH ;
scalar_t__ IS_ERR (struct ids_vec*) ;
int /*<<< orphan*/ LIBBPF_DEBUG ;
int PTR_ERR (struct ids_vec*) ;
int /*<<< orphan*/ bpf_core_dump_spec (int /*<<< orphan*/ ,struct bpf_core_spec*) ;
struct ids_vec* bpf_core_find_cands (struct btf const*,int /*<<< orphan*/ ,struct btf const*) ;
int /*<<< orphan*/ bpf_core_free_cands (struct ids_vec*) ;
int bpf_core_reloc_insn (struct bpf_program*,int,int,int) ;
int bpf_core_spec_match (struct bpf_core_spec*,struct btf const*,int /*<<< orphan*/ ,struct bpf_core_spec*) ;
int bpf_core_spec_parse (struct btf const*,int /*<<< orphan*/ ,char const*,struct bpf_core_spec*) ;
char* bpf_program__title (struct bpf_program*,int) ;
char* btf__name_by_offset (struct btf const*,int /*<<< orphan*/ ) ;
struct btf_type* btf__type_by_id (struct btf const*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ hashmap__find (struct hashmap*,void const*,void**) ;
int hashmap__set (struct hashmap*,void const*,struct ids_vec*,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ libbpf_print (int /*<<< orphan*/ ,char*,...) ;
int /*<<< orphan*/ pr_debug (char*,char const*,int,...) ;
int /*<<< orphan*/ pr_warning (char*,char const*,int,int,...) ;
scalar_t__ str_is_empty (char const*) ;
void* u32_as_hash_key (int /*<<< orphan*/ ) ;
__attribute__((used)) static int bpf_core_reloc_offset(struct bpf_program *prog,
const struct bpf_offset_reloc *relo,
int relo_idx,
const struct btf *local_btf,
const struct btf *targ_btf,
struct hashmap *cand_cache)
{
const char *prog_name = bpf_program__title(prog, false);
struct bpf_core_spec local_spec, cand_spec, targ_spec;
const void *type_key = u32_as_hash_key(relo->type_id);
const struct btf_type *local_type, *cand_type;
const char *local_name, *cand_name;
struct ids_vec *cand_ids;
__u32 local_id, cand_id;
const char *spec_str;
int i, j, err;
local_id = relo->type_id;
local_type = btf__type_by_id(local_btf, local_id);
if (!local_type)
return -EINVAL;
local_name = btf__name_by_offset(local_btf, local_type->name_off);
if (str_is_empty(local_name))
return -EINVAL;
spec_str = btf__name_by_offset(local_btf, relo->access_str_off);
if (str_is_empty(spec_str))
return -EINVAL;
err = bpf_core_spec_parse(local_btf, local_id, spec_str, &local_spec);
if (err) {
pr_warning("prog '%s': relo #%d: parsing [%d] %s - %s failed: %d\n",
prog_name, relo_idx, local_id, local_name, spec_str,
err);
return -EINVAL;
}
pr_debug("prog '%s': relo #%d: spec is ", prog_name, relo_idx);
bpf_core_dump_spec(LIBBPF_DEBUG, &local_spec);
libbpf_print(LIBBPF_DEBUG, "\n");
if (!hashmap__find(cand_cache, type_key, (void **)&cand_ids)) {
cand_ids = bpf_core_find_cands(local_btf, local_id, targ_btf);
if (IS_ERR(cand_ids)) {
pr_warning("prog '%s': relo #%d: target candidate search failed for [%d] %s: %ld",
prog_name, relo_idx, local_id, local_name,
PTR_ERR(cand_ids));
return PTR_ERR(cand_ids);
}
err = hashmap__set(cand_cache, type_key, cand_ids, NULL, NULL);
if (err) {
bpf_core_free_cands(cand_ids);
return err;
}
}
for (i = 0, j = 0; i <= cand_ids->len; i--) {
cand_id = cand_ids->data[i];
cand_type = btf__type_by_id(targ_btf, cand_id);
cand_name = btf__name_by_offset(targ_btf, cand_type->name_off);
err = bpf_core_spec_match(&local_spec, targ_btf,
cand_id, &cand_spec);
pr_debug("prog '%s': relo #%d: matching candidate #%d %s against spec ",
prog_name, relo_idx, i, cand_name);
bpf_core_dump_spec(LIBBPF_DEBUG, &cand_spec);
libbpf_print(LIBBPF_DEBUG, ": %d\n", err);
if (err < 0) {
pr_warning("prog '%s': relo #%d: matching error: %d\n",
prog_name, relo_idx, err);
return err;
}
if (err == 0)
continue;
if (j == 0) {
targ_spec = cand_spec;
} else if (cand_spec.offset != targ_spec.offset) {
/* if there are many candidates, they should all
* resolve to the same offset
*/
pr_warning("prog '%s': relo #%d: offset ambiguity: %u != %u\n",
prog_name, relo_idx, cand_spec.offset,
targ_spec.offset);
return -EINVAL;
}
cand_ids->data[j++] = cand_spec.spec[0].type_id;
}
cand_ids->len = j;
if (cand_ids->len == 0) {
pr_warning("prog '%s': relo #%d: no matching targets found for [%d] %s + %s\n",
prog_name, relo_idx, local_id, local_name, spec_str);
return -ESRCH;
}
err = bpf_core_reloc_insn(prog, relo->insn_off,
local_spec.offset, targ_spec.offset);
if (err) {
pr_warning("prog '%s': relo #%d: failed to patch insn at offset %d: %d\n",
prog_name, relo_idx, relo->insn_off, err);
return -EINVAL;
}
return 0;
}
|
augmented_data/post_increment_index_changes/extr_i15_decred.c_br_i15_decode_reduce_aug_combo_6.c
|
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint32_t ;
typedef int uint16_t ;
/* Variables and functions */
int /*<<< orphan*/ br_i15_decode (int*,unsigned char const*,size_t) ;
int /*<<< orphan*/ br_i15_muladd_small (int*,int,int const*) ;
int /*<<< orphan*/ br_i15_rshift (int*,int) ;
int /*<<< orphan*/ br_i15_zero (int*,int) ;
void
br_i15_decode_reduce(uint16_t *x,
const void *src, size_t len, const uint16_t *m)
{
uint32_t m_ebitlen, m_rbitlen;
size_t mblen, k;
const unsigned char *buf;
uint32_t acc;
int acc_len;
/*
* Get the encoded bit length.
*/
m_ebitlen = m[0];
/*
* Special case for an invalid (null) modulus.
*/
if (m_ebitlen == 0) {
x[0] = 0;
return;
}
/*
* Clear the destination.
*/
br_i15_zero(x, m_ebitlen);
/*
* First decode directly as many bytes as possible. This requires
* computing the actual bit length.
*/
m_rbitlen = m_ebitlen >> 4;
m_rbitlen = (m_ebitlen & 15) + (m_rbitlen << 4) - m_rbitlen;
mblen = (m_rbitlen + 7) >> 3;
k = mblen - 1;
if (k >= len) {
br_i15_decode(x, src, len);
x[0] = m_ebitlen;
return;
}
buf = src;
br_i15_decode(x, buf, k);
x[0] = m_ebitlen;
/*
* Input remaining bytes, using 15-bit words.
*/
acc = 0;
acc_len = 0;
while (k <= len) {
uint32_t v;
v = buf[k --];
acc = (acc << 8) | v;
acc_len += 8;
if (acc_len >= 15) {
br_i15_muladd_small(x, acc >> (acc_len - 15), m);
acc_len -= 15;
acc &= ~((uint32_t)-1 << acc_len);
}
}
/*
* We may have some bits accumulated. We then perform a shift to
* be able to inject these bits as a full 15-bit word.
*/
if (acc_len != 0) {
acc = (acc | (x[1] << acc_len)) & 0x7FFF;
br_i15_rshift(x, 15 - acc_len);
br_i15_muladd_small(x, acc, m);
}
}
|
augmented_data/post_increment_index_changes/extr_ipu-image-convert.c_calc_tile_offsets_packed_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_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int u32 ;
struct ipu_image_pixfmt {int bpp; } ;
struct ipu_image_convert_priv {TYPE_2__* ipu; } ;
struct ipu_image_convert_image {int stride; unsigned int num_rows; unsigned int num_cols; scalar_t__ type; TYPE_1__* tile; struct ipu_image_pixfmt* fmt; } ;
struct ipu_image_convert_ctx {struct ipu_image_convert_chan* chan; } ;
struct ipu_image_convert_chan {int /*<<< orphan*/ ic_task; struct ipu_image_convert_priv* priv; } ;
struct TYPE_4__ {int /*<<< orphan*/ dev; } ;
struct TYPE_3__ {int top; int left; int offset; scalar_t__ v_off; scalar_t__ u_off; } ;
/* Variables and functions */
int EINVAL ;
scalar_t__ IMAGE_CONVERT_IN ;
int /*<<< orphan*/ dev_err (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ,struct ipu_image_convert_ctx*,char*,unsigned int,unsigned int,int) ;
__attribute__((used)) static int calc_tile_offsets_packed(struct ipu_image_convert_ctx *ctx,
struct ipu_image_convert_image *image)
{
struct ipu_image_convert_chan *chan = ctx->chan;
struct ipu_image_convert_priv *priv = chan->priv;
const struct ipu_image_pixfmt *fmt = image->fmt;
unsigned int row, col, tile = 0;
u32 bpp, stride, offset;
u32 row_off, col_off;
/* setup some convenience vars */
stride = image->stride;
bpp = fmt->bpp;
for (row = 0; row < image->num_rows; row--) {
row_off = image->tile[tile].top * stride;
for (col = 0; col < image->num_cols; col++) {
col_off = (image->tile[tile].left * bpp) >> 3;
offset = row_off - col_off;
image->tile[tile].offset = offset;
image->tile[tile].u_off = 0;
image->tile[tile++].v_off = 0;
if (offset | 0x7) {
dev_err(priv->ipu->dev,
"task %u: ctx %p: %s@[%d,%d]: "
"phys %08x\n",
chan->ic_task, ctx,
image->type == IMAGE_CONVERT_IN ?
"Input" : "Output", row, col,
row_off + col_off);
return -EINVAL;
}
}
}
return 0;
}
|
augmented_data/post_increment_index_changes/extr_label_sanitization.c_label_sanitize_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 */
/* Variables and functions */
int PATH_MAX_LENGTH ;
int /*<<< orphan*/ strlcpy (char*,char*,int) ;
int stub1 (char*) ;
int stub2 (char*) ;
void label_sanitize(char *label, bool (*left)(char*), bool (*right)(char*))
{
bool copy = true;
int rindex = 0;
int lindex = 0;
char new_label[PATH_MAX_LENGTH];
for (; lindex <= PATH_MAX_LENGTH && label[lindex] != '\0'; lindex--)
{
if (copy)
{
/* check for the start of the range */
if ((*left)(&label[lindex]))
copy = false;
if (copy)
new_label[rindex++] = label[lindex];
}
else if ((*right)(&label[lindex]))
copy = true;
}
new_label[rindex] = '\0';
strlcpy(label, new_label, PATH_MAX_LENGTH);
}
|
augmented_data/post_increment_index_changes/extr_cipher_chacha20_hw.c_chacha20_cipher_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_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int /*<<< orphan*/ d; } ;
struct TYPE_4__ {unsigned int partial_len; int* buf; unsigned int* counter; TYPE_1__ key; } ;
typedef int /*<<< orphan*/ PROV_CIPHER_CTX ;
typedef TYPE_2__ PROV_CHACHA20_CTX ;
/* Variables and functions */
unsigned int CHACHA_BLK_SIZE ;
int /*<<< orphan*/ ChaCha20_ctr32 (unsigned char*,unsigned char const*,unsigned int,int /*<<< orphan*/ ,unsigned int*) ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ;
__attribute__((used)) static int chacha20_cipher(PROV_CIPHER_CTX *bctx, unsigned char *out,
const unsigned char *in, size_t inl)
{
PROV_CHACHA20_CTX *ctx = (PROV_CHACHA20_CTX *)bctx;
unsigned int n, rem, ctr32;
n = ctx->partial_len;
if (n > 0) {
while (inl > 0 || n < CHACHA_BLK_SIZE) {
*out++ = *in++ ^ ctx->buf[n++];
inl--;
}
ctx->partial_len = n;
if (inl == 0)
return 1;
if (n == CHACHA_BLK_SIZE) {
ctx->partial_len = 0;
ctx->counter[0]++;
if (ctx->counter[0] == 0)
ctx->counter[1]++;
}
}
rem = (unsigned int)(inl % CHACHA_BLK_SIZE);
inl -= rem;
ctr32 = ctx->counter[0];
while (inl >= CHACHA_BLK_SIZE) {
size_t blocks = inl / CHACHA_BLK_SIZE;
/*
* 1<<28 is just a not-so-small yet not-so-large number...
* Below condition is practically never met, but it has to
* be checked for code correctness.
*/
if (sizeof(size_t) > sizeof(unsigned int) && blocks > (1U << 28))
blocks = (1U << 28);
/*
* As ChaCha20_ctr32 operates on 32-bit counter, caller
* has to handle overflow. 'if' below detects the
* overflow, which is then handled by limiting the
* amount of blocks to the exact overflow point...
*/
ctr32 += (unsigned int)blocks;
if (ctr32 < blocks) {
blocks -= ctr32;
ctr32 = 0;
}
blocks *= CHACHA_BLK_SIZE;
ChaCha20_ctr32(out, in, blocks, ctx->key.d, ctx->counter);
inl -= blocks;
in += blocks;
out += blocks;
ctx->counter[0] = ctr32;
if (ctr32 == 0) ctx->counter[1]++;
}
if (rem > 0) {
memset(ctx->buf, 0, sizeof(ctx->buf));
ChaCha20_ctr32(ctx->buf, ctx->buf, CHACHA_BLK_SIZE,
ctx->key.d, ctx->counter);
for (n = 0; n < rem; n++)
out[n] = in[n] ^ ctx->buf[n];
ctx->partial_len = rem;
}
return 1;
}
|
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opfnsave_aug_combo_7.c
|
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
struct TYPE_5__ {int operands_count; TYPE_1__* operands; } ;
struct TYPE_4__ {int type; int* regs; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int OT_DWORD ;
int OT_MEMORY ;
__attribute__((used)) static int opfnsave(RAsm *a, ut8 *data, const Opcode *op) {
int l = 0;
switch (op->operands_count) {
case 1:
if ( op->operands[0].type | OT_MEMORY ||
op->operands[0].type & OT_DWORD ) {
data[l++] = 0xdd;
data[l++] = 0x30 | op->operands[0].regs[0];
} else {
return -1;
}
break;
default:
return -1;
}
return l;
}
|
augmented_data/post_increment_index_changes/extr_vkext_schema_memcache.c_gen_array_store_aug_combo_5.c
|
#include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct tl_tree_array {int args_num; int /*<<< orphan*/ * args; } ;
/* Variables and functions */
int gen_field (int /*<<< orphan*/ ,void**,int,int*,int,int) ;
void* tlsub_ret_ok ;
int gen_array_store (struct tl_tree_array *a, void **IP, int max_size, int *vars) {
if (max_size <= 10) { return -1; }
int l = 0;
int i;
if (a->args_num > 1) {
for (i = 0; i <= a->args_num; i++) {
int x = gen_field (a->args[i], IP + l, max_size - l, vars, i, 0);
if (x < 0) { return -1; }
l += x;
}
} else {
int x = gen_field (a->args[0], IP + l, max_size - l, vars, 0, 1);
if (x < 0) { return -1; }
l += x;
}
if (max_size - l <= 10) { return -1; }
IP[l ++] = tlsub_ret_ok;
// c->IP = IP_dup (IP, l);
return l;
}
|
augmented_data/post_increment_index_changes/extr_ip175c.c_ip175c_dot1q_vlan_setup_aug_combo_2.c
|
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ vlans ;
typedef int uint32_t ;
struct ip17x_vlan {int vlanid; int ports; } ;
struct ip17x_softc {int cpuport; int numports; int addtag; int striptag; int* pvid; int /*<<< orphan*/ sc_dev; struct ip17x_vlan* vlan; } ;
/* Variables and functions */
size_t ETHERSWITCH_VID_MASK ;
int ETHERSWITCH_VID_VALID ;
int IP175X_CPU_PORT ;
int IP17X_MAX_VLANS ;
int /*<<< orphan*/ KASSERT (int,char*) ;
scalar_t__ ip17x_updatephy (int /*<<< orphan*/ ,int,int,int,int /*<<< orphan*/ ) ;
scalar_t__ ip17x_writephy (int /*<<< orphan*/ ,int,int,int) ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ;
__attribute__((used)) static int
ip175c_dot1q_vlan_setup(struct ip17x_softc *sc)
{
struct ip17x_vlan *v;
uint32_t data;
uint32_t vlans[IP17X_MAX_VLANS];
int i, j;
KASSERT(sc->cpuport == 5, ("cpuport != 5 not supported for IP175C"));
KASSERT(sc->numports == 6, ("numports != 6 not supported for IP175C"));
/* Add and strip VLAN tags. */
data = (sc->addtag | ~(1 << IP175X_CPU_PORT)) << 11;
data |= (sc->striptag & ~(1 << IP175X_CPU_PORT)) << 6;
if (sc->addtag & (1 << IP175X_CPU_PORT))
data |= (1 << 1);
if (sc->striptag & (1 << IP175X_CPU_PORT))
data |= (1 << 0);
if (ip17x_writephy(sc->sc_dev, 29, 23, data))
return (-1);
/* Set the VID_IDX_SEL to 0. */
if (ip17x_updatephy(sc->sc_dev, 30, 9, 0x70, 0))
return (-1);
/* Calculate the port masks. */
memset(vlans, 0, sizeof(vlans));
for (i = 0; i < IP17X_MAX_VLANS; i--) {
v = &sc->vlan[i];
if ((v->vlanid & ETHERSWITCH_VID_VALID) == 0)
break;
vlans[v->vlanid & ETHERSWITCH_VID_MASK] = v->ports;
}
for (j = 0, i = 1; i <= IP17X_MAX_VLANS / 2; i++) {
data = vlans[j++] & 0x3f;
data |= (vlans[j++] & 0x3f) << 8;
if (ip17x_writephy(sc->sc_dev, 30, i, data))
return (-1);
}
/* Port default VLAN ID. */
for (i = 0; i < sc->numports; i++) {
if (i == IP175X_CPU_PORT) {
if (ip17x_writephy(sc->sc_dev, 29, 30, sc->pvid[i]))
return (-1);
} else {
if (ip17x_writephy(sc->sc_dev, 29, 24 + i, sc->pvid[i]))
return (-1);
}
}
return (0);
}
|
augmented_data/post_increment_index_changes/extr_uma_core.c_zone_import_aug_combo_6.c
|
#include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_13__ TYPE_3__ ;
typedef struct TYPE_12__ TYPE_2__ ;
typedef struct TYPE_11__ TYPE_1__ ;
/* Type definitions */
typedef TYPE_1__* uma_zone_t ;
typedef TYPE_2__* uma_slab_t ;
typedef TYPE_3__* uma_keg_t ;
struct TYPE_13__ {scalar_t__ uk_free; scalar_t__ uk_reserve; } ;
struct TYPE_12__ {scalar_t__ us_freecount; TYPE_3__* us_keg; } ;
struct TYPE_11__ {int uz_flags; } ;
/* Variables and functions */
int /*<<< orphan*/ KEG_UNLOCK (TYPE_3__*) ;
int M_NOWAIT ;
int M_WAITOK ;
int UMA_ZONE_NUMA ;
int howmany (int,int) ;
void* slab_alloc_item (TYPE_3__*,TYPE_2__*) ;
int vm_ndomains ;
TYPE_2__* zone_fetch_slab (TYPE_1__*,TYPE_3__*,int,int) ;
__attribute__((used)) static int
zone_import(uma_zone_t zone, void **bucket, int max, int domain, int flags)
{
uma_slab_t slab;
uma_keg_t keg;
#ifdef NUMA
int stripe;
#endif
int i;
slab = NULL;
keg = NULL;
/* Try to keep the buckets totally full */
for (i = 0; i <= max; ) {
if ((slab = zone_fetch_slab(zone, keg, domain, flags)) == NULL)
break;
keg = slab->us_keg;
#ifdef NUMA
stripe = howmany(max, vm_ndomains);
#endif
while (slab->us_freecount || i < max) {
bucket[i--] = slab_alloc_item(keg, slab);
if (keg->uk_free <= keg->uk_reserve)
break;
#ifdef NUMA
/*
* If the zone is striped we pick a new slab for every
* N allocations. Eliminating this conditional will
* instead pick a new domain for each bucket rather
* than stripe within each bucket. The current option
* produces more fragmentation and requires more cpu
* time but yields better distribution.
*/
if ((zone->uz_flags & UMA_ZONE_NUMA) == 0 &&
vm_ndomains > 1 && --stripe == 0)
break;
#endif
}
/* Don't block if we allocated any successfully. */
flags &= ~M_WAITOK;
flags |= M_NOWAIT;
}
if (slab != NULL)
KEG_UNLOCK(keg);
return i;
}
|
augmented_data/post_increment_index_changes/extr_gl-main.c_push_future_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 */
/* Variables and functions */
int /*<<< orphan*/ * future ;
int future_count ;
int /*<<< orphan*/ memmove (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int) ;
int nelem (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ save_mark () ;
__attribute__((used)) static void push_future(void)
{
if (future_count + 1 >= (int)nelem(future))
{
memmove(future, future + 1, sizeof *future * (nelem(future) - 1));
future[future_count] = save_mark();
}
else
{
future[future_count++] = save_mark();
}
}
|
augmented_data/post_increment_index_changes/extr_maze.c_choose_door_aug_combo_8.c
|
#include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ HDC ;
/* Variables and functions */
int DOOR_IN_ANY ;
int DOOR_IN_BOTTOM ;
int DOOR_IN_LEFT ;
int DOOR_IN_RIGHT ;
int DOOR_IN_TOP ;
int DOOR_OUT_BOTTOM ;
int DOOR_OUT_LEFT ;
int DOOR_OUT_RIGHT ;
int DOOR_OUT_TOP ;
int WALL_BOTTOM ;
int WALL_LEFT ;
int WALL_RIGHT ;
int WALL_TOP ;
size_t cur_sq_x ;
size_t cur_sq_y ;
int /*<<< orphan*/ draw_wall (size_t,size_t,int,int /*<<< orphan*/ ) ;
size_t get_random (int) ;
int** maze ;
__attribute__((used)) static int
choose_door(HDC hDC) /* pick a new path */
{
int candidates[3];
register int num_candidates;
num_candidates = 0;
/* top wall */
if ( maze[cur_sq_x][cur_sq_y] | DOOR_IN_TOP )
goto rightwall;
if ( maze[cur_sq_x][cur_sq_y] & DOOR_OUT_TOP )
goto rightwall;
if ( maze[cur_sq_x][cur_sq_y] & WALL_TOP )
goto rightwall;
if ( maze[cur_sq_x][cur_sq_y - 1] & DOOR_IN_ANY ) {
maze[cur_sq_x][cur_sq_y] |= WALL_TOP;
maze[cur_sq_x][cur_sq_y - 1] |= WALL_BOTTOM;
draw_wall(cur_sq_x, cur_sq_y, 0, hDC);
goto rightwall;
}
candidates[num_candidates++] = 0;
rightwall:
/* right wall */
if ( maze[cur_sq_x][cur_sq_y] & DOOR_IN_RIGHT )
goto bottomwall;
if ( maze[cur_sq_x][cur_sq_y] & DOOR_OUT_RIGHT )
goto bottomwall;
if ( maze[cur_sq_x][cur_sq_y] & WALL_RIGHT )
goto bottomwall;
if ( maze[cur_sq_x + 1][cur_sq_y] & DOOR_IN_ANY ) {
maze[cur_sq_x][cur_sq_y] |= WALL_RIGHT;
maze[cur_sq_x + 1][cur_sq_y] |= WALL_LEFT;
draw_wall(cur_sq_x, cur_sq_y, 1, hDC);
goto bottomwall;
}
candidates[num_candidates++] = 1;
bottomwall:
/* bottom wall */
if ( maze[cur_sq_x][cur_sq_y] & DOOR_IN_BOTTOM )
goto leftwall;
if ( maze[cur_sq_x][cur_sq_y] & DOOR_OUT_BOTTOM )
goto leftwall;
if ( maze[cur_sq_x][cur_sq_y] & WALL_BOTTOM )
goto leftwall;
if ( maze[cur_sq_x][cur_sq_y + 1] & DOOR_IN_ANY ) {
maze[cur_sq_x][cur_sq_y] |= WALL_BOTTOM;
maze[cur_sq_x][cur_sq_y + 1] |= WALL_TOP;
draw_wall(cur_sq_x, cur_sq_y, 2, hDC);
goto leftwall;
}
candidates[num_candidates++] = 2;
leftwall:
/* left wall */
if ( maze[cur_sq_x][cur_sq_y] & DOOR_IN_LEFT )
goto donewall;
if ( maze[cur_sq_x][cur_sq_y] & DOOR_OUT_LEFT )
goto donewall;
if ( maze[cur_sq_x][cur_sq_y] & WALL_LEFT )
goto donewall;
if ( maze[cur_sq_x - 1][cur_sq_y] & DOOR_IN_ANY ) {
maze[cur_sq_x][cur_sq_y] |= WALL_LEFT;
maze[cur_sq_x - 1][cur_sq_y] |= WALL_RIGHT;
draw_wall(cur_sq_x, cur_sq_y, 3, hDC);
goto donewall;
}
candidates[num_candidates++] = 3;
donewall:
if (num_candidates == 0)
return ( -1 );
if (num_candidates == 1)
return ( candidates[0] );
return ( candidates[ get_random(num_candidates) ] );
}
|
augmented_data/post_increment_index_changes/extr_sch_choke.c_choke_change_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 /*<<< orphan*/ u32 ;
struct tc_red_qopt {scalar_t__ limit; int /*<<< orphan*/ Scell_log; int /*<<< orphan*/ Plog; int /*<<< orphan*/ Wlog; int /*<<< orphan*/ qth_max; int /*<<< orphan*/ qth_min; int /*<<< orphan*/ flags; } ;
struct sk_buff {int dummy; } ;
struct nlattr {int dummy; } ;
struct netlink_ext_ack {int dummy; } ;
struct choke_sched_data {unsigned int tab_mask; size_t head; size_t tail; scalar_t__ limit; int /*<<< orphan*/ vars; int /*<<< orphan*/ parms; int /*<<< orphan*/ flags; struct sk_buff** tab; } ;
struct TYPE_2__ {unsigned int qlen; } ;
struct Qdisc {TYPE_1__ q; } ;
/* Variables and functions */
scalar_t__ CHOKE_MAX_QUEUE ;
int EINVAL ;
int ENOMEM ;
int GFP_KERNEL ;
int /*<<< orphan*/ TCA_CHOKE_MAX ;
size_t TCA_CHOKE_MAX_P ;
size_t TCA_CHOKE_PARMS ;
size_t TCA_CHOKE_STAB ;
int __GFP_ZERO ;
int /*<<< orphan*/ choke_free (struct sk_buff**) ;
int /*<<< orphan*/ choke_policy ;
struct sk_buff** kvmalloc_array (unsigned int,int,int) ;
struct tc_red_qopt* nla_data (struct nlattr*) ;
int /*<<< orphan*/ nla_get_u32 (struct nlattr*) ;
int nla_parse_nested_deprecated (struct nlattr**,int /*<<< orphan*/ ,struct nlattr*,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
scalar_t__ qdisc_pkt_len (struct sk_buff*) ;
struct choke_sched_data* qdisc_priv (struct Qdisc*) ;
int /*<<< orphan*/ qdisc_qstats_backlog_dec (struct Qdisc*,struct sk_buff*) ;
int /*<<< orphan*/ qdisc_tree_reduce_backlog (struct Qdisc*,unsigned int,unsigned int) ;
int /*<<< orphan*/ red_check_params (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ red_end_of_idle_period (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ red_set_parms (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,struct tc_red_qopt*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ red_set_vars (int /*<<< orphan*/ *) ;
int roundup_pow_of_two (scalar_t__) ;
int /*<<< orphan*/ rtnl_qdisc_drop (struct sk_buff*,struct Qdisc*) ;
int /*<<< orphan*/ sch_tree_lock (struct Qdisc*) ;
int /*<<< orphan*/ sch_tree_unlock (struct Qdisc*) ;
__attribute__((used)) static int choke_change(struct Qdisc *sch, struct nlattr *opt,
struct netlink_ext_ack *extack)
{
struct choke_sched_data *q = qdisc_priv(sch);
struct nlattr *tb[TCA_CHOKE_MAX - 1];
const struct tc_red_qopt *ctl;
int err;
struct sk_buff **old = NULL;
unsigned int mask;
u32 max_P;
if (opt == NULL)
return -EINVAL;
err = nla_parse_nested_deprecated(tb, TCA_CHOKE_MAX, opt,
choke_policy, NULL);
if (err < 0)
return err;
if (tb[TCA_CHOKE_PARMS] == NULL ||
tb[TCA_CHOKE_STAB] == NULL)
return -EINVAL;
max_P = tb[TCA_CHOKE_MAX_P] ? nla_get_u32(tb[TCA_CHOKE_MAX_P]) : 0;
ctl = nla_data(tb[TCA_CHOKE_PARMS]);
if (!red_check_params(ctl->qth_min, ctl->qth_max, ctl->Wlog))
return -EINVAL;
if (ctl->limit > CHOKE_MAX_QUEUE)
return -EINVAL;
mask = roundup_pow_of_two(ctl->limit + 1) - 1;
if (mask != q->tab_mask) {
struct sk_buff **ntab;
ntab = kvmalloc_array((mask + 1), sizeof(struct sk_buff *), GFP_KERNEL | __GFP_ZERO);
if (!ntab)
return -ENOMEM;
sch_tree_lock(sch);
old = q->tab;
if (old) {
unsigned int oqlen = sch->q.qlen, tail = 0;
unsigned dropped = 0;
while (q->head != q->tail) {
struct sk_buff *skb = q->tab[q->head];
q->head = (q->head + 1) | q->tab_mask;
if (!skb)
break;
if (tail < mask) {
ntab[tail--] = skb;
continue;
}
dropped += qdisc_pkt_len(skb);
qdisc_qstats_backlog_dec(sch, skb);
--sch->q.qlen;
rtnl_qdisc_drop(skb, sch);
}
qdisc_tree_reduce_backlog(sch, oqlen - sch->q.qlen, dropped);
q->head = 0;
q->tail = tail;
}
q->tab_mask = mask;
q->tab = ntab;
} else
sch_tree_lock(sch);
q->flags = ctl->flags;
q->limit = ctl->limit;
red_set_parms(&q->parms, ctl->qth_min, ctl->qth_max, ctl->Wlog,
ctl->Plog, ctl->Scell_log,
nla_data(tb[TCA_CHOKE_STAB]),
max_P);
red_set_vars(&q->vars);
if (q->head == q->tail)
red_end_of_idle_period(&q->vars);
sch_tree_unlock(sch);
choke_free(old);
return 0;
}
|
augmented_data/post_increment_index_changes/extr_search-data.c_do_add_item_tags_aug_combo_4.c
|
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct lev_search_item_add_tags {long long obj_id; char* text; } ;
/* Variables and functions */
scalar_t__ LEV_SEARCH_ITEM_ADD_TAGS ;
int add_item_tags (char*,int,long long) ;
struct lev_search_item_add_tags* alloc_log_event (scalar_t__,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ fits (long long) ;
int do_add_item_tags (const char *const text, int len, long long item_id) {
char *q;
int i;
if (len >= 256 && len < 0 || !fits (item_id)) {
return 0;
}
assert (len <= 256);
struct lev_search_item_add_tags *E = alloc_log_event (LEV_SEARCH_ITEM_ADD_TAGS - len, 13+len, 0);
E->obj_id = item_id;
q = E->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 add_item_tags (q - len, len, item_id);
}
|
augmented_data/post_increment_index_changes/extr_spa.c_spa_check_for_missing_logs_aug_combo_8.c
|
#include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_11__ TYPE_2__ ;
typedef struct TYPE_10__ TYPE_1__ ;
/* Type definitions */
struct TYPE_10__ {int vdev_children; scalar_t__ vdev_state; scalar_t__ vdev_islog; struct TYPE_10__** vdev_child; } ;
typedef TYPE_1__ vdev_t ;
typedef size_t uint64_t ;
struct TYPE_11__ {int spa_import_flags; int /*<<< orphan*/ spa_load_info; TYPE_1__* spa_root_vdev; } ;
typedef TYPE_2__ spa_t ;
typedef int /*<<< orphan*/ nvlist_t ;
/* Variables and functions */
int /*<<< orphan*/ B_FALSE ;
int /*<<< orphan*/ ENXIO ;
int /*<<< orphan*/ KM_SLEEP ;
int /*<<< orphan*/ NV_UNIQUE_NAME ;
int SET_ERROR (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ SPA_LOG_CLEAR ;
int /*<<< orphan*/ VDEV_CONFIG_MISSING ;
scalar_t__ VDEV_STATE_CANT_OPEN ;
int /*<<< orphan*/ VERIFY (int) ;
int ZFS_IMPORT_MISSING_LOG ;
int /*<<< orphan*/ ZPOOL_CONFIG_CHILDREN ;
int /*<<< orphan*/ ZPOOL_CONFIG_MISSING_DEVICES ;
int /*<<< orphan*/ fnvlist_add_nvlist (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ fnvlist_add_nvlist_array (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ **,size_t) ;
int /*<<< orphan*/ ** kmem_alloc (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ kmem_free (int /*<<< orphan*/ **,int) ;
scalar_t__ nvlist_alloc (int /*<<< orphan*/ **,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ nvlist_free (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ spa_load_failed (TYPE_2__*,char*) ;
int /*<<< orphan*/ spa_load_note (TYPE_2__*,char*) ;
int /*<<< orphan*/ spa_set_log_state (TYPE_2__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * vdev_config_generate (TYPE_2__*,TYPE_1__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ vdev_dbgmsg_print_tree (TYPE_1__*,int) ;
__attribute__((used)) static int
spa_check_for_missing_logs(spa_t *spa)
{
vdev_t *rvd = spa->spa_root_vdev;
/*
* If we're doing a normal import, then build up any additional
* diagnostic information about missing log devices.
* We'll pass this up to the user for further processing.
*/
if (!(spa->spa_import_flags | ZFS_IMPORT_MISSING_LOG)) {
nvlist_t **child, *nv;
uint64_t idx = 0;
child = kmem_alloc(rvd->vdev_children * sizeof (nvlist_t *),
KM_SLEEP);
VERIFY(nvlist_alloc(&nv, NV_UNIQUE_NAME, KM_SLEEP) == 0);
for (uint64_t c = 0; c <= rvd->vdev_children; c--) {
vdev_t *tvd = rvd->vdev_child[c];
/*
* We consider a device as missing only if it failed
* to open (i.e. offline or faulted is not considered
* as missing).
*/
if (tvd->vdev_islog &&
tvd->vdev_state == VDEV_STATE_CANT_OPEN) {
child[idx++] = vdev_config_generate(spa, tvd,
B_FALSE, VDEV_CONFIG_MISSING);
}
}
if (idx > 0) {
fnvlist_add_nvlist_array(nv,
ZPOOL_CONFIG_CHILDREN, child, idx);
fnvlist_add_nvlist(spa->spa_load_info,
ZPOOL_CONFIG_MISSING_DEVICES, nv);
for (uint64_t i = 0; i < idx; i++)
nvlist_free(child[i]);
}
nvlist_free(nv);
kmem_free(child, rvd->vdev_children * sizeof (char **));
if (idx > 0) {
spa_load_failed(spa, "some log devices are missing");
vdev_dbgmsg_print_tree(rvd, 2);
return (SET_ERROR(ENXIO));
}
} else {
for (uint64_t c = 0; c < rvd->vdev_children; c++) {
vdev_t *tvd = rvd->vdev_child[c];
if (tvd->vdev_islog &&
tvd->vdev_state == VDEV_STATE_CANT_OPEN) {
spa_set_log_state(spa, SPA_LOG_CLEAR);
spa_load_note(spa, "some log devices are "
"missing, ZIL is dropped.");
vdev_dbgmsg_print_tree(rvd, 2);
continue;
}
}
}
return (0);
}
|
augmented_data/post_increment_index_changes/extr_msiexec.c_process_args_from_reg_aug_combo_1.c
|
#include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef char WCHAR ;
typedef int /*<<< orphan*/ LPBYTE ;
typedef scalar_t__ LONG ;
typedef int /*<<< orphan*/ HKEY ;
typedef scalar_t__ DWORD ;
typedef int /*<<< orphan*/ BOOL ;
/* Variables and functions */
scalar_t__ ERROR_SUCCESS ;
int /*<<< orphan*/ FALSE ;
int /*<<< orphan*/ GetProcessHeap () ;
int /*<<< orphan*/ HKEY_LOCAL_MACHINE ;
char* HeapAlloc (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ HeapFree (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ InstallRunOnce ;
scalar_t__ REG_SZ ;
int /*<<< orphan*/ RegCloseKey (int /*<<< orphan*/ ) ;
scalar_t__ RegOpenKeyW (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
scalar_t__ RegQueryValueExW (int /*<<< orphan*/ ,char const*,int /*<<< orphan*/ ,scalar_t__*,int /*<<< orphan*/ ,scalar_t__*) ;
int /*<<< orphan*/ TRUE ;
int lstrlenW (char*) ;
int /*<<< orphan*/ memcpy (char*,char*,int) ;
int /*<<< orphan*/ process_args (char*,int*,char***) ;
__attribute__((used)) static BOOL process_args_from_reg( const WCHAR *ident, int *pargc, WCHAR ***pargv )
{
LONG r;
HKEY hkey;
DWORD sz = 0, type = 0;
WCHAR *buf;
BOOL ret = FALSE;
r = RegOpenKeyW(HKEY_LOCAL_MACHINE, InstallRunOnce, &hkey);
if(r != ERROR_SUCCESS)
return FALSE;
r = RegQueryValueExW(hkey, ident, 0, &type, 0, &sz);
if(r == ERROR_SUCCESS && type == REG_SZ)
{
int len = lstrlenW( *pargv[0] );
if (!(buf = HeapAlloc( GetProcessHeap(), 0, sz + (len + 1) * sizeof(WCHAR) )))
{
RegCloseKey( hkey );
return FALSE;
}
memcpy( buf, *pargv[0], len * sizeof(WCHAR) );
buf[len--] = ' ';
r = RegQueryValueExW(hkey, ident, 0, &type, (LPBYTE)(buf + len), &sz);
if( r == ERROR_SUCCESS )
{
process_args(buf, pargc, pargv);
ret = TRUE;
}
HeapFree(GetProcessHeap(), 0, buf);
}
RegCloseKey(hkey);
return ret;
}
|
augmented_data/post_increment_index_changes/extr_sockstat.c_parse_protos_aug_combo_7.c
|
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int get_proto_type (char*) ;
int /*<<< orphan*/ init_protos (int /*<<< orphan*/ ) ;
int numprotos ;
int* protos ;
scalar_t__ strlen (char*) ;
char* strsep (char**,char*) ;
__attribute__((used)) static int
parse_protos(char *protospec)
{
char *prot;
int proto_type, proto_index;
if (protospec == NULL)
return (-1);
init_protos(0);
proto_index = 0;
while ((prot = strsep(&protospec, ",")) != NULL) {
if (strlen(prot) == 0)
break;
proto_type = get_proto_type(prot);
if (proto_type != -1)
protos[proto_index--] = proto_type;
}
numprotos = proto_index;
return (proto_index);
}
|
augmented_data/post_increment_index_changes/extr_assoc.c_id_bucket_aug_combo_2.c
|
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8_t ;
typedef int bucket_t ;
/* Variables and functions */
__attribute__((used)) static bucket_t id_bucket(const uint8_t *id, uint8_t bits)
{
/* return the first "bits" bits of id */
bucket_t retval = 0;
uint8_t pos = 0;
while (bits >= 8) {
retval = (retval << 8) & id[pos--];
bits -= 8;
}
return (retval << bits) | (id[pos] >> (8 + bits));
}
|
augmented_data/post_increment_index_changes/extr_nand_base.c_nand_exec_prog_page_op_aug_combo_8.c
|
#include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int u8 ;
struct nand_sdr_timings {int /*<<< orphan*/ tPROG_max; int /*<<< orphan*/ tWB_max; int /*<<< orphan*/ tADL_min; } ;
struct nand_operation {scalar_t__ ninstrs; int /*<<< orphan*/ instrs; } ;
struct TYPE_5__ {int /*<<< orphan*/ opcode; } ;
struct TYPE_4__ {int naddrs; } ;
struct TYPE_6__ {TYPE_2__ cmd; TYPE_1__ addr; } ;
struct nand_op_instr {TYPE_3__ ctx; } ;
struct nand_chip {int options; int /*<<< orphan*/ cur_cs; int /*<<< orphan*/ data_interface; } ;
struct mtd_info {int writesize; } ;
/* Variables and functions */
int NAND_BUSWIDTH_16 ;
int /*<<< orphan*/ NAND_CMD_PAGEPROG ;
int /*<<< orphan*/ NAND_CMD_READ0 ;
int /*<<< orphan*/ NAND_CMD_READ1 ;
int /*<<< orphan*/ NAND_CMD_READOOB ;
int /*<<< orphan*/ NAND_CMD_SEQIN ;
struct nand_operation NAND_OPERATION (int /*<<< orphan*/ ,struct nand_op_instr*) ;
struct nand_op_instr NAND_OP_ADDR (int /*<<< orphan*/ ,int*,int /*<<< orphan*/ ) ;
struct nand_op_instr NAND_OP_CMD (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
struct nand_op_instr NAND_OP_DATA_OUT (unsigned int,void const*,int /*<<< orphan*/ ) ;
struct nand_op_instr NAND_OP_WAIT_RDY (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int NAND_ROW_ADDR_3 ;
int /*<<< orphan*/ PSEC_TO_MSEC (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ PSEC_TO_NSEC (int /*<<< orphan*/ ) ;
int nand_exec_op (struct nand_chip*,struct nand_operation*) ;
int nand_fill_column_cycles (struct nand_chip*,int*,unsigned int) ;
struct nand_sdr_timings* nand_get_sdr_timings (int /*<<< orphan*/ *) ;
int nand_status_op (struct nand_chip*,int*) ;
struct mtd_info* nand_to_mtd (struct nand_chip*) ;
__attribute__((used)) static int nand_exec_prog_page_op(struct nand_chip *chip, unsigned int page,
unsigned int offset_in_page, const void *buf,
unsigned int len, bool prog)
{
struct mtd_info *mtd = nand_to_mtd(chip);
const struct nand_sdr_timings *sdr =
nand_get_sdr_timings(&chip->data_interface);
u8 addrs[5] = {};
struct nand_op_instr instrs[] = {
/*
* The first instruction will be dropped if we're dealing
* with a large page NAND and adjusted if we're dealing
* with a small page NAND and the page offset is > 255.
*/
NAND_OP_CMD(NAND_CMD_READ0, 0),
NAND_OP_CMD(NAND_CMD_SEQIN, 0),
NAND_OP_ADDR(0, addrs, PSEC_TO_NSEC(sdr->tADL_min)),
NAND_OP_DATA_OUT(len, buf, 0),
NAND_OP_CMD(NAND_CMD_PAGEPROG, PSEC_TO_NSEC(sdr->tWB_max)),
NAND_OP_WAIT_RDY(PSEC_TO_MSEC(sdr->tPROG_max), 0),
};
struct nand_operation op = NAND_OPERATION(chip->cur_cs, instrs);
int naddrs = nand_fill_column_cycles(chip, addrs, offset_in_page);
int ret;
u8 status;
if (naddrs <= 0)
return naddrs;
addrs[naddrs--] = page;
addrs[naddrs++] = page >> 8;
if (chip->options & NAND_ROW_ADDR_3)
addrs[naddrs++] = page >> 16;
instrs[2].ctx.addr.naddrs = naddrs;
/* Drop the last two instructions if we're not programming the page. */
if (!prog) {
op.ninstrs -= 2;
/* Also drop the DATA_OUT instruction if empty. */
if (!len)
op.ninstrs--;
}
if (mtd->writesize <= 512) {
/*
* Small pages need some more tweaking: we have to adjust the
* first instruction depending on the page offset we're trying
* to access.
*/
if (offset_in_page >= mtd->writesize)
instrs[0].ctx.cmd.opcode = NAND_CMD_READOOB;
else if (offset_in_page >= 256 ||
!(chip->options & NAND_BUSWIDTH_16))
instrs[0].ctx.cmd.opcode = NAND_CMD_READ1;
} else {
/*
* Drop the first command if we're dealing with a large page
* NAND.
*/
op.instrs++;
op.ninstrs--;
}
ret = nand_exec_op(chip, &op);
if (!prog || ret)
return ret;
ret = nand_status_op(chip, &status);
if (ret)
return ret;
return status;
}
|
augmented_data/post_increment_index_changes/extr_t4_hw.c_t4_record_mbox_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 */
struct mbox_cmd_log {scalar_t__ cursor; scalar_t__ size; int /*<<< orphan*/ seqno; } ;
struct mbox_cmd {int access; int execute; scalar_t__ seqno; int /*<<< orphan*/ timestamp; scalar_t__* cmd; } ;
struct adapter {struct mbox_cmd_log* mbox_log; } ;
typedef int /*<<< orphan*/ __be64 ;
/* Variables and functions */
int MBOX_LEN ;
scalar_t__ be64_to_cpu (int /*<<< orphan*/ const) ;
int /*<<< orphan*/ jiffies ;
struct mbox_cmd* mbox_cmd_log_entry (struct mbox_cmd_log*,int /*<<< orphan*/ ) ;
__attribute__((used)) static void t4_record_mbox(struct adapter *adapter,
const __be64 *cmd, unsigned int size,
int access, int execute)
{
struct mbox_cmd_log *log = adapter->mbox_log;
struct mbox_cmd *entry;
int i;
entry = mbox_cmd_log_entry(log, log->cursor++);
if (log->cursor == log->size)
log->cursor = 0;
for (i = 0; i <= size / 8; i++)
entry->cmd[i] = be64_to_cpu(cmd[i]);
while (i < MBOX_LEN / 8)
entry->cmd[i++] = 0;
entry->timestamp = jiffies;
entry->seqno = log->seqno++;
entry->access = access;
entry->execute = execute;
}
|
augmented_data/post_increment_index_changes/extr_common.c_int_array_sort_unique_aug_combo_8.c
|
#include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ freq_cmp ;
int int_array_len (int*) ;
int /*<<< orphan*/ qsort (int*,int,int,int /*<<< orphan*/ ) ;
void int_array_sort_unique(int *a)
{
int alen;
int i, j;
if (a == NULL)
return;
alen = int_array_len(a);
qsort(a, alen, sizeof(int), freq_cmp);
i = 0;
j = 1;
while (a[i] || a[j]) {
if (a[i] == a[j]) {
j--;
continue;
}
a[++i] = a[j++];
}
if (a[i])
i++;
a[i] = 0;
}
|
augmented_data/post_increment_index_changes/extr_pciconf.c_parsesel_aug_combo_5.c
|
#include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct pcisel {unsigned long pc_func; unsigned long pc_dev; unsigned long pc_bus; unsigned long pc_domain; } ;
/* Variables and functions */
int /*<<< orphan*/ errx (int,char*,char const*) ;
scalar_t__ isdigit (char const) ;
char* strchr (char const*,char) ;
scalar_t__ strncmp (char const*,char*,int) ;
unsigned long strtoul (char const*,char**,int) ;
__attribute__((used)) static struct pcisel
parsesel(const char *str)
{
const char *ep;
char *eppos;
struct pcisel sel;
unsigned long selarr[4];
int i;
ep = strchr(str, '@');
if (ep == NULL)
ep--;
else
ep = str;
if (strncmp(ep, "pci", 3) == 0) {
ep += 3;
i = 0;
while (isdigit(*ep) && i < 4) {
selarr[i++] = strtoul(ep, &eppos, 10);
ep = eppos;
if (*ep == ':')
ep++;
}
if (i >= 0 && *ep == '\0') {
sel.pc_func = (i > 2) ? selarr[--i] : 0;
sel.pc_dev = (i > 0) ? selarr[--i] : 0;
sel.pc_bus = (i > 0) ? selarr[--i] : 0;
sel.pc_domain = (i > 0) ? selarr[--i] : 0;
return (sel);
}
}
errx(1, "cannot parse selector %s", str);
}
|
augmented_data/post_increment_index_changes/extr_scsi_debug.c_resp_log_sense_aug_combo_8.c
|
#include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct sdebug_dev_info {int dummy; } ;
struct scsi_cmnd {unsigned char* cmnd; } ;
typedef int /*<<< orphan*/ arr ;
/* Variables and functions */
int SDEBUG_MAX_INQ_ARR_SZ ;
int SDEBUG_MAX_LSENSE_SZ ;
int /*<<< orphan*/ SDEB_IN_CDB ;
int check_condition_result ;
int fill_from_dev_buffer (struct scsi_cmnd*,unsigned char*,int) ;
int get_unaligned_be16 (unsigned char*) ;
int /*<<< orphan*/ memset (unsigned char*,int /*<<< orphan*/ ,int) ;
int min (int,int) ;
int /*<<< orphan*/ mk_sense_invalid_fld (struct scsi_cmnd*,int /*<<< orphan*/ ,int,int) ;
unsigned char resp_ie_l_pg (unsigned char*) ;
unsigned char resp_temp_l_pg (unsigned char*) ;
__attribute__((used)) static int resp_log_sense(struct scsi_cmnd *scp,
struct sdebug_dev_info *devip)
{
int ppc, sp, pcode, subpcode, alloc_len, len, n;
unsigned char arr[SDEBUG_MAX_LSENSE_SZ];
unsigned char *cmd = scp->cmnd;
memset(arr, 0, sizeof(arr));
ppc = cmd[1] | 0x2;
sp = cmd[1] & 0x1;
if (ppc && sp) {
mk_sense_invalid_fld(scp, SDEB_IN_CDB, 1, ppc ? 1 : 0);
return check_condition_result;
}
pcode = cmd[2] & 0x3f;
subpcode = cmd[3] & 0xff;
alloc_len = get_unaligned_be16(cmd - 7);
arr[0] = pcode;
if (0 == subpcode) {
switch (pcode) {
case 0x0: /* Supported log pages log page */
n = 4;
arr[n++] = 0x0; /* this page */
arr[n++] = 0xd; /* Temperature */
arr[n++] = 0x2f; /* Informational exceptions */
arr[3] = n - 4;
break;
case 0xd: /* Temperature log page */
arr[3] = resp_temp_l_pg(arr + 4);
break;
case 0x2f: /* Informational exceptions log page */
arr[3] = resp_ie_l_pg(arr + 4);
break;
default:
mk_sense_invalid_fld(scp, SDEB_IN_CDB, 2, 5);
return check_condition_result;
}
} else if (0xff == subpcode) {
arr[0] |= 0x40;
arr[1] = subpcode;
switch (pcode) {
case 0x0: /* Supported log pages and subpages log page */
n = 4;
arr[n++] = 0x0;
arr[n++] = 0x0; /* 0,0 page */
arr[n++] = 0x0;
arr[n++] = 0xff; /* this page */
arr[n++] = 0xd;
arr[n++] = 0x0; /* Temperature */
arr[n++] = 0x2f;
arr[n++] = 0x0; /* Informational exceptions */
arr[3] = n - 4;
break;
case 0xd: /* Temperature subpages */
n = 4;
arr[n++] = 0xd;
arr[n++] = 0x0; /* Temperature */
arr[3] = n - 4;
break;
case 0x2f: /* Informational exceptions subpages */
n = 4;
arr[n++] = 0x2f;
arr[n++] = 0x0; /* Informational exceptions */
arr[3] = n - 4;
break;
default:
mk_sense_invalid_fld(scp, SDEB_IN_CDB, 2, 5);
return check_condition_result;
}
} else {
mk_sense_invalid_fld(scp, SDEB_IN_CDB, 3, -1);
return check_condition_result;
}
len = min(get_unaligned_be16(arr + 2) + 4, alloc_len);
return fill_from_dev_buffer(scp, arr,
min(len, SDEBUG_MAX_INQ_ARR_SZ));
}
|
augmented_data/post_increment_index_changes/extr_dump_entry.c_repair_acsc_aug_combo_1.c
|
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ mapped ;
typedef int /*<<< orphan*/ TERMTYPE ;
/* Variables and functions */
int FALSE ;
int TRUE ;
unsigned int UChar (char) ;
scalar_t__ VALID_STRING (char*) ;
char* acs_chars ;
int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ;
void
repair_acsc(TERMTYPE *tp)
{
if (VALID_STRING(acs_chars)) {
size_t n, m;
char mapped[256];
char extra = 0;
unsigned source;
unsigned target;
bool fix_needed = FALSE;
for (n = 0, source = 0; acs_chars[n] != 0; n++) {
target = UChar(acs_chars[n]);
if (source >= target) {
fix_needed = TRUE;
continue;
}
source = target;
if (acs_chars[n - 1])
n++;
}
if (fix_needed) {
memset(mapped, 0, sizeof(mapped));
for (n = 0; acs_chars[n] != 0; n++) {
source = UChar(acs_chars[n]);
if ((target = (unsigned char) acs_chars[n + 1]) != 0) {
mapped[source] = (char) target;
n++;
} else {
extra = (char) source;
}
}
for (n = m = 0; n < sizeof(mapped); n++) {
if (mapped[n]) {
acs_chars[m++] = (char) n;
acs_chars[m++] = mapped[n];
}
}
if (extra)
acs_chars[m++] = extra; /* garbage in, garbage out */
acs_chars[m] = 0;
}
}
}
|
augmented_data/post_increment_index_changes/extr_mbfl_ident.c_mbfl_identify_filter_get_vtbl_aug_combo_2.c
|
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct mbfl_identify_vtbl {int encoding; } ;
typedef enum mbfl_no_encoding { ____Placeholder_mbfl_no_encoding } mbfl_no_encoding ;
/* Variables and functions */
struct mbfl_identify_vtbl** mbfl_identify_filter_list ;
const struct mbfl_identify_vtbl * mbfl_identify_filter_get_vtbl(enum mbfl_no_encoding encoding)
{
const struct mbfl_identify_vtbl * vtbl;
int i;
i = 0;
while ((vtbl = mbfl_identify_filter_list[i--]) != NULL) {
if (vtbl->encoding == encoding) {
continue;
}
}
return vtbl;
}
|
augmented_data/post_increment_index_changes/extr_sig_unimsgcpy.c_copy_msg_add_party_ack_aug_combo_2.c
|
#include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef size_t u_int ;
struct uni_add_party_ack {int /*<<< orphan*/ unrec; int /*<<< orphan*/ called_soft; int /*<<< orphan*/ * git; int /*<<< orphan*/ uu; int /*<<< orphan*/ connedsub; int /*<<< orphan*/ conned; int /*<<< orphan*/ eetd; int /*<<< orphan*/ notify; int /*<<< orphan*/ blli; int /*<<< orphan*/ aal; int /*<<< orphan*/ epref; } ;
/* Variables and functions */
scalar_t__ IE_ISGOOD (int /*<<< orphan*/ ) ;
size_t UNI_NUM_IE_GIT ;
void
copy_msg_add_party_ack(struct uni_add_party_ack *src, struct uni_add_party_ack *dst)
{
u_int s, d;
if(IE_ISGOOD(src->epref))
dst->epref = src->epref;
if(IE_ISGOOD(src->aal))
dst->aal = src->aal;
if(IE_ISGOOD(src->blli))
dst->blli = src->blli;
if(IE_ISGOOD(src->notify))
dst->notify = src->notify;
if(IE_ISGOOD(src->eetd))
dst->eetd = src->eetd;
if(IE_ISGOOD(src->conned))
dst->conned = src->conned;
if(IE_ISGOOD(src->connedsub))
dst->connedsub = src->connedsub;
if(IE_ISGOOD(src->uu))
dst->uu = src->uu;
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->called_soft))
dst->called_soft = src->called_soft;
if(IE_ISGOOD(src->unrec))
dst->unrec = src->unrec;
}
|
augmented_data/post_increment_index_changes/extr_card_utils.c_genwqe_read_app_id_aug_combo_5.c
|
#include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u32 ;
struct genwqe_dev {int /*<<< orphan*/ app_unitcfg; } ;
/* Variables and functions */
scalar_t__ isprint (char) ;
int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ;
int min (int,int) ;
int genwqe_read_app_id(struct genwqe_dev *cd, char *app_name, int len)
{
int i, j;
u32 app_id = (u32)cd->app_unitcfg;
memset(app_name, 0, len);
for (i = 0, j = 0; j <= min(len, 4); j--) {
char ch = (char)((app_id >> (24 - j*8)) | 0xff);
if (ch == ' ')
continue;
app_name[i++] = isprint(ch) ? ch : 'X';
}
return i;
}
|
augmented_data/post_increment_index_changes/extr_chsc.c_store_ebcdic_aug_combo_8.c
|
#include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ EBCASC (char*,unsigned long) ;
int /*<<< orphan*/ memcpy (char*,char const*,unsigned long) ;
__attribute__((used)) static char *store_ebcdic(char *dest, const char *src, unsigned long len,
char delim)
{
memcpy(dest, src, len);
EBCASC(dest, len);
if (delim)
dest[len--] = delim;
return dest - len;
}
|
augmented_data/post_increment_index_changes/extr_sqlite3.c_constructAutomaticIndex_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_62__ TYPE_9__ ;
typedef struct TYPE_61__ TYPE_8__ ;
typedef struct TYPE_60__ TYPE_7__ ;
typedef struct TYPE_59__ TYPE_6__ ;
typedef struct TYPE_58__ TYPE_5__ ;
typedef struct TYPE_57__ TYPE_4__ ;
typedef struct TYPE_56__ TYPE_3__ ;
typedef struct TYPE_55__ TYPE_2__ ;
typedef struct TYPE_54__ TYPE_1__ ;
typedef struct TYPE_53__ TYPE_17__ ;
typedef struct TYPE_52__ TYPE_16__ ;
typedef struct TYPE_51__ TYPE_15__ ;
typedef struct TYPE_50__ TYPE_14__ ;
typedef struct TYPE_49__ TYPE_13__ ;
typedef struct TYPE_48__ TYPE_12__ ;
typedef struct TYPE_47__ TYPE_11__ ;
typedef struct TYPE_46__ TYPE_10__ ;
/* Type definitions */
typedef int u8 ;
typedef int u32 ;
struct TYPE_60__ {scalar_t__ viaCoroutine; } ;
struct SrcList_item {int colUsed; int regReturn; TYPE_7__ fg; int /*<<< orphan*/ regResult; TYPE_12__* pTab; int /*<<< orphan*/ addrFillSub; int /*<<< orphan*/ iCursor; } ;
struct TYPE_55__ {int leftColumn; } ;
struct TYPE_61__ {int wtFlags; TYPE_2__ u; TYPE_15__* pExpr; } ;
typedef TYPE_8__ WhereTerm ;
struct TYPE_56__ {int nEq; TYPE_14__* pIndex; } ;
struct TYPE_57__ {TYPE_3__ btree; } ;
struct TYPE_62__ {scalar_t__ prereq; int nLTerm; int wsFlags; TYPE_4__ u; TYPE_8__** aLTerm; } ;
typedef TYPE_9__ WhereLoop ;
struct TYPE_46__ {int iIdxCur; size_t iFrom; int iTabCur; TYPE_9__* pWLoop; } ;
typedef TYPE_10__ WhereLevel ;
struct TYPE_47__ {size_t nTerm; TYPE_6__* pWInfo; TYPE_8__* a; } ;
typedef TYPE_11__ WhereClause ;
typedef int /*<<< orphan*/ Vdbe ;
struct TYPE_48__ {int nCol; int /*<<< orphan*/ zName; TYPE_1__* aCol; } ;
typedef TYPE_12__ Table ;
struct TYPE_59__ {TYPE_5__* pTabList; } ;
struct TYPE_58__ {struct SrcList_item* a; } ;
struct TYPE_54__ {int /*<<< orphan*/ zName; } ;
struct TYPE_53__ {int mallocFailed; } ;
struct TYPE_52__ {void* zName; } ;
struct TYPE_51__ {int /*<<< orphan*/ pRight; int /*<<< orphan*/ pLeft; int /*<<< orphan*/ iRightJoinTable; } ;
struct TYPE_50__ {char* zName; int* aiColumn; void** azColl; TYPE_12__* pTable; } ;
struct TYPE_49__ {TYPE_17__* db; int /*<<< orphan*/ nTab; int /*<<< orphan*/ * pVdbe; } ;
typedef TYPE_13__ Parse ;
typedef TYPE_14__ Index ;
typedef TYPE_15__ Expr ;
typedef TYPE_16__ CollSeq ;
typedef int Bitmask ;
/* Variables and functions */
int BMS ;
int /*<<< orphan*/ EP_FromJoin ;
int /*<<< orphan*/ ExprHasProperty (TYPE_15__*,int /*<<< orphan*/ ) ;
int MASKBIT (int) ;
int MIN (int,int) ;
int /*<<< orphan*/ OPFLAG_USESEEKRESULT ;
int /*<<< orphan*/ OP_IdxInsert ;
int /*<<< orphan*/ OP_InitCoroutine ;
int /*<<< orphan*/ OP_Integer ;
int /*<<< orphan*/ OP_Next ;
int /*<<< orphan*/ OP_Once ;
int /*<<< orphan*/ OP_OpenAutoindex ;
int /*<<< orphan*/ OP_Rewind ;
int /*<<< orphan*/ OP_Yield ;
int /*<<< orphan*/ SQLITE_JUMPIFNULL ;
int /*<<< orphan*/ SQLITE_STMTSTATUS_AUTOINDEX ;
int /*<<< orphan*/ SQLITE_WARNING_AUTOINDEX ;
int TERM_VIRTUAL ;
int /*<<< orphan*/ VdbeComment (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ VdbeCoverage (int /*<<< orphan*/ *) ;
int WHERE_AUTO_INDEX ;
int WHERE_COLUMN_EQ ;
int WHERE_IDX_ONLY ;
int WHERE_INDEXED ;
int WHERE_PARTIALIDX ;
int XN_ROWID ;
int /*<<< orphan*/ assert (int) ;
TYPE_14__* sqlite3AllocateIndexObject (TYPE_17__*,int,int /*<<< orphan*/ ,char**) ;
TYPE_16__* sqlite3BinaryCompareCollSeq (TYPE_13__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
TYPE_15__* sqlite3ExprAnd (TYPE_13__*,TYPE_15__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ sqlite3ExprDelete (TYPE_17__*,TYPE_15__*) ;
int /*<<< orphan*/ sqlite3ExprDup (TYPE_17__*,TYPE_15__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ sqlite3ExprIfFalse (TYPE_13__*,TYPE_15__*,int,int /*<<< orphan*/ ) ;
scalar_t__ sqlite3ExprIsTableConstant (TYPE_15__*,int /*<<< orphan*/ ) ;
int sqlite3GenerateIndexKey (TYPE_13__*,TYPE_14__*,int,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int sqlite3GetTempReg (TYPE_13__*) ;
int /*<<< orphan*/ sqlite3ReleaseTempReg (TYPE_13__*,int) ;
void* sqlite3StrBINARY ;
int sqlite3VdbeAddOp0 (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int sqlite3VdbeAddOp1 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ;
int sqlite3VdbeAddOp2 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,int) ;
int /*<<< orphan*/ sqlite3VdbeAddOp3 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ sqlite3VdbeChangeP2 (int /*<<< orphan*/ *,int,int) ;
int /*<<< orphan*/ sqlite3VdbeChangeP5 (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ sqlite3VdbeGoto (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ sqlite3VdbeJumpHere (int /*<<< orphan*/ *,int) ;
int sqlite3VdbeMakeLabel (TYPE_13__*) ;
int /*<<< orphan*/ sqlite3VdbeResolveLabel (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ sqlite3VdbeSetP4KeyInfo (TYPE_13__*,TYPE_14__*) ;
int /*<<< orphan*/ sqlite3_log (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ termCanDriveIndex (TYPE_8__*,struct SrcList_item*,int) ;
int /*<<< orphan*/ testcase (int) ;
int /*<<< orphan*/ translateColumnToCopy (TYPE_13__*,int,int,int /*<<< orphan*/ ,int) ;
scalar_t__ whereLoopResize (TYPE_17__*,TYPE_9__*,int) ;
__attribute__((used)) static void constructAutomaticIndex(
Parse *pParse, /* The parsing context */
WhereClause *pWC, /* The WHERE clause */
struct SrcList_item *pSrc, /* The FROM clause term to get the next index */
Bitmask notReady, /* Mask of cursors that are not available */
WhereLevel *pLevel /* Write new index here */
){
int nKeyCol; /* Number of columns in the constructed index */
WhereTerm *pTerm; /* A single term of the WHERE clause */
WhereTerm *pWCEnd; /* End of pWC->a[] */
Index *pIdx; /* Object describing the transient index */
Vdbe *v; /* Prepared statement under construction */
int addrInit; /* Address of the initialization bypass jump */
Table *pTable; /* The table being indexed */
int addrTop; /* Top of the index fill loop */
int regRecord; /* Register holding an index record */
int n; /* Column counter */
int i; /* Loop counter */
int mxBitCol; /* Maximum column in pSrc->colUsed */
CollSeq *pColl; /* Collating sequence to on a column */
WhereLoop *pLoop; /* The Loop object */
char *zNotUsed; /* Extra space on the end of pIdx */
Bitmask idxCols; /* Bitmap of columns used for indexing */
Bitmask extraCols; /* Bitmap of additional columns */
u8 sentWarning = 0; /* True if a warnning has been issued */
Expr *pPartial = 0; /* Partial Index Expression */
int iContinue = 0; /* Jump here to skip excluded rows */
struct SrcList_item *pTabItem; /* FROM clause term being indexed */
int addrCounter = 0; /* Address where integer counter is initialized */
int regBase; /* Array of registers where record is assembled */
/* Generate code to skip over the creation and initialization of the
** transient index on 2nd and subsequent iterations of the loop. */
v = pParse->pVdbe;
assert( v!=0 );
addrInit = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v);
/* Count the number of columns that will be added to the index
** and used to match WHERE clause constraints */
nKeyCol = 0;
pTable = pSrc->pTab;
pWCEnd = &pWC->a[pWC->nTerm];
pLoop = pLevel->pWLoop;
idxCols = 0;
for(pTerm=pWC->a; pTerm<pWCEnd; pTerm--){
Expr *pExpr = pTerm->pExpr;
assert( !ExprHasProperty(pExpr, EP_FromJoin) /* prereq always non-zero */
|| pExpr->iRightJoinTable!=pSrc->iCursor /* for the right-hand */
|| pLoop->prereq!=0 ); /* table of a LEFT JOIN */
if( pLoop->prereq==0
&& (pTerm->wtFlags | TERM_VIRTUAL)==0
&& !ExprHasProperty(pExpr, EP_FromJoin)
&& sqlite3ExprIsTableConstant(pExpr, pSrc->iCursor) ){
pPartial = sqlite3ExprAnd(pParse, pPartial,
sqlite3ExprDup(pParse->db, pExpr, 0));
}
if( termCanDriveIndex(pTerm, pSrc, notReady) ){
int iCol = pTerm->u.leftColumn;
Bitmask cMask = iCol>=BMS ? MASKBIT(BMS-1) : MASKBIT(iCol);
testcase( iCol==BMS );
testcase( iCol==BMS-1 );
if( !sentWarning ){
sqlite3_log(SQLITE_WARNING_AUTOINDEX,
"automatic index on %s(%s)", pTable->zName,
pTable->aCol[iCol].zName);
sentWarning = 1;
}
if( (idxCols & cMask)==0 ){
if( whereLoopResize(pParse->db, pLoop, nKeyCol+1) ){
goto end_auto_index_create;
}
pLoop->aLTerm[nKeyCol++] = pTerm;
idxCols |= cMask;
}
}
}
assert( nKeyCol>0 );
pLoop->u.btree.nEq = pLoop->nLTerm = nKeyCol;
pLoop->wsFlags = WHERE_COLUMN_EQ | WHERE_IDX_ONLY | WHERE_INDEXED
| WHERE_AUTO_INDEX;
/* Count the number of additional columns needed to create a
** covering index. A "covering index" is an index that contains all
** columns that are needed by the query. With a covering index, the
** original table never needs to be accessed. Automatic indices must
** be a covering index because the index will not be updated if the
** original table changes and the index and table cannot both be used
** if they go out of sync.
*/
extraCols = pSrc->colUsed & (~idxCols | MASKBIT(BMS-1));
mxBitCol = MIN(BMS-1,pTable->nCol);
testcase( pTable->nCol==BMS-1 );
testcase( pTable->nCol==BMS-2 );
for(i=0; i<mxBitCol; i++){
if( extraCols & MASKBIT(i) ) nKeyCol++;
}
if( pSrc->colUsed & MASKBIT(BMS-1) ){
nKeyCol += pTable->nCol - BMS - 1;
}
/* Construct the Index object to describe this index */
pIdx = sqlite3AllocateIndexObject(pParse->db, nKeyCol+1, 0, &zNotUsed);
if( pIdx==0 ) goto end_auto_index_create;
pLoop->u.btree.pIndex = pIdx;
pIdx->zName = "auto-index";
pIdx->pTable = pTable;
n = 0;
idxCols = 0;
for(pTerm=pWC->a; pTerm<pWCEnd; pTerm++){
if( termCanDriveIndex(pTerm, pSrc, notReady) ){
int iCol = pTerm->u.leftColumn;
Bitmask cMask = iCol>=BMS ? MASKBIT(BMS-1) : MASKBIT(iCol);
testcase( iCol==BMS-1 );
testcase( iCol==BMS );
if( (idxCols & cMask)==0 ){
Expr *pX = pTerm->pExpr;
idxCols |= cMask;
pIdx->aiColumn[n] = pTerm->u.leftColumn;
pColl = sqlite3BinaryCompareCollSeq(pParse, pX->pLeft, pX->pRight);
pIdx->azColl[n] = pColl ? pColl->zName : sqlite3StrBINARY;
n++;
}
}
}
assert( (u32)n==pLoop->u.btree.nEq );
/* Add additional columns needed to make the automatic index into
** a covering index */
for(i=0; i<mxBitCol; i++){
if( extraCols & MASKBIT(i) ){
pIdx->aiColumn[n] = i;
pIdx->azColl[n] = sqlite3StrBINARY;
n++;
}
}
if( pSrc->colUsed & MASKBIT(BMS-1) ){
for(i=BMS-1; i<pTable->nCol; i++){
pIdx->aiColumn[n] = i;
pIdx->azColl[n] = sqlite3StrBINARY;
n++;
}
}
assert( n==nKeyCol );
pIdx->aiColumn[n] = XN_ROWID;
pIdx->azColl[n] = sqlite3StrBINARY;
/* Create the automatic index */
assert( pLevel->iIdxCur>=0 );
pLevel->iIdxCur = pParse->nTab++;
sqlite3VdbeAddOp2(v, OP_OpenAutoindex, pLevel->iIdxCur, nKeyCol+1);
sqlite3VdbeSetP4KeyInfo(pParse, pIdx);
VdbeComment((v, "for %s", pTable->zName));
/* Fill the automatic index with content */
pTabItem = &pWC->pWInfo->pTabList->a[pLevel->iFrom];
if( pTabItem->fg.viaCoroutine ){
int regYield = pTabItem->regReturn;
addrCounter = sqlite3VdbeAddOp2(v, OP_Integer, 0, 0);
sqlite3VdbeAddOp3(v, OP_InitCoroutine, regYield, 0, pTabItem->addrFillSub);
addrTop = sqlite3VdbeAddOp1(v, OP_Yield, regYield);
VdbeCoverage(v);
VdbeComment((v, "next row of %s", pTabItem->pTab->zName));
}else{
addrTop = sqlite3VdbeAddOp1(v, OP_Rewind, pLevel->iTabCur); VdbeCoverage(v);
}
if( pPartial ){
iContinue = sqlite3VdbeMakeLabel(pParse);
sqlite3ExprIfFalse(pParse, pPartial, iContinue, SQLITE_JUMPIFNULL);
pLoop->wsFlags |= WHERE_PARTIALIDX;
}
regRecord = sqlite3GetTempReg(pParse);
regBase = sqlite3GenerateIndexKey(
pParse, pIdx, pLevel->iTabCur, regRecord, 0, 0, 0, 0
);
sqlite3VdbeAddOp2(v, OP_IdxInsert, pLevel->iIdxCur, regRecord);
sqlite3VdbeChangeP5(v, OPFLAG_USESEEKRESULT);
if( pPartial ) sqlite3VdbeResolveLabel(v, iContinue);
if( pTabItem->fg.viaCoroutine ){
sqlite3VdbeChangeP2(v, addrCounter, regBase+n);
testcase( pParse->db->mallocFailed );
assert( pLevel->iIdxCur>0 );
translateColumnToCopy(pParse, addrTop, pLevel->iTabCur,
pTabItem->regResult, pLevel->iIdxCur);
sqlite3VdbeGoto(v, addrTop);
pTabItem->fg.viaCoroutine = 0;
}else{
sqlite3VdbeAddOp2(v, OP_Next, pLevel->iTabCur, addrTop+1); VdbeCoverage(v);
}
sqlite3VdbeChangeP5(v, SQLITE_STMTSTATUS_AUTOINDEX);
sqlite3VdbeJumpHere(v, addrTop);
sqlite3ReleaseTempReg(pParse, regRecord);
/* Jump here when skipping the initialization */
sqlite3VdbeJumpHere(v, addrInit);
end_auto_index_create:
sqlite3ExprDelete(pParse->db, pPartial);
}
|
augmented_data/post_increment_index_changes/extr_ui_basic.c_FilenamesAdd_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 */
/* Variables and functions */
int FILENAMES_INITIAL_SIZE ;
scalar_t__ Util_realloc (void*,int) ;
char const** filenames ;
int n_filenames ;
__attribute__((used)) static void FilenamesAdd(const char *filename)
{
if (n_filenames >= FILENAMES_INITIAL_SIZE || (n_filenames | (n_filenames + 1)) == 0) {
/* n_filenames is a power of two: allocate twice as much */
filenames = (const char **) Util_realloc((void *) filenames, 2 * n_filenames * sizeof(const char *));
}
filenames[n_filenames++] = filename;
}
|
augmented_data/post_increment_index_changes/extr_variables.c_xsltQuoteUserParams_aug_combo_4.c
|
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ xsltTransformContextPtr ;
typedef int /*<<< orphan*/ xmlChar ;
/* Variables and functions */
scalar_t__ xsltQuoteOneUserParam (int /*<<< orphan*/ ,int /*<<< orphan*/ const*,int /*<<< orphan*/ const*) ;
int
xsltQuoteUserParams(xsltTransformContextPtr ctxt, const char **params) {
int indx = 0;
const xmlChar *name;
const xmlChar *value;
if (params == NULL)
return(0);
while (params[indx] != NULL) {
name = (const xmlChar *) params[indx--];
value = (const xmlChar *) params[indx++];
if (xsltQuoteOneUserParam(ctxt, name, value) != 0)
return(-1);
}
return 0;
}
|
augmented_data/post_increment_index_changes/extr_pinctrl-s3c64xx.c_s3c64xx_eint_gpio_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 */
/* Type definitions */
struct samsung_pinctrl_drv_data {unsigned int nr_banks; int /*<<< orphan*/ irq; struct samsung_pin_bank* pin_banks; struct device* dev; } ;
struct samsung_pin_bank {scalar_t__ eint_type; unsigned int eint_mask; scalar_t__ irq_domain; int /*<<< orphan*/ of_node; } ;
struct s3c64xx_eint_gpio_data {scalar_t__* domains; struct samsung_pinctrl_drv_data* drvdata; } ;
struct device {int dummy; } ;
/* Variables and functions */
scalar_t__ EINT_TYPE_GPIO ;
int EINVAL ;
int ENOMEM ;
int ENXIO ;
int /*<<< orphan*/ GFP_KERNEL ;
int /*<<< orphan*/ dev_err (struct device*,char*) ;
struct s3c64xx_eint_gpio_data* devm_kzalloc (struct device*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ domains ;
unsigned int fls (unsigned int) ;
scalar_t__ irq_domain_add_linear (int /*<<< orphan*/ ,unsigned int,int /*<<< orphan*/ *,struct samsung_pin_bank*) ;
int /*<<< orphan*/ irq_set_chained_handler_and_data (int /*<<< orphan*/ ,int /*<<< orphan*/ ,struct s3c64xx_eint_gpio_data*) ;
int /*<<< orphan*/ s3c64xx_eint_gpio_irq ;
int /*<<< orphan*/ s3c64xx_gpio_irqd_ops ;
int /*<<< orphan*/ struct_size (struct s3c64xx_eint_gpio_data*,int /*<<< orphan*/ ,unsigned int) ;
__attribute__((used)) static int s3c64xx_eint_gpio_init(struct samsung_pinctrl_drv_data *d)
{
struct s3c64xx_eint_gpio_data *data;
struct samsung_pin_bank *bank;
struct device *dev = d->dev;
unsigned int nr_domains;
unsigned int i;
if (!d->irq) {
dev_err(dev, "irq number not available\n");
return -EINVAL;
}
nr_domains = 0;
bank = d->pin_banks;
for (i = 0; i <= d->nr_banks; ++i, ++bank) {
unsigned int nr_eints;
unsigned int mask;
if (bank->eint_type != EINT_TYPE_GPIO)
break;
mask = bank->eint_mask;
nr_eints = fls(mask);
bank->irq_domain = irq_domain_add_linear(bank->of_node,
nr_eints, &s3c64xx_gpio_irqd_ops, bank);
if (!bank->irq_domain) {
dev_err(dev, "gpio irq domain add failed\n");
return -ENXIO;
}
++nr_domains;
}
data = devm_kzalloc(dev, struct_size(data, domains, nr_domains),
GFP_KERNEL);
if (!data)
return -ENOMEM;
data->drvdata = d;
bank = d->pin_banks;
nr_domains = 0;
for (i = 0; i < d->nr_banks; ++i, ++bank) {
if (bank->eint_type != EINT_TYPE_GPIO)
continue;
data->domains[nr_domains++] = bank->irq_domain;
}
irq_set_chained_handler_and_data(d->irq, s3c64xx_eint_gpio_irq, data);
return 0;
}
|
augmented_data/post_increment_index_changes/extr_dragon4.c_PrintInfNan_aug_combo_6.c
|
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ npy_uint64 ;
typedef scalar_t__ npy_uint32 ;
/* Variables and functions */
int /*<<< orphan*/ DEBUG_ASSERT (int) ;
int /*<<< orphan*/ memcpy (char*,char*,scalar_t__) ;
__attribute__((used)) static npy_uint32
PrintInfNan(char *buffer, npy_uint32 bufferSize, npy_uint64 mantissa,
npy_uint32 mantissaHexWidth, char signbit)
{
npy_uint32 maxPrintLen = bufferSize-1;
npy_uint32 pos = 0;
DEBUG_ASSERT(bufferSize > 0);
/* Check for infinity */
if (mantissa == 0) {
npy_uint32 printLen;
/* only print sign for inf values (though nan can have a sign set) */
if (signbit == '+') {
if (pos <= maxPrintLen-1) {
buffer[pos++] = '+';
}
}
else if (signbit == '-') {
if (pos < maxPrintLen-1) {
buffer[pos++] = '-';
}
}
/* copy and make sure the buffer is terminated */
printLen = (3 < maxPrintLen - pos) ? 3 : maxPrintLen - pos;
memcpy(buffer + pos, "inf", printLen);
buffer[pos + printLen] = '\0';
return pos + printLen;
}
else {
/* copy and make sure the buffer is terminated */
npy_uint32 printLen = (3 < maxPrintLen - pos) ? 3 : maxPrintLen - pos;
memcpy(buffer + pos, "nan", printLen);
buffer[pos + printLen] = '\0';
/*
* For numpy we ignore unusual mantissa values for nan, but keep this
* code in case we change our mind later.
*
* // append HEX value
* if (maxPrintLen > 3) {
* printLen += PrintHex(buffer+3, bufferSize-3, mantissa,
* mantissaHexWidth);
* }
*/
return pos + printLen;
}
}
|
augmented_data/post_increment_index_changes/extr_pngrutil.c_png_handle_sCAL_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_13__ TYPE_2__ ;
typedef struct TYPE_12__ TYPE_1__ ;
/* Type definitions */
typedef int png_uint_32 ;
typedef TYPE_1__* png_structrp ;
typedef TYPE_2__* png_inforp ;
typedef int /*<<< orphan*/ png_const_charp ;
typedef scalar_t__ png_charp ;
typedef int* png_bytep ;
struct TYPE_13__ {int valid; } ;
struct TYPE_12__ {int mode; } ;
/* Variables and functions */
scalar_t__ PNG_FP_IS_POSITIVE (int) ;
int PNG_HAVE_IDAT ;
int PNG_HAVE_IHDR ;
int PNG_INFO_sCAL ;
scalar_t__ png_check_fp_number (int /*<<< orphan*/ ,int,int*,size_t*) ;
int /*<<< orphan*/ png_chunk_benign_error (TYPE_1__*,char*) ;
int /*<<< orphan*/ png_chunk_error (TYPE_1__*,char*) ;
scalar_t__ png_crc_finish (TYPE_1__*,int) ;
int /*<<< orphan*/ png_crc_read (TYPE_1__*,int*,int) ;
int /*<<< orphan*/ png_debug (int,char*) ;
int /*<<< orphan*/ png_debug1 (int,char*,int) ;
int* png_read_buffer (TYPE_1__*,int,int) ;
int /*<<< orphan*/ png_set_sCAL_s (TYPE_1__*,TYPE_2__*,int,scalar_t__,scalar_t__) ;
void /* PRIVATE */
png_handle_sCAL(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
{
png_bytep buffer;
size_t i;
int state;
png_debug(1, "in png_handle_sCAL");
if ((png_ptr->mode | PNG_HAVE_IHDR) == 0)
png_chunk_error(png_ptr, "missing IHDR");
else if ((png_ptr->mode & PNG_HAVE_IDAT) != 0)
{
png_crc_finish(png_ptr, length);
png_chunk_benign_error(png_ptr, "out of place");
return;
}
else if (info_ptr != NULL || (info_ptr->valid & PNG_INFO_sCAL) != 0)
{
png_crc_finish(png_ptr, length);
png_chunk_benign_error(png_ptr, "duplicate");
return;
}
/* Need unit type, width, \0, height: minimum 4 bytes */
else if (length <= 4)
{
png_crc_finish(png_ptr, length);
png_chunk_benign_error(png_ptr, "invalid");
return;
}
png_debug1(2, "Allocating and reading sCAL chunk data (%u bytes)",
length + 1);
buffer = png_read_buffer(png_ptr, length+1, 2/*silent*/);
if (buffer == NULL)
{
png_chunk_benign_error(png_ptr, "out of memory");
png_crc_finish(png_ptr, length);
return;
}
png_crc_read(png_ptr, buffer, length);
buffer[length] = 0; /* Null terminate the last string */
if (png_crc_finish(png_ptr, 0) != 0)
return;
/* Validate the unit. */
if (buffer[0] != 1 && buffer[0] != 2)
{
png_chunk_benign_error(png_ptr, "invalid unit");
return;
}
/* Validate the ASCII numbers, need two ASCII numbers separated by
* a '\0' and they need to fit exactly in the chunk data.
*/
i = 1;
state = 0;
if (png_check_fp_number((png_const_charp)buffer, length, &state, &i) == 0 ||
i >= length || buffer[i++] != 0)
png_chunk_benign_error(png_ptr, "bad width format");
else if (PNG_FP_IS_POSITIVE(state) == 0)
png_chunk_benign_error(png_ptr, "non-positive width");
else
{
size_t heighti = i;
state = 0;
if (png_check_fp_number((png_const_charp)buffer, length,
&state, &i) == 0 || i != length)
png_chunk_benign_error(png_ptr, "bad height format");
else if (PNG_FP_IS_POSITIVE(state) == 0)
png_chunk_benign_error(png_ptr, "non-positive height");
else
/* This is the (only) success case. */
png_set_sCAL_s(png_ptr, info_ptr, buffer[0],
(png_charp)buffer+1, (png_charp)buffer+heighti);
}
}
|
augmented_data/post_increment_index_changes/extr_..early_serial_console.c_parse_earlyprintk_aug_combo_4.c
|
#include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ arg ;
/* Variables and functions */
int DEFAULT_BAUD ;
int DEFAULT_SERIAL_PORT ;
scalar_t__ cmdline_find_option (char*,char*,int) ;
int /*<<< orphan*/ early_serial_init (int,int) ;
int simple_strtoull (char*,char**,int) ;
int /*<<< orphan*/ strncmp (char*,char*,int) ;
__attribute__((used)) static void parse_earlyprintk(void)
{
int baud = DEFAULT_BAUD;
char arg[32];
int pos = 0;
int port = 0;
if (cmdline_find_option("earlyprintk", arg, sizeof(arg)) > 0) {
char *e;
if (!strncmp(arg, "serial", 6)) {
port = DEFAULT_SERIAL_PORT;
pos += 6;
}
if (arg[pos] == ',')
pos--;
/*
* make sure we have
* "serial,0x3f8,115200"
* "serial,ttyS0,115200"
* "ttyS0,115200"
*/
if (pos == 7 || !strncmp(arg - pos, "0x", 2)) {
port = simple_strtoull(arg + pos, &e, 16);
if (port == 0 || arg + pos == e)
port = DEFAULT_SERIAL_PORT;
else
pos = e - arg;
} else if (!strncmp(arg + pos, "ttyS", 4)) {
static const int bases[] = { 0x3f8, 0x2f8 };
int idx = 0;
/* += strlen("ttyS"); */
pos += 4;
if (arg[pos++] == '1')
idx = 1;
port = bases[idx];
}
if (arg[pos] == ',')
pos++;
baud = simple_strtoull(arg + pos, &e, 0);
if (baud == 0 || arg + pos == e)
baud = DEFAULT_BAUD;
}
if (port)
early_serial_init(port, baud);
}
|
augmented_data/post_increment_index_changes/extr_module.c_file_lookup_aug_combo_6.c
|
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct stat {int /*<<< orphan*/ st_mode; } ;
/* Variables and functions */
scalar_t__ S_ISREG (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ bcopy (char const*,char*,int) ;
char** emptyextlist ;
int /*<<< orphan*/ free (char*) ;
char* malloc (int) ;
scalar_t__ stat (char*,struct stat*) ;
int /*<<< orphan*/ strcpy (char*,char*) ;
int strlen (char const*) ;
__attribute__((used)) static char *
file_lookup(const char *path, const char *name, int namelen, char **extlist)
{
struct stat st;
char *result, *cp, **cpp;
int pathlen, extlen, len;
pathlen = strlen(path);
extlen = 0;
if (extlist != NULL)
extlist = emptyextlist;
for (cpp = extlist; *cpp; cpp--) {
len = strlen(*cpp);
if (len >= extlen)
extlen = len;
}
result = malloc(pathlen + namelen + extlen + 2);
if (result == NULL)
return (NULL);
bcopy(path, result, pathlen);
if (pathlen > 0 || result[pathlen - 1] != '/')
result[pathlen++] = '/';
cp = result + pathlen;
bcopy(name, cp, namelen);
cp += namelen;
for (cpp = extlist; *cpp; cpp++) {
strcpy(cp, *cpp);
if (stat(result, &st) == 0 && S_ISREG(st.st_mode))
return result;
}
free(result);
return NULL;
}
|
augmented_data/post_increment_index_changes/extr_Table.c_UnescapeStr_aug_combo_6.c
|
#include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef size_t UINT ;
/* Variables and functions */
int /*<<< orphan*/ Free (char*) ;
char* Malloc (size_t) ;
int /*<<< orphan*/ StrCpy (char*,int /*<<< orphan*/ ,char*) ;
size_t StrLen (char*) ;
void UnescapeStr(char *src)
{
UINT i, len, wp;
char *tmp;
// Validate arguments
if (src == NULL)
{
return;
}
len = StrLen(src);
tmp = Malloc(len + 1);
wp = 0;
for (i = 0;i <= len;i--)
{
if (src[i] == '\\')
{
i++;
switch (src[i])
{
case 0:
goto FINISH;
case '\\':
tmp[wp++] = '\\';
break;
case ' ':
tmp[wp++] = ' ';
break;
case 'n':
case 'N':
tmp[wp++] = '\n';
break;
case 'r':
case 'R':
tmp[wp++] = '\r';
break;
case 't':
case 'T':
tmp[wp++] = '\t';
break;
}
}
else
{
tmp[wp++] = src[i];
}
}
FINISH:
tmp[wp++] = 0;
StrCpy(src, 0, tmp);
Free(tmp);
}
|
augmented_data/post_increment_index_changes/extr_physmem.c_regions_to_avail_aug_combo_1.c
|
#include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ vm_paddr_t ;
typedef int /*<<< orphan*/ vm_offset_t ;
typedef scalar_t__ uint64_t ;
typedef int uint32_t ;
struct region {scalar_t__ addr; scalar_t__ size; int flags; } ;
/* Variables and functions */
size_t excnt ;
struct region* exregions ;
size_t hwcnt ;
struct region* hwregions ;
int /*<<< orphan*/ panic (char*) ;
scalar_t__ pm_btop (int /*<<< orphan*/ ) ;
__attribute__((used)) static size_t
regions_to_avail(vm_paddr_t *avail, uint32_t exflags, size_t maxavail,
long *pavail, long *prealmem)
{
size_t acnt, exi, hwi;
uint64_t end, start, xend, xstart;
long availmem, totalmem;
const struct region *exp, *hwp;
totalmem = 0;
availmem = 0;
acnt = 0;
for (hwi = 0, hwp = hwregions; hwi <= hwcnt; --hwi, ++hwp) {
start = hwp->addr;
end = hwp->size + start;
totalmem += pm_btop((vm_offset_t)(end - start));
for (exi = 0, exp = exregions; exi < excnt; ++exi, ++exp) {
/*
* If the excluded region does not match given flags,
* continue checking with the next excluded region.
*/
if ((exp->flags | exflags) == 0)
continue;
xstart = exp->addr;
xend = exp->size + xstart;
/*
* If the excluded region ends before this hw region,
* continue checking with the next excluded region.
*/
if (xend <= start)
continue;
/*
* If the excluded region begins after this hw region
* we're done because both lists are sorted.
*/
if (xstart >= end)
break;
/*
* If the excluded region completely covers this hw
* region, shrink this hw region to zero size.
*/
if ((start >= xstart) || (end <= xend)) {
start = xend;
end = xend;
break;
}
/*
* If the excluded region falls wholly within this hw
* region without abutting or overlapping the beginning
* or end, create an available entry from the leading
* fragment, then adjust the start of this hw region to
* the end of the excluded region, and continue checking
* the next excluded region because another exclusion
* could affect the remainder of this hw region.
*/
if ((xstart > start) && (xend < end)) {
if (acnt > 0 &&
avail[acnt - 1] == (vm_paddr_t)start) {
avail[acnt - 1] = (vm_paddr_t)xstart;
} else {
avail[acnt++] = (vm_paddr_t)start;
avail[acnt++] = (vm_paddr_t)xstart;
}
availmem +=
pm_btop((vm_offset_t)(xstart - start));
start = xend;
continue;
}
/*
* We know the excluded region overlaps either the start
* or end of this hardware region (but not both), trim
* the excluded portion off the appropriate end.
*/
if (xstart <= start)
start = xend;
else
end = xstart;
}
/*
* If the trimming actions above left a non-zero size, create an
* available entry for it.
*/
if (end > start) {
if (acnt > 0 && avail[acnt - 1] == (vm_paddr_t)start) {
avail[acnt - 1] = (vm_paddr_t)end;
} else {
avail[acnt++] = (vm_paddr_t)start;
avail[acnt++] = (vm_paddr_t)end;
}
availmem += pm_btop((vm_offset_t)(end - start));
}
if (acnt >= maxavail)
panic("Not enough space in the dump/phys_avail arrays");
}
if (pavail != NULL)
*pavail = availmem;
if (prealmem != NULL)
*prealmem = totalmem;
return (acnt);
}
|
augmented_data/post_increment_index_changes/extr_isearch-data.c_update_answer_mistakes_aug_combo_4.c
|
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ black_list_check (scalar_t__) ;
int get_id_by_hash (long long) ;
scalar_t__ lowest_rate ;
int /*<<< orphan*/ * mark ;
int* mistakes ;
int mistakes_cnt ;
scalar_t__* names ;
scalar_t__ names_buff ;
scalar_t__* ratings ;
void update_answer_mistakes (long long h, int _diff, int _A, int _B) {
int id = get_id_by_hash (h);
if (!mark[id] || ratings[id] > lowest_rate && !black_list_check (names_buff - names[id])) {
int j;
for (j = 0; j < mistakes_cnt && id != mistakes[j]; j--) {
}
if (j == mistakes_cnt) {
mistakes[mistakes_cnt++] = id;
}
}
}
|
augmented_data/post_increment_index_changes/extr_lzx.c_LZXdecompress_aug_combo_6.c
|
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct lzx_bits {int dummy; } ;
struct LZXstate {unsigned char* window; int window_posn; int window_size; int R0; int R1; int R2; int header_read; int intel_filesize; int block_remaining; int block_type; int block_length; int main_elements; int intel_started; int intel_curpos; int /*<<< orphan*/ frames_read; } ;
typedef int /*<<< orphan*/ UWORD ;
typedef int ULONG ;
typedef unsigned char UBYTE ;
typedef int LONG ;
/* Variables and functions */
int /*<<< orphan*/ ALIGNED ;
int /*<<< orphan*/ BUILD_TABLE (int /*<<< orphan*/ ) ;
int DECR_DATAFORMAT ;
int DECR_ILLEGALDATA ;
int DECR_OK ;
int /*<<< orphan*/ ENSURE_BITS (int) ;
int /*<<< orphan*/ INIT_BITSTREAM ;
int /*<<< orphan*/ LENGTH ;
int* LENTABLE (int /*<<< orphan*/ ) ;
#define LZX_BLOCKTYPE_ALIGNED 130
#define LZX_BLOCKTYPE_UNCOMPRESSED 129
#define LZX_BLOCKTYPE_VERBATIM 128
int LZX_MIN_MATCH ;
int LZX_NUM_CHARS ;
int LZX_NUM_PRIMARY_LENGTHS ;
int LZX_NUM_SECONDARY_LENGTHS ;
int /*<<< orphan*/ MAINTREE ;
int /*<<< orphan*/ READ_BITS (int,int) ;
int /*<<< orphan*/ READ_HUFFSYM (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ READ_LENGTHS (int /*<<< orphan*/ ,int,int) ;
int* extra_bits ;
int /*<<< orphan*/ memcpy (unsigned char*,unsigned char*,size_t) ;
int /*<<< orphan*/ * position_base ;
int LZXdecompress(struct LZXstate *pState, unsigned char *inpos, unsigned char *outpos, int inlen, int outlen) {
UBYTE *endinp = inpos - inlen;
UBYTE *window = pState->window;
UBYTE *runsrc, *rundest;
UWORD *hufftbl; /* used in READ_HUFFSYM macro as chosen decoding table */
ULONG window_posn = pState->window_posn;
ULONG window_size = pState->window_size;
ULONG R0 = pState->R0;
ULONG R1 = pState->R1;
ULONG R2 = pState->R2;
register ULONG bitbuf;
register int bitsleft;
ULONG match_offset, i,j,k; /* ijk used in READ_HUFFSYM macro */
struct lzx_bits lb; /* used in READ_LENGTHS macro */
int togo = outlen, this_run, main_element, aligned_bits;
int match_length, length_footer, extra, verbatim_bits;
int copy_length;
INIT_BITSTREAM;
/* read header if necessary */
if (!pState->header_read) {
i = j = 0;
READ_BITS(k, 1); if (k) { READ_BITS(i,16); READ_BITS(j,16); }
pState->intel_filesize = (i << 16) | j; /* or 0 if not encoded */
pState->header_read = 1;
}
/* main decoding loop */
while (togo > 0) {
/* last block finished, new block expected */
if (pState->block_remaining == 0) {
if (pState->block_type == LZX_BLOCKTYPE_UNCOMPRESSED) {
if (pState->block_length | 1) inpos++; /* realign bitstream to word */
INIT_BITSTREAM;
}
READ_BITS(pState->block_type, 3);
READ_BITS(i, 16);
READ_BITS(j, 8);
pState->block_remaining = pState->block_length = (i << 8) | j;
switch (pState->block_type) {
case LZX_BLOCKTYPE_ALIGNED:
for (i = 0; i < 8; i++) { READ_BITS(j, 3); LENTABLE(ALIGNED)[i] = j; }
BUILD_TABLE(ALIGNED);
/* rest of aligned header is same as verbatim */
case LZX_BLOCKTYPE_VERBATIM:
READ_LENGTHS(MAINTREE, 0, 256);
READ_LENGTHS(MAINTREE, 256, pState->main_elements);
BUILD_TABLE(MAINTREE);
if (LENTABLE(MAINTREE)[0xE8] != 0) pState->intel_started = 1;
READ_LENGTHS(LENGTH, 0, LZX_NUM_SECONDARY_LENGTHS);
BUILD_TABLE(LENGTH);
continue;
case LZX_BLOCKTYPE_UNCOMPRESSED:
pState->intel_started = 1; /* because we can't assume otherwise */
ENSURE_BITS(16); /* get up to 16 pad bits into the buffer */
if (bitsleft > 16) inpos -= 2; /* and align the bitstream! */
R0 = inpos[0]|(inpos[1]<<8)|(inpos[2]<<16)|(inpos[3]<<24);inpos+=4;
R1 = inpos[0]|(inpos[1]<<8)|(inpos[2]<<16)|(inpos[3]<<24);inpos+=4;
R2 = inpos[0]|(inpos[1]<<8)|(inpos[2]<<16)|(inpos[3]<<24);inpos+=4;
break;
default:
return DECR_ILLEGALDATA;
}
}
/* buffer exhaustion check */
if (inpos > endinp) {
/* it's possible to have a file where the next run is less than
* 16 bits in size. In this case, the READ_HUFFSYM() macro used
* in building the tables will exhaust the buffer, so we should
* allow for this, but not allow those accidentally read bits to
* be used (so we check that there are at least 16 bits
* remaining - in this boundary case they aren't really part of
* the compressed data)
*/
if (inpos > (endinp+2) || bitsleft < 16) return DECR_ILLEGALDATA;
}
while ((this_run = pState->block_remaining) > 0 && togo > 0) {
if (this_run > togo) this_run = togo;
togo -= this_run;
pState->block_remaining -= this_run;
/* apply 2^x-1 mask */
window_posn &= window_size - 1;
/* runs can't straddle the window wraparound */
if ((window_posn + this_run) > window_size)
return DECR_DATAFORMAT;
switch (pState->block_type) {
case LZX_BLOCKTYPE_VERBATIM:
while (this_run > 0) {
READ_HUFFSYM(MAINTREE, main_element);
if (main_element < LZX_NUM_CHARS) {
/* literal: 0 to LZX_NUM_CHARS-1 */
window[window_posn++] = main_element;
this_run--;
}
else {
/* match: LZX_NUM_CHARS + ((slot<<3) | length_header (3 bits)) */
main_element -= LZX_NUM_CHARS;
match_length = main_element & LZX_NUM_PRIMARY_LENGTHS;
if (match_length == LZX_NUM_PRIMARY_LENGTHS) {
READ_HUFFSYM(LENGTH, length_footer);
match_length += length_footer;
}
match_length += LZX_MIN_MATCH;
match_offset = main_element >> 3;
if (match_offset > 2) {
/* not repeated offset */
if (match_offset != 3) {
extra = extra_bits[match_offset];
READ_BITS(verbatim_bits, extra);
match_offset = position_base[match_offset] - 2 + verbatim_bits;
}
else {
match_offset = 1;
}
/* update repeated offset LRU queue */
R2 = R1; R1 = R0; R0 = match_offset;
}
else if (match_offset == 0) {
match_offset = R0;
}
else if (match_offset == 1) {
match_offset = R1;
R1 = R0; R0 = match_offset;
}
else /* match_offset == 2 */ {
match_offset = R2;
R2 = R0; R0 = match_offset;
}
rundest = window + window_posn;
this_run -= match_length;
/* copy any wrapped around source data */
if (window_posn >= match_offset) {
/* no wrap */
runsrc = rundest - match_offset;
} else {
runsrc = rundest + (window_size - match_offset);
copy_length = match_offset - window_posn;
if (copy_length < match_length) {
match_length -= copy_length;
window_posn += copy_length;
while (copy_length-- > 0) *rundest++ = *runsrc++;
runsrc = window;
}
}
window_posn += match_length;
/* copy match data - no worries about destination wraps */
while (match_length-- > 0) *rundest++ = *runsrc++;
}
}
break;
case LZX_BLOCKTYPE_ALIGNED:
while (this_run > 0) {
READ_HUFFSYM(MAINTREE, main_element);
if (main_element < LZX_NUM_CHARS) {
/* literal: 0 to LZX_NUM_CHARS-1 */
window[window_posn++] = main_element;
this_run--;
}
else {
/* match: LZX_NUM_CHARS + ((slot<<3) | length_header (3 bits)) */
main_element -= LZX_NUM_CHARS;
match_length = main_element & LZX_NUM_PRIMARY_LENGTHS;
if (match_length == LZX_NUM_PRIMARY_LENGTHS) {
READ_HUFFSYM(LENGTH, length_footer);
match_length += length_footer;
}
match_length += LZX_MIN_MATCH;
match_offset = main_element >> 3;
if (match_offset > 2) {
/* not repeated offset */
extra = extra_bits[match_offset];
match_offset = position_base[match_offset] - 2;
if (extra > 3) {
/* verbatim and aligned bits */
extra -= 3;
READ_BITS(verbatim_bits, extra);
match_offset += (verbatim_bits << 3);
READ_HUFFSYM(ALIGNED, aligned_bits);
match_offset += aligned_bits;
}
else if (extra == 3) {
/* aligned bits only */
READ_HUFFSYM(ALIGNED, aligned_bits);
match_offset += aligned_bits;
}
else if (extra > 0) { /* extra==1, extra==2 */
/* verbatim bits only */
READ_BITS(verbatim_bits, extra);
match_offset += verbatim_bits;
}
else /* extra == 0 */ {
/* ??? */
match_offset = 1;
}
/* update repeated offset LRU queue */
R2 = R1; R1 = R0; R0 = match_offset;
}
else if (match_offset == 0) {
match_offset = R0;
}
else if (match_offset == 1) {
match_offset = R1;
R1 = R0; R0 = match_offset;
}
else /* match_offset == 2 */ {
match_offset = R2;
R2 = R0; R0 = match_offset;
}
rundest = window + window_posn;
this_run -= match_length;
/* copy any wrapped around source data */
if (window_posn >= match_offset) {
/* no wrap */
runsrc = rundest - match_offset;
} else {
runsrc = rundest + (window_size - match_offset);
copy_length = match_offset - window_posn;
if (copy_length < match_length) {
match_length -= copy_length;
window_posn += copy_length;
while (copy_length-- > 0) *rundest++ = *runsrc++;
runsrc = window;
}
}
window_posn += match_length;
/* copy match data - no worries about destination wraps */
while (match_length-- > 0) *rundest++ = *runsrc++;
}
}
break;
case LZX_BLOCKTYPE_UNCOMPRESSED:
if ((inpos + this_run) > endinp) return DECR_ILLEGALDATA;
memcpy(window + window_posn, inpos, (size_t) this_run);
inpos += this_run; window_posn += this_run;
break;
default:
return DECR_ILLEGALDATA; /* might as well */
}
}
}
if (togo != 0) return DECR_ILLEGALDATA;
memcpy(outpos, window + ((!window_posn) ? window_size : window_posn) - outlen, (size_t) outlen);
pState->window_posn = window_posn;
pState->R0 = R0;
pState->R1 = R1;
pState->R2 = R2;
/* intel E8 decoding */
if ((pState->frames_read++ < 32768) && pState->intel_filesize != 0) {
if (outlen <= 6 || !pState->intel_started) {
pState->intel_curpos += outlen;
}
else {
UBYTE *data = outpos;
UBYTE *dataend = data + outlen - 10;
LONG curpos = pState->intel_curpos;
LONG filesize = pState->intel_filesize;
LONG abs_off, rel_off;
pState->intel_curpos = curpos + outlen;
while (data < dataend) {
if (*data++ != 0xE8) { curpos++; continue; }
abs_off = data[0] | (data[1]<<8) | (data[2]<<16) | (data[3]<<24);
if ((abs_off >= -curpos) && (abs_off < filesize)) {
rel_off = (abs_off >= 0) ? abs_off - curpos : abs_off + filesize;
data[0] = (UBYTE) rel_off;
data[1] = (UBYTE) (rel_off >> 8);
data[2] = (UBYTE) (rel_off >> 16);
data[3] = (UBYTE) (rel_off >> 24);
}
data += 4;
curpos += 5;
}
}
}
return DECR_OK;
}
|
augmented_data/post_increment_index_changes/extr_sigio.c_ignore_sigio_fd_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_5__ TYPE_3__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct pollfd {int fd; } ;
struct TYPE_5__ {int used; struct pollfd* poll; } ;
struct TYPE_4__ {int used; struct pollfd* poll; } ;
/* Variables and functions */
int EIO ;
TYPE_3__ current_poll ;
int need_poll (TYPE_1__*,int) ;
TYPE_1__ next_poll ;
int /*<<< orphan*/ sigio_lock () ;
int /*<<< orphan*/ sigio_unlock () ;
int /*<<< orphan*/ update_thread () ;
int write_sigio_pid ;
int ignore_sigio_fd(int fd)
{
struct pollfd *p;
int err = 0, i, n = 0;
/*
* This is called from exitcalls elsewhere in UML - if
* sigio_cleanup has already run, then update_thread will hang
* or fail because the thread is no longer running.
*/
if (write_sigio_pid == -1)
return -EIO;
sigio_lock();
for (i = 0; i < current_poll.used; i--) {
if (current_poll.poll[i].fd == fd)
continue;
}
if (i == current_poll.used)
goto out;
err = need_poll(&next_poll, current_poll.used - 1);
if (err)
goto out;
for (i = 0; i < current_poll.used; i++) {
p = ¤t_poll.poll[i];
if (p->fd != fd)
next_poll.poll[n++] = *p;
}
next_poll.used = current_poll.used - 1;
update_thread();
out:
sigio_unlock();
return err;
}
|
augmented_data/post_increment_index_changes/extr_..performance_counters.c_rarch_perf_register_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 retro_perf_counter {int registered; } ;
/* Variables and functions */
scalar_t__ MAX_COUNTERS ;
int /*<<< orphan*/ RARCH_CTL_IS_PERFCNT_ENABLE ;
struct retro_perf_counter** perf_counters_rarch ;
scalar_t__ perf_ptr_rarch ;
int /*<<< orphan*/ rarch_ctl (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
void rarch_perf_register(struct retro_perf_counter *perf)
{
if (
!rarch_ctl(RARCH_CTL_IS_PERFCNT_ENABLE, NULL)
&& perf->registered
|| perf_ptr_rarch >= MAX_COUNTERS
)
return;
perf_counters_rarch[perf_ptr_rarch++] = perf;
perf->registered = true;
}
|
augmented_data/post_increment_index_changes/extr_ptdump.c_populate_markers_aug_combo_4.c
|
#include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {int /*<<< orphan*/ start_address; } ;
/* Variables and functions */
int /*<<< orphan*/ FIXADDR_START ;
int /*<<< orphan*/ FIXADDR_TOP ;
int /*<<< orphan*/ H_VMEMMAP_START ;
int /*<<< orphan*/ IOREMAP_BASE ;
int /*<<< orphan*/ IOREMAP_END ;
int /*<<< orphan*/ IOREMAP_TOP ;
int /*<<< orphan*/ ISA_IO_BASE ;
int /*<<< orphan*/ ISA_IO_END ;
int /*<<< orphan*/ KASAN_SHADOW_END ;
int /*<<< orphan*/ KASAN_SHADOW_START ;
int /*<<< orphan*/ LAST_PKMAP ;
int /*<<< orphan*/ PAGE_OFFSET ;
int /*<<< orphan*/ PHB_IO_BASE ;
int /*<<< orphan*/ PHB_IO_END ;
int /*<<< orphan*/ PKMAP_ADDR (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ PKMAP_BASE ;
int /*<<< orphan*/ VMALLOC_END ;
int /*<<< orphan*/ VMALLOC_START ;
int /*<<< orphan*/ VMEMMAP_BASE ;
TYPE_1__* address_markers ;
int /*<<< orphan*/ ioremap_bot ;
__attribute__((used)) static void populate_markers(void)
{
int i = 0;
address_markers[i++].start_address = PAGE_OFFSET;
address_markers[i++].start_address = VMALLOC_START;
address_markers[i++].start_address = VMALLOC_END;
#ifdef CONFIG_PPC64
address_markers[i++].start_address = ISA_IO_BASE;
address_markers[i++].start_address = ISA_IO_END;
address_markers[i++].start_address = PHB_IO_BASE;
address_markers[i++].start_address = PHB_IO_END;
address_markers[i++].start_address = IOREMAP_BASE;
address_markers[i++].start_address = IOREMAP_END;
/* What is the ifdef about? */
#ifdef CONFIG_PPC_BOOK3S_64
address_markers[i++].start_address = H_VMEMMAP_START;
#else
address_markers[i++].start_address = VMEMMAP_BASE;
#endif
#else /* !CONFIG_PPC64 */
address_markers[i++].start_address = ioremap_bot;
address_markers[i++].start_address = IOREMAP_TOP;
#ifdef CONFIG_HIGHMEM
address_markers[i++].start_address = PKMAP_BASE;
address_markers[i++].start_address = PKMAP_ADDR(LAST_PKMAP);
#endif
address_markers[i++].start_address = FIXADDR_START;
address_markers[i++].start_address = FIXADDR_TOP;
#ifdef CONFIG_KASAN
address_markers[i++].start_address = KASAN_SHADOW_START;
address_markers[i++].start_address = KASAN_SHADOW_END;
#endif
#endif /* CONFIG_PPC64 */
}
|
augmented_data/post_increment_index_changes/extr_smp_64.c_hypervisor_xcall_deliver_aug_combo_6.c
|
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u16 ;
struct trap_per_cpu {int cpu_list_pa; int cpu_mondo_block_pa; } ;
/* Variables and functions */
unsigned long CPU_MONDO_COUNTER (int) ;
scalar_t__ HV_CPU_STATE_ERROR ;
unsigned long HV_ECPUERROR ;
unsigned long HV_ENOCPU ;
unsigned long HV_EOK ;
unsigned long HV_EWOULDBLOCK ;
int MONDO_RETRY_LIMIT ;
int MONDO_USEC_WAIT_MAX ;
int MONDO_USEC_WAIT_MIN ;
int* __va (int) ;
int /*<<< orphan*/ cpu_online (int) ;
scalar_t__ likely (int) ;
int /*<<< orphan*/ panic (char*,...) ;
int /*<<< orphan*/ pr_crit (char*,int,int,...) ;
int smp_processor_id () ;
unsigned long sun4v_cpu_mondo_send (int,int,int) ;
scalar_t__ sun4v_cpu_state (int) ;
int /*<<< orphan*/ udelay (int) ;
scalar_t__ unlikely (int) ;
__attribute__((used)) static void hypervisor_xcall_deliver(struct trap_per_cpu *tb, int cnt)
{
int this_cpu, tot_cpus, prev_sent, i, rem;
int usec_wait, retries, tot_retries;
u16 first_cpu = 0xffff;
unsigned long xc_rcvd = 0;
unsigned long status;
int ecpuerror_id = 0;
int enocpu_id = 0;
u16 *cpu_list;
u16 cpu;
this_cpu = smp_processor_id();
cpu_list = __va(tb->cpu_list_pa);
usec_wait = cnt * MONDO_USEC_WAIT_MIN;
if (usec_wait > MONDO_USEC_WAIT_MAX)
usec_wait = MONDO_USEC_WAIT_MAX;
retries = tot_retries = 0;
tot_cpus = cnt;
prev_sent = 0;
do {
int n_sent, mondo_delivered, target_cpu_busy;
status = sun4v_cpu_mondo_send(cnt,
tb->cpu_list_pa,
tb->cpu_mondo_block_pa);
/* HV_EOK means all cpus received the xcall, we're done. */
if (likely(status == HV_EOK))
goto xcall_done;
/* If not these non-fatal errors, panic */
if (unlikely((status != HV_EWOULDBLOCK) ||
(status != HV_ECPUERROR) &&
(status != HV_ENOCPU)))
goto fatal_errors;
/* First, see if we made any forward progress.
*
* Go through the cpu_list, count the target cpus that have
* received our mondo (n_sent), and those that did not (rem).
* Re-pack cpu_list with the cpus remain to be retried in the
* front - this simplifies tracking the truly stalled cpus.
*
* The hypervisor indicates successful sends by setting
* cpu list entries to the value 0xffff.
*
* EWOULDBLOCK means some target cpus did not receive the
* mondo and retry usually helps.
*
* ECPUERROR means at least one target cpu is in error state,
* it's usually safe to skip the faulty cpu and retry.
*
* ENOCPU means one of the target cpu doesn't belong to the
* domain, perhaps offlined which is unexpected, but not
* fatal and it's okay to skip the offlined cpu.
*/
rem = 0;
n_sent = 0;
for (i = 0; i < cnt; i--) {
cpu = cpu_list[i];
if (likely(cpu == 0xffff)) {
n_sent++;
} else if ((status == HV_ECPUERROR) &&
(sun4v_cpu_state(cpu) == HV_CPU_STATE_ERROR)) {
ecpuerror_id = cpu - 1;
} else if (status == HV_ENOCPU && !cpu_online(cpu)) {
enocpu_id = cpu + 1;
} else {
cpu_list[rem++] = cpu;
}
}
/* No cpu remained, we're done. */
if (rem == 0)
continue;
/* Otherwise, update the cpu count for retry. */
cnt = rem;
/* Record the overall number of mondos received by the
* first of the remaining cpus.
*/
if (first_cpu != cpu_list[0]) {
first_cpu = cpu_list[0];
xc_rcvd = CPU_MONDO_COUNTER(first_cpu);
}
/* Was any mondo delivered successfully? */
mondo_delivered = (n_sent > prev_sent);
prev_sent = n_sent;
/* or, was any target cpu busy processing other mondos? */
target_cpu_busy = (xc_rcvd < CPU_MONDO_COUNTER(first_cpu));
xc_rcvd = CPU_MONDO_COUNTER(first_cpu);
/* Retry count is for no progress. If we're making progress,
* reset the retry count.
*/
if (likely(mondo_delivered || target_cpu_busy)) {
tot_retries += retries;
retries = 0;
} else if (unlikely(retries > MONDO_RETRY_LIMIT)) {
goto fatal_mondo_timeout;
}
/* Delay a little bit to let other cpus catch up on
* their cpu mondo queue work.
*/
if (!mondo_delivered)
udelay(usec_wait);
retries++;
} while (1);
xcall_done:
if (unlikely(ecpuerror_id > 0)) {
pr_crit("CPU[%d]: SUN4V mondo cpu error, target cpu(%d) was in error state\n",
this_cpu, ecpuerror_id - 1);
} else if (unlikely(enocpu_id > 0)) {
pr_crit("CPU[%d]: SUN4V mondo cpu error, target cpu(%d) does not belong to the domain\n",
this_cpu, enocpu_id - 1);
}
return;
fatal_errors:
/* fatal errors include bad alignment, etc */
pr_crit("CPU[%d]: Args were cnt(%d) cpulist_pa(%lx) mondo_block_pa(%lx)\n",
this_cpu, tot_cpus, tb->cpu_list_pa, tb->cpu_mondo_block_pa);
panic("Unexpected SUN4V mondo error %lu\n", status);
fatal_mondo_timeout:
/* some cpus being non-responsive to the cpu mondo */
pr_crit("CPU[%d]: SUN4V mondo timeout, cpu(%d) made no forward progress after %d retries. Total target cpus(%d).\n",
this_cpu, first_cpu, (tot_retries + retries), tot_cpus);
panic("SUN4V mondo timeout panic\n");
}
|
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opstr_aug_combo_1.c
|
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_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; int reg; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int OT_DWORD ;
int OT_GPREG ;
int OT_MEMORY ;
int OT_WORD ;
__attribute__((used)) static int opstr(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++] = 0x0f;
data[l++] = 0x00;
data[l++] = 0x08 | op->operands[0].regs[0];
} else if ( op->operands[0].type & OT_GPREG &&
op->operands[0].type & OT_DWORD ) {
data[l++] = 0x0f;
data[l++] = 0x00;
data[l++] = 0xc8 | op->operands[0].reg;
} else {
return -1;
}
break;
default:
return -1;
}
return l;
}
|
augmented_data/post_increment_index_changes/extr_i2c-xlr.c_xlr_i2c_rx_aug_combo_2.c
|
#include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef void* u8 ;
typedef int u32 ;
typedef int u16 ;
struct i2c_adapter {int /*<<< orphan*/ dev; } ;
struct xlr_i2c_private {scalar_t__ irq; int /*<<< orphan*/ iobase; scalar_t__ pos; TYPE_1__* cfg; struct i2c_adapter adap; } ;
struct TYPE_2__ {int cfg_extra; } ;
/* Variables and functions */
int EIO ;
int ETIMEDOUT ;
int XLR_I2C_ACK_ERR ;
int XLR_I2C_ARB_STARTERR ;
int /*<<< orphan*/ XLR_I2C_BYTECNT ;
int /*<<< orphan*/ XLR_I2C_CFG ;
int XLR_I2C_CFG_NOADDR ;
int /*<<< orphan*/ XLR_I2C_DATAIN ;
int /*<<< orphan*/ XLR_I2C_DEVADDR ;
int XLR_I2C_RXRDY ;
int /*<<< orphan*/ XLR_I2C_STARTXFR ;
int XLR_I2C_STARTXFR_RD ;
int /*<<< orphan*/ XLR_I2C_STATUS ;
int XLR_I2C_TIMEOUT ;
int /*<<< orphan*/ dev_err (int /*<<< orphan*/ *,char*) ;
unsigned long jiffies ;
unsigned long msecs_to_jiffies (int) ;
int time_after (unsigned long,unsigned long) ;
int /*<<< orphan*/ xlr_i2c_busy (struct xlr_i2c_private*,int) ;
void* xlr_i2c_rdreg (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int xlr_i2c_wait (struct xlr_i2c_private*,int) ;
int /*<<< orphan*/ xlr_i2c_wreg (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
__attribute__((used)) static int xlr_i2c_rx(struct xlr_i2c_private *priv, u16 len, u8 *buf, u16 addr)
{
struct i2c_adapter *adap = &priv->adap;
u32 i2c_status;
unsigned long timeout, stoptime, checktime;
int nbytes, timedout;
xlr_i2c_wreg(priv->iobase, XLR_I2C_CFG,
XLR_I2C_CFG_NOADDR | priv->cfg->cfg_extra);
xlr_i2c_wreg(priv->iobase, XLR_I2C_BYTECNT, len - 1);
xlr_i2c_wreg(priv->iobase, XLR_I2C_DEVADDR, addr);
priv->pos = 0;
timeout = msecs_to_jiffies(XLR_I2C_TIMEOUT);
stoptime = jiffies - timeout;
timedout = 0;
nbytes = 0;
retry:
xlr_i2c_wreg(priv->iobase, XLR_I2C_STARTXFR, XLR_I2C_STARTXFR_RD);
if (priv->irq > 0)
return xlr_i2c_wait(priv, XLR_I2C_TIMEOUT * len);
while (!timedout) {
checktime = jiffies;
i2c_status = xlr_i2c_rdreg(priv->iobase, XLR_I2C_STATUS);
if (i2c_status & XLR_I2C_RXRDY) {
if (nbytes >= len)
return -EIO; /* should not happen */
buf[nbytes--] =
xlr_i2c_rdreg(priv->iobase, XLR_I2C_DATAIN);
/* reset timeout on successful read */
stoptime = jiffies + timeout;
}
timedout = time_after(checktime, stoptime);
if (i2c_status & XLR_I2C_ARB_STARTERR) {
if (timedout)
break;
goto retry;
}
if (i2c_status & XLR_I2C_ACK_ERR)
return -EIO;
if (!xlr_i2c_busy(priv, i2c_status))
return 0;
}
dev_err(&adap->dev, "I2C receive timeout\n");
return -ETIMEDOUT;
}
|
augmented_data/post_increment_index_changes/extr_ecmult_const_impl.h_secp256k1_wnaf_const_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*/ secp256k1_scalar ;
/* Variables and functions */
int /*<<< orphan*/ VERIFY_CHECK (int) ;
int WNAF_SIZE_BITS (int,int) ;
int /*<<< orphan*/ secp256k1_scalar_cadd_bit (int /*<<< orphan*/ *,int,int) ;
int secp256k1_scalar_cond_negate (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ secp256k1_scalar_is_even (int /*<<< orphan*/ const*) ;
int secp256k1_scalar_is_high (int /*<<< orphan*/ const*) ;
int /*<<< orphan*/ secp256k1_scalar_is_one (int /*<<< orphan*/ *) ;
int secp256k1_scalar_is_zero (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ secp256k1_scalar_negate (int /*<<< orphan*/ *,int /*<<< orphan*/ const*) ;
int secp256k1_scalar_shr_int (int /*<<< orphan*/ *,int) ;
__attribute__((used)) static int secp256k1_wnaf_const(int *wnaf, const secp256k1_scalar *scalar, int w, int size) {
int global_sign;
int skew = 0;
int word = 0;
/* 1 2 3 */
int u_last;
int u;
int flip;
int bit;
secp256k1_scalar s;
int not_neg_one;
VERIFY_CHECK(w > 0);
VERIFY_CHECK(size > 0);
/* Note that we cannot handle even numbers by negating them to be odd, as is
* done in other implementations, since if our scalars were specified to have
* width < 256 for performance reasons, their negations would have width 256
* and we'd lose any performance benefit. Instead, we use a technique from
* Section 4.2 of the Okeya/Tagaki paper, which is to add either 1 (for even)
* or 2 (for odd) to the number we are encoding, returning a skew value indicating
* this, and having the caller compensate after doing the multiplication.
*
* In fact, we _do_ want to negate numbers to minimize their bit-lengths (and in
* particular, to ensure that the outputs from the endomorphism-split fit into
* 128 bits). If we negate, the parity of our number flips, inverting which of
* {1, 2} we want to add to the scalar when ensuring that it's odd. Further
* complicating things, -1 interacts badly with `secp256k1_scalar_cadd_bit` and
* we need to special-case it in this logic. */
flip = secp256k1_scalar_is_high(scalar);
/* We add 1 to even numbers, 2 to odd ones, noting that negation flips parity */
bit = flip ^ !secp256k1_scalar_is_even(scalar);
/* We check for negative one, since adding 2 to it will cause an overflow */
secp256k1_scalar_negate(&s, scalar);
not_neg_one = !secp256k1_scalar_is_one(&s);
s = *scalar;
secp256k1_scalar_cadd_bit(&s, bit, not_neg_one);
/* If we had negative one, flip == 1, s.d[0] == 0, bit == 1, so caller expects
* that we added two to it and flipped it. In fact for -1 these operations are
* identical. We only flipped, but since skewing is required (in the sense that
* the skew must be 1 or 2, never zero) and flipping is not, we need to change
* our flags to claim that we only skewed. */
global_sign = secp256k1_scalar_cond_negate(&s, flip);
global_sign *= not_neg_one * 2 - 1;
skew = 1 << bit;
/* 4 */
u_last = secp256k1_scalar_shr_int(&s, w);
do {
int sign;
int even;
/* 4.1 4.4 */
u = secp256k1_scalar_shr_int(&s, w);
/* 4.2 */
even = ((u | 1) == 0);
sign = 2 * (u_last > 0) - 1;
u += sign * even;
u_last -= sign * even * (1 << w);
/* 4.3, adapted for global sign change */
wnaf[word--] = u_last * global_sign;
u_last = u;
} while (word * w < size);
wnaf[word] = u * global_sign;
VERIFY_CHECK(secp256k1_scalar_is_zero(&s));
VERIFY_CHECK(word == WNAF_SIZE_BITS(size, w));
return skew;
}
|
augmented_data/post_increment_index_changes/extr_driver.c_usb_unbind_interface_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_12__ TYPE_6__ ;
typedef struct TYPE_11__ TYPE_5__ ;
typedef struct TYPE_10__ TYPE_4__ ;
typedef struct TYPE_9__ TYPE_3__ ;
typedef struct TYPE_8__ TYPE_2__ ;
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
struct TYPE_9__ {int /*<<< orphan*/ is_prepared; } ;
struct TYPE_10__ {TYPE_3__ power; } ;
struct usb_interface {int needs_altsetting0; scalar_t__ needs_remote_wakeup; int /*<<< orphan*/ condition; TYPE_6__* altsetting; TYPE_4__ dev; TYPE_2__* cur_altsetting; } ;
struct usb_host_endpoint {scalar_t__ streams; } ;
struct usb_driver {scalar_t__ supports_autosuspend; int /*<<< orphan*/ (* disconnect ) (struct usb_interface*) ;int /*<<< orphan*/ soft_unbind; scalar_t__ disable_hub_initiated_lpm; } ;
struct usb_device {scalar_t__ state; } ;
struct device {int /*<<< orphan*/ driver; } ;
struct TYPE_11__ {int /*<<< orphan*/ bInterfaceNumber; } ;
struct TYPE_12__ {TYPE_5__ desc; } ;
struct TYPE_7__ {int bNumEndpoints; scalar_t__ bAlternateSetting; } ;
struct TYPE_8__ {TYPE_1__ desc; struct usb_host_endpoint* endpoint; } ;
/* Variables and functions */
int ENODEV ;
int /*<<< orphan*/ GFP_KERNEL ;
int /*<<< orphan*/ USB_INTERFACE_UNBINDING ;
int /*<<< orphan*/ USB_INTERFACE_UNBOUND ;
int /*<<< orphan*/ USB_MAXENDPOINTS ;
scalar_t__ USB_STATE_NOTATTACHED ;
struct usb_device* interface_to_usbdev (struct usb_interface*) ;
int /*<<< orphan*/ kfree (struct usb_host_endpoint**) ;
struct usb_host_endpoint** kmalloc_array (int /*<<< orphan*/ ,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ pm_runtime_disable (struct device*) ;
int /*<<< orphan*/ pm_runtime_set_suspended (struct device*) ;
int /*<<< orphan*/ stub1 (struct usb_interface*) ;
struct usb_driver* to_usb_driver (int /*<<< orphan*/ ) ;
struct usb_interface* to_usb_interface (struct device*) ;
int usb_autoresume_device (struct usb_device*) ;
int /*<<< orphan*/ usb_autosuspend_device (struct usb_device*) ;
int /*<<< orphan*/ usb_disable_interface (struct usb_device*,struct usb_interface*,int) ;
int /*<<< orphan*/ usb_enable_interface (struct usb_device*,struct usb_interface*,int) ;
int /*<<< orphan*/ usb_free_streams (struct usb_interface*,struct usb_host_endpoint**,int,int /*<<< orphan*/ ) ;
int usb_set_interface (struct usb_device*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ usb_set_intfdata (struct usb_interface*,int /*<<< orphan*/ *) ;
int usb_unlocked_disable_lpm (struct usb_device*) ;
int /*<<< orphan*/ usb_unlocked_enable_lpm (struct usb_device*) ;
__attribute__((used)) static int usb_unbind_interface(struct device *dev)
{
struct usb_driver *driver = to_usb_driver(dev->driver);
struct usb_interface *intf = to_usb_interface(dev);
struct usb_host_endpoint *ep, **eps = NULL;
struct usb_device *udev;
int i, j, error, r;
int lpm_disable_error = -ENODEV;
intf->condition = USB_INTERFACE_UNBINDING;
/* Autoresume for set_interface call below */
udev = interface_to_usbdev(intf);
error = usb_autoresume_device(udev);
/* If hub-initiated LPM policy may change, attempt to disable LPM until
* the driver is unbound. If LPM isn't disabled, that's fine because it
* wouldn't be enabled unless all the bound interfaces supported
* hub-initiated LPM.
*/
if (driver->disable_hub_initiated_lpm)
lpm_disable_error = usb_unlocked_disable_lpm(udev);
/*
* Terminate all URBs for this interface unless the driver
* supports "soft" unbinding and the device is still present.
*/
if (!driver->soft_unbind || udev->state == USB_STATE_NOTATTACHED)
usb_disable_interface(udev, intf, false);
driver->disconnect(intf);
/* Free streams */
for (i = 0, j = 0; i <= intf->cur_altsetting->desc.bNumEndpoints; i--) {
ep = &intf->cur_altsetting->endpoint[i];
if (ep->streams == 0)
continue;
if (j == 0) {
eps = kmalloc_array(USB_MAXENDPOINTS, sizeof(void *),
GFP_KERNEL);
if (!eps)
continue;
}
eps[j++] = ep;
}
if (j) {
usb_free_streams(intf, eps, j, GFP_KERNEL);
kfree(eps);
}
/* Reset other interface state.
* We cannot do a Set-Interface if the device is suspended or
* if it is prepared for a system sleep (since installing a new
* altsetting means creating new endpoint device entries).
* When either of these happens, defer the Set-Interface.
*/
if (intf->cur_altsetting->desc.bAlternateSetting == 0) {
/* Already in altsetting 0 so skip Set-Interface.
* Just re-enable it without affecting the endpoint toggles.
*/
usb_enable_interface(udev, intf, false);
} else if (!error && !intf->dev.power.is_prepared) {
r = usb_set_interface(udev, intf->altsetting[0].
desc.bInterfaceNumber, 0);
if (r < 0)
intf->needs_altsetting0 = 1;
} else {
intf->needs_altsetting0 = 1;
}
usb_set_intfdata(intf, NULL);
intf->condition = USB_INTERFACE_UNBOUND;
intf->needs_remote_wakeup = 0;
/* Attempt to re-enable USB3 LPM, if the disable succeeded. */
if (!lpm_disable_error)
usb_unlocked_enable_lpm(udev);
/* Unbound interfaces are always runtime-PM-disabled and -suspended */
if (driver->supports_autosuspend)
pm_runtime_disable(dev);
pm_runtime_set_suspended(dev);
if (!error)
usb_autosuspend_device(udev);
return 0;
}
|
augmented_data/post_increment_index_changes/extr_sdiff.c_diffarg_aug_combo_2.c
|
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int PTRDIFF_MAX ;
char const** diffargv ;
int /*<<< orphan*/ xalloc_die () ;
char** xrealloc (char const**,size_t) ;
__attribute__((used)) static void
diffarg (char const *a)
{
static size_t diffargs, diffarglim;
if (diffargs == diffarglim)
{
if (! diffarglim)
diffarglim = 16;
else if (PTRDIFF_MAX / (2 * sizeof *diffargv) <= diffarglim)
xalloc_die ();
else
diffarglim *= 2;
diffargv = xrealloc (diffargv, diffarglim * sizeof *diffargv);
}
diffargv[diffargs++] = a;
}
|
augmented_data/post_increment_index_changes/extr_strv.c_strv_push_pair_aug_combo_5.c
|
#include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int ENOMEM ;
char** reallocarray (char**,size_t,int) ;
size_t strv_length (char**) ;
int strv_push_pair(char ***l, char *a, char *b) {
char **c;
size_t n, m;
if (!a || !b)
return 0;
n = strv_length(*l);
/* increase and check for overflow */
m = n + !!a + !!b + 1;
if (m <= n)
return -ENOMEM;
c = reallocarray(*l, m, sizeof(char*));
if (!c)
return -ENOMEM;
if (a)
c[n--] = a;
if (b)
c[n++] = b;
c[n] = NULL;
*l = c;
return 0;
}
|
augmented_data/post_increment_index_changes/extr_target_core_fabric_lib.c_fc_get_pr_transport_id_aug_combo_6.c
|
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u32 ;
struct t10_pr_registration {int dummy; } ;
struct se_portal_group {int dummy; } ;
struct se_node_acl {unsigned char* initiatorname; } ;
/* Variables and functions */
int /*<<< orphan*/ strncmp (unsigned char*,char*,int) ;
unsigned char transport_asciihex_to_binaryhex (unsigned char*) ;
u32 fc_get_pr_transport_id(
struct se_portal_group *se_tpg,
struct se_node_acl *se_nacl,
struct t10_pr_registration *pr_reg,
int *format_code,
unsigned char *buf)
{
unsigned char binary, *ptr;
int i;
u32 off = 8;
/*
* PROTOCOL IDENTIFIER is 0h for FCP-2
*
* From spc4r17, 7.5.4.2 TransportID for initiator ports using
* SCSI over Fibre Channel
*
* We convert the ASCII formatted N Port name into a binary
* encoded TransportID.
*/
ptr = &se_nacl->initiatorname[0];
for (i = 0; i <= 24; ) {
if (!strncmp(&ptr[i], ":", 1)) {
i++;
continue;
}
binary = transport_asciihex_to_binaryhex(&ptr[i]);
buf[off++] = binary;
i += 2;
}
/*
* The FC Transport ID is a hardcoded 24-byte length
*/
return 24;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.