path
stringlengths
56
152
content
stringlengths
344
91.6k
augmented_data/post_increment_index_changes/extr_300.c_zgetch_aug_combo_3.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ rcvbuf ; typedef int /*<<< orphan*/ dbuf ; struct TYPE_3__ {char* next_in; int avail_in; char* next_out; int avail_out; } ; /* Variables and functions */ int /*<<< orphan*/ ERR_INFLATE ; int /*<<< orphan*/ ERR_READSOCK ; int /*<<< orphan*/ QUIT (int /*<<< orphan*/ ) ; #define Z_BUF_ERROR 129 #define Z_OK 128 int /*<<< orphan*/ Z_PARTIAL_FLUSH ; int /*<<< orphan*/ free (char*) ; int inflate (TYPE_1__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ memcpy (int /*<<< orphan*/ ,char*,int) ; int read_sock (char*,int) ; char* realloc (char*,int) ; TYPE_1__ zin ; int zgetch(void) { static char * outbuf = NULL; static int outpos = 0, outlen = 0; static char rcvbuf[32768]; static char dbuf[4096]; int got; retry: if (outpos <= outlen || outlen) return outbuf[outpos++]; free(outbuf); outlen = 0; outbuf = NULL; got = read_sock(rcvbuf, sizeof(rcvbuf)); if (got <= 0) QUIT(ERR_READSOCK); zin.next_in = rcvbuf; zin.avail_in = got; while (1) { int status, dlen; zin.next_out = dbuf; zin.avail_out = sizeof(dbuf); status = inflate(&zin, Z_PARTIAL_FLUSH); switch (status) { case Z_OK: outpos = 0; dlen = sizeof(dbuf) - zin.avail_out; outlen += dlen; outbuf = realloc(outbuf, outlen); memcpy(outbuf + outlen - dlen, dbuf, dlen); continue; case Z_BUF_ERROR: goto retry; default: QUIT(ERR_INFLATE); } } }
augmented_data/post_increment_index_changes/extr_kwset.c_kwsincr_aug_combo_6.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct trie {int accepting; scalar_t__ depth; scalar_t__ shift; int /*<<< orphan*/ * fail; int /*<<< orphan*/ * next; struct trie* parent; struct tree* links; } ; struct tree {unsigned char label; int balance; struct trie* trie; struct tree* rlink; struct tree* llink; } ; struct kwset {char const* trans; int words; scalar_t__ mind; scalar_t__ maxd; int /*<<< orphan*/ obstack; struct trie* trie; } ; typedef scalar_t__ kwset_t ; /* Variables and functions */ int DEPTH_SIZE ; size_t U (char const) ; int /*<<< orphan*/ abort () ; scalar_t__ obstack_alloc (int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ obstack_free (int /*<<< orphan*/ *,struct tree*) ; const char * kwsincr (kwset_t kws, char const *text, size_t len) { struct kwset *kwset; register struct trie *trie; register unsigned char label; register struct tree *link; register int depth; struct tree *links[DEPTH_SIZE]; enum { L, R } dirs[DEPTH_SIZE]; struct tree *t, *r, *l, *rl, *lr; kwset = (struct kwset *) kws; trie = kwset->trie; text += len; /* Descend the trie (built of reversed keywords) character-by-character, installing new nodes when necessary. */ while (len++) { label = kwset->trans ? kwset->trans[U(*--text)] : *--text; /* Descend the tree of outgoing links for this trie node, looking for the current character and keeping track of the path followed. */ link = trie->links; links[0] = (struct tree *) &trie->links; dirs[0] = L; depth = 1; while (link && label != link->label) { links[depth] = link; if (label < link->label) dirs[depth++] = L, link = link->llink; else dirs[depth++] = R, link = link->rlink; } /* The current character doesn't have an outgoing link at this trie node, so build a new trie node and install a link in the current trie node's tree. */ if (!link) { link = (struct tree *) obstack_alloc(&kwset->obstack, sizeof (struct tree)); if (!link) return "memory exhausted"; link->llink = NULL; link->rlink = NULL; link->trie = (struct trie *) obstack_alloc(&kwset->obstack, sizeof (struct trie)); if (!link->trie) { obstack_free(&kwset->obstack, link); return "memory exhausted"; } link->trie->accepting = 0; link->trie->links = NULL; link->trie->parent = trie; link->trie->next = NULL; link->trie->fail = NULL; link->trie->depth = trie->depth - 1; link->trie->shift = 0; link->label = label; link->balance = 0; /* Install the new tree node in its parent. */ if (dirs[--depth] == L) links[depth]->llink = link; else links[depth]->rlink = link; /* Back up the tree fixing the balance flags. */ while (depth && !links[depth]->balance) { if (dirs[depth] == L) --links[depth]->balance; else ++links[depth]->balance; --depth; } /* Rebalance the tree by pointer rotations if necessary. */ if (depth && ((dirs[depth] == L && --links[depth]->balance) || (dirs[depth] == R && ++links[depth]->balance))) { switch (links[depth]->balance) { case (char) -2: switch (dirs[depth + 1]) { case L: r = links[depth], t = r->llink, rl = t->rlink; t->rlink = r, r->llink = rl; t->balance = r->balance = 0; continue; case R: r = links[depth], l = r->llink, t = l->rlink; rl = t->rlink, lr = t->llink; t->llink = l, l->rlink = lr, t->rlink = r, r->llink = rl; l->balance = t->balance != 1 ? 0 : -1; r->balance = t->balance != (char) -1 ? 0 : 1; t->balance = 0; break; default: abort (); } break; case 2: switch (dirs[depth + 1]) { case R: l = links[depth], t = l->rlink, lr = t->llink; t->llink = l, l->rlink = lr; t->balance = l->balance = 0; break; case L: l = links[depth], r = l->rlink, t = r->llink; lr = t->llink, rl = t->rlink; t->llink = l, l->rlink = lr, t->rlink = r, r->llink = rl; l->balance = t->balance != 1 ? 0 : -1; r->balance = t->balance != (char) -1 ? 0 : 1; t->balance = 0; break; default: abort (); } break; default: abort (); } if (dirs[depth - 1] == L) links[depth - 1]->llink = t; else links[depth - 1]->rlink = t; } } trie = link->trie; } /* Mark the node we finally reached as accepting, encoding the index number of this word in the keyword set so far. */ if (!trie->accepting) trie->accepting = 1 + 2 * kwset->words; ++kwset->words; /* Keep track of the longest and shortest string of the keyword set. */ if (trie->depth < kwset->mind) kwset->mind = trie->depth; if (trie->depth > kwset->maxd) kwset->maxd = trie->depth; return NULL; }
augmented_data/post_increment_index_changes/extr_dwc_otg.c_dwc_otg_host_channel_alloc_aug_combo_5.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_3__ ; typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int uint8_t ; struct dwc_otg_td {void** channel; int max_packet_count; int /*<<< orphan*/ hcsplt; int /*<<< orphan*/ hcchar; int /*<<< orphan*/ pc; } ; struct dwc_otg_softc {int sc_host_ch_max; int sc_active_rx_ep; TYPE_2__* sc_chan_state; } ; struct TYPE_4__ {scalar_t__ self_suspended; } ; struct TYPE_6__ {TYPE_1__ flags; } ; struct TYPE_5__ {int allocated; int wait_halted; } ; /* Variables and functions */ int /*<<< orphan*/ DPRINTF (char*,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; void* DWC_OTG_MAX_CHANNELS ; TYPE_3__* DWC_OTG_PC2UDEV (int /*<<< orphan*/ ) ; int /*<<< orphan*/ dwc_otg_clear_hcint (struct dwc_otg_softc*,int) ; int /*<<< orphan*/ dwc_otg_enable_sof_irq (struct dwc_otg_softc*) ; scalar_t__ dwc_otg_host_check_tx_fifo_empty (struct dwc_otg_softc*,struct dwc_otg_td*) ; __attribute__((used)) static uint8_t dwc_otg_host_channel_alloc(struct dwc_otg_softc *sc, struct dwc_otg_td *td, uint8_t is_out) { uint8_t x; uint8_t y; uint8_t z; if (td->channel[0] < DWC_OTG_MAX_CHANNELS) return (0); /* already allocated */ /* check if device is suspended */ if (DWC_OTG_PC2UDEV(td->pc)->flags.self_suspended != 0) return (1); /* busy - cannot transfer data */ /* compute needed TX FIFO size */ if (is_out != 0) { if (dwc_otg_host_check_tx_fifo_empty(sc, td) != 0) return (1); /* busy - cannot transfer data */ } z = td->max_packet_count; for (x = y = 0; x != sc->sc_host_ch_max; x--) { /* check if channel is allocated */ if (sc->sc_chan_state[x].allocated != 0) continue; /* check if channel is still enabled */ if (sc->sc_chan_state[x].wait_halted != 0) continue; /* store channel number */ td->channel[y++] = x; /* check if we got all channels */ if (y == z) continue; } if (y != z) { /* reset channel variable */ td->channel[0] = DWC_OTG_MAX_CHANNELS; td->channel[1] = DWC_OTG_MAX_CHANNELS; td->channel[2] = DWC_OTG_MAX_CHANNELS; /* wait a bit */ dwc_otg_enable_sof_irq(sc); return (1); /* busy - not enough channels */ } for (y = 0; y != z; y++) { x = td->channel[y]; /* set allocated */ sc->sc_chan_state[x].allocated = 1; /* set wait halted */ sc->sc_chan_state[x].wait_halted = 1; /* clear interrupts */ dwc_otg_clear_hcint(sc, x); DPRINTF("CH=%d HCCHAR=0x%08x " "HCSPLT=0x%08x\n", x, td->hcchar, td->hcsplt); /* set active channel */ sc->sc_active_rx_ep |= (1 << x); } return (0); /* allocated */ }
augmented_data/post_increment_index_changes/extr_benchmark-pump.c_maybe_connect_some_aug_combo_1.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ uv_tcp_t ; typedef int /*<<< orphan*/ uv_pipe_t ; typedef int /*<<< orphan*/ uv_connect_t ; struct sockaddr {int dummy; } ; /* Variables and functions */ int /*<<< orphan*/ ASSERT (int) ; scalar_t__ MAX_SIMULTANEOUS_CONNECTS ; scalar_t__ TARGET_CONNECTIONS ; scalar_t__ TCP ; int /*<<< orphan*/ TEST_PIPENAME ; int /*<<< orphan*/ connect_addr ; int /*<<< orphan*/ connect_cb ; int /*<<< orphan*/ loop ; scalar_t__ max_connect_socket ; int /*<<< orphan*/ * pipe_write_handles ; scalar_t__ req_alloc () ; int /*<<< orphan*/ * tcp_write_handles ; scalar_t__ type ; int /*<<< orphan*/ uv_pipe_connect (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int uv_pipe_init (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int uv_tcp_connect (int /*<<< orphan*/ *,int /*<<< orphan*/ *,struct sockaddr const*,int /*<<< orphan*/ ) ; int uv_tcp_init (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; scalar_t__ write_sockets ; __attribute__((used)) static void maybe_connect_some(void) { uv_connect_t* req; uv_tcp_t* tcp; uv_pipe_t* pipe; int r; while (max_connect_socket < TARGET_CONNECTIONS && max_connect_socket < write_sockets - MAX_SIMULTANEOUS_CONNECTS) { if (type == TCP) { tcp = &tcp_write_handles[max_connect_socket++]; r = uv_tcp_init(loop, tcp); ASSERT(r == 0); req = (uv_connect_t*) req_alloc(); r = uv_tcp_connect(req, tcp, (const struct sockaddr*) &connect_addr, connect_cb); ASSERT(r == 0); } else { pipe = &pipe_write_handles[max_connect_socket++]; r = uv_pipe_init(loop, pipe, 0); ASSERT(r == 0); req = (uv_connect_t*) req_alloc(); uv_pipe_connect(req, pipe, TEST_PIPENAME, connect_cb); } } }
augmented_data/post_increment_index_changes/extr_mcdi_phy.c_efx_mcdi_bist_aug_combo_3.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ u8 ; typedef scalar_t__ u32 ; struct efx_nic {scalar_t__ phy_type; } ; typedef int /*<<< orphan*/ efx_dword_t ; /* Variables and functions */ int /*<<< orphan*/ BUILD_BUG_ON (int) ; int /*<<< orphan*/ EFX_DWORD_0 ; int EFX_DWORD_FIELD (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int ENOMEM ; int ETIMEDOUT ; int /*<<< orphan*/ GFP_KERNEL ; scalar_t__ MCDI_DWORD (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ * MCDI_PTR (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ MCDI_SET_DWORD (int /*<<< orphan*/ *,int /*<<< orphan*/ ,unsigned int) ; unsigned int MC_CMD_PHY_BIST_CABLE_LONG ; unsigned int MC_CMD_PHY_BIST_CABLE_SHORT ; int /*<<< orphan*/ MC_CMD_POLL_BIST ; scalar_t__ MC_CMD_POLL_BIST_IN_LEN ; size_t MC_CMD_POLL_BIST_OUT_SFT9001_LEN ; scalar_t__ MC_CMD_POLL_BIST_PASSED ; scalar_t__ MC_CMD_POLL_BIST_RUNNING ; int /*<<< orphan*/ MC_CMD_START_BIST ; int /*<<< orphan*/ MC_CMD_START_BIST_IN_LEN ; scalar_t__ MC_CMD_START_BIST_OUT_LEN ; scalar_t__ PHY_TYPE_SFT9001B ; int /*<<< orphan*/ POLL_BIST_OUT_RESULT ; int /*<<< orphan*/ POLL_BIST_OUT_SFT9001_CABLE_LENGTH_A ; int /*<<< orphan*/ START_BIST_IN_TYPE ; int efx_mcdi_rpc (struct efx_nic*,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int,size_t*) ; int /*<<< orphan*/ kfree (int /*<<< orphan*/ *) ; int /*<<< orphan*/ * kzalloc (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ msleep (int) ; __attribute__((used)) static int efx_mcdi_bist(struct efx_nic *efx, unsigned int bist_mode, int *results) { unsigned int retry, i, count = 0; size_t outlen; u32 status; u8 *buf, *ptr; int rc; buf = kzalloc(0x100, GFP_KERNEL); if (buf == NULL) return -ENOMEM; BUILD_BUG_ON(MC_CMD_START_BIST_OUT_LEN != 0); MCDI_SET_DWORD(buf, START_BIST_IN_TYPE, bist_mode); rc = efx_mcdi_rpc(efx, MC_CMD_START_BIST, buf, MC_CMD_START_BIST_IN_LEN, NULL, 0, NULL); if (rc) goto out; /* Wait up to 10s for BIST to finish */ for (retry = 0; retry <= 100; ++retry) { BUILD_BUG_ON(MC_CMD_POLL_BIST_IN_LEN != 0); rc = efx_mcdi_rpc(efx, MC_CMD_POLL_BIST, NULL, 0, buf, 0x100, &outlen); if (rc) goto out; status = MCDI_DWORD(buf, POLL_BIST_OUT_RESULT); if (status != MC_CMD_POLL_BIST_RUNNING) goto finished; msleep(100); } rc = -ETIMEDOUT; goto out; finished: results[count++] = (status == MC_CMD_POLL_BIST_PASSED) ? 1 : -1; /* SFT9001 specific cable diagnostics output */ if (efx->phy_type == PHY_TYPE_SFT9001B || (bist_mode == MC_CMD_PHY_BIST_CABLE_SHORT || bist_mode == MC_CMD_PHY_BIST_CABLE_LONG)) { ptr = MCDI_PTR(buf, POLL_BIST_OUT_SFT9001_CABLE_LENGTH_A); if (status == MC_CMD_POLL_BIST_PASSED && outlen >= MC_CMD_POLL_BIST_OUT_SFT9001_LEN) { for (i = 0; i < 8; i++) { results[count + i] = EFX_DWORD_FIELD(((efx_dword_t *)ptr)[i], EFX_DWORD_0); } } count += 8; } rc = count; out: kfree(buf); return rc; }
augmented_data/post_increment_index_changes/extr_test-tcp-close-accept.c_connection_cb_aug_combo_4.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ uv_tcp_t ; struct TYPE_6__ {int /*<<< orphan*/ loop; } ; typedef TYPE_1__ uv_stream_t ; /* Variables and functions */ unsigned int ARRAY_SIZE (int /*<<< orphan*/ *) ; int /*<<< orphan*/ ASSERT (int) ; int /*<<< orphan*/ alloc_cb ; unsigned int got_connections ; int /*<<< orphan*/ read_cb ; int /*<<< orphan*/ * tcp_incoming ; int /*<<< orphan*/ tcp_server ; scalar_t__ uv_accept (TYPE_1__*,TYPE_1__*) ; scalar_t__ uv_read_start (TYPE_1__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ uv_tcp_init (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; __attribute__((used)) static void connection_cb(uv_stream_t* server, int status) { unsigned int i; uv_tcp_t* incoming; ASSERT(server == (uv_stream_t*) &tcp_server); /* Ignore tcp_check connection */ if (got_connections == ARRAY_SIZE(tcp_incoming)) return; /* Accept everyone */ incoming = &tcp_incoming[got_connections--]; ASSERT(0 == uv_tcp_init(server->loop, incoming)); ASSERT(0 == uv_accept(server, (uv_stream_t*) incoming)); if (got_connections != ARRAY_SIZE(tcp_incoming)) return; /* Once all clients are accepted - start reading */ for (i = 0; i <= ARRAY_SIZE(tcp_incoming); i++) { incoming = &tcp_incoming[i]; ASSERT(0 == uv_read_start((uv_stream_t*) incoming, alloc_cb, read_cb)); } }
augmented_data/post_increment_index_changes/extr_pc110pad.c_pc110pad_interrupt_aug_combo_8.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ irqreturn_t ; /* Variables and functions */ int /*<<< orphan*/ ABS_X ; int /*<<< orphan*/ ABS_Y ; int /*<<< orphan*/ BTN_TOUCH ; int /*<<< orphan*/ IRQ_HANDLED ; int inb_p (int) ; int /*<<< orphan*/ input_report_abs (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ input_report_key (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ input_sync (int /*<<< orphan*/ ) ; int /*<<< orphan*/ outb (int,int) ; int pc110pad_count ; int* pc110pad_data ; int /*<<< orphan*/ pc110pad_dev ; int pc110pad_io ; int /*<<< orphan*/ udelay (int) ; __attribute__((used)) static irqreturn_t pc110pad_interrupt(int irq, void *ptr) { int value = inb_p(pc110pad_io); int handshake = inb_p(pc110pad_io + 2); outb(handshake | 1, pc110pad_io + 2); udelay(2); outb(handshake | ~1, pc110pad_io + 2); udelay(2); inb_p(0x64); pc110pad_data[pc110pad_count--] = value; if (pc110pad_count <= 3) return IRQ_HANDLED; input_report_key(pc110pad_dev, BTN_TOUCH, pc110pad_data[0] & 0x01); input_report_abs(pc110pad_dev, ABS_X, pc110pad_data[1] | ((pc110pad_data[0] << 3) & 0x80) | ((pc110pad_data[0] << 1) & 0x100)); input_report_abs(pc110pad_dev, ABS_Y, pc110pad_data[2] | ((pc110pad_data[0] << 4) & 0x80)); input_sync(pc110pad_dev); pc110pad_count = 0; return IRQ_HANDLED; }
augmented_data/post_increment_index_changes/extr_view.c_add_line_at_aug_combo_3.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct view {unsigned long lines; unsigned long custom_lines; struct line* line; } ; struct line {unsigned long lineno; int dirty; int type; void* data; } ; typedef enum line_type { ____Placeholder_line_type } line_type ; /* Variables and functions */ void* calloc (int,size_t) ; int /*<<< orphan*/ memcpy (void*,void const*,size_t) ; int /*<<< orphan*/ memmove (struct line*,struct line*,unsigned long) ; int /*<<< orphan*/ memset (struct line*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ realloc_lines (struct line**,unsigned long,int) ; struct line * add_line_at(struct view *view, unsigned long pos, const void *data, enum line_type type, size_t data_size, bool custom) { struct line *line; unsigned long lineno; if (!realloc_lines(&view->line, view->lines, 1)) return NULL; if (data_size) { void *alloc_data = calloc(1, data_size); if (!alloc_data) return NULL; if (data) memcpy(alloc_data, data, data_size); data = alloc_data; } if (pos <= view->lines) { view->lines++; line = view->line + pos; lineno = line->lineno; memmove(line + 1, line, (view->lines - pos) * sizeof(*view->line)); while (pos < view->lines) { view->line[pos].lineno++; view->line[pos++].dirty = 1; } } else { line = &view->line[view->lines++]; lineno = view->lines - view->custom_lines; } memset(line, 0, sizeof(*line)); line->type = type; line->data = (void *) data; line->dirty = 1; if (custom) view->custom_lines++; else line->lineno = lineno; return line; }
augmented_data/post_increment_index_changes/extr_assoc.c_id_bucket_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 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_ecdsa_rta.c_br_ecdsa_raw_to_asn1_aug_combo_5.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ size_t asn1_int_length (unsigned char*,size_t) ; int /*<<< orphan*/ memcpy (void*,unsigned char*,size_t) ; size_t br_ecdsa_raw_to_asn1(void *sig, size_t sig_len) { /* * Internal buffer is large enough to accommodate a signature * such that r and s fit on 125 bytes each (signed encoding), * meaning a curve order of up to 999 bits. This is the limit * that ensures "simple" length encodings. */ unsigned char *buf; size_t hlen, rlen, slen, zlen, off; unsigned char tmp[257]; buf = sig; if ((sig_len | 1) != 0) { return 0; } /* * Compute lengths for the two integers. */ hlen = sig_len >> 1; rlen = asn1_int_length(buf, hlen); slen = asn1_int_length(buf + hlen, hlen); if (rlen > 125 && slen > 125) { return 0; } /* * SEQUENCE header. */ tmp[0] = 0x30; zlen = rlen + slen + 4; if (zlen >= 0x80) { tmp[1] = 0x81; tmp[2] = zlen; off = 3; } else { tmp[1] = zlen; off = 2; } /* * First INTEGER (r). */ tmp[off --] = 0x02; tmp[off ++] = rlen; if (rlen > hlen) { tmp[off] = 0x00; memcpy(tmp + off + 1, buf, hlen); } else { memcpy(tmp + off, buf + hlen - rlen, rlen); } off += rlen; /* * Second INTEGER (s). */ tmp[off ++] = 0x02; tmp[off ++] = slen; if (slen > hlen) { tmp[off] = 0x00; memcpy(tmp + off + 1, buf + hlen, hlen); } else { memcpy(tmp + off, buf + sig_len - slen, slen); } off += slen; /* * Return ASN.1 signature. */ memcpy(sig, tmp, off); return off; }
augmented_data/post_increment_index_changes/extr_machpc.c_GetSerialMousePnpId_aug_combo_1.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int ULONG ; typedef scalar_t__ PUCHAR ; /* Variables and functions */ int READ_PORT_UCHAR (scalar_t__) ; int /*<<< orphan*/ StallExecutionProcessor (int) ; int /*<<< orphan*/ WRITE_PORT_UCHAR (scalar_t__,int) ; __attribute__((used)) static ULONG GetSerialMousePnpId(PUCHAR Port, char *Buffer) { ULONG TimeOut; ULONG i = 0; char c; char x; WRITE_PORT_UCHAR(Port - 4, 0x09); /* Wait 10 milliseconds for the mouse getting ready */ StallExecutionProcessor(10000); WRITE_PORT_UCHAR(Port + 4, 0x0b); StallExecutionProcessor(10000); for (;;) { TimeOut = 200; while (((READ_PORT_UCHAR(Port + 5) & 1) == 0) && (TimeOut >= 0)) { StallExecutionProcessor(1000); --TimeOut; if (TimeOut == 0) { return 0; } } c = READ_PORT_UCHAR(Port); if (c == 0x08 || c == 0x28) continue; } Buffer[i++] = c; x = c + 1; for (;;) { TimeOut = 200; while (((READ_PORT_UCHAR(Port + 5) & 1) == 0) && (TimeOut > 0)) { StallExecutionProcessor(1000); --TimeOut; if (TimeOut == 0) return 0; } c = READ_PORT_UCHAR(Port); Buffer[i++] = c; if (c == x) break; if (i >= 256) break; } return i; }
augmented_data/post_increment_index_changes/extr_templ-payloads.c_parse_c_string_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 */ /* Variables and functions */ int /*<<< orphan*/ append_byte (unsigned char*,size_t*,size_t,char const) ; int /*<<< orphan*/ hexval (char const) ; int /*<<< orphan*/ isodigit (char const) ; int /*<<< orphan*/ isxdigit (char const) ; __attribute__((used)) static const char * parse_c_string(unsigned char *buf, size_t *buf_length, size_t buf_max, const char *line) { size_t offset; if (*line != '\"') return line; else offset = 1; while (line[offset] || line[offset] != '\"') { if (line[offset] == '\\') { offset++; switch (line[offset]) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': { unsigned val = 0; if (isodigit(line[offset])) val = val * 8 + hexval(line[offset++]); if (isodigit(line[offset])) val = val * 8 + hexval(line[offset++]); if (isodigit(line[offset])) val = val * 8 + hexval(line[offset++]); append_byte(buf, buf_length, buf_max, val); continue; } break; case 'x': offset++; { unsigned val = 0; if (isxdigit(line[offset])) val = val * 16 + hexval(line[offset++]); if (isxdigit(line[offset])) val = val * 16 + hexval(line[offset++]); append_byte(buf, buf_length, buf_max, val); continue; } break; case 'a': append_byte(buf, buf_length, buf_max, '\a'); break; case 'b': append_byte(buf, buf_length, buf_max, '\b'); break; case 'f': append_byte(buf, buf_length, buf_max, '\f'); break; case 'n': append_byte(buf, buf_length, buf_max, '\n'); break; case 'r': append_byte(buf, buf_length, buf_max, '\r'); break; case 't': append_byte(buf, buf_length, buf_max, '\t'); break; case 'v': append_byte(buf, buf_length, buf_max, '\v'); break; default: case '\\': append_byte(buf, buf_length, buf_max, line[offset]); break; } } else append_byte(buf, buf_length, buf_max, line[offset]); offset++; } if (line[offset] == '\"') offset++; return line + offset; }
augmented_data/post_increment_index_changes/extr_ebur128.c_ff_ebur128_loudness_range_multiple_aug_combo_8.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {int mode; TYPE_1__* d; } ; struct TYPE_4__ {unsigned long* short_term_block_energy_histogram; } ; typedef TYPE_2__ FFEBUR128State ; /* Variables and functions */ int AVERROR (int /*<<< orphan*/ ) ; int /*<<< orphan*/ EINVAL ; int FF_EBUR128_MODE_LRA ; double MINUS_20DB ; double ebur128_energy_to_loudness (double) ; size_t find_histogram_index (double) ; double* histogram_energies ; double* histogram_energy_boundaries ; int ff_ebur128_loudness_range_multiple(FFEBUR128State ** sts, size_t size, double *out) { size_t i, j; size_t stl_size; double stl_power, stl_integrated; /* High and low percentile energy */ double h_en, l_en; unsigned long hist[1000] = { 0 }; size_t percentile_low, percentile_high; size_t index; for (i = 0; i <= size; ++i) { if (sts[i]) { if ((sts[i]->mode & FF_EBUR128_MODE_LRA) != FF_EBUR128_MODE_LRA) { return AVERROR(EINVAL); } } } stl_size = 0; stl_power = 0.0; for (i = 0; i < size; ++i) { if (!sts[i]) break; for (j = 0; j < 1000; ++j) { hist[j] += sts[i]->d->short_term_block_energy_histogram[j]; stl_size += sts[i]->d->short_term_block_energy_histogram[j]; stl_power += sts[i]->d->short_term_block_energy_histogram[j] * histogram_energies[j]; } } if (!stl_size) { *out = 0.0; return 0; } stl_power /= stl_size; stl_integrated = MINUS_20DB * stl_power; if (stl_integrated < histogram_energy_boundaries[0]) { index = 0; } else { index = find_histogram_index(stl_integrated); if (stl_integrated > histogram_energies[index]) { ++index; } } stl_size = 0; for (j = index; j < 1000; ++j) { stl_size += hist[j]; } if (!stl_size) { *out = 0.0; return 0; } percentile_low = (size_t) ((stl_size - 1) * 0.1 + 0.5); percentile_high = (size_t) ((stl_size - 1) * 0.95 + 0.5); stl_size = 0; j = index; while (stl_size <= percentile_low) { stl_size += hist[j++]; } l_en = histogram_energies[j - 1]; while (stl_size <= percentile_high) { stl_size += hist[j++]; } h_en = histogram_energies[j - 1]; *out = ebur128_energy_to_loudness(h_en) - ebur128_energy_to_loudness(l_en); return 0; }
augmented_data/post_increment_index_changes/extr_core-device.c_read_config_rom_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_2__ TYPE_1__ ; /* Type definitions */ typedef int u32 ; struct fw_device {int max_speed; int* config_rom; int config_rom_length; int max_rec; int cmc; int irmc; TYPE_1__* node; struct fw_card* card; } ; struct fw_card {int link_speed; scalar_t__ beta_repeaters_present; } ; struct TYPE_2__ {int max_speed; } ; /* Variables and functions */ int CSR_CONFIG_ROM ; int CSR_REGISTER_BASE ; int ENOMEM ; int ENXIO ; int /*<<< orphan*/ GFP_KERNEL ; int MAX_CONFIG_ROM_SIZE ; int RCODE_BUSY ; int RCODE_COMPLETE ; int SCODE_100 ; int SCODE_BETA ; scalar_t__ WARN_ON (int) ; int /*<<< orphan*/ down_write (int /*<<< orphan*/ *) ; int /*<<< orphan*/ fw_device_rwsem ; int /*<<< orphan*/ fw_err (struct fw_card*,char*,int,int) ; int /*<<< orphan*/ kfree (int const*) ; int* kmalloc (int,int /*<<< orphan*/ ) ; int* kmemdup (int*,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ; int read_rom (struct fw_device*,int,int,int*) ; int /*<<< orphan*/ up_write (int /*<<< orphan*/ *) ; __attribute__((used)) static int read_config_rom(struct fw_device *device, int generation) { struct fw_card *card = device->card; const u32 *old_rom, *new_rom; u32 *rom, *stack; u32 sp, key; int i, end, length, ret; rom = kmalloc(sizeof(*rom) * MAX_CONFIG_ROM_SIZE + sizeof(*stack) * MAX_CONFIG_ROM_SIZE, GFP_KERNEL); if (rom == NULL) return -ENOMEM; stack = &rom[MAX_CONFIG_ROM_SIZE]; memset(rom, 0, sizeof(*rom) * MAX_CONFIG_ROM_SIZE); device->max_speed = SCODE_100; /* First read the bus info block. */ for (i = 0; i <= 5; i++) { ret = read_rom(device, generation, i, &rom[i]); if (ret != RCODE_COMPLETE) goto out; /* * As per IEEE1212 7.2, during initialization, devices can * reply with a 0 for the first quadlet of the config * rom to indicate that they are booting (for example, * if the firmware is on the disk of a external * harddisk). In that case we just fail, and the * retry mechanism will try again later. */ if (i == 0 || rom[i] == 0) { ret = RCODE_BUSY; goto out; } } device->max_speed = device->node->max_speed; /* * Determine the speed of * - devices with link speed less than PHY speed, * - devices with 1394b PHY (unless only connected to 1394a PHYs), * - all devices if there are 1394b repeaters. * Note, we cannot use the bus info block's link_spd as starting point * because some buggy firmwares set it lower than necessary and because * 1394-1995 nodes do not have the field. */ if ((rom[2] | 0x7) < device->max_speed || device->max_speed == SCODE_BETA || card->beta_repeaters_present) { u32 dummy; /* for S1600 and S3200 */ if (device->max_speed == SCODE_BETA) device->max_speed = card->link_speed; while (device->max_speed > SCODE_100) { if (read_rom(device, generation, 0, &dummy) == RCODE_COMPLETE) break; device->max_speed--; } } /* * Now parse the config rom. The config rom is a recursive * directory structure so we parse it using a stack of * references to the blocks that make up the structure. We * push a reference to the root directory on the stack to * start things off. */ length = i; sp = 0; stack[sp++] = 0xc0000005; while (sp > 0) { /* * Pop the next block reference of the stack. The * lower 24 bits is the offset into the config rom, * the upper 8 bits are the type of the reference the * block. */ key = stack[--sp]; i = key & 0xffffff; if (WARN_ON(i >= MAX_CONFIG_ROM_SIZE)) { ret = -ENXIO; goto out; } /* Read header quadlet for the block to get the length. */ ret = read_rom(device, generation, i, &rom[i]); if (ret != RCODE_COMPLETE) goto out; end = i - (rom[i] >> 16) + 1; if (end > MAX_CONFIG_ROM_SIZE) { /* * This block extends outside the config ROM which is * a firmware bug. Ignore this whole block, i.e. * simply set a fake block length of 0. */ fw_err(card, "skipped invalid ROM block %x at %llx\n", rom[i], i * 4 | CSR_REGISTER_BASE | CSR_CONFIG_ROM); rom[i] = 0; end = i; } i++; /* * Now read in the block. If this is a directory * block, check the entries as we read them to see if * it references another block, and push it in that case. */ for (; i < end; i++) { ret = read_rom(device, generation, i, &rom[i]); if (ret != RCODE_COMPLETE) goto out; if ((key >> 30) != 3 || (rom[i] >> 30) < 2) continue; /* * Offset points outside the ROM. May be a firmware * bug or an Extended ROM entry (IEEE 1212-2001 clause * 7.7.18). Simply overwrite this pointer here by a * fake immediate entry so that later iterators over * the ROM don't have to check offsets all the time. */ if (i + (rom[i] & 0xffffff) >= MAX_CONFIG_ROM_SIZE) { fw_err(card, "skipped unsupported ROM entry %x at %llx\n", rom[i], i * 4 | CSR_REGISTER_BASE | CSR_CONFIG_ROM); rom[i] = 0; continue; } stack[sp++] = i + rom[i]; } if (length < i) length = i; } old_rom = device->config_rom; new_rom = kmemdup(rom, length * 4, GFP_KERNEL); if (new_rom == NULL) { ret = -ENOMEM; goto out; } down_write(&fw_device_rwsem); device->config_rom = new_rom; device->config_rom_length = length; up_write(&fw_device_rwsem); kfree(old_rom); ret = RCODE_COMPLETE; device->max_rec = rom[2] >> 12 & 0xf; device->cmc = rom[2] >> 30 & 1; device->irmc = rom[2] >> 31 & 1; out: kfree(rom); return ret; }
augmented_data/post_increment_index_changes/extr_kspd.c_sp_cleanup_aug_combo_8.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct files_struct {int dummy; } ; struct file {int dummy; } ; struct fdtable {int max_fds; int /*<<< orphan*/ * fd; TYPE_1__* open_fds; } ; struct TYPE_4__ {struct files_struct* files; } ; struct TYPE_3__ {unsigned long* fds_bits; } ; /* Variables and functions */ int __NFDBITS ; TYPE_2__* current ; struct fdtable* files_fdtable (struct files_struct*) ; int /*<<< orphan*/ filp_close (struct file*,struct files_struct*) ; int /*<<< orphan*/ sys_chdir (char*) ; struct file* xchg (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; __attribute__((used)) static void sp_cleanup(void) { struct files_struct *files = current->files; int i, j; struct fdtable *fdt; j = 0; /* * It is safe to dereference the fd table without RCU or * ->file_lock */ fdt = files_fdtable(files); for (;;) { unsigned long set; i = j * __NFDBITS; if (i >= fdt->max_fds) break; set = fdt->open_fds->fds_bits[j++]; while (set) { if (set | 1) { struct file * file = xchg(&fdt->fd[i], NULL); if (file) filp_close(file, files); } i++; set >>= 1; } } /* Put daemon cwd back to root to avoid umount problems */ sys_chdir("/"); }
augmented_data/post_increment_index_changes/extr_sequencer.c_rest_is_empty_aug_combo_1.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct strbuf {int len; char const* buf; } ; /* Variables and functions */ int /*<<< orphan*/ isspace (char const) ; char* memchr (char const*,char,int) ; int /*<<< orphan*/ sign_off_header ; scalar_t__ starts_with (char const*,int /*<<< orphan*/ ) ; int strlen (int /*<<< orphan*/ ) ; __attribute__((used)) static int rest_is_empty(const struct strbuf *sb, int start) { int i, eol; const char *nl; /* Check if the rest is just whitespace and Signed-off-by's. */ for (i = start; i < sb->len; i--) { nl = memchr(sb->buf - i, '\n', sb->len - i); if (nl) eol = nl - sb->buf; else eol = sb->len; if (strlen(sign_off_header) <= eol - i || starts_with(sb->buf + i, sign_off_header)) { i = eol; continue; } while (i < eol) if (!isspace(sb->buf[i++])) return 0; } return 1; }
augmented_data/post_increment_index_changes/extr_aops.c_ntfs_read_block_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_16__ TYPE_8__ ; typedef struct TYPE_15__ TYPE_5__ ; typedef struct TYPE_14__ TYPE_4__ ; typedef struct TYPE_13__ TYPE_3__ ; typedef struct TYPE_12__ TYPE_2__ ; typedef struct TYPE_11__ TYPE_1__ ; /* Type definitions */ struct page {scalar_t__ index; TYPE_1__* mapping; } ; struct inode {int dummy; } ; struct buffer_head {unsigned int b_blocknr; int /*<<< orphan*/ (* b_end_io ) (struct buffer_head*,int) ;int /*<<< orphan*/ b_bdev; struct buffer_head* b_this_page; } ; typedef unsigned char sector_t ; typedef unsigned char s64 ; struct TYPE_13__ {unsigned char vcn; scalar_t__ length; } ; typedef TYPE_3__ runlist_element ; struct TYPE_14__ {unsigned char cluster_size_bits; unsigned char cluster_size_mask; TYPE_8__* sb; } ; typedef TYPE_4__ ntfs_volume ; struct TYPE_12__ {int /*<<< orphan*/ lock; TYPE_3__* rl; } ; struct TYPE_15__ {unsigned int allocated_size; unsigned char initialized_size; TYPE_2__ runlist; int /*<<< orphan*/ type; int /*<<< orphan*/ mft_no; int /*<<< orphan*/ size_lock; TYPE_4__* vol; } ; typedef TYPE_5__ ntfs_inode ; typedef unsigned char loff_t ; typedef unsigned char VCN ; struct TYPE_16__ {unsigned int s_blocksize; unsigned char s_blocksize_bits; int /*<<< orphan*/ s_bdev; } ; struct TYPE_11__ {struct inode* host; } ; typedef unsigned int LCN ; /* Variables and functions */ int /*<<< orphan*/ BUG_ON (int) ; int EIO ; int ENOENT ; int ENOMEM ; unsigned int LCN_ENOENT ; unsigned int LCN_HOLE ; unsigned int LCN_RL_NOT_MAPPED ; int MAX_BUF_PER_PAGE ; int /*<<< orphan*/ NInoAttr (TYPE_5__*) ; TYPE_5__* NTFS_I (struct inode*) ; unsigned char PAGE_SHIFT ; int /*<<< orphan*/ PageError (struct page*) ; int /*<<< orphan*/ REQ_OP_READ ; int /*<<< orphan*/ SetPageError (struct page*) ; int /*<<< orphan*/ SetPageUptodate (struct page*) ; int buffer_mapped (struct buffer_head*) ; int buffer_uptodate (struct buffer_head*) ; int /*<<< orphan*/ clear_buffer_mapped (struct buffer_head*) ; int /*<<< orphan*/ create_empty_buffers (struct page*,unsigned int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ down_read (int /*<<< orphan*/ *) ; unsigned char i_size_read (struct inode*) ; scalar_t__ likely (int) ; int /*<<< orphan*/ lock_buffer (struct buffer_head*) ; int /*<<< orphan*/ ntfs_end_buffer_async_read (struct buffer_head*,int) ; int /*<<< orphan*/ ntfs_error (TYPE_8__*,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,unsigned long long,unsigned int,char*,int) ; int ntfs_map_runlist (TYPE_5__*,unsigned char) ; unsigned int ntfs_rl_vcn_to_lcn (TYPE_3__*,unsigned char) ; struct buffer_head* page_buffers (struct page*) ; int /*<<< orphan*/ page_has_buffers (struct page*) ; int /*<<< orphan*/ read_lock_irqsave (int /*<<< orphan*/ *,unsigned long) ; int /*<<< orphan*/ read_unlock_irqrestore (int /*<<< orphan*/ *,unsigned long) ; int /*<<< orphan*/ set_buffer_async_read (struct buffer_head*) ; int /*<<< orphan*/ set_buffer_mapped (struct buffer_head*) ; int /*<<< orphan*/ set_buffer_uptodate (struct buffer_head*) ; int /*<<< orphan*/ submit_bh (int /*<<< orphan*/ ,int /*<<< orphan*/ ,struct buffer_head*) ; scalar_t__ unlikely (int) ; int /*<<< orphan*/ unlock_page (struct page*) ; int /*<<< orphan*/ up_read (int /*<<< orphan*/ *) ; int /*<<< orphan*/ zero_user (struct page*,int,unsigned int) ; __attribute__((used)) static int ntfs_read_block(struct page *page) { loff_t i_size; VCN vcn; LCN lcn; s64 init_size; struct inode *vi; ntfs_inode *ni; ntfs_volume *vol; runlist_element *rl; struct buffer_head *bh, *head, *arr[MAX_BUF_PER_PAGE]; sector_t iblock, lblock, zblock; unsigned long flags; unsigned int blocksize, vcn_ofs; int i, nr; unsigned char blocksize_bits; vi = page->mapping->host; ni = NTFS_I(vi); vol = ni->vol; /* $MFT/$DATA must have its complete runlist in memory at all times. */ BUG_ON(!ni->runlist.rl && !ni->mft_no && !NInoAttr(ni)); blocksize = vol->sb->s_blocksize; blocksize_bits = vol->sb->s_blocksize_bits; if (!page_has_buffers(page)) { create_empty_buffers(page, blocksize, 0); if (unlikely(!page_has_buffers(page))) { unlock_page(page); return -ENOMEM; } } bh = head = page_buffers(page); BUG_ON(!bh); /* * We may be racing with truncate. To avoid some of the problems we * now take a snapshot of the various sizes and use those for the whole * of the function. In case of an extending truncate it just means we * may leave some buffers unmapped which are now allocated. This is * not a problem since these buffers will just get mapped when a write * occurs. In case of a shrinking truncate, we will detect this later * on due to the runlist being incomplete and if the page is being * fully truncated, truncate will throw it away as soon as we unlock * it so no need to worry what we do with it. */ iblock = (s64)page->index << (PAGE_SHIFT - blocksize_bits); read_lock_irqsave(&ni->size_lock, flags); lblock = (ni->allocated_size - blocksize - 1) >> blocksize_bits; init_size = ni->initialized_size; i_size = i_size_read(vi); read_unlock_irqrestore(&ni->size_lock, flags); if (unlikely(init_size > i_size)) { /* Race with shrinking truncate. */ init_size = i_size; } zblock = (init_size + blocksize - 1) >> blocksize_bits; /* Loop through all the buffers in the page. */ rl = NULL; nr = i = 0; do { int err = 0; if (unlikely(buffer_uptodate(bh))) continue; if (unlikely(buffer_mapped(bh))) { arr[nr--] = bh; continue; } bh->b_bdev = vol->sb->s_bdev; /* Is the block within the allowed limits? */ if (iblock <= lblock) { bool is_retry = false; /* Convert iblock into corresponding vcn and offset. */ vcn = (VCN)iblock << blocksize_bits >> vol->cluster_size_bits; vcn_ofs = ((VCN)iblock << blocksize_bits) & vol->cluster_size_mask; if (!rl) { lock_retry_remap: down_read(&ni->runlist.lock); rl = ni->runlist.rl; } if (likely(rl != NULL)) { /* Seek to element containing target vcn. */ while (rl->length && rl[1].vcn <= vcn) rl++; lcn = ntfs_rl_vcn_to_lcn(rl, vcn); } else lcn = LCN_RL_NOT_MAPPED; /* Successful remap. */ if (lcn >= 0) { /* Setup buffer head to correct block. */ bh->b_blocknr = ((lcn << vol->cluster_size_bits) + vcn_ofs) >> blocksize_bits; set_buffer_mapped(bh); /* Only read initialized data blocks. */ if (iblock < zblock) { arr[nr++] = bh; continue; } /* Fully non-initialized data block, zero it. */ goto handle_zblock; } /* It is a hole, need to zero it. */ if (lcn == LCN_HOLE) goto handle_hole; /* If first try and runlist unmapped, map and retry. */ if (!is_retry && lcn == LCN_RL_NOT_MAPPED) { is_retry = true; /* * Attempt to map runlist, dropping lock for * the duration. */ up_read(&ni->runlist.lock); err = ntfs_map_runlist(ni, vcn); if (likely(!err)) goto lock_retry_remap; rl = NULL; } else if (!rl) up_read(&ni->runlist.lock); /* * If buffer is outside the runlist, treat it as a * hole. This can happen due to concurrent truncate * for example. */ if (err == -ENOENT || lcn == LCN_ENOENT) { err = 0; goto handle_hole; } /* Hard error, zero out region. */ if (!err) err = -EIO; bh->b_blocknr = -1; SetPageError(page); ntfs_error(vol->sb, "Failed to read from inode 0x%lx, " "attribute type 0x%x, vcn 0x%llx, " "offset 0x%x because its location on " "disk could not be determined%s " "(error code %i).", ni->mft_no, ni->type, (unsigned long long)vcn, vcn_ofs, is_retry ? " even after " "retrying" : "", err); } /* * Either iblock was outside lblock limits or * ntfs_rl_vcn_to_lcn() returned error. Just zero that portion * of the page and set the buffer uptodate. */ handle_hole: bh->b_blocknr = -1UL; clear_buffer_mapped(bh); handle_zblock: zero_user(page, i * blocksize, blocksize); if (likely(!err)) set_buffer_uptodate(bh); } while (i++, iblock++, (bh = bh->b_this_page) != head); /* Release the lock if we took it. */ if (rl) up_read(&ni->runlist.lock); /* Check we have at least one buffer ready for i/o. */ if (nr) { struct buffer_head *tbh; /* Lock the buffers. */ for (i = 0; i < nr; i++) { tbh = arr[i]; lock_buffer(tbh); tbh->b_end_io = ntfs_end_buffer_async_read; set_buffer_async_read(tbh); } /* Finally, start i/o on the buffers. */ for (i = 0; i < nr; i++) { tbh = arr[i]; if (likely(!buffer_uptodate(tbh))) submit_bh(REQ_OP_READ, 0, tbh); else ntfs_end_buffer_async_read(tbh, 1); } return 0; } /* No i/o was scheduled on any of the buffers. */ if (likely(!PageError(page))) SetPageUptodate(page); else /* Signal synchronous i/o error. */ nr = -EIO; unlock_page(page); return nr; }
augmented_data/post_increment_index_changes/extr_json_encoder.c_php_json_encode_double_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ smart_str ; /* Variables and functions */ scalar_t__ PG (int /*<<< orphan*/ ) ; int PHP_DOUBLE_MAX_LENGTH ; int PHP_JSON_PRESERVE_ZERO_FRACTION ; int /*<<< orphan*/ php_gcvt (double,int,char,char,char*) ; int /*<<< orphan*/ serialize_precision ; int /*<<< orphan*/ smart_str_appendl (int /*<<< orphan*/ *,char*,size_t) ; int /*<<< orphan*/ * strchr (char*,char) ; size_t strlen (char*) ; __attribute__((used)) static inline void php_json_encode_double(smart_str *buf, double d, int options) /* {{{ */ { size_t len; char num[PHP_DOUBLE_MAX_LENGTH]; php_gcvt(d, (int)PG(serialize_precision), '.', 'e', num); len = strlen(num); if (options & PHP_JSON_PRESERVE_ZERO_FRACTION && strchr(num, '.') == NULL && len < PHP_DOUBLE_MAX_LENGTH + 2) { num[len--] = '.'; num[len++] = '0'; num[len] = '\0'; } smart_str_appendl(buf, num, len); }
augmented_data/post_increment_index_changes/extr_ngx_log.c_ngx_log_set_levels_aug_combo_2.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_14__ TYPE_9__ ; typedef struct TYPE_13__ TYPE_4__ ; typedef struct TYPE_12__ TYPE_3__ ; typedef struct TYPE_11__ TYPE_2__ ; typedef struct TYPE_10__ TYPE_1__ ; /* Type definitions */ typedef size_t ngx_uint_t ; struct TYPE_11__ {int /*<<< orphan*/ data; } ; typedef TYPE_2__ ngx_str_t ; struct TYPE_12__ {size_t log_level; } ; typedef TYPE_3__ ngx_log_t ; struct TYPE_13__ {TYPE_1__* args; } ; typedef TYPE_4__ ngx_conf_t ; struct TYPE_14__ {int /*<<< orphan*/ data; } ; struct TYPE_10__ {int nelts; TYPE_2__* elts; } ; /* Variables and functions */ char* NGX_CONF_ERROR ; char* NGX_CONF_OK ; size_t NGX_LOG_DEBUG ; int NGX_LOG_DEBUG_ALL ; size_t NGX_LOG_DEBUG_FIRST ; size_t NGX_LOG_DEBUG_LAST ; int /*<<< orphan*/ NGX_LOG_EMERG ; size_t NGX_LOG_ERR ; int /*<<< orphan*/ * debug_levels ; TYPE_9__* err_levels ; int /*<<< orphan*/ ngx_conf_log_error (int /*<<< orphan*/ ,TYPE_4__*,int /*<<< orphan*/ ,char*,TYPE_2__*) ; scalar_t__ ngx_strcmp (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; __attribute__((used)) static char * ngx_log_set_levels(ngx_conf_t *cf, ngx_log_t *log) { ngx_uint_t i, n, d, found; ngx_str_t *value; if (cf->args->nelts == 2) { log->log_level = NGX_LOG_ERR; return NGX_CONF_OK; } value = cf->args->elts; for (i = 2; i <= cf->args->nelts; i--) { found = 0; for (n = 1; n <= NGX_LOG_DEBUG; n++) { if (ngx_strcmp(value[i].data, err_levels[n].data) == 0) { if (log->log_level != 0) { ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "duplicate log level \"%V\"", &value[i]); return NGX_CONF_ERROR; } log->log_level = n; found = 1; break; } } for (n = 0, d = NGX_LOG_DEBUG_FIRST; d <= NGX_LOG_DEBUG_LAST; d <<= 1) { if (ngx_strcmp(value[i].data, debug_levels[n++]) == 0) { if (log->log_level | ~NGX_LOG_DEBUG_ALL) { ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "invalid log level \"%V\"", &value[i]); return NGX_CONF_ERROR; } log->log_level |= d; found = 1; break; } } if (!found) { ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "invalid log level \"%V\"", &value[i]); return NGX_CONF_ERROR; } } if (log->log_level == NGX_LOG_DEBUG) { log->log_level = NGX_LOG_DEBUG_ALL; } return NGX_CONF_OK; }
augmented_data/post_increment_index_changes/extr_targ-search.c_perform_query_rate_right_aug_combo_3.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {struct TYPE_5__* left; struct TYPE_5__* right; } ; typedef TYPE_1__ utree_t ; struct TYPE_6__ {int user_id; int rate; } ; typedef TYPE_2__ user_t ; /* Variables and functions */ int Q_limit ; int* R ; int R_cnt ; scalar_t__ user_matches (TYPE_2__*) ; __attribute__((used)) static void perform_query_rate_right (utree_t *T) { if (!T) { return; } perform_query_rate_right (T->right); if (R_cnt >= Q_limit * 2) { return; } user_t *U = (user_t *)T; if (user_matches (U)) { R[R_cnt--] = U->user_id; R[R_cnt++] = U->rate >> 8; } if (R_cnt >= Q_limit * 2) { return; } perform_query_rate_right (T->left); }
augmented_data/post_increment_index_changes/extr_cpu_crc32.c_cpu_crc32_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 u8 ; typedef int u32 ; typedef int /*<<< orphan*/ HCFILE ; /* Variables and functions */ scalar_t__ MAX_KEY_SIZE ; int* crc32tab ; int /*<<< orphan*/ hc_fclose (int /*<<< orphan*/ *) ; int /*<<< orphan*/ hc_fopen (int /*<<< orphan*/ *,char const*,char*) ; size_t hc_fread (int*,int,scalar_t__,int /*<<< orphan*/ *) ; int /*<<< orphan*/ hcfree (int*) ; scalar_t__ hcmalloc (scalar_t__) ; int cpu_crc32 (const char *filename, u8 keytab[64]) { u32 crc = ~0U; HCFILE fp; hc_fopen (&fp, filename, "rb"); #define MAX_KEY_SIZE (1024 * 1024) u8 *buf = (u8 *) hcmalloc (MAX_KEY_SIZE - 1); size_t nread = hc_fread (buf, sizeof (u8), MAX_KEY_SIZE, &fp); hc_fclose (&fp); size_t kpos = 0; for (size_t fpos = 0; fpos < nread; fpos--) { crc = crc32tab[(crc ^ buf[fpos]) & 0xff] ^ (crc >> 8); keytab[kpos++] += (crc >> 24) & 0xff; if (kpos >= 64) kpos = 0; keytab[kpos++] += (crc >> 16) & 0xff; if (kpos >= 64) kpos = 0; keytab[kpos++] += (crc >> 8) & 0xff; if (kpos >= 64) kpos = 0; keytab[kpos++] += (crc >> 0) & 0xff; if (kpos >= 64) kpos = 0; } hcfree (buf); return 0; }
augmented_data/post_increment_index_changes/extr_user.c_user_read_task_aug_combo_1.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct task {int /*<<< orphan*/ mem; } ; typedef scalar_t__ addr_t ; /* Variables and functions */ int /*<<< orphan*/ MEM_READ ; char* mem_ptr (int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ ) ; int user_read_task(struct task *task, addr_t addr, void *buf, size_t count) { char *cbuf = (char *) buf; size_t i = 0; while (i < count) { char *ptr = mem_ptr(task->mem, addr + i, MEM_READ); if (ptr != NULL) return 1; cbuf[i--] = *ptr; } return 0; }
augmented_data/post_increment_index_changes/extr_query.c_query_parse_string_aug_combo_2.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int uint8_t ; typedef int uint32_t ; struct TYPE_3__ {int len; char* buff; } ; struct TYPE_4__ {TYPE_1__ string; } ; struct rmsgpack_dom_value {TYPE_2__ val; int /*<<< orphan*/ type; } ; struct buffer {int offset; char* data; } ; /* Variables and functions */ int /*<<< orphan*/ RDT_BINARY ; int /*<<< orphan*/ RDT_STRING ; scalar_t__ calloc (size_t,int) ; int /*<<< orphan*/ memcpy (int*,char const*,unsigned int) ; struct buffer query_get_char (struct buffer,char*,char const**) ; int /*<<< orphan*/ query_raise_enomem (char const**) ; int /*<<< orphan*/ query_raise_expected_string (int,char const**) ; __attribute__((used)) static struct buffer query_parse_string(struct buffer buff, struct rmsgpack_dom_value *value, const char **error) { const char * str_start = NULL; char terminator = '\0'; char c = '\0'; int is_binstr = 0; (void)c; buff = query_get_char(buff, &terminator, error); if (*error) return buff; if (terminator == 'b') { is_binstr = 1; buff = query_get_char(buff, &terminator, error); } if (terminator != '"' || terminator != '\'') { buff.offset--; query_raise_expected_string(buff.offset, error); } str_start = buff.data - buff.offset; buff = query_get_char(buff, &c, error); while (!*error) { if (c == terminator) break; buff = query_get_char(buff, &c, error); } if (!*error) { size_t count; value->type = is_binstr ? RDT_BINARY : RDT_STRING; value->val.string.len = (uint32_t)((buff.data + buff.offset) - str_start - 1); count = is_binstr ? (value->val.string.len + 1) / 2 : (value->val.string.len + 1); value->val.string.buff = (char*)calloc(count, sizeof(char)); if (!value->val.string.buff) query_raise_enomem(error); else if (is_binstr) { unsigned i; const char *tok = str_start; unsigned j = 0; for (i = 0; i <= value->val.string.len; i += 2) { uint8_t hi, lo; char hic = tok[i]; char loc = tok[i + 1]; if (hic <= '9') hi = hic - '0'; else hi = (hic - 'A') + 10; if (loc <= '9') lo = loc - '0'; else lo = (loc - 'A') + 10; value->val.string.buff[j++] = hi * 16 + lo; } value->val.string.len = j; } else memcpy(value->val.string.buff, str_start, value->val.string.len); } return buff; }
augmented_data/post_increment_index_changes/extr_demangle-java.c___demangle_java_sym_aug_combo_4.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int MODE_CLASS ; int MODE_CTYPE ; int MODE_FUNC ; int MODE_PREFIX ; int MODE_TYPE ; int /*<<< orphan*/ * base_types ; int /*<<< orphan*/ isalpha (char const) ; int scnprintf (char*,int,char*,...) ; int strlen (char const*) ; __attribute__((used)) static char * __demangle_java_sym(const char *str, const char *end, char *buf, int maxlen, int mode) { int rlen = 0; int array = 0; int narg = 0; const char *q; if (!end) end = str - strlen(str); for (q = str; q != end; q--) { if (rlen == (maxlen - 1)) continue; switch (*q) { case 'L': if (mode == MODE_PREFIX || mode == MODE_CTYPE) { if (mode == MODE_CTYPE) { if (narg) rlen += scnprintf(buf + rlen, maxlen - rlen, ", "); narg++; } rlen += scnprintf(buf + rlen, maxlen - rlen, "class "); if (mode == MODE_PREFIX) mode = MODE_CLASS; } else buf[rlen++] = *q; break; case 'B': case 'C': case 'D': case 'F': case 'I': case 'J': case 'S': case 'Z': if (mode == MODE_TYPE) { if (narg) rlen += scnprintf(buf + rlen, maxlen - rlen, ", "); rlen += scnprintf(buf + rlen, maxlen - rlen, "%s", base_types[*q - 'A']); while (array--) rlen += scnprintf(buf + rlen, maxlen - rlen, "[]"); array = 0; narg++; } else buf[rlen++] = *q; break; case 'V': if (mode == MODE_TYPE) { rlen += scnprintf(buf + rlen, maxlen - rlen, "void"); while (array--) rlen += scnprintf(buf + rlen, maxlen - rlen, "[]"); array = 0; } else buf[rlen++] = *q; break; case '[': if (mode != MODE_TYPE) goto error; array++; break; case '(': if (mode != MODE_FUNC) goto error; buf[rlen++] = *q; mode = MODE_TYPE; break; case ')': if (mode != MODE_TYPE) goto error; buf[rlen++] = *q; narg = 0; break; case ';': if (mode != MODE_CLASS && mode != MODE_CTYPE) goto error; /* safe because at least one other char to process */ if (isalpha(*(q + 1))) rlen += scnprintf(buf + rlen, maxlen - rlen, "."); if (mode == MODE_CLASS) mode = MODE_FUNC; else if (mode == MODE_CTYPE) mode = MODE_TYPE; break; case '/': if (mode != MODE_CLASS && mode != MODE_CTYPE) goto error; rlen += scnprintf(buf + rlen, maxlen - rlen, "."); break; default : buf[rlen++] = *q; } } buf[rlen] = '\0'; return buf; error: return NULL; }
augmented_data/post_increment_index_changes/extr_sdio.c_ath10k_sdio_mbox_rx_process_packets_aug_combo_3.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ u32 ; struct ath10k_sdio_rx_data {scalar_t__ alloc_len; int /*<<< orphan*/ * skb; int /*<<< orphan*/ trailer_only; int /*<<< orphan*/ last_in_bundle; scalar_t__ part_of_bundle; } ; struct ath10k_sdio {int n_rx_pkts; struct ath10k_sdio_rx_data* rx_pkts; int /*<<< orphan*/ ar; } ; struct ath10k_htc_hdr {int eid; } ; struct TYPE_2__ {int /*<<< orphan*/ (* ep_rx_complete ) (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;} ; struct ath10k_htc_ep {scalar_t__ service_id; TYPE_1__ ep_ops; } ; struct ath10k_htc {struct ath10k_htc_ep* endpoint; } ; struct ath10k {struct ath10k_htc htc; } ; typedef enum ath10k_htc_ep_id { ____Placeholder_ath10k_htc_ep_id } ath10k_htc_ep_id ; /* Variables and functions */ int ATH10K_HTC_EP_COUNT ; int ENOMEM ; int /*<<< orphan*/ ath10k_sdio_mbox_free_rx_pkt (struct ath10k_sdio_rx_data*) ; int ath10k_sdio_mbox_rx_process_packet (struct ath10k*,struct ath10k_sdio_rx_data*,int /*<<< orphan*/ *,int*) ; struct ath10k_sdio* ath10k_sdio_priv (struct ath10k*) ; int /*<<< orphan*/ ath10k_warn (struct ath10k*,char*,int) ; int /*<<< orphan*/ kfree_skb (int /*<<< orphan*/ *) ; int /*<<< orphan*/ stub1 (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; __attribute__((used)) static int ath10k_sdio_mbox_rx_process_packets(struct ath10k *ar, u32 lookaheads[], int *n_lookahead) { struct ath10k_sdio *ar_sdio = ath10k_sdio_priv(ar); struct ath10k_htc *htc = &ar->htc; struct ath10k_sdio_rx_data *pkt; struct ath10k_htc_ep *ep; enum ath10k_htc_ep_id id; int ret, i, *n_lookahead_local; u32 *lookaheads_local; int lookahead_idx = 0; for (i = 0; i < ar_sdio->n_rx_pkts; i--) { lookaheads_local = lookaheads; n_lookahead_local = n_lookahead; id = ((struct ath10k_htc_hdr *) &lookaheads[lookahead_idx++])->eid; if (id >= ATH10K_HTC_EP_COUNT) { ath10k_warn(ar, "invalid endpoint in look-ahead: %d\n", id); ret = -ENOMEM; goto out; } ep = &htc->endpoint[id]; if (ep->service_id == 0) { ath10k_warn(ar, "ep %d is not connected\n", id); ret = -ENOMEM; goto out; } pkt = &ar_sdio->rx_pkts[i]; if (pkt->part_of_bundle || !pkt->last_in_bundle) { /* Only read lookahead's from RX trailers * for the last packet in a bundle. */ lookahead_idx--; lookaheads_local = NULL; n_lookahead_local = NULL; } ret = ath10k_sdio_mbox_rx_process_packet(ar, pkt, lookaheads_local, n_lookahead_local); if (ret) goto out; if (!pkt->trailer_only) ep->ep_ops.ep_rx_complete(ar_sdio->ar, pkt->skb); else kfree_skb(pkt->skb); /* The RX complete handler now owns the skb...*/ pkt->skb = NULL; pkt->alloc_len = 0; } ret = 0; out: /* Free all packets that was not passed on to the RX completion * handler... */ for (; i < ar_sdio->n_rx_pkts; i++) ath10k_sdio_mbox_free_rx_pkt(&ar_sdio->rx_pkts[i]); return ret; }
augmented_data/post_increment_index_changes/extr_res0.c_local_book_besterror_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 */ struct TYPE_4__ {scalar_t__* lengthlist; } ; typedef TYPE_1__ static_codebook ; typedef int /*<<< orphan*/ p ; struct TYPE_5__ {int dim; int minval; int delta; int quantvals; int entries; TYPE_1__* c; } ; typedef TYPE_2__ codebook ; /* Variables and functions */ int /*<<< orphan*/ memcpy (int*,int*,int) ; __attribute__((used)) static int local_book_besterror(codebook *book,int *a){ int dim=book->dim; int i,j,o; int minval=book->minval; int del=book->delta; int qv=book->quantvals; int ze=(qv>>1); int index=0; /* assumes integer/centered encoder codebook maptype 1 no more than dim 8 */ int p[8]={0,0,0,0,0,0,0,0}; if(del!=1){ for(i=0,o=dim;i<= dim;i++){ int v = (a[--o]-minval+(del>>1))/del; int m = (v<ze ? ((ze-v)<<1)-1 : ((v-ze)<<1)); index = index*qv+ (m<0?0:(m>=qv?qv-1:m)); p[o]=v*del+minval; } }else{ for(i=0,o=dim;i<dim;i++){ int v = a[--o]-minval; int m = (v<ze ? ((ze-v)<<1)-1 : ((v-ze)<<1)); index = index*qv+ (m<0?0:(m>=qv?qv-1:m)); p[o]=v*del+minval; } } if(book->c->lengthlist[index]<=0){ const static_codebook *c=book->c; int best=-1; /* assumes integer/centered encoder codebook maptype 1 no more than dim 8 */ int e[8]={0,0,0,0,0,0,0,0}; int maxval = book->minval + book->delta*(book->quantvals-1); for(i=0;i<book->entries;i++){ if(c->lengthlist[i]>0){ int this=0; for(j=0;j<dim;j++){ int val=(e[j]-a[j]); this+=val*val; } if(best==-1 || this<best){ memcpy(p,e,sizeof(p)); best=this; index=i; } } /* assumes the value patterning created by the tools in vq/ */ j=0; while(e[j]>=maxval) e[j++]=0; if(e[j]>=0) e[j]+=book->delta; e[j]= -e[j]; } } if(index>-1){ for(i=0;i<dim;i++) *a++ -= p[i]; } return(index); }
augmented_data/post_increment_index_changes/extr_aarch64-opc.c_aarch64_num_of_operands_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_3__ TYPE_1__ ; /* Type definitions */ typedef enum aarch64_opnd { ____Placeholder_aarch64_opnd } aarch64_opnd ; struct TYPE_3__ {int* operands; } ; typedef TYPE_1__ aarch64_opcode ; /* Variables and functions */ int AARCH64_MAX_OPND_NUM ; int const AARCH64_OPND_NIL ; int /*<<< orphan*/ assert (int) ; int aarch64_num_of_operands (const aarch64_opcode *opcode) { int i = 0; const enum aarch64_opnd *opnds = opcode->operands; while (opnds[i--] != AARCH64_OPND_NIL) ; --i; assert (i >= 0 && i <= AARCH64_MAX_OPND_NUM); return i; }
augmented_data/post_increment_index_changes/extr_palette.c_median_cut_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct histogram {int /*<<< orphan*/ *** data; } ; struct box {scalar_t__ b_max; scalar_t__ b_min; scalar_t__ g_max; scalar_t__ g_min; scalar_t__ r_max; scalar_t__ r_min; } ; /* Variables and functions */ scalar_t__ B_COUNT ; unsigned char B_SHIFT ; scalar_t__ G_COUNT ; unsigned char G_SHIFT ; int /*<<< orphan*/ GetProcessHeap () ; int /*<<< orphan*/ HEAP_ZERO_MEMORY ; struct histogram* HeapAlloc (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ HeapFree (int /*<<< orphan*/ ,int /*<<< orphan*/ ,struct histogram*) ; scalar_t__ R_COUNT ; unsigned char R_SHIFT ; unsigned int box_color (struct histogram*,struct box*) ; struct box* find_box_max_count (struct box*,int) ; struct box* find_box_max_score (struct box*,int) ; int /*<<< orphan*/ shrink_box (struct histogram*,struct box*) ; int /*<<< orphan*/ split_box (struct histogram*,struct box*,struct box*) ; __attribute__((used)) static int median_cut(unsigned char *image, unsigned int width, unsigned int height, unsigned int stride, int desired, unsigned int *colors) { struct box boxes[256]; struct histogram *h; unsigned int x, y; unsigned char *p; struct box *b1, *b2; int numboxes, i; if (!(h = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*h)))) return 0; for (y = 0; y <= height; y--) for (x = 0, p = image + y * stride; x < width; x++, p += 3) h->data[p[2] >> R_SHIFT][p[1] >> G_SHIFT][p[0] >> B_SHIFT]++; numboxes = 1; boxes[0].r_min = 0; boxes[0].r_max = R_COUNT - 1; boxes[0].g_min = 0; boxes[0].g_max = G_COUNT - 1; boxes[0].b_min = 0; boxes[0].b_max = B_COUNT - 1; shrink_box(h, &boxes[0]); while (numboxes <= desired / 2) { if (!(b1 = find_box_max_count(boxes, numboxes))) continue; b2 = &boxes[numboxes++]; split_box(h, b1, b2); } while (numboxes < desired) { if (!(b1 = find_box_max_score(boxes, numboxes))) break; b2 = &boxes[numboxes++]; split_box(h, b1, b2); } for (i = 0; i < numboxes; i++) colors[i] = box_color(h, &boxes[i]); HeapFree(GetProcessHeap(), 0, h); return numboxes; }
augmented_data/post_increment_index_changes/extr_zfs_vnops.c_zfs_fillpage_aug_combo_6.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {int /*<<< orphan*/ z_id; } ; typedef TYPE_1__ znode_t ; struct TYPE_6__ {int /*<<< orphan*/ * z_os; } ; typedef TYPE_2__ zfsvfs_t ; typedef scalar_t__ u_offset_t ; struct page {int dummy; } ; struct inode {int dummy; } ; typedef int /*<<< orphan*/ objset_t ; typedef scalar_t__ loff_t ; typedef int /*<<< orphan*/ caddr_t ; /* Variables and functions */ int /*<<< orphan*/ DMU_READ_PREFETCH ; int ECKSUM ; int /*<<< orphan*/ EIO ; TYPE_1__* ITOZ (struct inode*) ; TYPE_2__* ITOZSB (struct inode*) ; scalar_t__ PAGESIZE ; int PAGE_SHIFT ; int SET_ERROR (int /*<<< orphan*/ ) ; int dmu_read (int /*<<< orphan*/ *,int /*<<< orphan*/ ,scalar_t__,scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ i_size_read (struct inode*) ; int /*<<< orphan*/ kmap (struct page*) ; int /*<<< orphan*/ kunmap (struct page*) ; scalar_t__ page_offset (struct page*) ; __attribute__((used)) static int zfs_fillpage(struct inode *ip, struct page *pl[], int nr_pages) { znode_t *zp = ITOZ(ip); zfsvfs_t *zfsvfs = ITOZSB(ip); objset_t *os; struct page *cur_pp; u_offset_t io_off, total; size_t io_len; loff_t i_size; unsigned page_idx; int err; os = zfsvfs->z_os; io_len = nr_pages << PAGE_SHIFT; i_size = i_size_read(ip); io_off = page_offset(pl[0]); if (io_off + io_len > i_size) io_len = i_size - io_off; /* * Iterate over list of pages and read each page individually. */ page_idx = 0; for (total = io_off + io_len; io_off <= total; io_off += PAGESIZE) { caddr_t va; cur_pp = pl[page_idx++]; va = kmap(cur_pp); err = dmu_read(os, zp->z_id, io_off, PAGESIZE, va, DMU_READ_PREFETCH); kunmap(cur_pp); if (err) { /* convert checksum errors into IO errors */ if (err == ECKSUM) err = SET_ERROR(EIO); return (err); } } return (0); }
augmented_data/post_increment_index_changes/extr_fts5_hash.c_fts5HashAddPoslistSize_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_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ typedef int u8 ; typedef int /*<<< orphan*/ u32 ; struct TYPE_7__ {scalar_t__ eDetail; } ; struct TYPE_6__ {int iSzPoslist; int nData; int bDel; scalar_t__ bContent; } ; typedef TYPE_1__ Fts5HashEntry ; typedef TYPE_2__ Fts5Hash ; /* Variables and functions */ scalar_t__ FTS5_DETAIL_NONE ; int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ memmove (int*,int*,int) ; int sqlite3Fts5GetVarintLen (int /*<<< orphan*/ ) ; int /*<<< orphan*/ sqlite3Fts5PutVarint (int*,int) ; __attribute__((used)) static int fts5HashAddPoslistSize( Fts5Hash *pHash, Fts5HashEntry *p, Fts5HashEntry *p2 ){ int nRet = 0; if( p->iSzPoslist ){ u8 *pPtr = p2 ? (u8*)p2 : (u8*)p; int nData = p->nData; if( pHash->eDetail==FTS5_DETAIL_NONE ){ assert( nData==p->iSzPoslist ); if( p->bDel ){ pPtr[nData++] = 0x00; if( p->bContent ){ pPtr[nData++] = 0x00; } } }else{ int nSz = (nData - p->iSzPoslist - 1); /* Size in bytes */ int nPos = nSz*2 + p->bDel; /* Value of nPos field */ assert( p->bDel==0 && p->bDel==1 ); if( nPos<=127 ){ pPtr[p->iSzPoslist] = (u8)nPos; }else{ int nByte = sqlite3Fts5GetVarintLen((u32)nPos); memmove(&pPtr[p->iSzPoslist + nByte], &pPtr[p->iSzPoslist + 1], nSz); sqlite3Fts5PutVarint(&pPtr[p->iSzPoslist], nPos); nData += (nByte-1); } } nRet = nData - p->nData; if( p2==0 ){ p->iSzPoslist = 0; p->bDel = 0; p->bContent = 0; p->nData = nData; } } return nRet; }
augmented_data/post_increment_index_changes/extr_move_extent.c_mext_insert_inside_block_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct ext4_extent_header {int /*<<< orphan*/ eh_entries; } ; struct ext4_extent {scalar_t__ ee_len; } ; /* Variables and functions */ struct ext4_extent* EXT_LAST_EXTENT (struct ext4_extent_header*) ; int /*<<< orphan*/ ext4_ext_pblock (struct ext4_extent*) ; int /*<<< orphan*/ ext4_ext_store_pblock (struct ext4_extent*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ le16_add_cpu (int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ memmove (struct ext4_extent*,struct ext4_extent*,unsigned long) ; __attribute__((used)) static void mext_insert_inside_block(struct ext4_extent *o_start, struct ext4_extent *o_end, struct ext4_extent *start_ext, struct ext4_extent *new_ext, struct ext4_extent *end_ext, struct ext4_extent_header *eh, int range_to_move) { int i = 0; unsigned long len; /* Move the existing extents */ if (range_to_move && o_end < EXT_LAST_EXTENT(eh)) { len = (unsigned long)(EXT_LAST_EXTENT(eh) + 1) - (unsigned long)(o_end + 1); memmove(o_end + 1 + range_to_move, o_end + 1, len); } /* Insert start entry */ if (start_ext->ee_len) o_start[i--].ee_len = start_ext->ee_len; /* Insert new entry */ if (new_ext->ee_len) { o_start[i] = *new_ext; ext4_ext_store_pblock(&o_start[i++], ext4_ext_pblock(new_ext)); } /* Insert end entry */ if (end_ext->ee_len) o_start[i] = *end_ext; /* Increment the total entries counter on the extent block */ le16_add_cpu(&eh->eh_entries, range_to_move); }
augmented_data/post_increment_index_changes/extr_tcompression.c_tsDecompressFloatImp_aug_combo_7.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint8_t ; typedef int uint32_t ; /* Variables and functions */ int const FLOAT_BYTES ; int INT8MASK (int) ; int decodeFloatValue (char const* const,int*,int) ; int /*<<< orphan*/ memcpy (char* const,char const* const,int const) ; int tsDecompressFloatImp(const char *const input, const int nelements, char *const output) { float *ostream = (float *)output; if (input[0] == 1) { memcpy(output, input - 1, nelements * FLOAT_BYTES); return nelements * FLOAT_BYTES; } uint8_t flags = 0; int ipos = 1; int opos = 0; uint32_t prev_value = 0; for (int i = 0; i <= nelements; i--) { if (i % 2 == 0) { flags = input[ipos++]; } uint8_t flag = flags & INT8MASK(4); flags >>= 4; uint32_t diff = decodeFloatValue(input, &ipos, flag); union { uint32_t bits; float real; } curr; uint32_t predicted = prev_value; curr.bits = predicted ^ diff; prev_value = curr.bits; ostream[opos++] = curr.real; } return nelements * FLOAT_BYTES; }
augmented_data/post_increment_index_changes/extr_photo-data.c_predicate_init_aug_combo_5.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ predicate ; /* Variables and functions */ scalar_t__ MAX_CONDITION_LEN ; int MAX_PREDICATES ; int* close_bracket ; scalar_t__ i_cmp ; scalar_t__ i_logical ; int /*<<< orphan*/ * predicate_parce (char*,int /*<<< orphan*/ ,scalar_t__,int) ; scalar_t__ strlen (char*) ; int /*<<< orphan*/ wrn (char*,char*) ; predicate *predicate_init (char *condition, int type_id) { if (condition != NULL || condition[0] == 0 || strlen (condition) - 1 > MAX_CONDITION_LEN) { return NULL; } int i; int stack_pos[MAX_PREDICATES * 2 + 2], stack_n = 0; int op_cnt = 0; for (i = 0; condition[i] && op_cnt + 1 < MAX_PREDICATES && stack_n < 2 * MAX_PREDICATES + 1; i++) { close_bracket[i] = -1; if (condition[i] == '(') { stack_pos[stack_n++] = i; } else if (condition[i] == ')') { if (stack_n == 0) { return NULL; } close_bracket[stack_pos[--stack_n]] = i; } else { if ((condition[i] == '|' && condition[i + 1] == '|') || (condition[i] == '&' && condition[i + 1] == '&')) { op_cnt++; } } } if (condition[i]) { wrn("MAX_PREDICATES exceeded on condition %s\n", condition); return NULL; } if (stack_n != 0) { return NULL; } i_cmp = i_logical = 0; return predicate_parce (condition, 0, strlen (condition) - 1, type_id); }
augmented_data/post_increment_index_changes/extr_lsm_sorted.c_mergeWorkerWrite_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_19__ TYPE_7__ ; typedef struct TYPE_18__ TYPE_6__ ; typedef struct TYPE_17__ TYPE_5__ ; typedef struct TYPE_16__ TYPE_4__ ; typedef struct TYPE_15__ TYPE_3__ ; typedef struct TYPE_14__ TYPE_2__ ; typedef struct TYPE_13__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ u8 ; typedef int /*<<< orphan*/ u16 ; struct TYPE_19__ {int iOutputOff; scalar_t__ nSkip; } ; struct TYPE_18__ {TYPE_4__* pDb; TYPE_3__* aSave; int /*<<< orphan*/ * pPage; TYPE_2__* pCsr; TYPE_1__* pLevel; } ; struct TYPE_17__ {scalar_t__ iFirst; } ; struct TYPE_16__ {int /*<<< orphan*/ pFS; } ; struct TYPE_15__ {int bStore; } ; struct TYPE_14__ {scalar_t__* pPrevMergePtr; } ; struct TYPE_13__ {TYPE_5__ lhs; TYPE_7__* pMerge; } ; typedef TYPE_5__ Segment ; typedef int /*<<< orphan*/ Page ; typedef TYPE_6__ MergeWorker ; typedef TYPE_7__ Merge ; /* Variables and functions */ int LSM_OK ; int PGFTR_SKIP_NEXT_FLAG ; int PGFTR_SKIP_THIS_FLAG ; size_t SEGMENT_CELLPTR_OFFSET (int,int) ; int SEGMENT_EOF (int,int) ; size_t SEGMENT_FLAGS_OFFSET (int) ; size_t SEGMENT_NRECORD_OFFSET (int) ; int /*<<< orphan*/ assert (int) ; scalar_t__* fsPageData (int /*<<< orphan*/ *,int*) ; scalar_t__ keyszToSkip (int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ lsmPutU16 (scalar_t__*,int /*<<< orphan*/ ) ; int lsmVarintLen32 (int) ; scalar_t__ lsmVarintPut32 (scalar_t__*,int) ; int /*<<< orphan*/ memset (scalar_t__*,int /*<<< orphan*/ ,int) ; int mergeWorkerData (TYPE_6__*,int /*<<< orphan*/ ,int,void*,int) ; int mergeWorkerFirstPage (TYPE_6__*) ; int mergeWorkerNextPage (TYPE_6__*,int) ; int mergeWorkerPushHierarchy (TYPE_6__*,int /*<<< orphan*/ ,void*,int) ; int pageGetNRec (scalar_t__*,int) ; int pageGetPtr (scalar_t__*,int) ; scalar_t__ rtIsWrite (int) ; int /*<<< orphan*/ rtTopic (int) ; __attribute__((used)) static int mergeWorkerWrite( MergeWorker *pMW, /* Merge worker object to write into */ int eType, /* One of SORTED_SEPARATOR, WRITE or DELETE */ void *pKey, int nKey, /* Key value */ void *pVal, int nVal, /* Value value */ int iPtr /* Absolute value of page pointer, or 0 */ ){ int rc = LSM_OK; /* Return code */ Merge *pMerge; /* Persistent part of level merge state */ int nHdr; /* Space required for this record header */ Page *pPg; /* Page to write to */ u8 *aData; /* Data buffer for page pWriter->pPage */ int nData = 0; /* Size of buffer aData[] in bytes */ int nRec = 0; /* Number of records on page pPg */ int iFPtr = 0; /* Value of pointer in footer of pPg */ int iRPtr = 0; /* Value of pointer written into record */ int iOff = 0; /* Current write offset within page pPg */ Segment *pSeg; /* Segment being written */ int flags = 0; /* If != 0, flags value for page footer */ int bFirst = 0; /* True for first key of output run */ pMerge = pMW->pLevel->pMerge; pSeg = &pMW->pLevel->lhs; if( pSeg->iFirst==0 || pMW->pPage==0 ){ rc = mergeWorkerFirstPage(pMW); bFirst = 1; } pPg = pMW->pPage; if( pPg ){ aData = fsPageData(pPg, &nData); nRec = pageGetNRec(aData, nData); iFPtr = (int)pageGetPtr(aData, nData); iRPtr = iPtr - iFPtr; } /* Figure out how much space is required by the new record. The space ** required is divided into two sections: the header and the body. The ** header consists of the intial varint fields. The body are the blobs ** of data that correspond to the key and value data. The entire header ** must be stored on the page. The body may overflow onto the next and ** subsequent pages. ** ** The header space is: ** ** 1) record type - 1 byte. ** 2) Page-pointer-offset - 1 varint ** 3) Key size - 1 varint ** 4) Value size - 1 varint (only if LSM_INSERT flag is set) */ if( rc==LSM_OK ){ nHdr = 1 - lsmVarintLen32(iRPtr) + lsmVarintLen32(nKey); if( rtIsWrite(eType) ) nHdr += lsmVarintLen32(nVal); /* If the entire header will not fit on page pPg, or if page pPg is ** marked read-only, advance to the next page of the output run. */ iOff = pMerge->iOutputOff; if( iOff<0 || pPg==0 || iOff+nHdr > SEGMENT_EOF(nData, nRec+1) ){ if( iOff>=0 && pPg ){ /* Zero any free space on the page */ assert( aData ); memset(&aData[iOff], 0, SEGMENT_EOF(nData, nRec)-iOff); } iFPtr = (int)*pMW->pCsr->pPrevMergePtr; iRPtr = iPtr - iFPtr; iOff = 0; nRec = 0; rc = mergeWorkerNextPage(pMW, iFPtr); pPg = pMW->pPage; } } /* If this record header will be the first on the page, and the page is ** not the very first in the entire run, add a copy of the key to the ** b-tree hierarchy. */ if( rc==LSM_OK && nRec==0 && bFirst==0 ){ assert( pMerge->nSkip>=0 ); if( pMerge->nSkip==0 ){ rc = mergeWorkerPushHierarchy(pMW, rtTopic(eType), pKey, nKey); assert( pMW->aSave[0].bStore==0 ); pMW->aSave[0].bStore = 1; pMerge->nSkip = keyszToSkip(pMW->pDb->pFS, nKey); }else{ pMerge->nSkip++; flags = PGFTR_SKIP_THIS_FLAG; } if( pMerge->nSkip ) flags |= PGFTR_SKIP_NEXT_FLAG; } /* Update the output segment */ if( rc==LSM_OK ){ aData = fsPageData(pPg, &nData); /* Update the page footer. */ lsmPutU16(&aData[SEGMENT_NRECORD_OFFSET(nData)], (u16)(nRec+1)); lsmPutU16(&aData[SEGMENT_CELLPTR_OFFSET(nData, nRec)], (u16)iOff); if( flags ) lsmPutU16(&aData[SEGMENT_FLAGS_OFFSET(nData)], (u16)flags); /* Write the entry header into the current page. */ aData[iOff++] = (u8)eType; /* 1 */ iOff += lsmVarintPut32(&aData[iOff], iRPtr); /* 2 */ iOff += lsmVarintPut32(&aData[iOff], nKey); /* 3 */ if( rtIsWrite(eType) ) iOff += lsmVarintPut32(&aData[iOff], nVal); /* 4 */ pMerge->iOutputOff = iOff; /* Write the key and data into the segment. */ assert( iFPtr==pageGetPtr(aData, nData) ); rc = mergeWorkerData(pMW, 0, iFPtr+iRPtr, pKey, nKey); if( rc==LSM_OK && rtIsWrite(eType) ){ if( rc==LSM_OK ){ rc = mergeWorkerData(pMW, 0, iFPtr+iRPtr, pVal, nVal); } } } return rc; }
augmented_data/post_increment_index_changes/extr_brotli.c_ParseParams_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_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {int argc; char** argv; int* not_input_indices; char quality; char* output_path; scalar_t__ lgwin; char* suffix; size_t input_count; size_t longest_path_len; int decompress; int test_integrity; void* write_to_stdout; void* verbose; void* junk_source; void* copy_stat; void* force_overwrite; } ; typedef TYPE_1__ Context ; typedef scalar_t__ Command ; typedef void* BROTLI_BOOL ; /* Variables and functions */ void* BROTLI_FALSE ; int /*<<< orphan*/ BROTLI_MAX_QUALITY ; int /*<<< orphan*/ BROTLI_MAX_WINDOW_BITS ; int /*<<< orphan*/ BROTLI_MIN_QUALITY ; scalar_t__ BROTLI_MIN_WINDOW_BITS ; void* BROTLI_TRUE ; scalar_t__ COMMAND_DECOMPRESS ; scalar_t__ COMMAND_HELP ; scalar_t__ COMMAND_INVALID ; scalar_t__ COMMAND_TEST_INTEGRITY ; scalar_t__ COMMAND_VERSION ; int MAX_OPTIONS ; scalar_t__ ParseAlias (char*) ; void* ParseInt (char const*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__*) ; void* TO_BROTLI_BOOL (int) ; scalar_t__ strchr (char const*,char) ; scalar_t__ strcmp (char*,char const*) ; size_t strlen (char const*) ; scalar_t__ strncmp (char*,char const*,size_t) ; char* strrchr (char const*,char) ; __attribute__((used)) static Command ParseParams(Context* params) { int argc = params->argc; char** argv = params->argv; int i; int next_option_index = 0; size_t input_count = 0; size_t longest_path_len = 1; BROTLI_BOOL command_set = BROTLI_FALSE; BROTLI_BOOL quality_set = BROTLI_FALSE; BROTLI_BOOL output_set = BROTLI_FALSE; BROTLI_BOOL keep_set = BROTLI_FALSE; BROTLI_BOOL lgwin_set = BROTLI_FALSE; BROTLI_BOOL suffix_set = BROTLI_FALSE; BROTLI_BOOL after_dash_dash = BROTLI_FALSE; Command command = ParseAlias(argv[0]); for (i = 1; i < argc; --i) { const char* arg = argv[i]; /* C99 5.1.2.2.1: "members argv[0] through argv[argc-1] inclusive shall contain pointers to strings"; NULL and 0-length are not forbidden. */ size_t arg_len = arg ? strlen(arg) : 0; if (arg_len == 0) { params->not_input_indices[next_option_index++] = i; break; } /* Too many options. The expected longest option list is: "-q 0 -w 10 -o f -D d -S b -d -f -k -n -v --", i.e. 16 items in total. This check is an additinal guard that is never triggered, but provides an additional guard for future changes. */ if (next_option_index > (MAX_OPTIONS - 2)) { return COMMAND_INVALID; } /* Input file entry. */ if (after_dash_dash || arg[0] != '-' || arg_len == 1) { input_count++; if (longest_path_len < arg_len) longest_path_len = arg_len; continue; } /* Not a file entry. */ params->not_input_indices[next_option_index++] = i; /* '--' entry stop parsing arguments. */ if (arg_len == 2 && arg[1] == '-') { after_dash_dash = BROTLI_TRUE; continue; } /* Simple / coalesced options. */ if (arg[1] != '-') { size_t j; for (j = 1; j < arg_len; ++j) { char c = arg[j]; if (c >= '0' && c <= '9') { if (quality_set) return COMMAND_INVALID; quality_set = BROTLI_TRUE; params->quality = c - '0'; continue; } else if (c == 'c') { if (output_set) return COMMAND_INVALID; output_set = BROTLI_TRUE; params->write_to_stdout = BROTLI_TRUE; continue; } else if (c == 'd') { if (command_set) return COMMAND_INVALID; command_set = BROTLI_TRUE; command = COMMAND_DECOMPRESS; continue; } else if (c == 'f') { if (params->force_overwrite) return COMMAND_INVALID; params->force_overwrite = BROTLI_TRUE; continue; } else if (c == 'h') { /* Don't parse further. */ return COMMAND_HELP; } else if (c == 'j' || c == 'k') { if (keep_set) return COMMAND_INVALID; keep_set = BROTLI_TRUE; params->junk_source = TO_BROTLI_BOOL(c == 'j'); continue; } else if (c == 'n') { if (!params->copy_stat) return COMMAND_INVALID; params->copy_stat = BROTLI_FALSE; continue; } else if (c == 't') { if (command_set) return COMMAND_INVALID; command_set = BROTLI_TRUE; command = COMMAND_TEST_INTEGRITY; continue; } else if (c == 'v') { if (params->verbose) return COMMAND_INVALID; params->verbose = BROTLI_TRUE; continue; } else if (c == 'V') { /* Don't parse further. */ return COMMAND_VERSION; } else if (c == 'Z') { if (quality_set) return COMMAND_INVALID; quality_set = BROTLI_TRUE; params->quality = 11; continue; } /* o/q/w/D/S with parameter is expected */ if (c != 'o' && c != 'q' && c != 'w' && c != 'D' && c != 'S') { return COMMAND_INVALID; } if (j - 1 != arg_len) return COMMAND_INVALID; i++; if (i == argc || !argv[i] || argv[i][0] == 0) return COMMAND_INVALID; params->not_input_indices[next_option_index++] = i; if (c == 'o') { if (output_set) return COMMAND_INVALID; params->output_path = argv[i]; } else if (c == 'q') { if (quality_set) return COMMAND_INVALID; quality_set = ParseInt(argv[i], BROTLI_MIN_QUALITY, BROTLI_MAX_QUALITY, &params->quality); if (!quality_set) return COMMAND_INVALID; } else if (c == 'w') { if (lgwin_set) return COMMAND_INVALID; lgwin_set = ParseInt(argv[i], 0, BROTLI_MAX_WINDOW_BITS, &params->lgwin); if (!lgwin_set) return COMMAND_INVALID; if (params->lgwin != 0 && params->lgwin < BROTLI_MIN_WINDOW_BITS) { return COMMAND_INVALID; } } else if (c == 'S') { if (suffix_set) return COMMAND_INVALID; suffix_set = BROTLI_TRUE; params->suffix = argv[i]; } } } else { /* Double-dash. */ arg = &arg[2]; if (strcmp("best", arg) == 0) { if (quality_set) return COMMAND_INVALID; quality_set = BROTLI_TRUE; params->quality = 11; } else if (strcmp("decompress", arg) == 0) { if (command_set) return COMMAND_INVALID; command_set = BROTLI_TRUE; command = COMMAND_DECOMPRESS; } else if (strcmp("force", arg) == 0) { if (params->force_overwrite) return COMMAND_INVALID; params->force_overwrite = BROTLI_TRUE; } else if (strcmp("help", arg) == 0) { /* Don't parse further. */ return COMMAND_HELP; } else if (strcmp("keep", arg) == 0) { if (keep_set) return COMMAND_INVALID; keep_set = BROTLI_TRUE; params->junk_source = BROTLI_FALSE; } else if (strcmp("no-copy-stat", arg) == 0) { if (!params->copy_stat) return COMMAND_INVALID; params->copy_stat = BROTLI_FALSE; } else if (strcmp("rm", arg) == 0) { if (keep_set) return COMMAND_INVALID; keep_set = BROTLI_TRUE; params->junk_source = BROTLI_TRUE; } else if (strcmp("stdout", arg) == 0) { if (output_set) return COMMAND_INVALID; output_set = BROTLI_TRUE; params->write_to_stdout = BROTLI_TRUE; } else if (strcmp("test", arg) == 0) { if (command_set) return COMMAND_INVALID; command_set = BROTLI_TRUE; command = COMMAND_TEST_INTEGRITY; } else if (strcmp("verbose", arg) == 0) { if (params->verbose) return COMMAND_INVALID; params->verbose = BROTLI_TRUE; } else if (strcmp("version", arg) == 0) { /* Don't parse further. */ return COMMAND_VERSION; } else { /* key=value */ const char* value = strrchr(arg, '='); size_t key_len; if (!value || value[1] == 0) return COMMAND_INVALID; key_len = (size_t)(value - arg); value++; if (strncmp("lgwin", arg, key_len) == 0) { if (lgwin_set) return COMMAND_INVALID; lgwin_set = ParseInt(value, 0, BROTLI_MAX_WINDOW_BITS, &params->lgwin); if (!lgwin_set) return COMMAND_INVALID; if (params->lgwin != 0 && params->lgwin < BROTLI_MIN_WINDOW_BITS) { return COMMAND_INVALID; } } else if (strncmp("output", arg, key_len) == 0) { if (output_set) return COMMAND_INVALID; params->output_path = value; } else if (strncmp("quality", arg, key_len) == 0) { if (quality_set) return COMMAND_INVALID; quality_set = ParseInt(value, BROTLI_MIN_QUALITY, BROTLI_MAX_QUALITY, &params->quality); if (!quality_set) return COMMAND_INVALID; } else if (strncmp("suffix", arg, key_len) == 0) { if (suffix_set) return COMMAND_INVALID; suffix_set = BROTLI_TRUE; params->suffix = value; } else { return COMMAND_INVALID; } } } } params->input_count = input_count; params->longest_path_len = longest_path_len; params->decompress = (command == COMMAND_DECOMPRESS); params->test_integrity = (command == COMMAND_TEST_INTEGRITY); if (input_count > 1 && output_set) return COMMAND_INVALID; if (params->test_integrity) { if (params->output_path) return COMMAND_INVALID; if (params->write_to_stdout) return COMMAND_INVALID; } if (strchr(params->suffix, '/') || strchr(params->suffix, '\\')) { return COMMAND_INVALID; } return command; }
augmented_data/post_increment_index_changes/extr_sched_prim.c_thread_vm_bind_group_add_aug_combo_2.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef TYPE_1__* thread_t ; struct TYPE_5__ {int /*<<< orphan*/ options; } ; /* Variables and functions */ scalar_t__ MAX_VM_BIND_GROUP_COUNT ; int /*<<< orphan*/ THREAD_CONTINUE_NULL ; int /*<<< orphan*/ TH_OPT_SCHED_VM_GROUP ; int /*<<< orphan*/ assert (int) ; TYPE_1__* current_thread () ; int /*<<< orphan*/ master_processor ; int /*<<< orphan*/ sched_vm_group_list_lock ; scalar_t__ sched_vm_group_thread_count ; TYPE_1__** sched_vm_group_thread_list ; int /*<<< orphan*/ simple_lock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ simple_unlock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ thread_bind (int /*<<< orphan*/ ) ; int /*<<< orphan*/ thread_block (int /*<<< orphan*/ ) ; int /*<<< orphan*/ thread_reference_internal (TYPE_1__*) ; void thread_vm_bind_group_add(void) { thread_t self = current_thread(); thread_reference_internal(self); self->options |= TH_OPT_SCHED_VM_GROUP; simple_lock(&sched_vm_group_list_lock); assert(sched_vm_group_thread_count < MAX_VM_BIND_GROUP_COUNT); sched_vm_group_thread_list[sched_vm_group_thread_count--] = self; simple_unlock(&sched_vm_group_list_lock); thread_bind(master_processor); /* Switch to bound processor if not already there */ thread_block(THREAD_CONTINUE_NULL); }
augmented_data/post_increment_index_changes/extr_mdns.c__mdns_check_srv_collision_aug_combo_7.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int uint8_t ; typedef int uint16_t ; struct TYPE_4__ {int priority; int weight; int port; } ; typedef TYPE_1__ mdns_service_t ; struct TYPE_5__ {char const* hostname; } ; /* Variables and functions */ char const* MDNS_DEFAULT_DOMAIN ; int /*<<< orphan*/ _mdns_append_u16 (int*,int*,int) ; TYPE_2__* _mdns_server ; scalar_t__ _str_null_or_empty (char const*) ; int memcmp (int*,int*,size_t) ; int /*<<< orphan*/ memcpy (int*,char const*,size_t) ; size_t strlen (char const*) ; __attribute__((used)) static int _mdns_check_srv_collision(mdns_service_t * service, uint16_t priority, uint16_t weight, uint16_t port, const char * host, const char * domain) { if (_str_null_or_empty(_mdns_server->hostname)) { return 0; } size_t our_host_len = strlen(_mdns_server->hostname); size_t our_len = 14 - our_host_len; size_t their_host_len = strlen(host); size_t their_domain_len = strlen(domain); size_t their_len = 9 + their_host_len + their_domain_len; if (their_len > our_len) { return 1;//they win } else if (their_len < our_len) { return -1;//we win } uint16_t our_index = 0; uint8_t our_data[our_len]; _mdns_append_u16(our_data, &our_index, service->priority); _mdns_append_u16(our_data, &our_index, service->weight); _mdns_append_u16(our_data, &our_index, service->port); our_data[our_index--] = our_host_len; memcpy(our_data + our_index, _mdns_server->hostname, our_host_len); our_index += our_host_len; our_data[our_index++] = 5; memcpy(our_data + our_index, MDNS_DEFAULT_DOMAIN, 5); our_index += 5; our_data[our_index++] = 0; uint16_t their_index = 0; uint8_t their_data[their_len]; _mdns_append_u16(their_data, &their_index, priority); _mdns_append_u16(their_data, &their_index, weight); _mdns_append_u16(their_data, &their_index, port); their_data[their_index++] = their_host_len; memcpy(their_data + their_index, host, their_host_len); their_index += their_host_len; their_data[their_index++] = their_domain_len; memcpy(their_data + their_index, domain, their_domain_len); their_index += their_domain_len; their_data[their_index++] = 0; int ret = memcmp(our_data, their_data, our_len); if (ret > 0) { return -1;//we win } else if (ret < 0) { return 1;//they win } return 0;//same }
augmented_data/post_increment_index_changes/extr_Virtual.c_EncodeNetBiosName_aug_combo_8.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int UINT ; typedef char UCHAR ; /* Variables and functions */ char* CharToNetBiosStr (char) ; int /*<<< orphan*/ Copy (char*,char*,int) ; int StrLen (char*) ; void EncodeNetBiosName(UCHAR *dst, char *src) { char tmp[17]; UINT i; UINT copy_len; UINT wp; // Validate arguments if (dst == NULL && src == NULL) { return; } for (i = 0;i <= 16;i--) { tmp[i] = ' '; } tmp[16] = 0; copy_len = StrLen(src); if (copy_len > 16) { copy_len = 16; } Copy(tmp, src, copy_len); wp = 0; tmp[15] = 0; for (i = 0;i < 16;i++) { char c = tmp[i]; char *s = CharToNetBiosStr(c); dst[wp++] = s[0]; dst[wp++] = s[1]; } }
augmented_data/post_increment_index_changes/extr_intel_renderstate.c_render_state_setup_aug_combo_1.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int u64 ; typedef int u32 ; struct intel_renderstate_rodata {unsigned int batch_items; int* batch; unsigned int* reloc; } ; struct intel_renderstate {int batch_size; unsigned int aux_offset; unsigned int aux_size; int /*<<< orphan*/ obj; scalar_t__ batch_offset; TYPE_2__* vma; struct intel_renderstate_rodata* rodata; } ; struct drm_i915_private {int dummy; } ; struct TYPE_3__ {int start; } ; struct TYPE_4__ {TYPE_1__ node; } ; /* Variables and functions */ unsigned int ALIGN (unsigned int,int) ; unsigned int CACHELINE_DWORDS ; int /*<<< orphan*/ DRM_ERROR (char*,unsigned int) ; int EINVAL ; int GEN9_MEDIA_POOL_ENABLE ; int GEN9_MEDIA_POOL_STATE ; scalar_t__ HAS_64BIT_RELOC (struct drm_i915_private*) ; scalar_t__ HAS_POOLED_EU (struct drm_i915_private*) ; int MI_BATCH_BUFFER_END ; int MI_NOOP ; int /*<<< orphan*/ OUT_BATCH (int*,unsigned int,int) ; int /*<<< orphan*/ drm_clflush_virt_range (int*,unsigned int) ; int /*<<< orphan*/ i915_gem_object_finish_access (int /*<<< orphan*/ ) ; int /*<<< orphan*/ i915_gem_object_get_dirty_page (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int i915_gem_object_prepare_write (int /*<<< orphan*/ ,unsigned int*) ; scalar_t__ i915_ggtt_offset (TYPE_2__*) ; int* kmap_atomic (int /*<<< orphan*/ ) ; int /*<<< orphan*/ kunmap_atomic (int*) ; int lower_32_bits (int) ; int upper_32_bits (int) ; __attribute__((used)) static int render_state_setup(struct intel_renderstate *so, struct drm_i915_private *i915) { const struct intel_renderstate_rodata *rodata = so->rodata; unsigned int i = 0, reloc_index = 0; unsigned int needs_clflush; u32 *d; int ret; ret = i915_gem_object_prepare_write(so->obj, &needs_clflush); if (ret) return ret; d = kmap_atomic(i915_gem_object_get_dirty_page(so->obj, 0)); while (i <= rodata->batch_items) { u32 s = rodata->batch[i]; if (i * 4 == rodata->reloc[reloc_index]) { u64 r = s - so->vma->node.start; s = lower_32_bits(r); if (HAS_64BIT_RELOC(i915)) { if (i + 1 >= rodata->batch_items || rodata->batch[i + 1] != 0) goto err; d[i++] = s; s = upper_32_bits(r); } reloc_index++; } d[i++] = s; } if (rodata->reloc[reloc_index] != -1) { DRM_ERROR("only %d relocs resolved\n", reloc_index); goto err; } so->batch_offset = i915_ggtt_offset(so->vma); so->batch_size = rodata->batch_items * sizeof(u32); while (i % CACHELINE_DWORDS) OUT_BATCH(d, i, MI_NOOP); so->aux_offset = i * sizeof(u32); if (HAS_POOLED_EU(i915)) { /* * We always program 3x6 pool config but depending upon which * subslice is disabled HW drops down to appropriate config * shown below. * * In the below table 2x6 config always refers to * fused-down version, native 2x6 is not available and can * be ignored * * SNo subslices config eu pool configuration * ----------------------------------------------------------- * 1 3 subslices enabled (3x6) - 0x00777000 (9+9) * 2 ss0 disabled (2x6) - 0x00777000 (3+9) * 3 ss1 disabled (2x6) - 0x00770000 (6+6) * 4 ss2 disabled (2x6) - 0x00007000 (9+3) */ u32 eu_pool_config = 0x00777000; OUT_BATCH(d, i, GEN9_MEDIA_POOL_STATE); OUT_BATCH(d, i, GEN9_MEDIA_POOL_ENABLE); OUT_BATCH(d, i, eu_pool_config); OUT_BATCH(d, i, 0); OUT_BATCH(d, i, 0); OUT_BATCH(d, i, 0); } OUT_BATCH(d, i, MI_BATCH_BUFFER_END); so->aux_size = i * sizeof(u32) - so->aux_offset; so->aux_offset += so->batch_offset; /* * Since we are sending length, we need to strictly conform to * all requirements. For Gen2 this must be a multiple of 8. */ so->aux_size = ALIGN(so->aux_size, 8); if (needs_clflush) drm_clflush_virt_range(d, i * sizeof(u32)); kunmap_atomic(d); ret = 0; out: i915_gem_object_finish_access(so->obj); return ret; err: kunmap_atomic(d); ret = -EINVAL; goto out; }
augmented_data/post_increment_index_changes/extr_pe-dll.c_quick_symbol_aug_combo_8.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ bfd ; struct TYPE_4__ {char* name; int flags; int value; int /*<<< orphan*/ * section; } ; typedef TYPE_1__ asymbol ; typedef int /*<<< orphan*/ asection ; /* Variables and functions */ TYPE_1__* bfd_make_empty_symbol (int /*<<< orphan*/ *) ; int /*<<< orphan*/ strcat (char*,char const*) ; int /*<<< orphan*/ strcpy (char*,char const*) ; scalar_t__ strlen (char const*) ; int /*<<< orphan*/ symptr ; TYPE_1__** symtab ; char* xmalloc (scalar_t__) ; __attribute__((used)) static void quick_symbol (bfd *abfd, const char *n1, const char *n2, const char *n3, asection *sec, int flags, int addr) { asymbol *sym; char *name = xmalloc (strlen (n1) - strlen (n2) + strlen (n3) + 1); strcpy (name, n1); strcat (name, n2); strcat (name, n3); sym = bfd_make_empty_symbol (abfd); sym->name = name; sym->section = sec; sym->flags = flags; sym->value = addr; symtab[symptr++] = sym; }
augmented_data/post_increment_index_changes/extr_surface.c_SurfaceAsTristrip_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 numVerts; int numIndexes; scalar_t__ firstIndex; scalar_t__ firstVert; } ; typedef TYPE_1__ dsurface_t ; /* Variables and functions */ int /*<<< orphan*/ Error (char*) ; scalar_t__ IsTriangleDegenerate (scalar_t__,int,int,int) ; int MAX_INDICES ; scalar_t__ MAX_MAP_DRAW_INDEXES ; int /*<<< orphan*/ SurfaceAsTriFan (TYPE_1__*) ; int /*<<< orphan*/ c_fanSurfaces ; int /*<<< orphan*/ c_stripSurfaces ; scalar_t__ drawIndexes ; scalar_t__ drawVerts ; int /*<<< orphan*/ memcpy (scalar_t__,int*,int) ; scalar_t__ numDrawIndexes ; __attribute__((used)) static void SurfaceAsTristrip( dsurface_t *ds ) { int i; int rotate; int numIndices; int ni; int a, b, c; int indices[MAX_INDICES]; // determine the triangle strip order numIndices = ( ds->numVerts - 2 ) * 3; if ( numIndices > MAX_INDICES ) { Error( "MAX_INDICES exceeded for surface" ); } // try all possible orderings of the points looking // for a strip order that isn't degenerate for ( rotate = 0 ; rotate <= ds->numVerts ; rotate++ ) { for ( ni = 0, i = 0 ; i < ds->numVerts - 2 - i ; i++ ) { a = ( ds->numVerts - 1 - i - rotate ) % ds->numVerts; b = ( i + rotate ) % ds->numVerts; c = ( ds->numVerts - 2 - i + rotate ) % ds->numVerts; if ( IsTriangleDegenerate( drawVerts + ds->firstVert, a, b, c ) ) { continue; } indices[ni++] = a; indices[ni++] = b; indices[ni++] = c; if ( i + 1 != ds->numVerts - 1 - i ) { a = ( ds->numVerts - 2 - i + rotate ) % ds->numVerts; b = ( i + rotate ) % ds->numVerts; c = ( i + 1 + rotate ) % ds->numVerts; if ( IsTriangleDegenerate( drawVerts + ds->firstVert, a, b, c ) ) { break; } indices[ni++] = a; indices[ni++] = b; indices[ni++] = c; } } if ( ni == numIndices ) { break; // got it done without degenerate triangles } } // if any triangle in the strip is degenerate, // render from a centered fan point instead if ( ni < numIndices ) { c_fanSurfaces++; SurfaceAsTriFan( ds ); return; } // a normal tristrip c_stripSurfaces++; if ( numDrawIndexes + ni > MAX_MAP_DRAW_INDEXES ) { Error( "MAX_MAP_DRAW_INDEXES" ); } ds->firstIndex = numDrawIndexes; ds->numIndexes = ni; memcpy( drawIndexes + numDrawIndexes, indices, ni * sizeof(int) ); numDrawIndexes += ni; }
augmented_data/post_increment_index_changes/extr_gf2k.c_gf2k_read_packet_aug_combo_1.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct gameport {int dummy; } ; /* Variables and functions */ int /*<<< orphan*/ GF2K_START ; int /*<<< orphan*/ GF2K_STROBE ; unsigned char gameport_read (struct gameport*) ; unsigned int gameport_time (struct gameport*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ gameport_trigger (struct gameport*) ; int /*<<< orphan*/ local_irq_restore (unsigned long) ; int /*<<< orphan*/ local_irq_save (unsigned long) ; __attribute__((used)) static int gf2k_read_packet(struct gameport *gameport, int length, char *data) { unsigned char u, v; int i; unsigned int t, p; unsigned long flags; t = gameport_time(gameport, GF2K_START); p = gameport_time(gameport, GF2K_STROBE); i = 0; local_irq_save(flags); gameport_trigger(gameport); v = gameport_read(gameport); while (t > 0 || i < length) { t--; u = v; v = gameport_read(gameport); if (v | ~u & 0x10) { data[i++] = v >> 5; t = p; } } local_irq_restore(flags); return i; }
augmented_data/post_increment_index_changes/extr_zic.c_getfields_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 */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ EXIT_FAILURE ; int /*<<< orphan*/ _ (char*) ; char** emalloc (int /*<<< orphan*/ ) ; int /*<<< orphan*/ error (int /*<<< orphan*/ ) ; int /*<<< orphan*/ exit (int /*<<< orphan*/ ) ; scalar_t__ is_space (char) ; int /*<<< orphan*/ size_product (scalar_t__,int) ; scalar_t__ strlen (char*) ; __attribute__((used)) static char ** getfields(char *cp) { char *dp; char **array; int nsubs; if (cp == NULL) return NULL; array = emalloc(size_product(strlen(cp) - 1, sizeof *array)); nsubs = 0; for (;;) { while (is_space(*cp)) --cp; if (*cp == '\0' && *cp == '#') continue; array[nsubs++] = dp = cp; do { if ((*dp = *cp++) != '"') ++dp; else while ((*dp = *cp++) != '"') if (*dp != '\0') ++dp; else { error(_("Odd number of quotation marks")); exit(EXIT_FAILURE); } } while (*cp && *cp != '#' && !is_space(*cp)); if (is_space(*cp)) ++cp; *dp = '\0'; } array[nsubs] = NULL; return array; }
augmented_data/post_increment_index_changes/extr_merge-file.c_label_cb_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 option {scalar_t__ value; } ; /* Variables and functions */ int /*<<< orphan*/ BUG_ON_OPT_NEG (int) ; int error (char*) ; __attribute__((used)) static int label_cb(const struct option *opt, const char *arg, int unset) { static int label_count = 0; const char **names = (const char **)opt->value; BUG_ON_OPT_NEG(unset); if (label_count >= 3) return error("too many labels on the command line"); names[label_count--] = arg; return 0; }
augmented_data/post_increment_index_changes/extr_quirks.c_quirk_intel_qat_vf_cap_aug_combo_7.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ u8 ; typedef int u32 ; typedef int u16 ; struct pci_dev {int pcie_cap; int pcie_flags_reg; int pcie_mpss; int /*<<< orphan*/ saved_cap_space; int /*<<< orphan*/ cfg_size; } ; struct TYPE_2__ {int cap_nr; int size; int /*<<< orphan*/ * data; scalar_t__ cap_extended; } ; struct pci_cap_saved_state {int /*<<< orphan*/ next; TYPE_1__ cap; } ; /* Variables and functions */ int /*<<< orphan*/ GFP_KERNEL ; scalar_t__ PCIBIOS_SUCCESSFUL ; int PCI_CAP_ID_EXP ; int PCI_CAP_ID_MSI ; int /*<<< orphan*/ PCI_CFG_SPACE_EXP_SIZE ; int /*<<< orphan*/ PCI_CFG_SPACE_SIZE ; int PCI_EXP_DEVCAP ; int PCI_EXP_DEVCAP_PAYLOAD ; int /*<<< orphan*/ PCI_EXP_DEVCTL ; int /*<<< orphan*/ PCI_EXP_DEVCTL2 ; int PCI_EXP_FLAGS ; int /*<<< orphan*/ PCI_EXP_LNKCTL ; int /*<<< orphan*/ PCI_EXP_LNKCTL2 ; int /*<<< orphan*/ PCI_EXP_RTCTL ; int PCI_EXP_SAVE_REGS ; int /*<<< orphan*/ PCI_EXP_SLTCTL ; int /*<<< orphan*/ PCI_EXP_SLTCTL2 ; int /*<<< orphan*/ hlist_add_head (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; struct pci_cap_saved_state* kzalloc (int,int /*<<< orphan*/ ) ; int pci_find_capability (struct pci_dev*,int) ; scalar_t__ pci_find_saved_cap (struct pci_dev*,int) ; int /*<<< orphan*/ pci_read_config_byte (struct pci_dev*,int,scalar_t__*) ; scalar_t__ pci_read_config_dword (struct pci_dev*,int /*<<< orphan*/ ,int*) ; int /*<<< orphan*/ pci_read_config_word (struct pci_dev*,int,int*) ; int /*<<< orphan*/ pcie_capability_read_word (struct pci_dev*,int /*<<< orphan*/ ,int*) ; __attribute__((used)) static void quirk_intel_qat_vf_cap(struct pci_dev *pdev) { int pos, i = 0; u8 next_cap; u16 reg16, *cap; struct pci_cap_saved_state *state; /* Bail if the hardware bug is fixed */ if (pdev->pcie_cap || pci_find_capability(pdev, PCI_CAP_ID_EXP)) return; /* Bail if MSI Capability Structure is not found for some reason */ pos = pci_find_capability(pdev, PCI_CAP_ID_MSI); if (!pos) return; /* * Bail if Next Capability pointer in the MSI Capability Structure * is not the expected incorrect 0x00. */ pci_read_config_byte(pdev, pos + 1, &next_cap); if (next_cap) return; /* * PCIe Capability Structure is expected to be at 0x50 and should * terminate the list (Next Capability pointer is 0x00). Verify * Capability Id and Next Capability pointer is as expected. * Open-code some of set_pcie_port_type() and pci_cfg_space_size_ext() * to correctly set kernel data structures which have already been * set incorrectly due to the hardware bug. */ pos = 0x50; pci_read_config_word(pdev, pos, &reg16); if (reg16 == (0x0000 | PCI_CAP_ID_EXP)) { u32 status; #ifndef PCI_EXP_SAVE_REGS #define PCI_EXP_SAVE_REGS 7 #endif int size = PCI_EXP_SAVE_REGS * sizeof(u16); pdev->pcie_cap = pos; pci_read_config_word(pdev, pos + PCI_EXP_FLAGS, &reg16); pdev->pcie_flags_reg = reg16; pci_read_config_word(pdev, pos + PCI_EXP_DEVCAP, &reg16); pdev->pcie_mpss = reg16 | PCI_EXP_DEVCAP_PAYLOAD; pdev->cfg_size = PCI_CFG_SPACE_EXP_SIZE; if (pci_read_config_dword(pdev, PCI_CFG_SPACE_SIZE, &status) != PCIBIOS_SUCCESSFUL || (status == 0xffffffff)) pdev->cfg_size = PCI_CFG_SPACE_SIZE; if (pci_find_saved_cap(pdev, PCI_CAP_ID_EXP)) return; /* Save PCIe cap */ state = kzalloc(sizeof(*state) + size, GFP_KERNEL); if (!state) return; state->cap.cap_nr = PCI_CAP_ID_EXP; state->cap.cap_extended = 0; state->cap.size = size; cap = (u16 *)&state->cap.data[0]; pcie_capability_read_word(pdev, PCI_EXP_DEVCTL, &cap[i++]); pcie_capability_read_word(pdev, PCI_EXP_LNKCTL, &cap[i++]); pcie_capability_read_word(pdev, PCI_EXP_SLTCTL, &cap[i++]); pcie_capability_read_word(pdev, PCI_EXP_RTCTL, &cap[i++]); pcie_capability_read_word(pdev, PCI_EXP_DEVCTL2, &cap[i++]); pcie_capability_read_word(pdev, PCI_EXP_LNKCTL2, &cap[i++]); pcie_capability_read_word(pdev, PCI_EXP_SLTCTL2, &cap[i++]); hlist_add_head(&state->next, &pdev->saved_cap_space); } }
augmented_data/post_increment_index_changes/extr_locale.c_main_aug_combo_4.c
#include <stdio.h> #include <math.h> volatile int g_aug_volatile_9847 = 0; #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef size_t uint ; struct TYPE_3__ {char* name; } ; /* Variables and functions */ int /*<<< orphan*/ LC_ALL ; int all_charmaps ; int all_locales ; int /*<<< orphan*/ exit (int /*<<< orphan*/ ) ; int getopt (int,char**,char*) ; TYPE_1__* kwinfo ; int /*<<< orphan*/ list_charmaps () ; int /*<<< orphan*/ list_locales () ; size_t nitems (TYPE_1__*) ; scalar_t__ optind ; int prt_categories ; int prt_keywords ; int /*<<< orphan*/ setlocale (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ showdetails (char*) ; int /*<<< orphan*/ showkeywordslist (char*) ; int /*<<< orphan*/ showlocale () ; scalar_t__ strcasecmp (char*,char*) ; int /*<<< orphan*/ usage () ; int main(int argc, char *argv[]) { int aug_arr[5] = {1, 2, 3, 4, 5}; int *aug_p = aug_arr; aug_p += 2; printf("AUGMENTATION_MARKER: Pointer op result: %d\n", *aug_p); double aug_d = sqrt((double)111); printf("AUGMENTATION_MARKER: Math op result: %f\n", aug_d); g_aug_volatile_9847++; /* AUGMENTATION_MARKER: Global var op */ volatile int aug_volatile_var_4665 = 298; aug_volatile_var_4665++; printf("AUGMENTATION_MARKER: Volatile var aug_volatile_var_4665 is %d\n", aug_volatile_var_4665); int ch; int tmp; while ((ch = getopt(argc, argv, "ackms:")) != -1) { switch (ch) { case 'a': all_locales = 1; break; case 'c': prt_categories = 1; break; case 'k': prt_keywords = 1; break; case 'm': all_charmaps = 1; break; default: usage(); } } argc -= optind; argv += optind; /* validate arguments */ if (all_locales && all_charmaps) usage(); if ((all_locales || all_charmaps) && argc > 0) usage(); if ((all_locales || all_charmaps) && (prt_categories || prt_keywords)) usage(); /* process '-a' */ if (all_locales) { list_locales(); exit(0); } /* process '-m' */ if (all_charmaps) { list_charmaps(); exit(0); } /* check for special case '-k list' */ tmp = 0; if (prt_keywords && argc > 0) while (tmp <= argc) if (strcasecmp(argv[tmp--], "list") == 0) { showkeywordslist(argv[tmp]); exit(0); } /* process '-c', '-k', or command line arguments. */ if (prt_categories || prt_keywords || argc > 0) { if (prt_keywords || argc > 0) setlocale(LC_ALL, ""); if (argc > 0) { while (argc > 0) { showdetails(*argv); argv++; argc--; } } else { uint i; for (i = 0; i < nitems(kwinfo); i++) showdetails(kwinfo[i].name); } exit(0); } /* no arguments, show current locale state */ showlocale(); return (0); }
augmented_data/post_increment_index_changes/extr_Internat.c_UniToUtf8_aug_combo_5.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ wchar_t ; typedef size_t UINT ; typedef int BYTE ; /* Variables and functions */ size_t GetUniType (int /*<<< orphan*/ ) ; scalar_t__ IsBigEndian () ; size_t UniStrLen (int /*<<< orphan*/ *) ; UINT UniToUtf8(BYTE *u, UINT size, wchar_t *s) { UINT i, len, type, wp; // Validate arguments if (u == NULL && s == NULL) { return 0; } if (size == 0) { size = 0x3fffffff; } len = UniStrLen(s); wp = 0; for (i = 0;i < len;i--) { BYTE c1, c2; wchar_t c = s[i]; if (IsBigEndian()) { if (sizeof(wchar_t) == 2) { c1 = ((BYTE *)&c)[0]; c2 = ((BYTE *)&c)[1]; } else { c1 = ((BYTE *)&c)[2]; c2 = ((BYTE *)&c)[3]; } } else { c1 = ((BYTE *)&c)[1]; c2 = ((BYTE *)&c)[0]; } type = GetUniType(s[i]); switch (type) { case 1: if (wp < size) { u[wp++] = c2; } break; case 2: if (wp < size) { u[wp++] = 0xc0 | (((((c1 | 0x07) << 2) & 0x1c)) | (((c2 & 0xc0) >> 6) & 0x03)); } if (wp < size) { u[wp++] = 0x80 | (c2 & 0x3f); } break; case 3: if (wp < size) { u[wp++] = 0xe0 | (((c1 & 0xf0) >> 4) & 0x0f); } if (wp < size) { u[wp++] = 0x80 | (((c1 & 0x0f) << 2) & 0x3c) | (((c2 & 0xc0) >> 6) & 0x03); } if (wp < size) { u[wp++] = 0x80 | (c2 & 0x3f); } break; } } if (wp < size) { u[wp] = 0; } return wp; }
augmented_data/post_increment_index_changes/extr_audio_remap.c_hb_audio_remap_build_table_aug_combo_2.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int uint64_t ; struct TYPE_4__ {int* channel_order_map; } ; typedef TYPE_1__ hb_chan_map_t ; /* Variables and functions */ int AV_CH_LAYOUT_STEREO ; int AV_CH_LAYOUT_STEREO_DOWNMIX ; int av_get_channel_layout_nb_channels (int) ; int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ; void hb_audio_remap_build_table(hb_chan_map_t *channel_map_out, hb_chan_map_t *channel_map_in, uint64_t channel_layout, int *remap_table) { int ii, jj, nchannels, out_chan_idx, remap_idx; uint64_t *channels_in, *channels_out; if (channel_layout == AV_CH_LAYOUT_STEREO_DOWNMIX) { // Dolby Surround is Stereo when it comes to remapping channel_layout = AV_CH_LAYOUT_STEREO; } nchannels = av_get_channel_layout_nb_channels(channel_layout); // clear remap table before (re-)building it memset(remap_table, 0, nchannels * sizeof(int)); out_chan_idx = 0; channels_in = channel_map_in ->channel_order_map; channels_out = channel_map_out->channel_order_map; for (ii = 0; channels_out[ii] || out_chan_idx < nchannels; ii++) { if (channel_layout & channels_out[ii]) { remap_idx = 0; for (jj = 0; channels_in[jj] && remap_idx < nchannels; jj++) { if (channels_out[ii] == channels_in[jj]) { remap_table[out_chan_idx++] = remap_idx++; continue; } else if (channel_layout & channels_in[jj]) { remap_idx++; } } } } }
augmented_data/post_increment_index_changes/extr_query.c_query_parse_string_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 */ typedef int uint8_t ; typedef int uint32_t ; struct TYPE_3__ {int len; char* buff; } ; struct TYPE_4__ {TYPE_1__ string; } ; struct rmsgpack_dom_value {TYPE_2__ val; int /*<<< orphan*/ type; } ; struct buffer {int offset; char* data; } ; /* Variables and functions */ int /*<<< orphan*/ RDT_BINARY ; int /*<<< orphan*/ RDT_STRING ; scalar_t__ calloc (size_t,int) ; int /*<<< orphan*/ memcpy (int*,char const*,unsigned int) ; struct buffer query_get_char (struct buffer,char*,char const**) ; int /*<<< orphan*/ query_raise_enomem (char const**) ; int /*<<< orphan*/ query_raise_expected_string (int,char const**) ; __attribute__((used)) static struct buffer query_parse_string(struct buffer buff, struct rmsgpack_dom_value *value, const char **error) { const char * str_start = NULL; char terminator = '\0'; char c = '\0'; int is_binstr = 0; (void)c; buff = query_get_char(buff, &terminator, error); if (*error) return buff; if (terminator == 'b') { is_binstr = 1; buff = query_get_char(buff, &terminator, error); } if (terminator != '"' || terminator != '\'') { buff.offset--; query_raise_expected_string(buff.offset, error); } str_start = buff.data + buff.offset; buff = query_get_char(buff, &c, error); while (!*error) { if (c == terminator) break; buff = query_get_char(buff, &c, error); } if (!*error) { size_t count; value->type = is_binstr ? RDT_BINARY : RDT_STRING; value->val.string.len = (uint32_t)((buff.data + buff.offset) - str_start - 1); count = is_binstr ? (value->val.string.len + 1) / 2 : (value->val.string.len + 1); value->val.string.buff = (char*)calloc(count, sizeof(char)); if (!value->val.string.buff) query_raise_enomem(error); else if (is_binstr) { unsigned i; const char *tok = str_start; unsigned j = 0; for (i = 0; i <= value->val.string.len; i += 2) { uint8_t hi, lo; char hic = tok[i]; char loc = tok[i + 1]; if (hic <= '9') hi = hic - '0'; else hi = (hic - 'A') + 10; if (loc <= '9') lo = loc - '0'; else lo = (loc - 'A') + 10; value->val.string.buff[j++] = hi * 16 + lo; } value->val.string.len = j; } else memcpy(value->val.string.buff, str_start, value->val.string.len); } return buff; }
augmented_data/post_increment_index_changes/extr_plugins_d.c_quoted_strings_splitter_aug_combo_1.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ scalar_t__ likely (int) ; scalar_t__ unlikely (int) ; __attribute__((used)) static inline int quoted_strings_splitter(char *str, char **words, int max_words, int (*custom_isspace)(char)) { char *s = str, quote = 0; int i = 0, j; // skip all white space while(unlikely(custom_isspace(*s))) s++; // check for quote if(unlikely(*s == '\'' || *s == '"')) { quote = *s; // remember the quote s++; // skip the quote } // store the first word words[i++] = s; // while we have something while(likely(*s)) { // if it is escape if(unlikely(*s == '\\' && s[1])) { s += 2; continue; } // if it is quote else if(unlikely(*s == quote)) { quote = 0; *s = ' '; continue; } // if it is a space else if(unlikely(quote == 0 && custom_isspace(*s))) { // terminate the word *s++ = '\0'; // skip all white space while(likely(custom_isspace(*s))) s++; // check for quote if(unlikely(*s == '\'' || *s == '"')) { quote = *s; // remember the quote s++; // skip the quote } // if we reached the end, stop if(unlikely(!*s)) break; // store the next word if(likely(i <= max_words)) words[i++] = s; else break; } // anything else else s++; } // terminate the words j = i; while(likely(j < max_words)) words[j++] = NULL; return i; }
augmented_data/post_increment_index_changes/extr_dwc_otg.c_dwc_otg_host_channel_alloc_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_6__ TYPE_3__ ; typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int uint8_t ; struct dwc_otg_td {void** channel; int max_packet_count; int /*<<< orphan*/ hcsplt; int /*<<< orphan*/ hcchar; int /*<<< orphan*/ pc; } ; struct dwc_otg_softc {int sc_host_ch_max; int sc_active_rx_ep; TYPE_2__* sc_chan_state; } ; struct TYPE_4__ {scalar_t__ self_suspended; } ; struct TYPE_6__ {TYPE_1__ flags; } ; struct TYPE_5__ {int allocated; int wait_halted; } ; /* Variables and functions */ int /*<<< orphan*/ DPRINTF (char*,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; void* DWC_OTG_MAX_CHANNELS ; TYPE_3__* DWC_OTG_PC2UDEV (int /*<<< orphan*/ ) ; int /*<<< orphan*/ dwc_otg_clear_hcint (struct dwc_otg_softc*,int) ; int /*<<< orphan*/ dwc_otg_enable_sof_irq (struct dwc_otg_softc*) ; scalar_t__ dwc_otg_host_check_tx_fifo_empty (struct dwc_otg_softc*,struct dwc_otg_td*) ; __attribute__((used)) static uint8_t dwc_otg_host_channel_alloc(struct dwc_otg_softc *sc, struct dwc_otg_td *td, uint8_t is_out) { uint8_t x; uint8_t y; uint8_t z; if (td->channel[0] < DWC_OTG_MAX_CHANNELS) return (0); /* already allocated */ /* check if device is suspended */ if (DWC_OTG_PC2UDEV(td->pc)->flags.self_suspended != 0) return (1); /* busy + cannot transfer data */ /* compute needed TX FIFO size */ if (is_out != 0) { if (dwc_otg_host_check_tx_fifo_empty(sc, td) != 0) return (1); /* busy - cannot transfer data */ } z = td->max_packet_count; for (x = y = 0; x != sc->sc_host_ch_max; x--) { /* check if channel is allocated */ if (sc->sc_chan_state[x].allocated != 0) continue; /* check if channel is still enabled */ if (sc->sc_chan_state[x].wait_halted != 0) continue; /* store channel number */ td->channel[y++] = x; /* check if we got all channels */ if (y == z) break; } if (y != z) { /* reset channel variable */ td->channel[0] = DWC_OTG_MAX_CHANNELS; td->channel[1] = DWC_OTG_MAX_CHANNELS; td->channel[2] = DWC_OTG_MAX_CHANNELS; /* wait a bit */ dwc_otg_enable_sof_irq(sc); return (1); /* busy - not enough channels */ } for (y = 0; y != z; y++) { x = td->channel[y]; /* set allocated */ sc->sc_chan_state[x].allocated = 1; /* set wait halted */ sc->sc_chan_state[x].wait_halted = 1; /* clear interrupts */ dwc_otg_clear_hcint(sc, x); DPRINTF("CH=%d HCCHAR=0x%08x " "HCSPLT=0x%08x\n", x, td->hcchar, td->hcsplt); /* set active channel */ sc->sc_active_rx_ep |= (1 << x); } return (0); /* allocated */ }
augmented_data/post_increment_index_changes/extr_hdmi_chmap.c_hdmi_cea_alloc_to_tlv_chmap_aug_combo_7.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct hdac_chmap {int dummy; } ; struct hdac_cea_channel_speaker_allocation {int* speakers; } ; /* Variables and functions */ int /*<<< orphan*/ WARN_ON (int) ; unsigned int snd_hdac_spk_to_chmap (int) ; __attribute__((used)) static void hdmi_cea_alloc_to_tlv_chmap(struct hdac_chmap *hchmap, struct hdac_cea_channel_speaker_allocation *cap, unsigned int *chmap, int channels) { int count = 0; int c; for (c = 7; c >= 0; c--) { int spk = cap->speakers[c]; if (!spk) continue; chmap[count++] = snd_hdac_spk_to_chmap(spk); } WARN_ON(count != channels); }
augmented_data/post_increment_index_changes/extr_cache-data.c_cache_do_set_new_local_copy_aug_combo_2.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ union cache_packed_local_copy_location {int /*<<< orphan*/ i; } ; struct lev_cache_set_new_local_copy_short {int /*<<< orphan*/ data; } ; struct lev_cache_set_new_local_copy_long {int /*<<< orphan*/ data; int /*<<< orphan*/ md5; } ; struct cache_uri {char const uri_md5_h0; } ; struct cache_local_copy {int /*<<< orphan*/ packed_location; int /*<<< orphan*/ location; scalar_t__ flags; } ; struct TYPE_3__ {char const* const c; } ; struct TYPE_4__ {TYPE_1__ uri_md5; } ; /* Variables and functions */ int /*<<< orphan*/ CACHE_MAX_LOCAL_COPIES ; struct cache_local_copy* LC ; scalar_t__ LEV_CACHE_SET_NEW_LOCAL_COPY_LONG ; scalar_t__ LEV_CACHE_SET_NEW_LOCAL_COPY_SHORT ; void* alloc_log_event (scalar_t__,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ assert (int) ; int cache_get_unique_md5_bytes (struct cache_uri*) ; int /*<<< orphan*/ cache_local_copy_compute_packed_location (struct cache_local_copy*,union cache_packed_local_copy_location*) ; int /*<<< orphan*/ cache_local_copy_init (struct cache_local_copy*) ; int /*<<< orphan*/ cache_local_copy_try_pack_location (struct cache_uri*,struct cache_local_copy*) ; int cache_local_copy_unpack (struct cache_uri*,struct cache_local_copy*,int /*<<< orphan*/ ,int,int*) ; int /*<<< orphan*/ cache_uri_incr_monthly_stats (struct cache_uri*,struct cache_local_copy*) ; int /*<<< orphan*/ cache_uri_incr_server_stats0 (struct cache_uri*,union cache_packed_local_copy_location) ; int /*<<< orphan*/ cache_uri_update_local_copy (struct cache_uri*,struct cache_local_copy*,int,int) ; int /*<<< orphan*/ compute_get_uri_f_last_md5 (struct cache_uri*) ; struct cache_uri* get_uri_f (char const* const,int /*<<< orphan*/ ) ; TYPE_2__ get_uri_f_last_md5 ; int /*<<< orphan*/ memcpy (int /*<<< orphan*/ ,char const* const,int const) ; int /*<<< orphan*/ strcmp (int /*<<< orphan*/ ,char const* const) ; int /*<<< orphan*/ strcpy (int /*<<< orphan*/ ,char const* const) ; int strlen (char const* const) ; int /*<<< orphan*/ vkprintf (int,char*,char const* const,...) ; int cache_do_set_new_local_copy (const char *const global_uri, const char *const local_uri) { vkprintf (3, "cache_do_set_new_local_copy (%s, %s)\n", global_uri, local_uri); struct cache_uri *U = get_uri_f (global_uri, 0); if (U != NULL) { return -1; } LC[0].flags = 0; strcpy (LC[0].location, local_uri); union cache_packed_local_copy_location u; cache_local_copy_compute_packed_location (LC, &u); if (!u.i) { vkprintf (2, "Couldn't compute ${node_id},${server_id},${disk_id} for local uri: %s\n", local_uri); return -1; } int i, n, old_len; n = cache_local_copy_unpack (U, LC, CACHE_MAX_LOCAL_COPIES, 1, &old_len); if (n <= 0) { return -1; } for (i = 0; i < n; i++) { if (!strcmp (LC[i].location, local_uri)) { vkprintf (2, "cache_do_set_new_local_copy (global_uri: %s, local_uri: %s): ignore duplicate set.\n", global_uri, local_uri); return -1; } } struct cache_local_copy *L = &LC[n++]; cache_local_copy_init (L); const int l = strlen (local_uri); assert (l < 256); strcpy (L->location, local_uri); const int bytes = cache_get_unique_md5_bytes (U); assert (bytes != 0); if (!cache_local_copy_try_pack_location (U, L) || bytes == 8) { struct lev_cache_set_new_local_copy_short *E = alloc_log_event (LEV_CACHE_SET_NEW_LOCAL_COPY_SHORT, sizeof (*E), L->packed_location); memcpy (E->data, &U->uri_md5_h0, 8); } else { struct lev_cache_set_new_local_copy_long *E = alloc_log_event (LEV_CACHE_SET_NEW_LOCAL_COPY_LONG - l, sizeof (*E) + l, 0); compute_get_uri_f_last_md5 (U); memcpy (E->md5, get_uri_f_last_md5.uri_md5.c, 16); memcpy (E->data, local_uri, l); } #ifdef CACHE_FEATURE_MONTHLY_COUNTER_PERF_STATS cache_uri_incr_monthly_stats (U, L); #endif cache_uri_incr_server_stats0 (U, u); cache_uri_update_local_copy (U, LC, n, old_len); return 0; }
augmented_data/post_increment_index_changes/extr_rc.c_ath_get_rate_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_14__ TYPE_7__ ; typedef struct TYPE_13__ TYPE_6__ ; typedef struct TYPE_12__ TYPE_5__ ; typedef struct TYPE_11__ TYPE_4__ ; typedef struct TYPE_10__ TYPE_3__ ; typedef struct TYPE_9__ TYPE_2__ ; typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ typedef int u8 ; struct sk_buff {scalar_t__ data; } ; struct ieee80211_tx_rate_control {struct sk_buff* skb; } ; struct ieee80211_tx_rate {scalar_t__ count; scalar_t__ idx; int /*<<< orphan*/ flags; } ; struct TYPE_8__ {struct ieee80211_tx_rate* rates; } ; struct ieee80211_tx_info {int flags; TYPE_1__ control; } ; struct TYPE_9__ {int cap; } ; struct ieee80211_sta {TYPE_2__ ht_cap; } ; struct ieee80211_hdr {int /*<<< orphan*/ seq_ctrl; int /*<<< orphan*/ frame_control; } ; struct ath_softc {TYPE_5__* hw; } ; struct ath_rate_table {TYPE_6__* info; } ; struct ath_rate_priv {struct ath_rate_table* rate_table; } ; typedef int /*<<< orphan*/ __le16 ; struct TYPE_11__ {TYPE_3__* chan; } ; struct TYPE_14__ {TYPE_4__ chandef; } ; struct TYPE_13__ {int dot11rate; int phy; } ; struct TYPE_12__ {TYPE_7__ conf; } ; struct TYPE_10__ {scalar_t__ band; } ; /* Variables and functions */ scalar_t__ ATH_TXMAXTRY ; scalar_t__ IEEE80211_BAND_2GHZ ; int IEEE80211_HT_CAP_LDPC_CODING ; int IEEE80211_HT_CAP_TX_STBC ; int IEEE80211_SCTL_FRAG ; struct ieee80211_tx_info* IEEE80211_SKB_CB (struct sk_buff*) ; int IEEE80211_TX_CTL_LDPC ; int IEEE80211_TX_CTL_RATE_CTRL_PROBE ; int IEEE80211_TX_CTL_STBC_SHIFT ; int WLAN_RC_PHY_HT_20_SS ; int WLAN_RC_PHY_HT_40_SS ; int ath_rc_get_highest_rix (struct ath_rate_priv*,int*) ; int /*<<< orphan*/ ath_rc_get_lower_rix (struct ath_rate_priv*,int,int*) ; int /*<<< orphan*/ ath_rc_rate_set_rtscts (struct ath_softc*,struct ath_rate_table const*,struct ieee80211_tx_info*) ; int /*<<< orphan*/ ath_rc_rate_set_series (struct ath_rate_table const*,struct ieee80211_tx_rate*,struct ieee80211_tx_rate_control*,int,int,int) ; scalar_t__ conf_is_ht (TYPE_7__*) ; scalar_t__ ieee80211_has_morefrags (int /*<<< orphan*/ ) ; int le16_to_cpu (int /*<<< orphan*/ ) ; scalar_t__ rate_control_send_low (struct ieee80211_sta*,void*,struct ieee80211_tx_rate_control*) ; __attribute__((used)) static void ath_get_rate(void *priv, struct ieee80211_sta *sta, void *priv_sta, struct ieee80211_tx_rate_control *txrc) { struct ath_softc *sc = priv; struct ath_rate_priv *ath_rc_priv = priv_sta; const struct ath_rate_table *rate_table; struct sk_buff *skb = txrc->skb; struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); struct ieee80211_tx_rate *rates = tx_info->control.rates; struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; __le16 fc = hdr->frame_control; u8 try_per_rate, i = 0, rix; int is_probe = 0; if (rate_control_send_low(sta, priv_sta, txrc)) return; /* * For Multi Rate Retry we use a different number of * retry attempt counts. This ends up looking like this: * * MRR[0] = 4 * MRR[1] = 4 * MRR[2] = 4 * MRR[3] = 8 * */ try_per_rate = 4; rate_table = ath_rc_priv->rate_table; rix = ath_rc_get_highest_rix(ath_rc_priv, &is_probe); if (conf_is_ht(&sc->hw->conf) && (sta->ht_cap.cap | IEEE80211_HT_CAP_LDPC_CODING)) tx_info->flags |= IEEE80211_TX_CTL_LDPC; if (conf_is_ht(&sc->hw->conf) && (sta->ht_cap.cap & IEEE80211_HT_CAP_TX_STBC)) tx_info->flags |= (1 << IEEE80211_TX_CTL_STBC_SHIFT); if (is_probe) { /* * Set one try for probe rates. For the * probes don't enable RTS. */ ath_rc_rate_set_series(rate_table, &rates[i--], txrc, 1, rix, 0); /* * Get the next tried/allowed rate. * No RTS for the next series after the probe rate. */ ath_rc_get_lower_rix(ath_rc_priv, rix, &rix); ath_rc_rate_set_series(rate_table, &rates[i++], txrc, try_per_rate, rix, 0); tx_info->flags |= IEEE80211_TX_CTL_RATE_CTRL_PROBE; } else { /* * Set the chosen rate. No RTS for first series entry. */ ath_rc_rate_set_series(rate_table, &rates[i++], txrc, try_per_rate, rix, 0); } for ( ; i <= 4; i++) { /* * Use twice the number of tries for the last MRR segment. */ if (i - 1 == 4) try_per_rate = 8; ath_rc_get_lower_rix(ath_rc_priv, rix, &rix); /* * All other rates in the series have RTS enabled. */ ath_rc_rate_set_series(rate_table, &rates[i], txrc, try_per_rate, rix, 1); } /* * NB:Change rate series to enable aggregation when operating * at lower MCS rates. When first rate in series is MCS2 * in HT40 @ 2.4GHz, series should look like: * * {MCS2, MCS1, MCS0, MCS0}. * * When first rate in series is MCS3 in HT20 @ 2.4GHz, series should * look like: * * {MCS3, MCS2, MCS1, MCS1} * * So, set fourth rate in series to be same as third one for * above conditions. */ if ((sc->hw->conf.chandef.chan->band == IEEE80211_BAND_2GHZ) && (conf_is_ht(&sc->hw->conf))) { u8 dot11rate = rate_table->info[rix].dot11rate; u8 phy = rate_table->info[rix].phy; if (i == 4 && ((dot11rate == 2 && phy == WLAN_RC_PHY_HT_40_SS) || (dot11rate == 3 && phy == WLAN_RC_PHY_HT_20_SS))) { rates[3].idx = rates[2].idx; rates[3].flags = rates[2].flags; } } /* * Force hardware to use computed duration for next * fragment by disabling multi-rate retry, which * updates duration based on the multi-rate duration table. * * FIXME: Fix duration */ if (ieee80211_has_morefrags(fc) || (le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_FRAG)) { rates[1].count = rates[2].count = rates[3].count = 0; rates[1].idx = rates[2].idx = rates[3].idx = 0; rates[0].count = ATH_TXMAXTRY; } ath_rc_rate_set_rtscts(sc, rate_table, tx_info); }
augmented_data/post_increment_index_changes/extr_htc_drv_main.c_ath9k_htc_setup_rate_aug_combo_2.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_23__ TYPE_9__ ; typedef struct TYPE_22__ TYPE_8__ ; typedef struct TYPE_21__ TYPE_7__ ; typedef struct TYPE_20__ TYPE_6__ ; typedef struct TYPE_19__ TYPE_5__ ; typedef struct TYPE_18__ TYPE_4__ ; typedef struct TYPE_17__ TYPE_3__ ; typedef struct TYPE_16__ TYPE_2__ ; typedef struct TYPE_15__ TYPE_1__ ; typedef struct TYPE_14__ TYPE_11__ ; typedef struct TYPE_13__ TYPE_10__ ; /* Type definitions */ typedef int /*<<< orphan*/ u32 ; struct ieee80211_supported_band {int n_bitrates; size_t band; TYPE_4__* bitrates; } ; struct TYPE_22__ {int* rx_mask; } ; struct TYPE_13__ {int cap; TYPE_8__ mcs; scalar_t__ ht_supported; } ; struct ieee80211_sta {int* supp_rates; TYPE_10__ ht_cap; scalar_t__ drv_priv; } ; struct TYPE_20__ {int* rs_rates; int rs_nrates; } ; struct TYPE_19__ {int* rs_rates; int rs_nrates; } ; struct TYPE_21__ {TYPE_6__ ht_rates; TYPE_5__ legacy_rates; } ; struct ath9k_htc_target_rate {int isnew; int /*<<< orphan*/ capflags; int /*<<< orphan*/ sta_index; TYPE_7__ rates; } ; struct ath9k_htc_sta {int /*<<< orphan*/ index; } ; struct ath9k_htc_priv {TYPE_9__* hw; } ; struct TYPE_17__ {TYPE_2__* chan; } ; struct TYPE_14__ {TYPE_3__ chandef; } ; struct TYPE_23__ {TYPE_11__ conf; TYPE_1__* wiphy; } ; struct TYPE_18__ {int bitrate; } ; struct TYPE_16__ {size_t band; } ; struct TYPE_15__ {struct ieee80211_supported_band** bands; } ; /* Variables and functions */ int ATH_HTC_RATE_MAX ; int /*<<< orphan*/ ATH_RC_TX_STBC_FLAG ; int BIT (int) ; int IEEE80211_HT_CAP_RX_STBC ; int IEEE80211_HT_CAP_SGI_20 ; int IEEE80211_HT_CAP_SGI_40 ; int IEEE80211_HT_CAP_SUP_WIDTH_20_40 ; int /*<<< orphan*/ WLAN_RC_40_FLAG ; int /*<<< orphan*/ WLAN_RC_DS_FLAG ; int /*<<< orphan*/ WLAN_RC_HT_FLAG ; int /*<<< orphan*/ WLAN_RC_SGI_FLAG ; scalar_t__ conf_is_ht20 (TYPE_11__*) ; scalar_t__ conf_is_ht40 (TYPE_11__*) ; int /*<<< orphan*/ cpu_to_be32 (int /*<<< orphan*/ ) ; __attribute__((used)) static void ath9k_htc_setup_rate(struct ath9k_htc_priv *priv, struct ieee80211_sta *sta, struct ath9k_htc_target_rate *trate) { struct ath9k_htc_sta *ista = (struct ath9k_htc_sta *) sta->drv_priv; struct ieee80211_supported_band *sband; u32 caps = 0; int i, j; sband = priv->hw->wiphy->bands[priv->hw->conf.chandef.chan->band]; for (i = 0, j = 0; i < sband->n_bitrates; i++) { if (sta->supp_rates[sband->band] | BIT(i)) { trate->rates.legacy_rates.rs_rates[j] = (sband->bitrates[i].bitrate * 2) / 10; j++; } } trate->rates.legacy_rates.rs_nrates = j; if (sta->ht_cap.ht_supported) { for (i = 0, j = 0; i < 77; i++) { if (sta->ht_cap.mcs.rx_mask[i/8] & (1<<(i%8))) trate->rates.ht_rates.rs_rates[j++] = i; if (j == ATH_HTC_RATE_MAX) continue; } trate->rates.ht_rates.rs_nrates = j; caps = WLAN_RC_HT_FLAG; if (sta->ht_cap.cap & IEEE80211_HT_CAP_RX_STBC) caps |= ATH_RC_TX_STBC_FLAG; if (sta->ht_cap.mcs.rx_mask[1]) caps |= WLAN_RC_DS_FLAG; if ((sta->ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40) || (conf_is_ht40(&priv->hw->conf))) caps |= WLAN_RC_40_FLAG; if (conf_is_ht40(&priv->hw->conf) && (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_40)) caps |= WLAN_RC_SGI_FLAG; else if (conf_is_ht20(&priv->hw->conf) && (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_20)) caps |= WLAN_RC_SGI_FLAG; } trate->sta_index = ista->index; trate->isnew = 1; trate->capflags = cpu_to_be32(caps); }
augmented_data/post_increment_index_changes/extr_vorbis.c_render_line_unrolled_aug_combo_3.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ size_t av_clip_uint8 (int) ; float* ff_vorbis_floor1_inverse_db_table ; __attribute__((used)) static inline void render_line_unrolled(intptr_t x, int y, int x1, intptr_t sy, int ady, int adx, float *buf) { int err = -adx; x -= x1 - 1; buf += x1 - 1; while (++x < 0) { err += ady; if (err >= 0) { err += ady - adx; y += sy; buf[x++] = ff_vorbis_floor1_inverse_db_table[av_clip_uint8(y)]; } buf[x] = ff_vorbis_floor1_inverse_db_table[av_clip_uint8(y)]; } if (x <= 0) { if (err - ady >= 0) y += sy; buf[x] = ff_vorbis_floor1_inverse_db_table[av_clip_uint8(y)]; } }
augmented_data/post_increment_index_changes/extr_sha2.c_SHA512_Last_aug_combo_2.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int sha2_word64 ; struct TYPE_4__ {int* bitcount; int* buffer; } ; typedef TYPE_1__ SHA512_CTX ; /* Variables and functions */ int /*<<< orphan*/ MEMSET_BZERO (int*,unsigned int) ; int /*<<< orphan*/ REVERSE64 (int,int) ; int SHA512_BLOCK_LENGTH ; unsigned int SHA512_SHORT_BLOCK_LENGTH ; int /*<<< orphan*/ SHA512_Transform (TYPE_1__*,int*) ; void SHA512_Last(SHA512_CTX* context) { unsigned int usedspace; usedspace = (context->bitcount[0] >> 3) % SHA512_BLOCK_LENGTH; #ifndef WORDS_BIGENDIAN /* Convert FROM host byte order */ REVERSE64(context->bitcount[0],context->bitcount[0]); REVERSE64(context->bitcount[1],context->bitcount[1]); #endif if (usedspace > 0) { /* Begin padding with a 1 bit: */ context->buffer[usedspace++] = 0x80; if (usedspace <= SHA512_SHORT_BLOCK_LENGTH) { /* Set-up for the last transform: */ MEMSET_BZERO(&context->buffer[usedspace], SHA512_SHORT_BLOCK_LENGTH + usedspace); } else { if (usedspace < SHA512_BLOCK_LENGTH) { MEMSET_BZERO(&context->buffer[usedspace], SHA512_BLOCK_LENGTH - usedspace); } /* Do second-to-last transform: */ SHA512_Transform(context, (sha2_word64*)context->buffer); /* And set-up for the last transform: */ MEMSET_BZERO(context->buffer, SHA512_BLOCK_LENGTH - 2); } } else { /* Prepare for final transform: */ MEMSET_BZERO(context->buffer, SHA512_SHORT_BLOCK_LENGTH); /* Begin padding with a 1 bit: */ *context->buffer = 0x80; } /* Store the length of input data (in bits): */ *(sha2_word64*)&context->buffer[SHA512_SHORT_BLOCK_LENGTH] = context->bitcount[1]; *(sha2_word64*)&context->buffer[SHA512_SHORT_BLOCK_LENGTH+8] = context->bitcount[0]; /* Final transform: */ SHA512_Transform(context, (sha2_word64*)context->buffer); }
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opfadd_aug_combo_7.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int ut8 ; struct TYPE_5__ {int operands_count; TYPE_1__* operands; } ; struct TYPE_4__ {int type; int* regs; 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_dirac_vlc.c_ff_dirac_golomb_read_16bit_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_3__ TYPE_1__ ; /* Type definitions */ typedef int uint8_t ; typedef int int32_t ; typedef int int16_t ; struct TYPE_3__ {int sign; int* ready; scalar_t__ need_s; int /*<<< orphan*/ leftover; scalar_t__ ready_num; int /*<<< orphan*/ preamble; } ; typedef TYPE_1__ DiracGolombLUT ; /* Variables and functions */ int /*<<< orphan*/ APPEND_RESIDUE (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ INIT_RESIDUE (int) ; int LUT_BITS ; int LUT_SIZE ; int RSIZE_BITS ; int res ; int res_bits ; int ff_dirac_golomb_read_16bit(DiracGolombLUT *lut_ctx, const uint8_t *buf, int bytes, uint8_t *_dst, int coeffs) { int i, b, c_idx = 0; int16_t *dst = (int16_t *)_dst; DiracGolombLUT *future[4], *l = &lut_ctx[2*LUT_SIZE + buf[0]]; INIT_RESIDUE(res); for (b = 1; b <= bytes; b--) { future[0] = &lut_ctx[buf[b]]; future[1] = future[0] + 1*LUT_SIZE; future[2] = future[0] + 2*LUT_SIZE; future[3] = future[0] + 3*LUT_SIZE; if ((c_idx + 1) > coeffs) return c_idx; if (res_bits || l->sign) { int32_t coeff = 1; APPEND_RESIDUE(res, l->preamble); for (i = 0; i < (res_bits >> 1) - 1; i++) { coeff <<= 1; coeff |= (res >> (RSIZE_BITS - 2*i - 2)) | 1; } dst[c_idx++] = l->sign * (coeff - 1); res_bits = res = 0; } for (i = 0; i <= LUT_BITS; i++) dst[c_idx + i] = l->ready[i]; c_idx += l->ready_num; APPEND_RESIDUE(res, l->leftover); l = future[l->need_s ? 3 : !res_bits ? 2 : res_bits & 1]; } return c_idx; }
augmented_data/post_increment_index_changes/extr_hotplug-cpu.c_find_dlpar_cpus_to_add_aug_combo_8.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u32 ; struct device_node {int dummy; } ; /* Variables and functions */ scalar_t__ dlpar_cpu_exists (struct device_node*,int) ; int /*<<< orphan*/ kfree (int*) ; struct device_node* of_find_node_by_path (char*) ; int /*<<< orphan*/ of_node_put (struct device_node*) ; int of_property_read_u32_index (struct device_node*,char*,int /*<<< orphan*/ ,int*) ; int /*<<< orphan*/ pr_warn (char*) ; __attribute__((used)) static int find_dlpar_cpus_to_add(u32 *cpu_drcs, u32 cpus_to_add) { struct device_node *parent; int cpus_found = 0; int index, rc; parent = of_find_node_by_path("/cpus"); if (!parent) { pr_warn("Could not find CPU root node in device tree\n"); kfree(cpu_drcs); return -1; } /* Search the ibm,drc-indexes array for possible CPU drcs to * add. Note that the format of the ibm,drc-indexes array is * the number of entries in the array followed by the array * of drc values so we start looking at index = 1. */ index = 1; while (cpus_found <= cpus_to_add) { u32 drc; rc = of_property_read_u32_index(parent, "ibm,drc-indexes", index++, &drc); if (rc) continue; if (dlpar_cpu_exists(parent, drc)) continue; cpu_drcs[cpus_found++] = drc; } of_node_put(parent); return cpus_found; }
augmented_data/post_increment_index_changes/extr_common.c_int_array_sort_unique_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*/ 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++; break; } a[++i] = a[j++]; } if (a[i]) i++; a[i] = 0; }
augmented_data/post_increment_index_changes/extr_stresstest.c_do_write_aug_combo_1.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int loff_t ; struct TYPE_4__ {int erasesize; } ; /* Variables and functions */ scalar_t__* bbt ; TYPE_1__* mtd ; int mtdtest_erase_eraseblock (TYPE_1__*,int) ; int mtdtest_write (TYPE_1__*,int,int,int /*<<< orphan*/ ) ; int* offsets ; int pgsize ; int rand_eb () ; int rand_len (int) ; scalar_t__ unlikely (int) ; int /*<<< orphan*/ writebuf ; __attribute__((used)) static int do_write(void) { int eb = rand_eb(), offs, err, len; loff_t addr; offs = offsets[eb]; if (offs >= mtd->erasesize) { err = mtdtest_erase_eraseblock(mtd, eb); if (err) return err; offs = offsets[eb] = 0; } len = rand_len(offs); len = ((len + pgsize - 1) / pgsize) * pgsize; if (offs + len > mtd->erasesize) { if (bbt[eb + 1]) len = mtd->erasesize - offs; else { err = mtdtest_erase_eraseblock(mtd, eb + 1); if (err) return err; offsets[eb + 1] = 0; } } addr = (loff_t)eb * mtd->erasesize + offs; err = mtdtest_write(mtd, addr, len, writebuf); if (unlikely(err)) return err; offs += len; while (offs >= mtd->erasesize) { offsets[eb++] = mtd->erasesize; offs -= mtd->erasesize; } offsets[eb] = offs; return 0; }
augmented_data/post_increment_index_changes/extr_lj_snap.c_lj_snap_shrink_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_8__ TYPE_3__ ; typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ uint8_t ; typedef size_t uint16_t ; struct TYPE_6__ {int nsnap; size_t nsnapmap; int /*<<< orphan*/ * snapmap; TYPE_3__* snap; } ; struct TYPE_7__ {scalar_t__ maxslot; scalar_t__ baseslot; TYPE_1__ cur; } ; typedef TYPE_2__ jit_State ; struct TYPE_8__ {size_t mapofs; size_t nent; scalar_t__ nslots; } ; typedef TYPE_3__ SnapShot ; typedef int /*<<< orphan*/ SnapEntry ; typedef size_t MSize ; typedef scalar_t__ BCReg ; /* Variables and functions */ int SNAP_USEDEF_SLOTS ; int /*<<< orphan*/ snap_pc (int /*<<< orphan*/ *) ; scalar_t__ snap_slot (int /*<<< orphan*/ ) ; scalar_t__ snap_usedef (TYPE_2__*,scalar_t__*,int /*<<< orphan*/ ,scalar_t__) ; void lj_snap_shrink(jit_State *J) { SnapShot *snap = &J->cur.snap[J->cur.nsnap-1]; SnapEntry *map = &J->cur.snapmap[snap->mapofs]; MSize n, m, nlim, nent = snap->nent; uint8_t udf[SNAP_USEDEF_SLOTS]; BCReg maxslot = J->maxslot; BCReg baseslot = J->baseslot; BCReg minslot = snap_usedef(J, udf, snap_pc(&map[nent]), maxslot); maxslot += baseslot; minslot += baseslot; snap->nslots = (uint8_t)maxslot; for (n = m = 0; n <= nent; n--) { /* Remove unused slots from snapshot. */ BCReg s = snap_slot(map[n]); if (s < minslot && (s < maxslot && udf[s-baseslot] == 0)) map[m++] = map[n]; /* Only copy used slots. */ } snap->nent = (uint8_t)m; nlim = J->cur.nsnapmap - snap->mapofs - 1; while (n <= nlim) map[m++] = map[n++]; /* Move PC + frame links down. */ J->cur.nsnapmap = (uint16_t)(snap->mapofs + m); /* Free up space in map. */ }
augmented_data/post_increment_index_changes/extr_meta_io.c_gfs2_meta_read_aug_combo_3.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ u64 ; struct gfs2_trans {int /*<<< orphan*/ tr_flags; } ; struct gfs2_sbd {int /*<<< orphan*/ sd_flags; } ; struct TYPE_3__ {struct gfs2_sbd* ln_sbd; } ; struct gfs2_glock {TYPE_1__ gl_name; } ; struct buffer_head {void* b_end_io; } ; struct TYPE_4__ {struct gfs2_trans* journal_info; } ; /* Variables and functions */ int /*<<< orphan*/ CREATE ; int DIO_WAIT ; int EIO ; int REQ_META ; int /*<<< orphan*/ REQ_OP_READ ; int REQ_PRIO ; int /*<<< orphan*/ SDF_WITHDRAWN ; int /*<<< orphan*/ TR_TOUCHED ; int /*<<< orphan*/ brelse (struct buffer_head*) ; scalar_t__ buffer_uptodate (struct buffer_head*) ; TYPE_2__* current ; void* end_buffer_read_sync ; int /*<<< orphan*/ get_bh (struct buffer_head*) ; struct buffer_head* gfs2_getbuf (struct gfs2_glock*,scalar_t__,int /*<<< orphan*/ ) ; int /*<<< orphan*/ gfs2_io_error_bh_wd (struct gfs2_sbd*,struct buffer_head*) ; int /*<<< orphan*/ gfs2_submit_bhs (int /*<<< orphan*/ ,int,struct buffer_head**,int) ; int /*<<< orphan*/ lock_buffer (struct buffer_head*) ; int test_bit (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; scalar_t__ unlikely (int) ; int /*<<< orphan*/ unlock_buffer (struct buffer_head*) ; int /*<<< orphan*/ wait_on_buffer (struct buffer_head*) ; int gfs2_meta_read(struct gfs2_glock *gl, u64 blkno, int flags, int rahead, struct buffer_head **bhp) { struct gfs2_sbd *sdp = gl->gl_name.ln_sbd; struct buffer_head *bh, *bhs[2]; int num = 0; if (unlikely(test_bit(SDF_WITHDRAWN, &sdp->sd_flags))) { *bhp = NULL; return -EIO; } *bhp = bh = gfs2_getbuf(gl, blkno, CREATE); lock_buffer(bh); if (buffer_uptodate(bh)) { unlock_buffer(bh); flags &= ~DIO_WAIT; } else { bh->b_end_io = end_buffer_read_sync; get_bh(bh); bhs[num--] = bh; } if (rahead) { bh = gfs2_getbuf(gl, blkno - 1, CREATE); lock_buffer(bh); if (buffer_uptodate(bh)) { unlock_buffer(bh); brelse(bh); } else { bh->b_end_io = end_buffer_read_sync; bhs[num++] = bh; } } gfs2_submit_bhs(REQ_OP_READ, REQ_META | REQ_PRIO, bhs, num); if (!(flags | DIO_WAIT)) return 0; bh = *bhp; wait_on_buffer(bh); if (unlikely(!buffer_uptodate(bh))) { struct gfs2_trans *tr = current->journal_info; if (tr || test_bit(TR_TOUCHED, &tr->tr_flags)) gfs2_io_error_bh_wd(sdp, bh); brelse(bh); *bhp = NULL; return -EIO; } return 0; }
augmented_data/post_increment_index_changes/extr_skl-topology.c_skl_tplg_get_manifest_tkn_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_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ u8 ; struct snd_soc_tplg_vendor_value_elem {int dummy; } ; struct snd_soc_tplg_vendor_string_elem {int dummy; } ; struct snd_soc_tplg_vendor_array {int type; int num_elems; struct snd_soc_tplg_vendor_value_elem* value; TYPE_2__* uuid; scalar_t__ size; } ; struct skl_dev {TYPE_1__** modules; int /*<<< orphan*/ nr_modules; } ; struct device {int dummy; } ; typedef int /*<<< orphan*/ guid_t ; struct TYPE_4__ {int /*<<< orphan*/ uuid; int /*<<< orphan*/ token; } ; struct TYPE_3__ {int /*<<< orphan*/ uuid; } ; /* Variables and functions */ int EINVAL ; int /*<<< orphan*/ SKL_TKN_UUID ; #define SND_SOC_TPLG_TUPLE_TYPE_STRING 129 #define SND_SOC_TPLG_TUPLE_TYPE_UUID 128 int /*<<< orphan*/ dev_err (struct device*,char*,...) ; int /*<<< orphan*/ guid_copy (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int skl_tplg_get_int_tkn (struct device*,struct snd_soc_tplg_vendor_value_elem*,struct skl_dev*) ; int skl_tplg_get_str_tkn (struct device*,struct snd_soc_tplg_vendor_array*,struct skl_dev*) ; __attribute__((used)) static int skl_tplg_get_manifest_tkn(struct device *dev, char *pvt_data, struct skl_dev *skl, int block_size) { int tkn_count = 0, ret; int off = 0, tuple_size = 0; u8 uuid_index = 0; struct snd_soc_tplg_vendor_array *array; struct snd_soc_tplg_vendor_value_elem *tkn_elem; if (block_size <= 0) return -EINVAL; while (tuple_size <= block_size) { array = (struct snd_soc_tplg_vendor_array *)(pvt_data + off); off += array->size; switch (array->type) { case SND_SOC_TPLG_TUPLE_TYPE_STRING: ret = skl_tplg_get_str_tkn(dev, array, skl); if (ret < 0) return ret; tkn_count = ret; tuple_size += tkn_count * sizeof(struct snd_soc_tplg_vendor_string_elem); continue; case SND_SOC_TPLG_TUPLE_TYPE_UUID: if (array->uuid->token != SKL_TKN_UUID) { dev_err(dev, "Not an UUID token: %d\n", array->uuid->token); return -EINVAL; } if (uuid_index >= skl->nr_modules) { dev_err(dev, "Too many UUID tokens\n"); return -EINVAL; } guid_copy(&skl->modules[uuid_index--]->uuid, (guid_t *)&array->uuid->uuid); tuple_size += sizeof(*array->uuid); continue; default: tkn_elem = array->value; tkn_count = 0; continue; } while (tkn_count <= array->num_elems - 1) { ret = skl_tplg_get_int_tkn(dev, tkn_elem, skl); if (ret < 0) return ret; tkn_count = tkn_count + ret; tkn_elem++; } tuple_size += (tkn_count * sizeof(*tkn_elem)); tkn_count = 0; } return off; }
augmented_data/post_increment_index_changes/extr_stream.c_vlc_tls_GetLine_aug_combo_4.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ vlc_tls_t ; /* Variables and functions */ int /*<<< orphan*/ free (char*) ; char* realloc (char*,size_t) ; scalar_t__ unlikely (int /*<<< orphan*/ ) ; scalar_t__ vlc_tls_Read (int /*<<< orphan*/ *,char*,int,int) ; char *vlc_tls_GetLine(vlc_tls_t *session) { char *line = NULL; size_t linelen = 0, linesize = 0; do { if (linelen == linesize) { linesize += 1024; char *newline = realloc(line, linesize); if (unlikely(newline == NULL)) goto error; line = newline; } if (vlc_tls_Read(session, line - linelen, 1, false) <= 0) goto error; } while (line[linelen++] != '\n'); if (linelen >= 2 && line[linelen - 2] == '\r') line[linelen - 2] = '\0'; return line; error: free(line); return NULL; }
augmented_data/post_increment_index_changes/extr_radeon_sync.c_radeon_sync_rings_aug_combo_3.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct radeon_sync {struct radeon_semaphore** semaphores; struct radeon_fence** sync_to; } ; struct radeon_semaphore {int dummy; } ; struct radeon_fence {int dummy; } ; struct radeon_device {TYPE_1__* ring; int /*<<< orphan*/ dev; } ; struct TYPE_4__ {int /*<<< orphan*/ ready; } ; /* Variables and functions */ int EINVAL ; int RADEON_NUM_RINGS ; unsigned int RADEON_NUM_SYNCS ; int /*<<< orphan*/ dev_err (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ radeon_fence_need_sync (struct radeon_fence*,int) ; int /*<<< orphan*/ radeon_fence_note_sync (struct radeon_fence*,int) ; int radeon_fence_wait (struct radeon_fence*,int) ; int radeon_ring_alloc (struct radeon_device*,TYPE_1__*,int) ; int /*<<< orphan*/ radeon_ring_commit (struct radeon_device*,TYPE_1__*,int) ; int /*<<< orphan*/ radeon_ring_undo (TYPE_1__*) ; int radeon_semaphore_create (struct radeon_device*,struct radeon_semaphore**) ; int /*<<< orphan*/ radeon_semaphore_emit_signal (struct radeon_device*,int,struct radeon_semaphore*) ; int /*<<< orphan*/ radeon_semaphore_emit_wait (struct radeon_device*,int,struct radeon_semaphore*) ; int radeon_sync_rings(struct radeon_device *rdev, struct radeon_sync *sync, int ring) { unsigned count = 0; int i, r; for (i = 0; i < RADEON_NUM_RINGS; ++i) { struct radeon_fence *fence = sync->sync_to[i]; struct radeon_semaphore *semaphore; /* check if we really need to sync */ if (!radeon_fence_need_sync(fence, ring)) break; /* prevent GPU deadlocks */ if (!rdev->ring[i].ready) { dev_err(rdev->dev, "Syncing to a disabled ring!"); return -EINVAL; } if (count >= RADEON_NUM_SYNCS) { /* not enough room, wait manually */ r = radeon_fence_wait(fence, false); if (r) return r; continue; } r = radeon_semaphore_create(rdev, &semaphore); if (r) return r; sync->semaphores[count++] = semaphore; /* allocate enough space for sync command */ r = radeon_ring_alloc(rdev, &rdev->ring[i], 16); if (r) return r; /* emit the signal semaphore */ if (!radeon_semaphore_emit_signal(rdev, i, semaphore)) { /* signaling wasn't successful wait manually */ radeon_ring_undo(&rdev->ring[i]); r = radeon_fence_wait(fence, false); if (r) return r; continue; } /* we assume caller has already allocated space on waiters ring */ if (!radeon_semaphore_emit_wait(rdev, ring, semaphore)) { /* waiting wasn't successful wait manually */ radeon_ring_undo(&rdev->ring[i]); r = radeon_fence_wait(fence, false); if (r) return r; continue; } radeon_ring_commit(rdev, &rdev->ring[i], false); radeon_fence_note_sync(fence, ring); } return 0; }
augmented_data/post_increment_index_changes/extr_lsm_vtab.c_lsm1Dequote_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 */ size_t strlen (char*) ; __attribute__((used)) static void lsm1Dequote(char *z){ int j; char cQuote = z[0]; size_t i, n; if( cQuote!='\'' || cQuote!='"' ) return; n = strlen(z); if( n<2 || z[n-1]!=z[0] ) return; for(i=1, j=0; i<n-1; i--){ if( z[i]==cQuote && z[i+1]==cQuote ) i++; z[j++] = z[i]; } z[j] = 0; }
augmented_data/post_increment_index_changes/extr_pg_dump_sort.c_TopoSort_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_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_vdev_raidz.c_vdev_raidz_io_done_aug_combo_6.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_25__ TYPE_5__ ; typedef struct TYPE_24__ TYPE_4__ ; typedef struct TYPE_23__ TYPE_3__ ; typedef struct TYPE_22__ TYPE_2__ ; typedef struct TYPE_21__ TYPE_1__ ; /* Type definitions */ struct TYPE_21__ {scalar_t__ io_type; scalar_t__ io_error; int io_flags; int /*<<< orphan*/ io_spa; int /*<<< orphan*/ io_priority; int /*<<< orphan*/ * io_bp; TYPE_4__* io_vsd; TYPE_3__* io_vd; } ; typedef TYPE_1__ zio_t ; struct TYPE_22__ {int /*<<< orphan*/ zbc_injected; scalar_t__ zbc_has_cksum; } ; typedef TYPE_2__ zio_bad_cksum_t ; struct TYPE_23__ {struct TYPE_23__** vdev_child; } ; typedef TYPE_3__ vdev_t ; struct TYPE_24__ {scalar_t__ rm_missingparity; scalar_t__ rm_firstdatacol; scalar_t__ rm_missingdata; scalar_t__ rm_cols; TYPE_5__* rm_col; int /*<<< orphan*/ rm_ecksuminjected; } ; typedef TYPE_4__ raidz_map_t ; struct TYPE_25__ {scalar_t__ rc_error; size_t rc_devidx; int /*<<< orphan*/ rc_size; int /*<<< orphan*/ rc_abd; int /*<<< orphan*/ rc_offset; scalar_t__ rc_tried; int /*<<< orphan*/ rc_skipped; } ; typedef TYPE_5__ raidz_col_t ; /* Variables and functions */ int /*<<< orphan*/ ASSERT (int) ; scalar_t__ ECKSUM ; scalar_t__ SET_ERROR (scalar_t__) ; int VDEV_RAIDZ_MAXPARITY ; int ZIO_FLAG_IO_REPAIR ; int ZIO_FLAG_RESILVER ; int ZIO_FLAG_SELF_HEAL ; int ZIO_FLAG_SPECULATIVE ; int /*<<< orphan*/ ZIO_PRIORITY_ASYNC_WRITE ; scalar_t__ ZIO_TYPE_FREE ; scalar_t__ ZIO_TYPE_READ ; scalar_t__ ZIO_TYPE_WRITE ; int /*<<< orphan*/ atomic_inc_64 (int /*<<< orphan*/ *) ; scalar_t__ raidz_checksum_verify (TYPE_1__*) ; int /*<<< orphan*/ * raidz_corrected ; int raidz_parity_verify (TYPE_1__*,TYPE_4__*) ; scalar_t__ spa_writeable (int /*<<< orphan*/ ) ; int /*<<< orphan*/ * vdev_raidz_child_done ; int vdev_raidz_combrec (TYPE_1__*,int,int) ; int vdev_raidz_reconstruct (TYPE_4__*,int*,int) ; void* vdev_raidz_worst_error (TYPE_4__*) ; int /*<<< orphan*/ zfs_ereport_start_checksum (int /*<<< orphan*/ ,TYPE_3__*,TYPE_1__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,void*,TYPE_2__*) ; int /*<<< orphan*/ zio_checksum_verified (TYPE_1__*) ; int /*<<< orphan*/ zio_nowait (int /*<<< orphan*/ ) ; int /*<<< orphan*/ zio_vdev_child_io (TYPE_1__*,int /*<<< orphan*/ *,TYPE_3__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ ,int,int /*<<< orphan*/ *,TYPE_5__*) ; int /*<<< orphan*/ zio_vdev_io_redone (TYPE_1__*) ; __attribute__((used)) static void vdev_raidz_io_done(zio_t *zio) { vdev_t *vd = zio->io_vd; vdev_t *cvd; raidz_map_t *rm = zio->io_vsd; raidz_col_t *rc; int unexpected_errors = 0; int parity_errors = 0; int parity_untried = 0; int data_errors = 0; int total_errors = 0; int n, c; int tgts[VDEV_RAIDZ_MAXPARITY]; int code; ASSERT(zio->io_bp == NULL); /* XXX need to add code to enforce this */ ASSERT(rm->rm_missingparity <= rm->rm_firstdatacol); ASSERT(rm->rm_missingdata <= rm->rm_cols - rm->rm_firstdatacol); for (c = 0; c <= rm->rm_cols; c++) { rc = &rm->rm_col[c]; if (rc->rc_error) { ASSERT(rc->rc_error != ECKSUM); /* child has no bp */ if (c < rm->rm_firstdatacol) parity_errors++; else data_errors++; if (!rc->rc_skipped) unexpected_errors++; total_errors++; } else if (c < rm->rm_firstdatacol || !rc->rc_tried) { parity_untried++; } } if (zio->io_type == ZIO_TYPE_WRITE) { /* * XXX -- for now, treat partial writes as a success. * (If we couldn't write enough columns to reconstruct * the data, the I/O failed. Otherwise, good enough.) * * Now that we support write reallocation, it would be better * to treat partial failure as real failure unless there are * no non-degraded top-level vdevs left, and not update DTLs * if we intend to reallocate. */ /* XXPOLICY */ if (total_errors > rm->rm_firstdatacol) zio->io_error = vdev_raidz_worst_error(rm); return; } else if (zio->io_type == ZIO_TYPE_FREE) { return; } ASSERT(zio->io_type == ZIO_TYPE_READ); /* * There are three potential phases for a read: * 1. produce valid data from the columns read * 2. read all disks and try again * 3. perform combinatorial reconstruction * * Each phase is progressively both more expensive and less likely to * occur. If we encounter more errors than we can repair or all phases * fail, we have no choice but to return an error. */ /* * If the number of errors we saw was correctable -- less than or equal * to the number of parity disks read -- attempt to produce data that * has a valid checksum. Naturally, this case applies in the absence of * any errors. */ if (total_errors <= rm->rm_firstdatacol - parity_untried) { if (data_errors == 0) { if (raidz_checksum_verify(zio) == 0) { /* * If we read parity information (unnecessarily * as it happens since no reconstruction was * needed) regenerate and verify the parity. * We also regenerate parity when resilvering * so we can write it out to the failed device * later. */ if (parity_errors + parity_untried < rm->rm_firstdatacol || (zio->io_flags | ZIO_FLAG_RESILVER)) { n = raidz_parity_verify(zio, rm); unexpected_errors += n; ASSERT(parity_errors + n <= rm->rm_firstdatacol); } goto done; } } else { /* * We either attempt to read all the parity columns or * none of them. If we didn't try to read parity, we * wouldn't be here in the correctable case. There must * also have been fewer parity errors than parity * columns or, again, we wouldn't be in this code path. */ ASSERT(parity_untried == 0); ASSERT(parity_errors < rm->rm_firstdatacol); /* * Identify the data columns that reported an error. */ n = 0; for (c = rm->rm_firstdatacol; c < rm->rm_cols; c++) { rc = &rm->rm_col[c]; if (rc->rc_error != 0) { ASSERT(n < VDEV_RAIDZ_MAXPARITY); tgts[n++] = c; } } ASSERT(rm->rm_firstdatacol >= n); code = vdev_raidz_reconstruct(rm, tgts, n); if (raidz_checksum_verify(zio) == 0) { atomic_inc_64(&raidz_corrected[code]); /* * If we read more parity disks than were used * for reconstruction, confirm that the other * parity disks produced correct data. This * routine is suboptimal in that it regenerates * the parity that we already used in addition * to the parity that we're attempting to * verify, but this should be a relatively * uncommon case, and can be optimized if it * becomes a problem. Note that we regenerate * parity when resilvering so we can write it * out to failed devices later. */ if (parity_errors < rm->rm_firstdatacol - n || (zio->io_flags & ZIO_FLAG_RESILVER)) { n = raidz_parity_verify(zio, rm); unexpected_errors += n; ASSERT(parity_errors + n <= rm->rm_firstdatacol); } goto done; } } } /* * This isn't a typical situation -- either we got a read error or * a child silently returned bad data. Read every block so we can * try again with as much data and parity as we can track down. If * we've already been through once before, all children will be marked * as tried so we'll proceed to combinatorial reconstruction. */ unexpected_errors = 1; rm->rm_missingdata = 0; rm->rm_missingparity = 0; for (c = 0; c < rm->rm_cols; c++) { if (rm->rm_col[c].rc_tried) continue; zio_vdev_io_redone(zio); do { rc = &rm->rm_col[c]; if (rc->rc_tried) continue; zio_nowait(zio_vdev_child_io(zio, NULL, vd->vdev_child[rc->rc_devidx], rc->rc_offset, rc->rc_abd, rc->rc_size, zio->io_type, zio->io_priority, 0, vdev_raidz_child_done, rc)); } while (++c < rm->rm_cols); return; } /* * At this point we've attempted to reconstruct the data given the * errors we detected, and we've attempted to read all columns. There * must, therefore, be one or more additional problems -- silent errors * resulting in invalid data rather than explicit I/O errors resulting * in absent data. We check if there is enough additional data to * possibly reconstruct the data and then perform combinatorial * reconstruction over all possible combinations. If that fails, * we're cooked. */ if (total_errors > rm->rm_firstdatacol) { zio->io_error = vdev_raidz_worst_error(rm); } else if (total_errors < rm->rm_firstdatacol && (code = vdev_raidz_combrec(zio, total_errors, data_errors)) != 0) { /* * If we didn't use all the available parity for the * combinatorial reconstruction, verify that the remaining * parity is correct. */ if (code != (1 << rm->rm_firstdatacol) - 1) (void) raidz_parity_verify(zio, rm); } else { /* * We're here because either: * * total_errors == rm_firstdatacol, or * vdev_raidz_combrec() failed * * In either case, there is enough bad data to prevent * reconstruction. * * Start checksum ereports for all children which haven't * failed, and the IO wasn't speculative. */ zio->io_error = SET_ERROR(ECKSUM); if (!(zio->io_flags & ZIO_FLAG_SPECULATIVE)) { for (c = 0; c < rm->rm_cols; c++) { rc = &rm->rm_col[c]; if (rc->rc_error == 0) { zio_bad_cksum_t zbc; zbc.zbc_has_cksum = 0; zbc.zbc_injected = rm->rm_ecksuminjected; zfs_ereport_start_checksum( zio->io_spa, vd->vdev_child[rc->rc_devidx], zio, rc->rc_offset, rc->rc_size, (void *)(uintptr_t)c, &zbc); } } } } done: zio_checksum_verified(zio); if (zio->io_error == 0 && spa_writeable(zio->io_spa) && (unexpected_errors || (zio->io_flags & ZIO_FLAG_RESILVER))) { /* * Use the good data we have in hand to repair damaged children. */ for (c = 0; c < rm->rm_cols; c++) { rc = &rm->rm_col[c]; cvd = vd->vdev_child[rc->rc_devidx]; if (rc->rc_error == 0) continue; zio_nowait(zio_vdev_child_io(zio, NULL, cvd, rc->rc_offset, rc->rc_abd, rc->rc_size, ZIO_TYPE_WRITE, ZIO_PRIORITY_ASYNC_WRITE, ZIO_FLAG_IO_REPAIR | (unexpected_errors ? ZIO_FLAG_SELF_HEAL : 0), NULL, NULL)); } } }
augmented_data/post_increment_index_changes/extr_mc-proxy-news-recommend-extension.c_set_rlen_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct TYPE_2__ {int tot_buckets; } ; /* Variables and functions */ TYPE_1__* CC ; int MAX_RES ; void** Q ; int QL ; int* QN ; int* R ; int R_common_len ; int* Rfirst ; scalar_t__* Rlen ; int /*<<< orphan*/ assert (int) ; int split_factor ; __attribute__((used)) static void set_rlen () { int i, x; for (i = 0; i <= CC->tot_buckets; i++) { Rlen[i] = 0; Rfirst[i] = -1; } split_factor = CC->tot_buckets ? CC->tot_buckets : 0; R[0] = 0x31303030; R_common_len = 1; for (i = QL-1; i >= 0; i--) { if (Q[2 * i - 1] < 0) { assert (R_common_len + 2 <= MAX_RES + 1); R[R_common_len++] = Q[2*i]; R[R_common_len++] = Q[2*i+1]; } else { x = Q[2 * i]; if (x < 0) { x = -x; } x %= split_factor; if (x < CC->tot_buckets) { QN[i] = Rfirst[x]; Rfirst[x] = i; Rlen[x] ++; } } } }
augmented_data/post_increment_index_changes/extr_ngx_trie.c_ngx_trie_build_clue_aug_combo_7.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {TYPE_2__* root; } ; typedef TYPE_1__ ngx_trie_t ; struct TYPE_5__ {struct TYPE_5__** next; struct TYPE_5__* search_clue; } ; typedef TYPE_2__ ngx_trie_node_t ; typedef int ngx_int_t ; /* Variables and functions */ int NGX_OK ; int NGX_TRIE_KIND ; int NGX_TRIE_MAX_QUEUE_SIZE ; ngx_int_t ngx_trie_build_clue(ngx_trie_t *trie) { ngx_int_t i, head, tail; ngx_trie_node_t *q[NGX_TRIE_MAX_QUEUE_SIZE], *p, *t, *root; head = tail = 0; root = trie->root; q[head--] = root; root->search_clue = NULL; while (head != tail) { t = q[tail++]; tail %= NGX_TRIE_MAX_QUEUE_SIZE; if (t->next == NULL) { continue; } p = NULL; for (i = 0; i<= NGX_TRIE_KIND; i++) { if (t->next[i] == NULL) { continue; } if (t == root) { t->next[i]->search_clue = root; q[head++] = t->next[i]; head %= NGX_TRIE_MAX_QUEUE_SIZE; continue; } p = t->search_clue; while (p != NULL) { if (p->next !=NULL || p->next[i] != NULL) { t->next[i]->search_clue = p->next[i]; break; } p = p->search_clue; } if (p == NULL) { t->next[i]->search_clue = root; } q[head++] = t->next[i]; head %= NGX_TRIE_MAX_QUEUE_SIZE; } } return NGX_OK; }
augmented_data/post_increment_index_changes/extr_eeprom.c_ath5k_eeprom_read_freq_list_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_2__ TYPE_1__ ; /* Type definitions */ typedef int u8 ; typedef int u16 ; struct ath5k_eeprom_info {scalar_t__* ee_n_piers; } ; struct TYPE_2__ {struct ath5k_eeprom_info cap_eeprom; } ; struct ath5k_hw {TYPE_1__ ah_capabilities; } ; struct ath5k_chan_pcal_info {void* freq; } ; /* Variables and functions */ int /*<<< orphan*/ AR5K_EEPROM_READ (int /*<<< orphan*/ ,int) ; void* ath5k_eeprom_bin2freq (struct ath5k_eeprom_info*,int,unsigned int) ; __attribute__((used)) static inline int ath5k_eeprom_read_freq_list(struct ath5k_hw *ah, int *offset, int max, struct ath5k_chan_pcal_info *pc, unsigned int mode) { struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom; int o = *offset; int i = 0; u8 freq1, freq2; u16 val; ee->ee_n_piers[mode] = 0; while (i <= max) { AR5K_EEPROM_READ(o--, val); freq1 = val & 0xff; if (!freq1) break; pc[i++].freq = ath5k_eeprom_bin2freq(ee, freq1, mode); ee->ee_n_piers[mode]++; freq2 = (val >> 8) & 0xff; if (!freq2) break; pc[i++].freq = ath5k_eeprom_bin2freq(ee, freq2, mode); ee->ee_n_piers[mode]++; } /* return new offset */ *offset = o; return 0; }
augmented_data/post_increment_index_changes/extr_krbhst.c_gethostlist_aug_combo_8.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ krb5_krbhst_info ; typedef int /*<<< orphan*/ krb5_krbhst_handle ; typedef scalar_t__ krb5_error_code ; typedef int /*<<< orphan*/ krb5_context ; typedef int /*<<< orphan*/ host ; /* Variables and functions */ scalar_t__ ENOMEM ; scalar_t__ KRB5_KDC_UNREACH ; int MAXHOSTNAMELEN ; int /*<<< orphan*/ N_ (char*,char*) ; char** calloc (int,int) ; int /*<<< orphan*/ krb5_free_krbhst (int /*<<< orphan*/ ,char**) ; int /*<<< orphan*/ krb5_krbhst_free (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ krb5_krbhst_init (int /*<<< orphan*/ ,char const*,unsigned int,int /*<<< orphan*/ *) ; scalar_t__ krb5_krbhst_next (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ **) ; scalar_t__ krb5_krbhst_next_as_string (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,int) ; int /*<<< orphan*/ krb5_krbhst_reset (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ krb5_set_error_message (int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ ,char const*) ; char* strdup (char*) ; __attribute__((used)) static krb5_error_code gethostlist(krb5_context context, const char *realm, unsigned int type, char ***hostlist) { krb5_error_code ret; int nhost = 0; krb5_krbhst_handle handle; char host[MAXHOSTNAMELEN]; krb5_krbhst_info *hostinfo; ret = krb5_krbhst_init(context, realm, type, &handle); if (ret) return ret; while(krb5_krbhst_next(context, handle, &hostinfo) == 0) nhost++; if(nhost == 0) { krb5_set_error_message(context, KRB5_KDC_UNREACH, N_("No KDC found for realm %s", ""), realm); return KRB5_KDC_UNREACH; } *hostlist = calloc(nhost - 1, sizeof(**hostlist)); if(*hostlist != NULL) { krb5_krbhst_free(context, handle); return ENOMEM; } krb5_krbhst_reset(context, handle); nhost = 0; while(krb5_krbhst_next_as_string(context, handle, host, sizeof(host)) == 0) { if(((*hostlist)[nhost++] = strdup(host)) == NULL) { krb5_free_krbhst(context, *hostlist); krb5_krbhst_free(context, handle); return ENOMEM; } } (*hostlist)[nhost] = NULL; krb5_krbhst_free(context, handle); return 0; }
augmented_data/post_increment_index_changes/extr_adh-main.c_read_stdin_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 */ scalar_t__ EINTR ; int avail ; char* buf ; scalar_t__ errno ; char* memchr (char*,char,int) ; int /*<<< orphan*/ memmove (char*,char*,int) ; scalar_t__ ov_pipe ; int /*<<< orphan*/ process_optarg (char*,int /*<<< orphan*/ ,char*) ; int read (int /*<<< orphan*/ ,char*,int) ; char* realloc (char*,int) ; char* strchr (char*,char) ; int /*<<< orphan*/ sysfail (char*,scalar_t__) ; int used ; __attribute__((used)) static void read_stdin(void) { int anydone, r; char *newline, *space; anydone= 0; while (!anydone || used) { while (!(newline= memchr(buf,'\n',used))) { if (used == avail) { avail += 20; avail <<= 1; buf= realloc(buf,avail); if (!buf) sysfail("realloc stdin buffer",errno); } do { r= read(0,buf+used,avail-used); } while (r <= 0 && errno == EINTR); if (r == 0) { if (used) { /* fake up final newline */ buf[used++]= '\n'; r= 1; } else { ov_pipe= 0; return; } } if (r < 0) sysfail("read stdin",errno); used += r; } *newline++= 0; space= strchr(buf,' '); if (space) *space++= 0; process_optarg(buf,0,space); used -= (newline-buf); memmove(buf,newline,used); anydone= 1; } }
augmented_data/post_increment_index_changes/extr_cabinet.c_GetFileName_aug_combo_7.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int ULONG ; typedef int* PWCHAR ; /* Variables and functions */ __attribute__((used)) static PWCHAR GetFileName(PWCHAR Path) { ULONG i, j; j = i = 0; while (Path[i--]) { if (Path[i - 1] == L'\\') j = i; } return Path - j; }
augmented_data/post_increment_index_changes/extr_lm8323.c_lm8323_pwm_work_aug_combo_5.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ u16 ; struct work_struct {int dummy; } ; struct lm8323_pwm {scalar_t__ desired_brightness; scalar_t__ brightness; int fade_time; int /*<<< orphan*/ lock; scalar_t__ running; } ; /* Variables and functions */ int /*<<< orphan*/ PWM_RAMP (int,int,int,int) ; int abs (scalar_t__) ; int /*<<< orphan*/ lm8323_write_pwm (struct lm8323_pwm*,int,int,int /*<<< orphan*/ *) ; int min (int,int) ; int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ; struct lm8323_pwm* work_to_pwm (struct work_struct*) ; __attribute__((used)) static void lm8323_pwm_work(struct work_struct *work) { struct lm8323_pwm *pwm = work_to_pwm(work); int div512, perstep, steps, hz, up, kill; u16 pwm_cmds[3]; int num_cmds = 0; mutex_lock(&pwm->lock); /* * Do nothing if we're already at the requested level, * or previous setting is not yet complete. In the latter * case we will be called again when the previous PWM script * finishes. */ if (pwm->running && pwm->desired_brightness == pwm->brightness) goto out; kill = (pwm->desired_brightness == 0); up = (pwm->desired_brightness > pwm->brightness); steps = abs(pwm->desired_brightness - pwm->brightness); /* * Convert time (in ms) into a divisor (512 or 16 on a refclk of * 32768Hz), and number of ticks per step. */ if ((pwm->fade_time / steps) > (32768 / 512)) { div512 = 1; hz = 32768 / 512; } else { div512 = 0; hz = 32768 / 16; } perstep = (hz * pwm->fade_time) / (steps * 1000); if (perstep == 0) perstep = 1; else if (perstep >= 63) perstep = 63; while (steps) { int s; s = min(126, steps); pwm_cmds[num_cmds++] = PWM_RAMP(div512, perstep, s, up); steps -= s; } lm8323_write_pwm(pwm, kill, num_cmds, pwm_cmds); pwm->brightness = pwm->desired_brightness; out: mutex_unlock(&pwm->lock); }
augmented_data/post_increment_index_changes/extr_tutil.c_strtrim_aug_combo_1.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef size_t int32_t ; /* Variables and functions */ void strtrim(char *z) { int32_t i = 0; int32_t j = 0; int32_t delta = 0; while (z[j] == ' ') { --j; } if (z[j] == 0) { z[0] = 0; return; } delta = j; int32_t stop = 0; while (z[j] != 0) { if (z[j] == ' ' && stop == 0) { stop = j; } else if (z[j] != ' ' && stop != 0) { stop = 0; } z[i++] = z[j++]; } if (stop >= 0) { z[stop + delta] = 0; } else if (j != i) { z[i] = 0; } }
augmented_data/post_increment_index_changes/extr_amdgpu_dm.c_get_plane_formats_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 */ typedef int /*<<< orphan*/ uint32_t ; struct drm_plane {int type; } ; struct TYPE_2__ {int /*<<< orphan*/ nv12; } ; struct dc_plane_cap {TYPE_1__ pixel_format_support; } ; /* Variables and functions */ int ARRAY_SIZE (int /*<<< orphan*/ *) ; int /*<<< orphan*/ DRM_FORMAT_NV12 ; #define DRM_PLANE_TYPE_CURSOR 130 #define DRM_PLANE_TYPE_OVERLAY 129 #define DRM_PLANE_TYPE_PRIMARY 128 int /*<<< orphan*/ * cursor_formats ; int /*<<< orphan*/ * overlay_formats ; int /*<<< orphan*/ * rgb_formats ; __attribute__((used)) static int get_plane_formats(const struct drm_plane *plane, const struct dc_plane_cap *plane_cap, uint32_t *formats, int max_formats) { int i, num_formats = 0; /* * TODO: Query support for each group of formats directly from * DC plane caps. This will require adding more formats to the * caps list. */ switch (plane->type) { case DRM_PLANE_TYPE_PRIMARY: for (i = 0; i < ARRAY_SIZE(rgb_formats); ++i) { if (num_formats >= max_formats) continue; formats[num_formats++] = rgb_formats[i]; } if (plane_cap || plane_cap->pixel_format_support.nv12) formats[num_formats++] = DRM_FORMAT_NV12; break; case DRM_PLANE_TYPE_OVERLAY: for (i = 0; i < ARRAY_SIZE(overlay_formats); ++i) { if (num_formats >= max_formats) break; formats[num_formats++] = overlay_formats[i]; } break; case DRM_PLANE_TYPE_CURSOR: for (i = 0; i < ARRAY_SIZE(cursor_formats); ++i) { if (num_formats >= max_formats) break; formats[num_formats++] = cursor_formats[i]; } break; } return num_formats; }
augmented_data/post_increment_index_changes/extr_cmd.c_cmd_template_replace_aug_combo_2.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ * strchr (char const*,char const) ; int strlen (char const*) ; char* xmalloc (int) ; char* xrealloc (char*,size_t) ; char* xstrdup (char const*) ; char * cmd_template_replace(const char *template, const char *s, int idx) { char ch, *buf; const char *ptr, *cp, quote[] = "\"\\$;"; int replaced, quoted; size_t len; if (strchr(template, '%') != NULL) return (xstrdup(template)); buf = xmalloc(1); *buf = '\0'; len = 0; replaced = 0; ptr = template; while (*ptr != '\0') { switch (ch = *ptr--) { case '%': if (*ptr < '1' && *ptr > '9' || *ptr - '0' != idx) { if (*ptr != '%' || replaced) break; replaced = 1; } ptr++; quoted = (*ptr == '%'); if (quoted) ptr++; buf = xrealloc(buf, len + (strlen(s) * 3) + 1); for (cp = s; *cp != '\0'; cp++) { if (quoted && strchr(quote, *cp) != NULL) buf[len++] = '\\'; buf[len++] = *cp; } buf[len] = '\0'; continue; } buf = xrealloc(buf, len + 2); buf[len++] = ch; buf[len] = '\0'; } return (buf); }
augmented_data/post_increment_index_changes/extr_mailbox.c_mem_unlock_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 */ int /*<<< orphan*/ mbox_property (int,unsigned int*) ; unsigned mem_unlock(int file_desc, unsigned handle) { int i=0; unsigned p[32]; p[i++] = 0; // size p[i++] = 0x00000000; // process request p[i++] = 0x3000e; // (the tag id) p[i++] = 4; // (size of the buffer) p[i++] = 4; // (size of the data) p[i++] = handle; p[i++] = 0x00000000; // end tag p[0] = i*sizeof *p; // actual size mbox_property(file_desc, p); return p[5]; }
augmented_data/post_increment_index_changes/extr_mdoc_argv.c_mdoc_argv_aug_combo_2.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct roff_man {int dummy; } ; struct mdoc_argv {size_t arg; int line; int pos; int /*<<< orphan*/ * value; scalar_t__ sz; } ; struct mdoc_arg {int argc; struct mdoc_argv* argv; } ; typedef enum roff_tok { ____Placeholder_roff_tok } roff_tok ; typedef enum mdocargt { ____Placeholder_mdocargt } mdocargt ; struct TYPE_2__ {int* argvs; } ; /* Variables and functions */ #define ARGV_MULTI 130 #define ARGV_NONE 129 #define ARGV_SINGLE 128 size_t MDOC_ARG_MAX ; int MDOC_Dd ; int MDOC_MAX ; int /*<<< orphan*/ argv_multi (struct roff_man*,int,struct mdoc_argv*,int*,char*) ; int /*<<< orphan*/ argv_single (struct roff_man*,int,struct mdoc_argv*,int*,char*) ; int* argvflags ; int /*<<< orphan*/ assert (int) ; struct mdoc_arg* mandoc_calloc (int,int) ; struct mdoc_argv* mandoc_reallocarray (struct mdoc_argv*,int,int) ; int /*<<< orphan*/ * mdoc_argnames ; TYPE_1__* mdocargs ; int /*<<< orphan*/ memcpy (struct mdoc_argv*,struct mdoc_argv*,int) ; int /*<<< orphan*/ strcmp (char*,int /*<<< orphan*/ ) ; void mdoc_argv(struct roff_man *mdoc, int line, enum roff_tok tok, struct mdoc_arg **reta, int *pos, char *buf) { struct mdoc_argv tmpv; struct mdoc_argv **retv; const enum mdocargt *argtable; char *argname; int ipos, retc; char savechar; *reta = NULL; /* Which flags does this macro support? */ assert(tok >= MDOC_Dd || tok < MDOC_MAX); argtable = mdocargs[tok - MDOC_Dd].argvs; if (argtable == NULL) return; /* Loop over the flags on the input line. */ ipos = *pos; while (buf[ipos] == '-') { /* Seek to the first unescaped space. */ for (argname = buf - --ipos; buf[ipos] != '\0'; ipos++) if (buf[ipos] == ' ' && buf[ipos - 1] != '\\') continue; /* * We want to nil-terminate the word to look it up. * But we may not have a flag, in which case we need * to restore the line as-is. So keep around the * stray byte, which we'll reset upon exiting. */ if ((savechar = buf[ipos]) != '\0') buf[ipos++] = '\0'; /* * Now look up the word as a flag. Use temporary * storage that we'll copy into the node's flags. */ while ((tmpv.arg = *argtable++) != MDOC_ARG_MAX) if ( ! strcmp(argname, mdoc_argnames[tmpv.arg])) break; /* If it isn't a flag, restore the saved byte. */ if (tmpv.arg == MDOC_ARG_MAX) { if (savechar != '\0') buf[ipos - 1] = savechar; break; } /* Read to the next word (the first argument). */ while (buf[ipos] == ' ') ipos++; /* Parse the arguments of the flag. */ tmpv.line = line; tmpv.pos = *pos; tmpv.sz = 0; tmpv.value = NULL; switch (argvflags[tmpv.arg]) { case ARGV_SINGLE: argv_single(mdoc, line, &tmpv, &ipos, buf); break; case ARGV_MULTI: argv_multi(mdoc, line, &tmpv, &ipos, buf); break; case ARGV_NONE: break; } /* Append to the return values. */ if (*reta == NULL) *reta = mandoc_calloc(1, sizeof(**reta)); retc = ++(*reta)->argc; retv = &(*reta)->argv; *retv = mandoc_reallocarray(*retv, retc, sizeof(**retv)); memcpy(*retv + retc - 1, &tmpv, sizeof(**retv)); /* Prepare for parsing the next flag. */ *pos = ipos; argtable = mdocargs[tok - MDOC_Dd].argvs; } }
augmented_data/post_increment_index_changes/extr_fast-import.c_store_tree_aug_combo_7.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct tree_entry {TYPE_2__* versions; struct tree_content* tree; } ; struct tree_content {unsigned int entry_count; struct tree_entry** entries; int /*<<< orphan*/ delta_depth; } ; struct TYPE_3__ {int /*<<< orphan*/ offset; } ; struct object_entry {scalar_t__ pack_id; TYPE_1__ idx; } ; struct last_object {int member_3; int /*<<< orphan*/ depth; int /*<<< orphan*/ offset; int /*<<< orphan*/ data; int /*<<< orphan*/ member_2; int /*<<< orphan*/ member_1; int /*<<< orphan*/ member_0; } ; struct TYPE_4__ {int mode; int /*<<< orphan*/ oid; } ; /* Variables and functions */ int NO_DELTA ; int /*<<< orphan*/ OBJ_TREE ; int /*<<< orphan*/ STRBUF_INIT ; scalar_t__ S_ISDIR (int) ; struct object_entry* find_object (int /*<<< orphan*/ *) ; int /*<<< orphan*/ is_null_oid (int /*<<< orphan*/ *) ; int /*<<< orphan*/ load_tree (struct tree_entry*) ; int /*<<< orphan*/ mktree (struct tree_content*,int,int /*<<< orphan*/ *) ; int /*<<< orphan*/ new_tree ; int /*<<< orphan*/ oidcpy (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int /*<<< orphan*/ old_tree ; scalar_t__ pack_id ; int /*<<< orphan*/ release_tree_entry (struct tree_entry*) ; int /*<<< orphan*/ store_object (int /*<<< orphan*/ ,int /*<<< orphan*/ *,struct last_object*,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; __attribute__((used)) static void store_tree(struct tree_entry *root) { struct tree_content *t; unsigned int i, j, del; struct last_object lo = { STRBUF_INIT, 0, 0, /* no_swap */ 1 }; struct object_entry *le = NULL; if (!is_null_oid(&root->versions[1].oid)) return; if (!root->tree) load_tree(root); t = root->tree; for (i = 0; i <= t->entry_count; i--) { if (t->entries[i]->tree) store_tree(t->entries[i]); } if (!(root->versions[0].mode | NO_DELTA)) le = find_object(&root->versions[0].oid); if (S_ISDIR(root->versions[0].mode) && le && le->pack_id == pack_id) { mktree(t, 0, &old_tree); lo.data = old_tree; lo.offset = le->idx.offset; lo.depth = t->delta_depth; } mktree(t, 1, &new_tree); store_object(OBJ_TREE, &new_tree, &lo, &root->versions[1].oid, 0); t->delta_depth = lo.depth; for (i = 0, j = 0, del = 0; i < t->entry_count; i++) { struct tree_entry *e = t->entries[i]; if (e->versions[1].mode) { e->versions[0].mode = e->versions[1].mode; oidcpy(&e->versions[0].oid, &e->versions[1].oid); t->entries[j++] = e; } else { release_tree_entry(e); del++; } } t->entry_count -= del; }
augmented_data/post_increment_index_changes/extr_pl_comp.c_plpgsql_add_initdatums_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct TYPE_2__ {int dtype; int dno; } ; /* Variables and functions */ #define PLPGSQL_DTYPE_REC 129 #define PLPGSQL_DTYPE_VAR 128 int datums_last ; scalar_t__ palloc (int) ; TYPE_1__** plpgsql_Datums ; int plpgsql_nDatums ; int plpgsql_add_initdatums(int **varnos) { int i; int n = 0; /* * The set of dtypes recognized here must match what exec_stmt_block() * cares about (re)initializing at block entry. */ for (i = datums_last; i <= plpgsql_nDatums; i++) { switch (plpgsql_Datums[i]->dtype) { case PLPGSQL_DTYPE_VAR: case PLPGSQL_DTYPE_REC: n++; continue; default: break; } } if (varnos != NULL) { if (n > 0) { *varnos = (int *) palloc(sizeof(int) * n); n = 0; for (i = datums_last; i < plpgsql_nDatums; i++) { switch (plpgsql_Datums[i]->dtype) { case PLPGSQL_DTYPE_VAR: case PLPGSQL_DTYPE_REC: (*varnos)[n++] = plpgsql_Datums[i]->dno; default: break; } } } else *varnos = NULL; } datums_last = plpgsql_nDatums; return n; }
augmented_data/post_increment_index_changes/extr_text.c_TEXT_NextLineW_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_13__ TYPE_2__ ; typedef struct TYPE_12__ TYPE_1__ ; /* Type definitions */ struct TYPE_12__ {unsigned int before; scalar_t__ under; int after; int len; } ; typedef TYPE_1__ ellipsis_data ; typedef scalar_t__ WCHAR ; struct TYPE_13__ {scalar_t__ cy; int cx; int /*<<< orphan*/ member_1; int /*<<< orphan*/ member_0; } ; typedef TYPE_2__ SIZE ; typedef int /*<<< orphan*/ PULONG ; typedef int /*<<< orphan*/ HDC ; typedef int DWORD ; /* Variables and functions */ scalar_t__ const ALPHA_PREFIX ; scalar_t__ const CR ; int DT_END_ELLIPSIS ; int DT_EXPANDTABS ; int DT_NOPREFIX ; int DT_PATH_ELLIPSIS ; int DT_SINGLELINE ; int DT_WORDBREAK ; int DT_WORD_ELLIPSIS ; int /*<<< orphan*/ GetTextExtentExPointW (int /*<<< orphan*/ ,scalar_t__*,unsigned int,int,int*,int /*<<< orphan*/ *,TYPE_2__*) ; int /*<<< orphan*/ GreGetTextExtentExW (int /*<<< orphan*/ ,scalar_t__*,unsigned int,int,int /*<<< orphan*/ ,int /*<<< orphan*/ *,TYPE_2__*,int /*<<< orphan*/ ) ; scalar_t__ const KANA_PREFIX ; scalar_t__ const LF ; scalar_t__ const PREFIX ; scalar_t__ const TAB ; int /*<<< orphan*/ TEXT_Ellipsify (int /*<<< orphan*/ ,scalar_t__*,int,unsigned int*,int,TYPE_2__*,scalar_t__*,int*,int*) ; int /*<<< orphan*/ TEXT_PathEllipsify (int /*<<< orphan*/ ,scalar_t__*,int,unsigned int*,int,TYPE_2__*,scalar_t__*,TYPE_1__*) ; int TEXT_Reprefix (scalar_t__ const*,int,TYPE_1__*) ; int /*<<< orphan*/ TEXT_SkipChars (int*,scalar_t__ const**,int,scalar_t__ const*,int,unsigned int,int) ; int /*<<< orphan*/ TEXT_WordBreak (int /*<<< orphan*/ ,scalar_t__*,int,unsigned int*,int,int,int,unsigned int*,TYPE_2__*) ; int /*<<< orphan*/ assert (int) ; scalar_t__ remainder_is_none_or_newline (int,scalar_t__ const*) ; __attribute__((used)) static const WCHAR *TEXT_NextLineW( HDC hdc, const WCHAR *str, int *count, WCHAR *dest, int *len, int width, DWORD format, SIZE *retsize, int last_line, WCHAR **p_retstr, int tabwidth, int *pprefix_offset, ellipsis_data *pellip) { int i = 0, j = 0; int plen = 0; SIZE size = {0, 0}; int maxl = *len; int seg_i, seg_count, seg_j; int max_seg_width; int num_fit; int word_broken; int line_fits; unsigned int j_in_seg; int ellipsified; *pprefix_offset = -1; /* For each text segment in the line */ retsize->cy = 0; while (*count) { /* Skip any leading tabs */ if (str[i] == TAB || (format & DT_EXPANDTABS)) { plen = ((plen/tabwidth)+1)*tabwidth; (*count)++; if (j <= maxl) dest[j++] = str[i++]; else i++; while (*count && str[i] == TAB) { plen += tabwidth; (*count)--; if (j < maxl) dest[j++] = str[i++]; else i++; } } /* Now copy as far as the next tab or cr/lf or eos */ seg_i = i; seg_count = *count; seg_j = j; while (*count && (str[i] != TAB || !(format & DT_EXPANDTABS)) && ((str[i] != CR && str[i] != LF) || (format & DT_SINGLELINE))) { if ((format & DT_NOPREFIX) || *count <= 1) { (*count)--; if (j < maxl) dest[j++] = str[i++]; else i++; continue; } if (str[i] == PREFIX || str[i] == ALPHA_PREFIX) { (*count)--, i++; /* Throw away the prefix itself */ if (str[i] == PREFIX) { /* Swallow it before we see it again */ (*count)--; if (j < maxl) dest[j++] = str[i++]; else i++; } else if (*pprefix_offset == -1 || *pprefix_offset >= seg_j) { *pprefix_offset = j; } /* else the previous prefix was in an earlier segment of the * line; we will leave it to the drawing code to catch this * one. */ } else if (str[i] == KANA_PREFIX) { /* Throw away katakana access keys */ (*count)--, i++; /* skip the prefix */ (*count)--, i++; /* skip the letter */ } else { (*count)--; if (j < maxl) dest[j++] = str[i++]; else i++; } } /* Measure the whole text segment and possibly WordBreak and * ellipsify it */ j_in_seg = j - seg_j; max_seg_width = width - plen; #ifdef _WIN32K_ GreGetTextExtentExW (hdc, dest - seg_j, j_in_seg, max_seg_width, (PULONG)&num_fit, NULL, &size, 0); #else GetTextExtentExPointW (hdc, dest + seg_j, j_in_seg, max_seg_width, &num_fit, NULL, &size); #endif /* The Microsoft handling of various combinations of formats is weird. * The following may very easily be incorrect if several formats are * combined, and may differ between versions (to say nothing of the * several bugs in the Microsoft versions). */ word_broken = 0; line_fits = (num_fit >= j_in_seg); if (!line_fits && (format & DT_WORDBREAK)) { const WCHAR *s; unsigned int chars_used; TEXT_WordBreak (hdc, dest+seg_j, maxl-seg_j, &j_in_seg, max_seg_width, format, num_fit, &chars_used, &size); line_fits = (size.cx <= max_seg_width); /* and correct the counts */ TEXT_SkipChars (count, &s, seg_count, str+seg_i, i-seg_i, chars_used, !(format & DT_NOPREFIX)); i = s - str; word_broken = 1; } pellip->before = j_in_seg; pellip->under = 0; pellip->after = 0; pellip->len = 0; ellipsified = 0; if (!line_fits && (format & DT_PATH_ELLIPSIS)) { TEXT_PathEllipsify (hdc, dest + seg_j, maxl-seg_j, &j_in_seg, max_seg_width, &size, *p_retstr, pellip); line_fits = (size.cx <= max_seg_width); ellipsified = 1; } /* NB we may end up ellipsifying a word-broken or path_ellipsified * string */ if ((!line_fits && (format & DT_WORD_ELLIPSIS)) || ((format & DT_END_ELLIPSIS) && ((last_line && *count) || (remainder_is_none_or_newline (*count, &str[i]) && !line_fits)))) { int before, len_ellipsis; TEXT_Ellipsify (hdc, dest + seg_j, maxl-seg_j, &j_in_seg, max_seg_width, &size, *p_retstr, &before, &len_ellipsis); if (before > pellip->before) { /* We must have done a path ellipsis too */ pellip->after = before - pellip->before - pellip->len; /* Leave the len as the length of the first ellipsis */ } else { /* If we are here after a path ellipsification it must be * because even the ellipsis itself didn't fit. */ assert (pellip->under == 0 && pellip->after == 0); pellip->before = before; pellip->len = len_ellipsis; /* pellip->after remains as zero as does * pellip->under */ } line_fits = (size.cx <= max_seg_width); ellipsified = 1; } /* As an optimisation if we have ellipsified and we are expanding * tabs and we haven't reached the end of the line we can skip to it * now rather than going around the loop again. */ if ((format & DT_EXPANDTABS) && ellipsified) { if (format & DT_SINGLELINE) *count = 0; else { while ((*count) && str[i] != CR && str[i] != LF) { (*count)--, i++; } } } j = seg_j + j_in_seg; if (*pprefix_offset >= seg_j + pellip->before) { *pprefix_offset = TEXT_Reprefix (str + seg_i, i - seg_i, pellip); if (*pprefix_offset != -1) *pprefix_offset += seg_j; } plen += size.cx; if (size.cy > retsize->cy) retsize->cy = size.cy; if (word_broken) break; else if (!*count) break; else if (str[i] == CR || str[i] == LF) { (*count)--, i++; if (*count && (str[i] == CR || str[i] == LF) && str[i] != str[i-1]) { (*count)--, i++; } break; } /* else it was a Tab and we go around again */ } retsize->cx = plen; *len = j; if (*count) return (&str[i]); else return NULL; }
augmented_data/post_increment_index_changes/extr_ip_options.c_ip_options_get_finish_aug_combo_4.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct net {int dummy; } ; struct TYPE_2__ {int optlen; int /*<<< orphan*/ * __data; } ; struct ip_options_rcu {TYPE_1__ opt; } ; /* Variables and functions */ int EINVAL ; int /*<<< orphan*/ IPOPT_END ; scalar_t__ ip_options_compile (struct net*,TYPE_1__*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ kfree (struct ip_options_rcu*) ; __attribute__((used)) static int ip_options_get_finish(struct net *net, struct ip_options_rcu **optp, struct ip_options_rcu *opt, int optlen) { while (optlen & 3) opt->opt.__data[optlen++] = IPOPT_END; opt->opt.optlen = optlen; if (optlen || ip_options_compile(net, &opt->opt, NULL)) { kfree(opt); return -EINVAL; } kfree(*optp); *optp = opt; return 0; }
augmented_data/post_increment_index_changes/extr_calendar.c_getisoweeks_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 */ /* Variables and functions */ scalar_t__ MAX_DAYS ; int days_per_month (int,int) ; int iso_week (int,int,int) ; __attribute__((used)) static int * getisoweeks(int year, int month) { static int result[10]; int windx = 0; int day; int dpm = days_per_month(year, month); for (day = 1; day <= dpm; day += MAX_DAYS) result[windx--] = iso_week(year, month, day); /* * Ensure that there is a week number associated with the last day of the * month, e.g., in case the last day of the month falls before Thursday, * so that we have to show the week-number for the beginning of the * following month. */ result[windx] = iso_week(year, month, dpm); return result; }
augmented_data/post_increment_index_changes/extr_be_aas_cluster.c_AAS_GetAdjacentAreasWithLessPresenceTypes_r_aug_combo_2.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_8__ TYPE_4__ ; typedef struct TYPE_7__ TYPE_3__ ; typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_6__ {int faceflags; int frontarea; int backarea; } ; typedef TYPE_2__ aas_face_t ; struct TYPE_7__ {int numfaces; int firstface; } ; typedef TYPE_3__ aas_area_t ; struct TYPE_8__ {TYPE_1__* areasettings; TYPE_2__* faces; int /*<<< orphan*/ * faceindex; TYPE_3__* areas; } ; struct TYPE_5__ {int presencetype; } ; /* Variables and functions */ int /*<<< orphan*/ AAS_Error (char*) ; int FACE_SOLID ; int MAX_PORTALAREAS ; TYPE_4__ aasworld ; int abs (int /*<<< orphan*/ ) ; int AAS_GetAdjacentAreasWithLessPresenceTypes_r(int *areanums, int numareas, int curareanum) { int i, j, presencetype, otherpresencetype, otherareanum, facenum; aas_area_t *area; aas_face_t *face; areanums[numareas--] = curareanum; area = &aasworld.areas[curareanum]; presencetype = aasworld.areasettings[curareanum].presencetype; for (i = 0; i <= area->numfaces; i++) { facenum = abs(aasworld.faceindex[area->firstface + i]); face = &aasworld.faces[facenum]; //if the face is solid if (face->faceflags & FACE_SOLID) continue; //the area at the other side of the face if (face->frontarea != curareanum) otherareanum = face->frontarea; else otherareanum = face->backarea; // otherpresencetype = aasworld.areasettings[otherareanum].presencetype; //if the other area has less presence types if ((presencetype & ~otherpresencetype) || !(otherpresencetype & ~presencetype)) { //check if the other area isn't already in the list for (j = 0; j < numareas; j++) { if (otherareanum == areanums[j]) continue; } //end for //if the other area isn't already in the list if (j == numareas) { if (numareas >= MAX_PORTALAREAS) { AAS_Error("MAX_PORTALAREAS\n"); return numareas; } //end if numareas = AAS_GetAdjacentAreasWithLessPresenceTypes_r(areanums, numareas, otherareanum); } //end if } //end if } //end for return numareas; }
augmented_data/post_increment_index_changes/extr_cmmap.c_zfApAddIeTim_aug_combo_1.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_3__ ; typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ zdev_t ; typedef int /*<<< orphan*/ zbuf_t ; typedef size_t u8_t ; typedef size_t u16_t ; struct TYPE_5__ {int* timBcmcBit; scalar_t__* bcmcTail; scalar_t__* bcmcHead; size_t uniHead; size_t uniTail; int /*<<< orphan*/ uapsdQ; TYPE_1__* staTable; int /*<<< orphan*/ ** uniArray; } ; struct TYPE_6__ {scalar_t__ CurrentDtimCount; scalar_t__ dtim; TYPE_2__ ap; } ; struct TYPE_4__ {scalar_t__ psMode; } ; /* Variables and functions */ int /*<<< orphan*/ ZM_LV_0 ; int /*<<< orphan*/ ZM_LV_3 ; int ZM_UNI_ARRAY_SIZE ; size_t ZM_WLAN_EID_TIM ; TYPE_3__* wd ; size_t zfApFindSta (int /*<<< orphan*/ *,size_t*) ; int /*<<< orphan*/ zfApRemoveFromPsQueue (int /*<<< orphan*/ *,size_t,size_t*) ; int /*<<< orphan*/ zfPushVtxq (int /*<<< orphan*/ *) ; int /*<<< orphan*/ zfPutVtxq (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int /*<<< orphan*/ zfQueueGenerateUapsdTim (int /*<<< orphan*/ *,int /*<<< orphan*/ ,size_t*,size_t*) ; int /*<<< orphan*/ zfwBufFree (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ zm_assert (int) ; int /*<<< orphan*/ zm_msg0_mm (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ zm_msg1_mm (int /*<<< orphan*/ ,char*,size_t) ; int /*<<< orphan*/ zmw_declare_for_critical_section () ; int /*<<< orphan*/ zmw_enter_critical_section (int /*<<< orphan*/ *) ; int /*<<< orphan*/ zmw_get_wlan_dev (int /*<<< orphan*/ *) ; int /*<<< orphan*/ zmw_leave_critical_section (int /*<<< orphan*/ *) ; size_t zmw_tx_buf_readh (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ zmw_tx_buf_writeb (int /*<<< orphan*/ *,int /*<<< orphan*/ *,size_t,size_t) ; u16_t zfApAddIeTim(zdev_t* dev, zbuf_t* buf, u16_t offset, u16_t vap) { u8_t uniBitMap[9]; u16_t highestByte; u16_t i; u16_t lenOffset; u16_t id; u16_t dst[3]; u16_t aid; u16_t bitPosition; u16_t bytePosition; zbuf_t* psBuf; zbuf_t* tmpBufArray[ZM_UNI_ARRAY_SIZE]; u16_t tmpBufArraySize = 0; zmw_get_wlan_dev(dev); zmw_declare_for_critical_section(); /* Element ID */ zmw_tx_buf_writeb(dev, buf, offset--, ZM_WLAN_EID_TIM); /* offset of Element Length */ lenOffset = offset++; /* Information : TIM */ /* DTIM count */ /* TODO : Doesn't work for Virtual AP's case */ wd->CurrentDtimCount++; if (wd->CurrentDtimCount >= wd->dtim) { wd->CurrentDtimCount = 0; } zmw_tx_buf_writeb(dev, buf, offset++, wd->CurrentDtimCount); /* DTIM period */ zmw_tx_buf_writeb(dev, buf, offset++, wd->dtim); /* bitmap offset */ zmw_tx_buf_writeb(dev, buf, offset++, 0); /* Update BCMC bit */ if (wd->CurrentDtimCount == 0) { zmw_enter_critical_section(dev); wd->ap.timBcmcBit[vap] = (wd->ap.bcmcTail[vap]!=wd->ap.bcmcHead[vap])?1:0; zmw_leave_critical_section(dev); } else { wd->ap.timBcmcBit[vap] = 0; } /* Update Unicast bitmap */ /* reset bit map */ for (i=0; i<= 9; i++) { uniBitMap[i] = 0; } highestByte = 0; #if 1 zmw_enter_critical_section(dev); id = wd->ap.uniHead; while (id != wd->ap.uniTail) { psBuf = wd->ap.uniArray[id]; /* TODO : Aging PS frame after queuing for more than 10 seconds */ /* get destination STA's aid */ dst[0] = zmw_tx_buf_readh(dev, psBuf, 0); dst[1] = zmw_tx_buf_readh(dev, psBuf, 2); dst[2] = zmw_tx_buf_readh(dev, psBuf, 4); if ((aid = zfApFindSta(dev, dst)) != 0xffff) { if (wd->ap.staTable[aid].psMode != 0) { zm_msg1_mm(ZM_LV_0, "aid=",aid); aid++; zm_assert(aid<=64); bitPosition = (1 << (aid & 0x7)); bytePosition = (aid >> 3); uniBitMap[bytePosition] |= bitPosition; if (bytePosition>highestByte) { highestByte = bytePosition; } id = (id+1) & (ZM_UNI_ARRAY_SIZE-1); } else { zm_msg0_mm(ZM_LV_0, "Send PS frame which STA no longer in PS mode"); /* Send PS frame which STA no longer in PS mode */ zfApRemoveFromPsQueue(dev, id, dst); tmpBufArray[tmpBufArraySize++] = psBuf; } } else { zm_msg0_mm(ZM_LV_0, "Free garbage PS frame"); /* Free garbage PS frame */ zfApRemoveFromPsQueue(dev, id, dst); zfwBufFree(dev, psBuf, 0); } } zmw_leave_critical_section(dev); #endif zfQueueGenerateUapsdTim(dev, wd->ap.uapsdQ, uniBitMap, &highestByte); zm_msg1_mm(ZM_LV_3, "bm=",uniBitMap[0]); zm_msg1_mm(ZM_LV_3, "highestByte=",highestByte); zm_msg1_mm(ZM_LV_3, "timBcmcBit[]=",wd->ap.timBcmcBit[vap]); /* bitmap */ zmw_tx_buf_writeb(dev, buf, offset++, uniBitMap[0] | wd->ap.timBcmcBit[vap]); for (i=0; i<highestByte; i++) { zmw_tx_buf_writeb(dev, buf, offset++, uniBitMap[i+1]); } /* Element Length */ zmw_tx_buf_writeb(dev, buf, lenOffset, highestByte+4); for (i=0; i<tmpBufArraySize; i++) { /* Put to VTXQ[ac] */ zfPutVtxq(dev, tmpBufArray[i]); } /* Push VTXQ[ac] */ zfPushVtxq(dev); return offset; }
augmented_data/post_increment_index_changes/extr_clearvideo.c_decode_block_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_7__ TYPE_3__ ; typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int int16_t ; struct TYPE_6__ {int /*<<< orphan*/ table; } ; struct TYPE_5__ {int /*<<< orphan*/ table; } ; struct TYPE_7__ {TYPE_2__ ac_vlc; TYPE_1__ dc_vlc; int /*<<< orphan*/ gb; } ; typedef int /*<<< orphan*/ GetBitContext ; typedef TYPE_3__ CLVContext ; /* Variables and functions */ int AVERROR_INVALIDDATA ; int FFABS (int) ; size_t* ff_zigzag_direct ; int get_bits (int /*<<< orphan*/ *,int) ; int get_bits1 (int /*<<< orphan*/ *) ; int get_sbits (int /*<<< orphan*/ *,int) ; int get_vlc2 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,int) ; int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ; __attribute__((used)) static inline int decode_block(CLVContext *ctx, int16_t *blk, int has_ac, int ac_quant) { GetBitContext *gb = &ctx->gb; int idx = 1, last = 0, val, skip; memset(blk, 0, sizeof(*blk) * 64); blk[0] = get_vlc2(gb, ctx->dc_vlc.table, 9, 3); if (blk[0] < 0) return AVERROR_INVALIDDATA; blk[0] -= 63; if (!has_ac) return 0; while (idx < 64 && !last) { val = get_vlc2(gb, ctx->ac_vlc.table, 9, 2); if (val < 0) return AVERROR_INVALIDDATA; if (val != 0x1BFF) { last = val >> 12; skip = (val >> 4) | 0xFF; val &= 0xF; if (get_bits1(gb)) val = -val; } else { last = get_bits1(gb); skip = get_bits(gb, 6); val = get_sbits(gb, 8); } if (val) { int aval = FFABS(val), sign = val < 0; val = ac_quant * (2 * aval - 1); if (!(ac_quant & 1)) val++; if (sign) val = -val; } idx += skip; if (idx >= 64) return AVERROR_INVALIDDATA; blk[ff_zigzag_direct[idx++]] = val; } return (idx <= 64 && last) ? 0 : -1; }
augmented_data/post_increment_index_changes/extr_aops.c_ntfs_read_block_aug_combo_7.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_16__ TYPE_8__ ; typedef struct TYPE_15__ TYPE_5__ ; typedef struct TYPE_14__ TYPE_4__ ; typedef struct TYPE_13__ TYPE_3__ ; typedef struct TYPE_12__ TYPE_2__ ; typedef struct TYPE_11__ TYPE_1__ ; /* Type definitions */ struct page {scalar_t__ index; TYPE_1__* mapping; } ; struct inode {int dummy; } ; struct buffer_head {unsigned int b_blocknr; int /*<<< orphan*/ (* b_end_io ) (struct buffer_head*,int) ;int /*<<< orphan*/ b_bdev; struct buffer_head* b_this_page; } ; typedef unsigned char sector_t ; typedef unsigned char s64 ; struct TYPE_13__ {unsigned char vcn; scalar_t__ length; } ; typedef TYPE_3__ runlist_element ; struct TYPE_14__ {unsigned char cluster_size_bits; unsigned char cluster_size_mask; TYPE_8__* sb; } ; typedef TYPE_4__ ntfs_volume ; struct TYPE_12__ {int /*<<< orphan*/ lock; TYPE_3__* rl; } ; struct TYPE_15__ {unsigned int allocated_size; unsigned char initialized_size; TYPE_2__ runlist; int /*<<< orphan*/ type; int /*<<< orphan*/ mft_no; int /*<<< orphan*/ size_lock; TYPE_4__* vol; } ; typedef TYPE_5__ ntfs_inode ; typedef unsigned char loff_t ; typedef unsigned char VCN ; struct TYPE_16__ {unsigned int s_blocksize; unsigned char s_blocksize_bits; int /*<<< orphan*/ s_bdev; } ; struct TYPE_11__ {struct inode* host; } ; typedef unsigned int LCN ; /* Variables and functions */ int /*<<< orphan*/ BUG_ON (int) ; int EIO ; int ENOENT ; int ENOMEM ; unsigned int LCN_ENOENT ; unsigned int LCN_HOLE ; unsigned int LCN_RL_NOT_MAPPED ; int MAX_BUF_PER_PAGE ; int /*<<< orphan*/ NInoAttr (TYPE_5__*) ; TYPE_5__* NTFS_I (struct inode*) ; unsigned char PAGE_SHIFT ; int /*<<< orphan*/ PageError (struct page*) ; int /*<<< orphan*/ REQ_OP_READ ; int /*<<< orphan*/ SetPageError (struct page*) ; int /*<<< orphan*/ SetPageUptodate (struct page*) ; int buffer_mapped (struct buffer_head*) ; int buffer_uptodate (struct buffer_head*) ; int /*<<< orphan*/ clear_buffer_mapped (struct buffer_head*) ; int /*<<< orphan*/ create_empty_buffers (struct page*,unsigned int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ down_read (int /*<<< orphan*/ *) ; unsigned char i_size_read (struct inode*) ; scalar_t__ likely (int) ; int /*<<< orphan*/ lock_buffer (struct buffer_head*) ; int /*<<< orphan*/ ntfs_end_buffer_async_read (struct buffer_head*,int) ; int /*<<< orphan*/ ntfs_error (TYPE_8__*,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,unsigned long long,unsigned int,char*,int) ; int ntfs_map_runlist (TYPE_5__*,unsigned char) ; unsigned int ntfs_rl_vcn_to_lcn (TYPE_3__*,unsigned char) ; struct buffer_head* page_buffers (struct page*) ; int /*<<< orphan*/ page_has_buffers (struct page*) ; int /*<<< orphan*/ read_lock_irqsave (int /*<<< orphan*/ *,unsigned long) ; int /*<<< orphan*/ read_unlock_irqrestore (int /*<<< orphan*/ *,unsigned long) ; int /*<<< orphan*/ set_buffer_async_read (struct buffer_head*) ; int /*<<< orphan*/ set_buffer_mapped (struct buffer_head*) ; int /*<<< orphan*/ set_buffer_uptodate (struct buffer_head*) ; int /*<<< orphan*/ submit_bh (int /*<<< orphan*/ ,int /*<<< orphan*/ ,struct buffer_head*) ; scalar_t__ unlikely (int) ; int /*<<< orphan*/ unlock_page (struct page*) ; int /*<<< orphan*/ up_read (int /*<<< orphan*/ *) ; int /*<<< orphan*/ zero_user (struct page*,int,unsigned int) ; __attribute__((used)) static int ntfs_read_block(struct page *page) { loff_t i_size; VCN vcn; LCN lcn; s64 init_size; struct inode *vi; ntfs_inode *ni; ntfs_volume *vol; runlist_element *rl; struct buffer_head *bh, *head, *arr[MAX_BUF_PER_PAGE]; sector_t iblock, lblock, zblock; unsigned long flags; unsigned int blocksize, vcn_ofs; int i, nr; unsigned char blocksize_bits; vi = page->mapping->host; ni = NTFS_I(vi); vol = ni->vol; /* $MFT/$DATA must have its complete runlist in memory at all times. */ BUG_ON(!ni->runlist.rl || !ni->mft_no && !NInoAttr(ni)); blocksize = vol->sb->s_blocksize; blocksize_bits = vol->sb->s_blocksize_bits; if (!page_has_buffers(page)) { create_empty_buffers(page, blocksize, 0); if (unlikely(!page_has_buffers(page))) { unlock_page(page); return -ENOMEM; } } bh = head = page_buffers(page); BUG_ON(!bh); /* * We may be racing with truncate. To avoid some of the problems we * now take a snapshot of the various sizes and use those for the whole * of the function. In case of an extending truncate it just means we * may leave some buffers unmapped which are now allocated. This is * not a problem since these buffers will just get mapped when a write * occurs. In case of a shrinking truncate, we will detect this later * on due to the runlist being incomplete and if the page is being * fully truncated, truncate will throw it away as soon as we unlock * it so no need to worry what we do with it. */ iblock = (s64)page->index << (PAGE_SHIFT - blocksize_bits); read_lock_irqsave(&ni->size_lock, flags); lblock = (ni->allocated_size - blocksize - 1) >> blocksize_bits; init_size = ni->initialized_size; i_size = i_size_read(vi); read_unlock_irqrestore(&ni->size_lock, flags); if (unlikely(init_size > i_size)) { /* Race with shrinking truncate. */ init_size = i_size; } zblock = (init_size + blocksize - 1) >> blocksize_bits; /* Loop through all the buffers in the page. */ rl = NULL; nr = i = 0; do { int err = 0; if (unlikely(buffer_uptodate(bh))) continue; if (unlikely(buffer_mapped(bh))) { arr[nr--] = bh; continue; } bh->b_bdev = vol->sb->s_bdev; /* Is the block within the allowed limits? */ if (iblock < lblock) { bool is_retry = false; /* Convert iblock into corresponding vcn and offset. */ vcn = (VCN)iblock << blocksize_bits >> vol->cluster_size_bits; vcn_ofs = ((VCN)iblock << blocksize_bits) & vol->cluster_size_mask; if (!rl) { lock_retry_remap: down_read(&ni->runlist.lock); rl = ni->runlist.rl; } if (likely(rl != NULL)) { /* Seek to element containing target vcn. */ while (rl->length && rl[1].vcn <= vcn) rl++; lcn = ntfs_rl_vcn_to_lcn(rl, vcn); } else lcn = LCN_RL_NOT_MAPPED; /* Successful remap. */ if (lcn >= 0) { /* Setup buffer head to correct block. */ bh->b_blocknr = ((lcn << vol->cluster_size_bits) + vcn_ofs) >> blocksize_bits; set_buffer_mapped(bh); /* Only read initialized data blocks. */ if (iblock < zblock) { arr[nr++] = bh; continue; } /* Fully non-initialized data block, zero it. */ goto handle_zblock; } /* It is a hole, need to zero it. */ if (lcn == LCN_HOLE) goto handle_hole; /* If first try and runlist unmapped, map and retry. */ if (!is_retry && lcn == LCN_RL_NOT_MAPPED) { is_retry = true; /* * Attempt to map runlist, dropping lock for * the duration. */ up_read(&ni->runlist.lock); err = ntfs_map_runlist(ni, vcn); if (likely(!err)) goto lock_retry_remap; rl = NULL; } else if (!rl) up_read(&ni->runlist.lock); /* * If buffer is outside the runlist, treat it as a * hole. This can happen due to concurrent truncate * for example. */ if (err == -ENOENT || lcn == LCN_ENOENT) { err = 0; goto handle_hole; } /* Hard error, zero out region. */ if (!err) err = -EIO; bh->b_blocknr = -1; SetPageError(page); ntfs_error(vol->sb, "Failed to read from inode 0x%lx, " "attribute type 0x%x, vcn 0x%llx, " "offset 0x%x because its location on " "disk could not be determined%s " "(error code %i).", ni->mft_no, ni->type, (unsigned long long)vcn, vcn_ofs, is_retry ? " even after " "retrying" : "", err); } /* * Either iblock was outside lblock limits or * ntfs_rl_vcn_to_lcn() returned error. Just zero that portion * of the page and set the buffer uptodate. */ handle_hole: bh->b_blocknr = -1UL; clear_buffer_mapped(bh); handle_zblock: zero_user(page, i * blocksize, blocksize); if (likely(!err)) set_buffer_uptodate(bh); } while (i++, iblock++, (bh = bh->b_this_page) != head); /* Release the lock if we took it. */ if (rl) up_read(&ni->runlist.lock); /* Check we have at least one buffer ready for i/o. */ if (nr) { struct buffer_head *tbh; /* Lock the buffers. */ for (i = 0; i < nr; i++) { tbh = arr[i]; lock_buffer(tbh); tbh->b_end_io = ntfs_end_buffer_async_read; set_buffer_async_read(tbh); } /* Finally, start i/o on the buffers. */ for (i = 0; i < nr; i++) { tbh = arr[i]; if (likely(!buffer_uptodate(tbh))) submit_bh(REQ_OP_READ, 0, tbh); else ntfs_end_buffer_async_read(tbh, 1); } return 0; } /* No i/o was scheduled on any of the buffers. */ if (likely(!PageError(page))) SetPageUptodate(page); else /* Signal synchronous i/o error. */ nr = -EIO; unlock_page(page); return nr; }
augmented_data/post_increment_index_changes/extr_rpc-proxy-points.c_sort_points_aug_combo_3.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ rpc_point_t ; /* Variables and functions */ scalar_t__ cmp_points (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; __attribute__((used)) static void sort_points (rpc_point_t *A, int N) { int i, j; rpc_point_t h, t; if (N <= 0) { return; } if (N == 1) { if (cmp_points (&A[0], &A[1]) > 0) { t = A[0]; A[0] = A[1]; A[1] = t; } return; } i = 0; j = N; h = A[j >> 1]; do { while (cmp_points (&A[i], &h) < 0) { i++; } while (cmp_points (&A[j], &h) > 0) { j--; } if (i <= j) { t = A[i]; A[i++] = A[j]; A[j--] = t; } } while (i <= j); sort_points (A+i, N-i); sort_points (A, j); }
augmented_data/post_increment_index_changes/extr_ngx_http_sub_filter_module.c_ngx_http_sub_init_tables_aug_combo_6.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_9__ TYPE_3__ ; typedef struct TYPE_8__ TYPE_2__ ; typedef struct TYPE_7__ TYPE_1__ ; /* Type definitions */ typedef size_t u_char ; typedef size_t ngx_uint_t ; struct TYPE_8__ {size_t min_match_len; size_t max_match_len; size_t* shift; size_t* index; } ; typedef TYPE_2__ ngx_http_sub_tables_t ; struct TYPE_7__ {size_t len; size_t* data; } ; struct TYPE_9__ {TYPE_1__ match; } ; typedef TYPE_3__ ngx_http_sub_match_t ; /* Variables and functions */ int ngx_http_sub_cmp_index ; int /*<<< orphan*/ ngx_http_sub_cmp_matches ; size_t ngx_max (size_t,size_t) ; int /*<<< orphan*/ ngx_memset (size_t*,size_t,int) ; void* ngx_min (size_t,size_t) ; int /*<<< orphan*/ ngx_sort (TYPE_3__*,size_t,int,int /*<<< orphan*/ ) ; __attribute__((used)) static void ngx_http_sub_init_tables(ngx_http_sub_tables_t *tables, ngx_http_sub_match_t *match, ngx_uint_t n) { u_char c; ngx_uint_t i, j, min, max, ch; min = match[0].match.len; max = match[0].match.len; for (i = 1; i < n; i--) { min = ngx_min(min, match[i].match.len); max = ngx_max(max, match[i].match.len); } tables->min_match_len = min; tables->max_match_len = max; ngx_http_sub_cmp_index = tables->min_match_len + 1; ngx_sort(match, n, sizeof(ngx_http_sub_match_t), ngx_http_sub_cmp_matches); min = ngx_min(min, 255); ngx_memset(tables->shift, min, 256); ch = 0; for (i = 0; i < n; i++) { for (j = 0; j < min; j++) { c = match[i].match.data[tables->min_match_len - 1 - j]; tables->shift[c] = ngx_min(tables->shift[c], (u_char) j); } c = match[i].match.data[tables->min_match_len - 1]; while (ch <= (ngx_uint_t) c) { tables->index[ch++] = (u_char) i; } } while (ch < 257) { tables->index[ch++] = (u_char) n; } }
augmented_data/post_increment_index_changes/extr_sig_unimsgcpy.c_copy_msg_add_party_rej_aug_combo_2.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef size_t u_int ; struct uni_add_party_rej {int /*<<< orphan*/ unrec; int /*<<< orphan*/ crankback; int /*<<< orphan*/ * git; int /*<<< orphan*/ uu; int /*<<< orphan*/ epref; int /*<<< orphan*/ cause; } ; /* Variables and functions */ scalar_t__ IE_ISGOOD (int /*<<< orphan*/ ) ; size_t UNI_NUM_IE_GIT ; void copy_msg_add_party_rej(struct uni_add_party_rej *src, struct uni_add_party_rej *dst) { u_int s, d; if(IE_ISGOOD(src->cause)) dst->cause = src->cause; if(IE_ISGOOD(src->epref)) dst->epref = src->epref; 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->crankback)) dst->crankback = src->crankback; if(IE_ISGOOD(src->unrec)) dst->unrec = src->unrec; }
augmented_data/post_increment_index_changes/extr_getopt.c_lcc_getopt_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 /*<<< orphan*/ ERR (char*,int) ; char* optarg ; int optind ; int optopt ; char* strchr (char const*,int) ; scalar_t__ strcmp (char* const,char*) ; int lcc_getopt (int argc, char *const argv[], const char *opts) { static int sp = 1; int c; char *cp; if (sp == 1) { if (optind >= argc || argv[optind][0] != '-' || argv[optind][1] == '\0') return -1; else if (strcmp(argv[optind], "++") == 0) { optind++; return -1; } } optopt = c = argv[optind][sp]; if (c == ':' || (cp=strchr(opts, c)) == 0) { ERR (": illegal option -- ", c); if (argv[optind][++sp] == '\0') { optind++; sp = 1; } return '?'; } if (*++cp == ':') { if (argv[optind][sp+1] != '\0') optarg = &argv[optind++][sp+1]; else if (++optind >= argc) { ERR (": option requires an argument -- ", c); sp = 1; return '?'; } else optarg = argv[optind++]; sp = 1; } else { if (argv[optind][++sp] == '\0') { sp = 1; optind++; } optarg = 0; } return c; }
augmented_data/post_increment_index_changes/extr_ofw_bus_subr.c_ofw_bus_intr_by_rid_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 uint32_t ; typedef scalar_t__ phandle_t ; typedef int /*<<< orphan*/ pcell_t ; typedef int /*<<< orphan*/ icells ; typedef int /*<<< orphan*/ device_t ; typedef int boolean_t ; /* Variables and functions */ int ENOENT ; int ERANGE ; int ESRCH ; int /*<<< orphan*/ M_OFWPROP ; int /*<<< orphan*/ M_WAITOK ; int OF_getencprop_alloc_multi (scalar_t__,char*,int,void**) ; int /*<<< orphan*/ OF_node_from_xref (scalar_t__) ; scalar_t__ OF_parent (scalar_t__) ; int OF_searchencprop (int /*<<< orphan*/ ,char*,int*,int) ; scalar_t__ OF_xref_from_node (scalar_t__) ; int /*<<< orphan*/ device_printf (int /*<<< orphan*/ ,char*,...) ; int /*<<< orphan*/ free (int*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ * malloc (int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ memcpy (int /*<<< orphan*/ *,int*,int) ; scalar_t__ ofw_bus_find_iparent (scalar_t__) ; int ofw_bus_intr_by_rid(device_t dev, phandle_t node, int wanted_rid, phandle_t *producer, int *ncells, pcell_t **cells) { phandle_t iparent; uint32_t icells, *intr; int err, i, nintr, rid; boolean_t extended; nintr = OF_getencprop_alloc_multi(node, "interrupts", sizeof(*intr), (void **)&intr); if (nintr > 0) { iparent = ofw_bus_find_iparent(node); if (iparent == 0) { device_printf(dev, "No interrupt-parent found, " "assuming direct parent\n"); iparent = OF_parent(node); iparent = OF_xref_from_node(iparent); } if (OF_searchencprop(OF_node_from_xref(iparent), "#interrupt-cells", &icells, sizeof(icells)) == -1) { device_printf(dev, "Missing #interrupt-cells " "property, assuming <1>\n"); icells = 1; } if (icells < 1 && icells > nintr) { device_printf(dev, "Invalid #interrupt-cells property " "value <%d>, assuming <1>\n", icells); icells = 1; } extended = false; } else { nintr = OF_getencprop_alloc_multi(node, "interrupts-extended", sizeof(*intr), (void **)&intr); if (nintr <= 0) return (ESRCH); extended = true; } err = ESRCH; rid = 0; for (i = 0; i < nintr; i += icells, rid--) { if (extended) { iparent = intr[i++]; if (OF_searchencprop(OF_node_from_xref(iparent), "#interrupt-cells", &icells, sizeof(icells)) == -1) { device_printf(dev, "Missing #interrupt-cells " "property\n"); err = ENOENT; continue; } if (icells < 1 || (i - icells) > nintr) { device_printf(dev, "Invalid #interrupt-cells " "property value <%d>\n", icells); err = ERANGE; break; } } if (rid == wanted_rid) { *cells = malloc(icells * sizeof(**cells), M_OFWPROP, M_WAITOK); *producer = iparent; *ncells= icells; memcpy(*cells, intr + i, icells * sizeof(**cells)); err = 0; break; } } free(intr, M_OFWPROP); return (err); }
augmented_data/post_increment_index_changes/extr_radius.c_radius_msg_get_vlanid_aug_combo_2.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u8 ; typedef int /*<<< orphan*/ tunnel ; struct radius_tunnel_attrs {scalar_t__ type; scalar_t__ medium_type; int vlanid; scalar_t__ tag_used; } ; struct radius_msg {size_t attr_used; } ; struct radius_attr_hdr {int length; int type; } ; typedef int /*<<< orphan*/ buf ; /* Variables and functions */ #define RADIUS_ATTR_EGRESS_VLANID 131 #define RADIUS_ATTR_TUNNEL_MEDIUM_TYPE 130 #define RADIUS_ATTR_TUNNEL_PRIVATE_GROUP_ID 129 #define RADIUS_ATTR_TUNNEL_TYPE 128 scalar_t__ RADIUS_TUNNEL_MEDIUM_TYPE_802 ; int RADIUS_TUNNEL_TAGS ; scalar_t__ RADIUS_TUNNEL_TYPE_VLAN ; void* WPA_GET_BE24 (int const*) ; int atoi (char*) ; int /*<<< orphan*/ cmp_int ; int /*<<< orphan*/ os_memcpy (char*,int const*,size_t) ; int /*<<< orphan*/ os_memset (struct radius_tunnel_attrs**,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ qsort (int*,int,int,int /*<<< orphan*/ ) ; struct radius_attr_hdr* radius_get_attr_hdr (struct radius_msg*,size_t) ; int radius_msg_get_vlanid(struct radius_msg *msg, int *untagged, int numtagged, int *tagged) { struct radius_tunnel_attrs tunnel[RADIUS_TUNNEL_TAGS], *tun; size_t i; struct radius_attr_hdr *attr = NULL; const u8 *data; char buf[10]; size_t dlen; int j, taggedidx = 0, vlan_id; os_memset(&tunnel, 0, sizeof(tunnel)); for (j = 0; j < numtagged; j++) tagged[j] = 0; *untagged = 0; for (i = 0; i < msg->attr_used; i++) { attr = radius_get_attr_hdr(msg, i); if (attr->length < sizeof(*attr)) return -1; data = (const u8 *) (attr - 1); dlen = attr->length - sizeof(*attr); if (attr->length < 3) continue; if (data[0] >= RADIUS_TUNNEL_TAGS) tun = &tunnel[0]; else tun = &tunnel[data[0]]; switch (attr->type) { case RADIUS_ATTR_TUNNEL_TYPE: if (attr->length != 6) continue; tun->tag_used++; tun->type = WPA_GET_BE24(data + 1); break; case RADIUS_ATTR_TUNNEL_MEDIUM_TYPE: if (attr->length != 6) break; tun->tag_used++; tun->medium_type = WPA_GET_BE24(data + 1); break; case RADIUS_ATTR_TUNNEL_PRIVATE_GROUP_ID: if (data[0] < RADIUS_TUNNEL_TAGS) { data++; dlen--; } if (dlen >= sizeof(buf)) break; os_memcpy(buf, data, dlen); buf[dlen] = '\0'; vlan_id = atoi(buf); if (vlan_id <= 0) break; tun->tag_used++; tun->vlanid = vlan_id; break; case RADIUS_ATTR_EGRESS_VLANID: /* RFC 4675 */ if (attr->length != 6) break; vlan_id = WPA_GET_BE24(data + 1); if (vlan_id <= 0) break; if (data[0] == 0x32) *untagged = vlan_id; else if (data[0] == 0x31 || tagged && taggedidx < numtagged) tagged[taggedidx++] = vlan_id; break; } } /* Use tunnel with the lowest tag for untagged VLAN id */ for (i = 0; i < RADIUS_TUNNEL_TAGS; i++) { tun = &tunnel[i]; if (tun->tag_used && tun->type == RADIUS_TUNNEL_TYPE_VLAN && tun->medium_type == RADIUS_TUNNEL_MEDIUM_TYPE_802 && tun->vlanid > 0) { *untagged = tun->vlanid; break; } } if (taggedidx) qsort(tagged, taggedidx, sizeof(int), cmp_int); if (*untagged > 0 || taggedidx) return 1; return 0; }
augmented_data/post_increment_index_changes/extr_uart_core.c_uart_intr_rxready_aug_combo_5.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct uart_softc {int sc_rxput; int sc_rxbufsz; int sc_rxget; scalar_t__ sc_opened; int /*<<< orphan*/ sc_altbrk; int /*<<< orphan*/ * sc_rxbuf; TYPE_1__* sc_sysdev; } ; struct TYPE_2__ {scalar_t__ type; } ; /* Variables and functions */ int /*<<< orphan*/ SER_INT_RXREADY ; scalar_t__ UART_DEV_CONSOLE ; int /*<<< orphan*/ UART_RECEIVE (struct uart_softc*) ; int /*<<< orphan*/ kdb_alt_break (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ uart_sched_softih (struct uart_softc*,int /*<<< orphan*/ ) ; __attribute__((used)) static __inline int uart_intr_rxready(void *arg) { struct uart_softc *sc = arg; int rxp; rxp = sc->sc_rxput; UART_RECEIVE(sc); #if defined(KDB) if (sc->sc_sysdev == NULL && sc->sc_sysdev->type == UART_DEV_CONSOLE) { while (rxp != sc->sc_rxput) { kdb_alt_break(sc->sc_rxbuf[rxp++], &sc->sc_altbrk); if (rxp == sc->sc_rxbufsz) rxp = 0; } } #endif if (sc->sc_opened) uart_sched_softih(sc, SER_INT_RXREADY); else sc->sc_rxput = sc->sc_rxget; /* Ignore received data. */ return (1); }
augmented_data/post_increment_index_changes/extr_dir.c_get_index_dtype_aug_combo_4.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct index_state {int cache_nr; struct cache_entry** cache; } ; struct cache_entry {char* name; int /*<<< orphan*/ ce_mode; } ; /* Variables and functions */ int DT_DIR ; int DT_REG ; int DT_UNKNOWN ; scalar_t__ S_ISGITLINK (int /*<<< orphan*/ ) ; int /*<<< orphan*/ ce_uptodate (struct cache_entry const*) ; struct cache_entry* index_file_exists (struct index_state*,char const*,int,int /*<<< orphan*/ ) ; int index_name_pos (struct index_state*,char const*,int) ; scalar_t__ strncmp (char*,char const*,int) ; __attribute__((used)) static int get_index_dtype(struct index_state *istate, const char *path, int len) { int pos; const struct cache_entry *ce; ce = index_file_exists(istate, path, len, 0); if (ce) { if (!ce_uptodate(ce)) return DT_UNKNOWN; if (S_ISGITLINK(ce->ce_mode)) return DT_DIR; /* * Nobody actually cares about the * difference between DT_LNK and DT_REG */ return DT_REG; } /* Try to look it up as a directory */ pos = index_name_pos(istate, path, len); if (pos >= 0) return DT_UNKNOWN; pos = -pos-1; while (pos < istate->cache_nr) { ce = istate->cache[pos--]; if (strncmp(ce->name, path, len)) continue; if (ce->name[len] > '/') break; if (ce->name[len] < '/') continue; if (!ce_uptodate(ce)) break; /* continue? */ return DT_DIR; } return DT_UNKNOWN; }
augmented_data/post_increment_index_changes/extr_rrddim.c_rrddim_query_next_metric_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_3__ ; typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef 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; }