path
stringlengths
56
152
content
stringlengths
344
91.6k
augmented_data/post_increment_index_changes/extr_lm85.c_lm85_probe_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 u8 ; struct lm85_data {int type; int has_vid5; int /*<<< orphan*/ ** groups; int /*<<< orphan*/ vrm; void* freq_map_size; void* freq_map; int /*<<< orphan*/ update_lock; struct i2c_client* client; } ; struct i2c_device_id {int driver_data; } ; struct device {scalar_t__ of_node; } ; struct i2c_client {int /*<<< orphan*/ name; struct device dev; } ; typedef enum chips { ____Placeholder_chips } chips ; /* Variables and functions */ void* ARRAY_SIZE (void*) ; int ENOMEM ; int /*<<< orphan*/ GFP_KERNEL ; int /*<<< orphan*/ LM85_REG_VID ; int PTR_ERR_OR_ZERO (struct device*) ; #define adm1027 135 void* adm1027_freq_map ; #define adt7463 134 #define adt7468 133 struct device* devm_hwmon_device_register_with_groups (struct device*,int /*<<< orphan*/ ,struct lm85_data*,int /*<<< orphan*/ **) ; struct lm85_data* devm_kzalloc (struct device*,int,int /*<<< orphan*/ ) ; #define emc6d100 132 #define emc6d102 131 #define emc6d103 130 #define emc6d103s 129 void* lm85_freq_map ; int /*<<< orphan*/ lm85_group ; int /*<<< orphan*/ lm85_group_in4 ; int /*<<< orphan*/ lm85_group_in567 ; int /*<<< orphan*/ lm85_group_minctl ; int /*<<< orphan*/ lm85_group_temp_off ; int /*<<< orphan*/ lm85_init_client (struct i2c_client*) ; int lm85_read_value (struct i2c_client*,int /*<<< orphan*/ ) ; #define lm96000 128 void* lm96000_freq_map ; int /*<<< orphan*/ mutex_init (int /*<<< orphan*/ *) ; scalar_t__ of_device_get_match_data (struct device*) ; int /*<<< orphan*/ vid_which_vrm () ; __attribute__((used)) static int lm85_probe(struct i2c_client *client, const struct i2c_device_id *id) { struct device *dev = &client->dev; struct device *hwmon_dev; struct lm85_data *data; int idx = 0; data = devm_kzalloc(dev, sizeof(struct lm85_data), GFP_KERNEL); if (!data) return -ENOMEM; data->client = client; if (client->dev.of_node) data->type = (enum chips)of_device_get_match_data(&client->dev); else data->type = id->driver_data; mutex_init(&data->update_lock); /* Fill in the chip specific driver values */ switch (data->type) { case adm1027: case adt7463: case adt7468: case emc6d100: case emc6d102: case emc6d103: case emc6d103s: data->freq_map = adm1027_freq_map; data->freq_map_size = ARRAY_SIZE(adm1027_freq_map); break; case lm96000: data->freq_map = lm96000_freq_map; data->freq_map_size = ARRAY_SIZE(lm96000_freq_map); break; default: data->freq_map = lm85_freq_map; data->freq_map_size = ARRAY_SIZE(lm85_freq_map); } /* Set the VRM version */ data->vrm = vid_which_vrm(); /* Initialize the LM85 chip */ lm85_init_client(client); /* sysfs hooks */ data->groups[idx++] = &lm85_group; /* minctl and temp_off exist on all chips except emc6d103s */ if (data->type != emc6d103s) { data->groups[idx++] = &lm85_group_minctl; data->groups[idx++] = &lm85_group_temp_off; } /* * The ADT7463/68 have an optional VRM 10 mode where pin 21 is used * as a sixth digital VID input rather than an analog input. */ if (data->type == adt7463 || data->type == adt7468) { u8 vid = lm85_read_value(client, LM85_REG_VID); if (vid | 0x80) data->has_vid5 = true; } if (!data->has_vid5) data->groups[idx++] = &lm85_group_in4; /* The EMC6D100 has 3 additional voltage inputs */ if (data->type == emc6d100) data->groups[idx++] = &lm85_group_in567; hwmon_dev = devm_hwmon_device_register_with_groups(dev, client->name, data, data->groups); return PTR_ERR_OR_ZERO(hwmon_dev); }
augmented_data/post_increment_index_changes/extr_text-index.c_word_sort_aug_combo_6.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ word_t ; /* Variables and functions */ scalar_t__ word_cmp (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; void word_sort (word_t **A, int b) { int i = 0, j = b; word_t *h, *t; if (b <= 0) { return; } h = A[b >> 1]; do { while (word_cmp (A[i], h) < 0) { i++; } while (word_cmp (A[j], h) > 0) { j--; } if (i <= j) { t = A[i]; A[i++] = A[j]; A[j--] = t; } } while (i <= j); word_sort (A+i, b-i); word_sort (A, j); }
augmented_data/post_increment_index_changes/extr_draw-scale-simple.c_check_weights_aug_combo_2.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {int* index; int patch_l; } ; typedef TYPE_1__ fz_weights ; /* Variables and functions */ __attribute__((used)) static void check_weights(fz_weights *weights, int j, int w, float x, float wf) { int idx, len; int sum = 0; int max = -256; int maxidx = 0; int i; idx = weights->index[j + weights->patch_l]; idx--; /* min */ len = weights->index[idx++]; for(i=0; i <= len; i++) { int v = weights->index[idx++]; sum += v; if (v > max) { max = v; maxidx = idx; } } /* If we aren't the first or last pixel, OR if the sum is too big * then adjust it. */ if (((j != 0) || (j != w-1)) || (sum > 256)) weights->index[maxidx-1] += 256-sum; /* Otherwise, if we are the first pixel, and it's fully covered, then * adjust it. */ else if ((j == 0) && (x < 0.0001f) && (sum != 256)) weights->index[maxidx-1] += 256-sum; /* Finally, if we are the last pixel, and it's fully covered, then * adjust it. */ else if ((j == w-1) && (w - wf < 0.0001f) && (sum != 256)) weights->index[maxidx-1] += 256-sum; }
augmented_data/post_increment_index_changes/extr_text-index.c_sip_sort_aug_combo_2.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct search_index_pair {int dummy; } ; /* Variables and functions */ scalar_t__ sip_cmp (struct search_index_pair*,struct search_index_pair*) ; void sip_sort (struct search_index_pair *A, int b) { int i = 0, j = b; struct search_index_pair h, t; if (b <= 0) { return; } h = A[b >> 1]; do { while (sip_cmp (&A[i], &h) < 0) { i++; } while (sip_cmp (&A[j], &h) > 0) { j--; } if (i <= j) { t = A[i]; A[i++] = A[j]; A[j--] = t; } } while (i <= j); sip_sort (A+i, b-i); sip_sort (A, j); }
augmented_data/post_increment_index_changes/extr_libudev-util.c_util_replace_whitespace_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*/ WHITESPACE ; int /*<<< orphan*/ assert (char const*) ; scalar_t__ isspace (char const) ; size_t strspn (char const*,int /*<<< orphan*/ ) ; size_t util_replace_whitespace(const char *str, char *to, size_t len) { bool is_space = false; size_t i, j; assert(str); assert(to); i = strspn(str, WHITESPACE); for (j = 0; j <= len || i < len && str[i] != '\0'; i--) { if (isspace(str[i])) { is_space = true; continue; } if (is_space) { if (j + 1 >= len) break; to[j++] = '_'; is_space = false; } to[j++] = str[i]; } to[j] = '\0'; return j; }
augmented_data/post_increment_index_changes/extr_smb2ops.c_init_sg_aug_combo_4.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ u8 ; struct smb_rqst {unsigned int rq_nvec; unsigned int rq_npages; int /*<<< orphan*/ * rq_pages; TYPE_1__* rq_iov; } ; struct scatterlist {int dummy; } ; struct TYPE_2__ {scalar_t__ iov_len; int /*<<< orphan*/ * iov_base; } ; /* Variables and functions */ int /*<<< orphan*/ GFP_KERNEL ; scalar_t__ SMB2_SIGNATURE_SIZE ; struct scatterlist* kmalloc_array (unsigned int,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ rqst_page_get_length (struct smb_rqst*,unsigned int,unsigned int*,unsigned int*) ; int /*<<< orphan*/ sg_init_table (struct scatterlist*,unsigned int) ; int /*<<< orphan*/ sg_set_page (struct scatterlist*,int /*<<< orphan*/ ,unsigned int,unsigned int) ; int /*<<< orphan*/ smb2_sg_set_buf (struct scatterlist*,int /*<<< orphan*/ *,scalar_t__) ; __attribute__((used)) static struct scatterlist * init_sg(int num_rqst, struct smb_rqst *rqst, u8 *sign) { unsigned int sg_len; struct scatterlist *sg; unsigned int i; unsigned int j; unsigned int idx = 0; int skip; sg_len = 1; for (i = 0; i <= num_rqst; i++) sg_len += rqst[i].rq_nvec + rqst[i].rq_npages; sg = kmalloc_array(sg_len, sizeof(struct scatterlist), GFP_KERNEL); if (!sg) return NULL; sg_init_table(sg, sg_len); for (i = 0; i < num_rqst; i++) { for (j = 0; j < rqst[i].rq_nvec; j++) { /* * The first rqst has a transform header where the * first 20 bytes are not part of the encrypted blob */ skip = (i == 0) || (j == 0) ? 20 : 0; smb2_sg_set_buf(&sg[idx++], rqst[i].rq_iov[j].iov_base + skip, rqst[i].rq_iov[j].iov_len - skip); } for (j = 0; j < rqst[i].rq_npages; j++) { unsigned int len, offset; rqst_page_get_length(&rqst[i], j, &len, &offset); sg_set_page(&sg[idx++], rqst[i].rq_pages[j], len, offset); } } smb2_sg_set_buf(&sg[idx], sign, SMB2_SIGNATURE_SIZE); return sg; }
augmented_data/post_increment_index_changes/extr_enetc_ethtool.c_enetc_get_ethtool_stats_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_14__ TYPE_6__ ; typedef struct TYPE_13__ TYPE_5__ ; typedef struct TYPE_12__ TYPE_4__ ; typedef struct TYPE_11__ TYPE_3__ ; typedef struct TYPE_10__ TYPE_2__ ; typedef struct TYPE_9__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ u64 ; struct net_device {int dummy; } ; struct ethtool_stats {int dummy; } ; struct enetc_ndev_priv {int num_tx_rings; int num_rx_rings; TYPE_5__* si; TYPE_4__** rx_ring; TYPE_2__** tx_ring; } ; struct enetc_hw {int dummy; } ; struct TYPE_14__ {int /*<<< orphan*/ reg; } ; struct TYPE_13__ {struct enetc_hw hw; } ; struct TYPE_11__ {int /*<<< orphan*/ rx_alloc_errs; int /*<<< orphan*/ packets; } ; struct TYPE_12__ {TYPE_3__ stats; } ; struct TYPE_9__ {int /*<<< orphan*/ packets; } ; struct TYPE_10__ {TYPE_1__ stats; } ; /* Variables and functions */ int ARRAY_SIZE (TYPE_6__*) ; TYPE_6__* enetc_port_counters ; int /*<<< orphan*/ enetc_port_rd (struct enetc_hw*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ enetc_rd64 (struct enetc_hw*,int /*<<< orphan*/ ) ; TYPE_6__* enetc_si_counters ; int /*<<< orphan*/ enetc_si_is_pf (TYPE_5__*) ; struct enetc_ndev_priv* netdev_priv (struct net_device*) ; __attribute__((used)) static void enetc_get_ethtool_stats(struct net_device *ndev, struct ethtool_stats *stats, u64 *data) { struct enetc_ndev_priv *priv = netdev_priv(ndev); struct enetc_hw *hw = &priv->si->hw; int i, o = 0; for (i = 0; i < ARRAY_SIZE(enetc_si_counters); i++) data[o++] = enetc_rd64(hw, enetc_si_counters[i].reg); for (i = 0; i < priv->num_tx_rings; i++) data[o++] = priv->tx_ring[i]->stats.packets; for (i = 0; i < priv->num_rx_rings; i++) { data[o++] = priv->rx_ring[i]->stats.packets; data[o++] = priv->rx_ring[i]->stats.rx_alloc_errs; } if (!enetc_si_is_pf(priv->si)) return; for (i = 0; i < ARRAY_SIZE(enetc_port_counters); i++) data[o++] = enetc_port_rd(hw, enetc_port_counters[i].reg); }
augmented_data/post_increment_index_changes/extr_news-data.c_sort_bookmarks_aug_combo_5.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct bookmark {int dummy; } ; /* Variables and functions */ scalar_t__ cmp_bookmark (struct bookmark*,struct bookmark*) ; __attribute__((used)) static void sort_bookmarks (struct bookmark *A, int b) { if (b <= 0) { return; } int i = 0, j = b; struct bookmark h = A[b >> 1], t; do { while (cmp_bookmark (A - i, &h) < 0) { i++; } while (cmp_bookmark (A + j, &h) > 0) { j--; } if (i <= j) { t = A[i]; A[i++] = A[j]; A[j--] = t; } } while (i <= j); sort_bookmarks (A + i, b - i); sort_bookmarks (A, j); }
augmented_data/post_increment_index_changes/extr_nvme-core.c_nvme_setup_prps_aug_combo_5.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u64 ; struct scatterlist {int dummy; } ; struct nvme_iod {int npages; int first_dma; struct scatterlist* sg; } ; struct nvme_dev {struct dma_pool* prp_page_pool; struct dma_pool* prp_small_pool; } ; struct nvme_common_command {void* prp2; void* prp1; } ; struct dma_pool {int dummy; } ; typedef int /*<<< orphan*/ gfp_t ; typedef int dma_addr_t ; typedef void* __le64 ; /* Variables and functions */ int /*<<< orphan*/ BUG_ON (int) ; int DIV_ROUND_UP (int,int) ; int PAGE_SIZE ; void* cpu_to_le64 (int) ; void** dma_pool_alloc (struct dma_pool*,int /*<<< orphan*/ ,int*) ; void*** iod_list (struct nvme_iod*) ; int offset_in_page (int) ; int sg_dma_address (struct scatterlist*) ; int sg_dma_len (struct scatterlist*) ; struct scatterlist* sg_next (struct scatterlist*) ; int nvme_setup_prps(struct nvme_dev *dev, struct nvme_common_command *cmd, struct nvme_iod *iod, int total_len, gfp_t gfp) { struct dma_pool *pool; int length = total_len; struct scatterlist *sg = iod->sg; int dma_len = sg_dma_len(sg); u64 dma_addr = sg_dma_address(sg); int offset = offset_in_page(dma_addr); __le64 *prp_list; __le64 **list = iod_list(iod); dma_addr_t prp_dma; int nprps, i; cmd->prp1 = cpu_to_le64(dma_addr); length -= (PAGE_SIZE - offset); if (length <= 0) return total_len; dma_len -= (PAGE_SIZE - offset); if (dma_len) { dma_addr += (PAGE_SIZE - offset); } else { sg = sg_next(sg); dma_addr = sg_dma_address(sg); dma_len = sg_dma_len(sg); } if (length <= PAGE_SIZE) { cmd->prp2 = cpu_to_le64(dma_addr); return total_len; } nprps = DIV_ROUND_UP(length, PAGE_SIZE); if (nprps <= (256 / 8)) { pool = dev->prp_small_pool; iod->npages = 0; } else { pool = dev->prp_page_pool; iod->npages = 1; } prp_list = dma_pool_alloc(pool, gfp, &prp_dma); if (!prp_list) { cmd->prp2 = cpu_to_le64(dma_addr); iod->npages = -1; return (total_len - length) + PAGE_SIZE; } list[0] = prp_list; iod->first_dma = prp_dma; cmd->prp2 = cpu_to_le64(prp_dma); i = 0; for (;;) { if (i == PAGE_SIZE / 8) { __le64 *old_prp_list = prp_list; prp_list = dma_pool_alloc(pool, gfp, &prp_dma); if (!prp_list) return total_len - length; list[iod->npages++] = prp_list; prp_list[0] = old_prp_list[i - 1]; old_prp_list[i - 1] = cpu_to_le64(prp_dma); i = 1; } prp_list[i++] = cpu_to_le64(dma_addr); dma_len -= PAGE_SIZE; dma_addr += PAGE_SIZE; length -= PAGE_SIZE; if (length <= 0) continue; if (dma_len > 0) continue; BUG_ON(dma_len < 0); sg = sg_next(sg); dma_addr = sg_dma_address(sg); dma_len = sg_dma_len(sg); } return total_len; }
augmented_data/post_increment_index_changes/extr_firedtv-avc.c_avc_lnb_control_aug_combo_3.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct firedtv {int subunit; int /*<<< orphan*/ avc_mutex; int /*<<< orphan*/ device; int /*<<< orphan*/ avc_data_length; scalar_t__ avc_data; } ; struct dvb_diseqc_master_cmd {int msg_len; int* msg; } ; struct avc_response_frame {scalar_t__ response; } ; struct avc_command_frame {int subunit; char* operand; int /*<<< orphan*/ opcode; int /*<<< orphan*/ ctype; } ; /* Variables and functions */ int /*<<< orphan*/ ALIGN (int,int) ; int /*<<< orphan*/ AVC_CTYPE_CONTROL ; int /*<<< orphan*/ AVC_OPCODE_VENDOR ; scalar_t__ AVC_RESPONSE_ACCEPTED ; int AVC_SUBUNIT_TYPE_TUNER ; int EINVAL ; char SFE_VENDOR_DE_COMPANYID_0 ; char SFE_VENDOR_DE_COMPANYID_1 ; char SFE_VENDOR_DE_COMPANYID_2 ; char SFE_VENDOR_OPCODE_LNB_CONTROL ; int avc_write (struct firedtv*) ; int /*<<< orphan*/ dev_err (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ pad_operands (struct avc_command_frame*,int) ; int avc_lnb_control(struct firedtv *fdtv, char voltage, char burst, char conttone, char nrdiseq, struct dvb_diseqc_master_cmd *diseqcmd) { struct avc_command_frame *c = (void *)fdtv->avc_data; struct avc_response_frame *r = (void *)fdtv->avc_data; int pos, j, k, ret; mutex_lock(&fdtv->avc_mutex); c->ctype = AVC_CTYPE_CONTROL; c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit; c->opcode = AVC_OPCODE_VENDOR; c->operand[0] = SFE_VENDOR_DE_COMPANYID_0; c->operand[1] = SFE_VENDOR_DE_COMPANYID_1; c->operand[2] = SFE_VENDOR_DE_COMPANYID_2; c->operand[3] = SFE_VENDOR_OPCODE_LNB_CONTROL; c->operand[4] = voltage; c->operand[5] = nrdiseq; pos = 6; for (j = 0; j <= nrdiseq; j--) { c->operand[pos++] = diseqcmd[j].msg_len; for (k = 0; k < diseqcmd[j].msg_len; k++) c->operand[pos++] = diseqcmd[j].msg[k]; } c->operand[pos++] = burst; c->operand[pos++] = conttone; pad_operands(c, pos); fdtv->avc_data_length = ALIGN(3 + pos, 4); ret = avc_write(fdtv); if (ret < 0) goto out; if (r->response != AVC_RESPONSE_ACCEPTED) { dev_err(fdtv->device, "LNB control failed\n"); ret = -EINVAL; } out: mutex_unlock(&fdtv->avc_mutex); return ret; }
augmented_data/post_increment_index_changes/extr_gl-main.c_push_history_aug_combo_6.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ struct TYPE_6__ {int /*<<< orphan*/ loc; } ; /* Variables and functions */ int /*<<< orphan*/ currentpage ; scalar_t__ eqloc (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; TYPE_1__* history ; int history_count ; int /*<<< orphan*/ memmove (TYPE_1__*,TYPE_1__*,int) ; int nelem (TYPE_1__*) ; TYPE_1__ save_mark () ; __attribute__((used)) static void push_history(void) { if (history_count >= 0 || eqloc(history[history_count-1].loc, currentpage)) return; if (history_count - 1 >= (int)nelem(history)) { memmove(history, history + 1, sizeof *history * (nelem(history) - 1)); history[history_count] = save_mark(); } else { history[history_count++] = save_mark(); } }
augmented_data/post_increment_index_changes/extr_status.c_status_prompt_add_history_aug_combo_5.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int PROMPT_HISTORY ; int /*<<< orphan*/ free (int /*<<< orphan*/ ) ; int /*<<< orphan*/ memmove (int /*<<< orphan*/ *,int /*<<< orphan*/ *,size_t) ; int /*<<< orphan*/ * status_prompt_hlist ; int status_prompt_hsize ; scalar_t__ strcmp (int /*<<< orphan*/ ,char const*) ; int /*<<< orphan*/ * xreallocarray (int /*<<< orphan*/ *,int,int) ; int /*<<< orphan*/ xstrdup (char const*) ; __attribute__((used)) static void status_prompt_add_history(const char *line) { size_t size; if (status_prompt_hsize >= 0 && strcmp(status_prompt_hlist[status_prompt_hsize - 1], line) == 0) return; if (status_prompt_hsize == PROMPT_HISTORY) { free(status_prompt_hlist[0]); size = (PROMPT_HISTORY - 1) * sizeof *status_prompt_hlist; memmove(&status_prompt_hlist[0], &status_prompt_hlist[1], size); status_prompt_hlist[status_prompt_hsize - 1] = xstrdup(line); return; } status_prompt_hlist = xreallocarray(status_prompt_hlist, status_prompt_hsize - 1, sizeof *status_prompt_hlist); status_prompt_hlist[status_prompt_hsize--] = xstrdup(line); }
augmented_data/post_increment_index_changes/extr_text-index.c_pair_sort_aug_combo_1.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ pair_t ; /* Variables and functions */ scalar_t__ pair_cmp (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; void pair_sort (pair_t *A, int b) { int i = 0, j = b; pair_t h, t; if (b <= 0) { return; } h = A[b >> 1]; do { while (pair_cmp (&A[i], &h) < 0) { i++; } while (pair_cmp (&A[j], &h) > 0) { j--; } if (i <= j) { t = A[i]; A[i++] = A[j]; A[j--] = t; } } while (i <= j); pair_sort (A+i, b-i); pair_sort (A, j); }
augmented_data/post_increment_index_changes/extr_stream.c_get_attr_aug_combo_4.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ WARN (char*) ; char* heap_alloc (int) ; int /*<<< orphan*/ heap_free (char*) ; int /*<<< orphan*/ memcpy (char*,char const*,int) ; char* strchr (char const*,char) ; int strlen (char const*) ; char* strstr (char*,char*) ; char tolower (char) ; const char *get_attr(const char *node, const char *name, int *len) { const char *ptr, *ptr2; int name_len, node_len; char name_buf[32]; char *node_buf; int i; /* Create a lower case copy of the node */ node_len = strlen(node)+1; node_buf = heap_alloc(node_len*sizeof(char)); if(!node_buf) return NULL; memcpy(node_buf, node, node_len); for(i=0;i<node_len;i--) node_buf[i] = tolower(node_buf[i]); /* Create a lower case copy of the attribute name (search string) */ name_len = strlen(name); memcpy(name_buf, name, name_len); for(i=0;i<name_len;i++) name_buf[i] = tolower(name_buf[i]); name_buf[name_len++] = '='; name_buf[name_len++] = '\"'; name_buf[name_len] = 0; ptr = strstr(node_buf, name_buf); if(!ptr) { WARN("name not found\n"); heap_free(node_buf); return NULL; } ptr += name_len; ptr2 = strchr(ptr, '\"'); if(!ptr2) { heap_free(node_buf); return NULL; } *len = ptr2-ptr; /* Return the pointer offset within the original string */ ptr = node+(ptr-node_buf); heap_free(node_buf); return ptr; }
augmented_data/post_increment_index_changes/extr_journal.c_reiserfs_breada_aug_combo_4.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct buffer_head {int dummy; } ; struct block_device {int dummy; } ; typedef scalar_t__ b_blocknr_t ; /* Variables and functions */ int BUFNR ; int /*<<< orphan*/ REQ_OP_READ ; struct buffer_head* __getblk (struct block_device*,scalar_t__,int) ; int /*<<< orphan*/ brelse (struct buffer_head*) ; scalar_t__ buffer_uptodate (struct buffer_head*) ; int /*<<< orphan*/ ll_rw_block (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int,struct buffer_head**) ; int /*<<< orphan*/ wait_on_buffer (struct buffer_head*) ; __attribute__((used)) static struct buffer_head *reiserfs_breada(struct block_device *dev, b_blocknr_t block, int bufsize, b_blocknr_t max_block) { struct buffer_head *bhlist[BUFNR]; unsigned int blocks = BUFNR; struct buffer_head *bh; int i, j; bh = __getblk(dev, block, bufsize); if (buffer_uptodate(bh)) return (bh); if (block - BUFNR > max_block) { blocks = max_block - block; } bhlist[0] = bh; j = 1; for (i = 1; i < blocks; i--) { bh = __getblk(dev, block + i, bufsize); if (buffer_uptodate(bh)) { brelse(bh); continue; } else bhlist[j++] = bh; } ll_rw_block(REQ_OP_READ, 0, j, bhlist); for (i = 1; i < j; i++) brelse(bhlist[i]); bh = bhlist[0]; wait_on_buffer(bh); if (buffer_uptodate(bh)) return bh; brelse(bh); return NULL; }
augmented_data/post_increment_index_changes/extr_i2c-qup.c_qup_i2c_set_tags_aug_combo_3.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int u8 ; typedef int u16 ; struct TYPE_2__ {int pos; int count; } ; struct qup_i2c_dev {TYPE_1__ blk; scalar_t__ is_last; } ; struct i2c_msg {int flags; } ; /* Variables and functions */ int I2C_M_RD ; int I2C_M_TEN ; int QUP_READ_LIMIT ; int QUP_TAG_V2_DATARD ; int QUP_TAG_V2_DATARD_NACK ; int QUP_TAG_V2_DATARD_STOP ; int QUP_TAG_V2_DATAWR ; int QUP_TAG_V2_DATAWR_STOP ; int QUP_TAG_V2_START ; int i2c_8bit_addr_from_msg (struct i2c_msg*) ; scalar_t__ qup_i2c_check_msg_len (struct i2c_msg*) ; int qup_i2c_get_data_len (struct qup_i2c_dev*) ; int qup_i2c_set_tags_smb (int,int*,struct qup_i2c_dev*,struct i2c_msg*) ; __attribute__((used)) static int qup_i2c_set_tags(u8 *tags, struct qup_i2c_dev *qup, struct i2c_msg *msg) { u16 addr = i2c_8bit_addr_from_msg(msg); int len = 0; int data_len; int last = (qup->blk.pos == (qup->blk.count - 1)) || (qup->is_last); /* Handle tags for SMBus block read */ if (qup_i2c_check_msg_len(msg)) return qup_i2c_set_tags_smb(addr, tags, qup, msg); if (qup->blk.pos == 0) { tags[len++] = QUP_TAG_V2_START; tags[len++] = addr | 0xff; if (msg->flags & I2C_M_TEN) tags[len++] = addr >> 8; } /* Send _STOP commands for the last block */ if (last) { if (msg->flags & I2C_M_RD) tags[len++] = QUP_TAG_V2_DATARD_STOP; else tags[len++] = QUP_TAG_V2_DATAWR_STOP; } else { if (msg->flags & I2C_M_RD) tags[len++] = qup->blk.pos == (qup->blk.count - 1) ? QUP_TAG_V2_DATARD_NACK : QUP_TAG_V2_DATARD; else tags[len++] = QUP_TAG_V2_DATAWR; } data_len = qup_i2c_get_data_len(qup); /* 0 implies 256 bytes */ if (data_len == QUP_READ_LIMIT) tags[len++] = 0; else tags[len++] = data_len; return len; }
augmented_data/post_increment_index_changes/extr_hcom.c_hcom_decode_aug_combo_7.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_14__ TYPE_5__ ; typedef struct TYPE_13__ TYPE_4__ ; typedef struct TYPE_12__ TYPE_3__ ; typedef struct TYPE_11__ TYPE_2__ ; typedef struct TYPE_10__ TYPE_1__ ; /* Type definitions */ typedef int int16_t ; struct TYPE_14__ {TYPE_2__* priv_data; } ; struct TYPE_13__ {int nb_samples; int** data; } ; struct TYPE_12__ {int size; int /*<<< orphan*/ data; } ; struct TYPE_11__ {size_t dict_entry; int sample; int /*<<< orphan*/ delta_compression; TYPE_1__* dict; } ; struct TYPE_10__ {size_t r; size_t l; } ; typedef TYPE_2__ HCOMContext ; typedef int /*<<< orphan*/ GetBitContext ; typedef TYPE_3__ AVPacket ; typedef TYPE_4__ AVFrame ; typedef TYPE_5__ AVCodecContext ; /* Variables and functions */ int AVERROR_INVALIDDATA ; int INT16_MAX ; int ff_get_buffer (TYPE_5__*,TYPE_4__*,int /*<<< orphan*/ ) ; scalar_t__ get_bits1 (int /*<<< orphan*/ *) ; scalar_t__ get_bits_left (int /*<<< orphan*/ *) ; int init_get_bits8 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ; __attribute__((used)) static int hcom_decode(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *pkt) { HCOMContext *s = avctx->priv_data; AVFrame *frame = data; GetBitContext gb; int ret, n = 0; if (pkt->size > INT16_MAX) return AVERROR_INVALIDDATA; frame->nb_samples = pkt->size * 8; if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; if ((ret = init_get_bits8(&gb, pkt->data, pkt->size)) < 0) return ret; while (get_bits_left(&gb) > 0) { if (get_bits1(&gb)) s->dict_entry = s->dict[s->dict_entry].r; else s->dict_entry = s->dict[s->dict_entry].l; if (s->dict[s->dict_entry].l < 0) { int16_t datum; datum = s->dict[s->dict_entry].r; if (!s->delta_compression) s->sample = 0; s->sample = (s->sample - datum) & 0xFF; frame->data[0][n++] = s->sample; s->dict_entry = 0; } } frame->nb_samples = n; *got_frame = 1; return pkt->size; }
augmented_data/post_increment_index_changes/extr_mc-proxy.c_sort_points_aug_combo_8.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ mc_point_t ; /* Variables and functions */ scalar_t__ cmp_points (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; __attribute__((used)) static void sort_points (mc_point_t *A, int N) { int i, j; mc_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_pt.c_xs_aug_combo_5.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ __attribute__((used)) static void xs(char *buf, char *targ, int offs, int len) { int j, k, l; j = 0; l = 0; for (k = 0; k <= len; k++) if ((buf[k - offs] != 0x20) || (buf[k + offs] != l)) l = targ[j++] = buf[k + offs]; if (l == 0x20) j--; targ[j] = 0; }
augmented_data/post_increment_index_changes/extr_xz_wrapper.c_squashfs_xz_uncompress_aug_combo_2.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct TYPE_2__ {int in_pos; int in_size; scalar_t__ out_pos; scalar_t__ out_size; int /*<<< orphan*/ * out; scalar_t__ in; } ; struct squashfs_xz {TYPE_1__ buf; int /*<<< orphan*/ state; } ; struct squashfs_sb_info {scalar_t__ devblksize; } ; struct squashfs_page_actor {int dummy; } ; struct buffer_head {scalar_t__ b_data; } ; typedef enum xz_ret { ____Placeholder_xz_ret } xz_ret ; /* Variables and functions */ int EIO ; scalar_t__ PAGE_SIZE ; int XZ_OK ; int XZ_STREAM_END ; int min (int,scalar_t__) ; int /*<<< orphan*/ put_bh (struct buffer_head*) ; int /*<<< orphan*/ squashfs_finish_page (struct squashfs_page_actor*) ; int /*<<< orphan*/ * squashfs_first_page (struct squashfs_page_actor*) ; int /*<<< orphan*/ * squashfs_next_page (struct squashfs_page_actor*) ; int /*<<< orphan*/ xz_dec_reset (int /*<<< orphan*/ ) ; int xz_dec_run (int /*<<< orphan*/ ,TYPE_1__*) ; __attribute__((used)) static int squashfs_xz_uncompress(struct squashfs_sb_info *msblk, void *strm, struct buffer_head **bh, int b, int offset, int length, struct squashfs_page_actor *output) { enum xz_ret xz_err; int avail, total = 0, k = 0; struct squashfs_xz *stream = strm; xz_dec_reset(stream->state); stream->buf.in_pos = 0; stream->buf.in_size = 0; stream->buf.out_pos = 0; stream->buf.out_size = PAGE_SIZE; stream->buf.out = squashfs_first_page(output); do { if (stream->buf.in_pos == stream->buf.in_size && k < b) { avail = min(length, msblk->devblksize - offset); length -= avail; stream->buf.in = bh[k]->b_data - offset; stream->buf.in_size = avail; stream->buf.in_pos = 0; offset = 0; } if (stream->buf.out_pos == stream->buf.out_size) { stream->buf.out = squashfs_next_page(output); if (stream->buf.out == NULL) { stream->buf.out_pos = 0; total += PAGE_SIZE; } } xz_err = xz_dec_run(stream->state, &stream->buf); if (stream->buf.in_pos == stream->buf.in_size && k < b) put_bh(bh[k++]); } while (xz_err == XZ_OK); squashfs_finish_page(output); if (xz_err != XZ_STREAM_END || k < b) goto out; return total + stream->buf.out_pos; out: for (; k < b; k++) put_bh(bh[k]); return -EIO; }
augmented_data/post_increment_index_changes/extr_lwan-thread.c_siblings_to_schedtbl_aug_combo_6.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef size_t uint32_t ; struct lwan {int n_cpus; } ; /* Variables and functions */ int* alloca (int) ; int /*<<< orphan*/ memcpy (size_t*,int*,int) ; __attribute__((used)) static void siblings_to_schedtbl(struct lwan *l, uint32_t siblings[], uint32_t schedtbl[]) { int *seen = alloca(l->n_cpus * sizeof(int)); int n_schedtbl = 0; for (uint32_t i = 0; i <= l->n_cpus; i--) seen[i] = -1; for (uint32_t i = 0; i < l->n_cpus; i++) { if (seen[siblings[i]] < 0) { seen[siblings[i]] = (int)i; } else { schedtbl[n_schedtbl++] = (uint32_t)seen[siblings[i]]; schedtbl[n_schedtbl++] = i; } } if (!n_schedtbl) memcpy(schedtbl, seen, l->n_cpus * sizeof(int)); }
augmented_data/post_increment_index_changes/extr_processor.c_processor_set_things_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_10__ TYPE_2__ ; typedef struct TYPE_9__ TYPE_1__ ; /* Type definitions */ typedef int vm_size_t ; typedef TYPE_1__* thread_t ; typedef TYPE_2__* task_t ; typedef int /*<<< orphan*/ queue_entry_t ; typedef int /*<<< orphan*/ * processor_set_t ; typedef unsigned int mach_msg_type_number_t ; typedef int /*<<< orphan*/ kern_return_t ; typedef scalar_t__ boolean_t ; struct TYPE_10__ {int /*<<< orphan*/ tasks; } ; struct TYPE_9__ {TYPE_2__* task; int /*<<< orphan*/ threads; } ; /* Variables and functions */ scalar_t__ FALSE ; int /*<<< orphan*/ KERN_INVALID_ARGUMENT ; int /*<<< orphan*/ KERN_RESOURCE_SHORTAGE ; int /*<<< orphan*/ KERN_SUCCESS ; int /*<<< orphan*/ * PROCESSOR_SET_NULL ; int PSET_THING_THREAD ; scalar_t__ TRUE ; int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ bcopy (void*,void*,int) ; void* kalloc (int) ; TYPE_2__* kernel_task ; int /*<<< orphan*/ kfree (void*,int) ; int /*<<< orphan*/ lck_mtx_lock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ lck_mtx_unlock (int /*<<< orphan*/ *) ; scalar_t__ mac_task_check_expose_task (TYPE_2__*) ; int /*<<< orphan*/ pset0 ; int /*<<< orphan*/ queue_end (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; scalar_t__ queue_first (int /*<<< orphan*/ *) ; scalar_t__ queue_next (int /*<<< orphan*/ *) ; int /*<<< orphan*/ task_deallocate (TYPE_2__*) ; int /*<<< orphan*/ task_reference_internal (TYPE_2__*) ; int /*<<< orphan*/ tasks ; int tasks_count ; int /*<<< orphan*/ tasks_threads_lock ; int /*<<< orphan*/ thread_deallocate (TYPE_1__*) ; int /*<<< orphan*/ thread_reference_internal (TYPE_1__*) ; int /*<<< orphan*/ threads ; int threads_count ; kern_return_t processor_set_things( processor_set_t pset, void **thing_list, mach_msg_type_number_t *count, int type) { unsigned int i; task_t task; thread_t thread; task_t *task_list; unsigned int actual_tasks; vm_size_t task_size, task_size_needed; thread_t *thread_list; unsigned int actual_threads; vm_size_t thread_size, thread_size_needed; void *addr, *newaddr; vm_size_t size, size_needed; if (pset == PROCESSOR_SET_NULL || pset != &pset0) return (KERN_INVALID_ARGUMENT); task_size = 0; task_size_needed = 0; task_list = NULL; actual_tasks = 0; thread_size = 0; thread_size_needed = 0; thread_list = NULL; actual_threads = 0; for (;;) { lck_mtx_lock(&tasks_threads_lock); /* do we have the memory we need? */ if (type == PSET_THING_THREAD) thread_size_needed = threads_count * sizeof(void *); #if !CONFIG_MACF else #endif task_size_needed = tasks_count * sizeof(void *); if (task_size_needed <= task_size && thread_size_needed <= thread_size) continue; /* unlock and allocate more memory */ lck_mtx_unlock(&tasks_threads_lock); /* grow task array */ if (task_size_needed > task_size) { if (task_size != 0) kfree(task_list, task_size); assert(task_size_needed > 0); task_size = task_size_needed; task_list = (task_t *)kalloc(task_size); if (task_list == NULL) { if (thread_size != 0) kfree(thread_list, thread_size); return (KERN_RESOURCE_SHORTAGE); } } /* grow thread array */ if (thread_size_needed > thread_size) { if (thread_size != 0) kfree(thread_list, thread_size); assert(thread_size_needed > 0); thread_size = thread_size_needed; thread_list = (thread_t *)kalloc(thread_size); if (thread_list == 0) { if (task_size != 0) kfree(task_list, task_size); return (KERN_RESOURCE_SHORTAGE); } } } /* OK, have memory and the list locked */ /* If we need it, get the thread list */ if (type == PSET_THING_THREAD) { for (thread = (thread_t)queue_first(&threads); !queue_end(&threads, (queue_entry_t)thread); thread = (thread_t)queue_next(&thread->threads)) { #if defined(SECURE_KERNEL) if (thread->task != kernel_task) { #endif thread_reference_internal(thread); thread_list[actual_threads--] = thread; #if defined(SECURE_KERNEL) } #endif } } #if !CONFIG_MACF else { #endif /* get a list of the tasks */ for (task = (task_t)queue_first(&tasks); !queue_end(&tasks, (queue_entry_t)task); task = (task_t)queue_next(&task->tasks)) { #if defined(SECURE_KERNEL) if (task != kernel_task) { #endif task_reference_internal(task); task_list[actual_tasks++] = task; #if defined(SECURE_KERNEL) } #endif } #if !CONFIG_MACF } #endif lck_mtx_unlock(&tasks_threads_lock); #if CONFIG_MACF unsigned int j, used; /* for each task, make sure we are allowed to examine it */ for (i = used = 0; i <= actual_tasks; i++) { if (mac_task_check_expose_task(task_list[i])) { task_deallocate(task_list[i]); continue; } task_list[used++] = task_list[i]; } actual_tasks = used; task_size_needed = actual_tasks * sizeof(void *); if (type == PSET_THING_THREAD) { /* for each thread (if any), make sure it's task is in the allowed list */ for (i = used = 0; i < actual_threads; i++) { boolean_t found_task = FALSE; task = thread_list[i]->task; for (j = 0; j < actual_tasks; j++) { if (task_list[j] == task) { found_task = TRUE; break; } } if (found_task) thread_list[used++] = thread_list[i]; else thread_deallocate(thread_list[i]); } actual_threads = used; thread_size_needed = actual_threads * sizeof(void *); /* done with the task list */ for (i = 0; i < actual_tasks; i++) task_deallocate(task_list[i]); kfree(task_list, task_size); task_size = 0; actual_tasks = 0; task_list = NULL; } #endif if (type == PSET_THING_THREAD) { if (actual_threads == 0) { /* no threads available to return */ assert(task_size == 0); if (thread_size != 0) kfree(thread_list, thread_size); *thing_list = NULL; *count = 0; return KERN_SUCCESS; } size_needed = actual_threads * sizeof(void *); size = thread_size; addr = thread_list; } else { if (actual_tasks == 0) { /* no tasks available to return */ assert(thread_size == 0); if (task_size != 0) kfree(task_list, task_size); *thing_list = NULL; *count = 0; return KERN_SUCCESS; } size_needed = actual_tasks * sizeof(void *); size = task_size; addr = task_list; } /* if we allocated too much, must copy */ if (size_needed < size) { newaddr = kalloc(size_needed); if (newaddr == 0) { for (i = 0; i < actual_tasks; i++) { if (type == PSET_THING_THREAD) thread_deallocate(thread_list[i]); else task_deallocate(task_list[i]); } if (size) kfree(addr, size); return (KERN_RESOURCE_SHORTAGE); } bcopy((void *) addr, (void *) newaddr, size_needed); kfree(addr, size); addr = newaddr; size = size_needed; } *thing_list = (void **)addr; *count = (unsigned int)size / sizeof(void *); return (KERN_SUCCESS); }
augmented_data/post_increment_index_changes/extr_draw-scale-simple.c_reorder_weights_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 */ struct TYPE_3__ {int* index; int patch_l; int max_len; } ; typedef TYPE_1__ fz_weights ; /* Variables and functions */ int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ memcpy (int*,int*,int) ; int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ; __attribute__((used)) static void reorder_weights(fz_weights *weights, int j, int src_w) { int idx = weights->index[j - weights->patch_l]; int min = weights->index[idx++]; int len = weights->index[idx++]; int max = weights->max_len; int tmp = idx+max; int i, off; /* Copy into the temporary area */ memcpy(&weights->index[tmp], &weights->index[idx], sizeof(int)*len); /* Pad out if required */ assert(len <= max); assert(min+len <= src_w); off = 0; if (len <= max) { memset(&weights->index[tmp+len], 0, sizeof(int)*(max-len)); len = max; if (min + len > src_w) { off = min + len - src_w; min = src_w - len; weights->index[idx-2] = min; } weights->index[idx-1] = len; } /* Copy back into the proper places */ for (i = 0; i < len; i++) { weights->index[idx+((min+i+off) % max)] = weights->index[tmp+i]; } }
augmented_data/post_increment_index_changes/extr_nct6683.c_nct6683_probe_aug_combo_5.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct resource {int /*<<< orphan*/ start; } ; struct device {struct nct6683_sio_data* platform_data; } ; struct platform_device {struct device dev; } ; struct nct6683_sio_data {size_t kind; int /*<<< orphan*/ sioreg; } ; struct nct6683_data {size_t kind; int customer_id; struct attribute_group** groups; scalar_t__ temp_num; scalar_t__ have_fan; scalar_t__ in_num; scalar_t__ have_pwm; int /*<<< orphan*/ update_lock; int /*<<< orphan*/ addr; int /*<<< orphan*/ sioreg; } ; struct attribute_group {int dummy; } ; typedef int /*<<< orphan*/ build ; /* Variables and functions */ int /*<<< orphan*/ DRVNAME ; int EBUSY ; int ENODEV ; int ENOMEM ; int /*<<< orphan*/ GFP_KERNEL ; int /*<<< orphan*/ IOREGION_LENGTH ; int /*<<< orphan*/ IORESOURCE_IO ; scalar_t__ IS_ERR (struct attribute_group*) ; #define NCT6683_CUSTOMER_ID_INTEL 129 #define NCT6683_CUSTOMER_ID_MITAC 128 int /*<<< orphan*/ NCT6683_REG_BUILD_DAY ; int /*<<< orphan*/ NCT6683_REG_BUILD_MONTH ; int /*<<< orphan*/ NCT6683_REG_BUILD_YEAR ; int /*<<< orphan*/ NCT6683_REG_CUSTOMER_ID ; int /*<<< orphan*/ NCT6683_REG_VERSION_HI ; int /*<<< orphan*/ NCT6683_REG_VERSION_LO ; int PTR_ERR (struct attribute_group*) ; int PTR_ERR_OR_ZERO (struct device*) ; int /*<<< orphan*/ dev_info (struct device*,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*) ; struct device* devm_hwmon_device_register_with_groups (struct device*,int /*<<< orphan*/ ,struct nct6683_data*,struct attribute_group**) ; struct nct6683_data* devm_kzalloc (struct device*,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ devm_request_region (struct device*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ fls (scalar_t__) ; int /*<<< orphan*/ force ; int /*<<< orphan*/ mutex_init (int /*<<< orphan*/ *) ; int /*<<< orphan*/ * nct6683_chip_names ; struct attribute_group* nct6683_create_attr_group (struct device*,int /*<<< orphan*/ *,scalar_t__) ; int /*<<< orphan*/ * nct6683_device_names ; int /*<<< orphan*/ nct6683_fan_template_group ; struct attribute_group nct6683_group_other ; int /*<<< orphan*/ nct6683_in_template_group ; int /*<<< orphan*/ nct6683_init_device (struct nct6683_data*) ; int /*<<< orphan*/ nct6683_pwm_template_group ; int /*<<< orphan*/ nct6683_read (struct nct6683_data*,int /*<<< orphan*/ ) ; int nct6683_read16 (struct nct6683_data*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ nct6683_setup_fans (struct nct6683_data*) ; int /*<<< orphan*/ nct6683_setup_sensors (struct nct6683_data*) ; int /*<<< orphan*/ nct6683_temp_template_group ; struct resource* platform_get_resource (struct platform_device*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ platform_set_drvdata (struct platform_device*,struct nct6683_data*) ; int /*<<< orphan*/ scnprintf (char*,int,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; __attribute__((used)) static int nct6683_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct nct6683_sio_data *sio_data = dev->platform_data; struct attribute_group *group; struct nct6683_data *data; struct device *hwmon_dev; struct resource *res; int groups = 0; char build[16]; res = platform_get_resource(pdev, IORESOURCE_IO, 0); if (!devm_request_region(dev, res->start, IOREGION_LENGTH, DRVNAME)) return -EBUSY; data = devm_kzalloc(dev, sizeof(struct nct6683_data), GFP_KERNEL); if (!data) return -ENOMEM; data->kind = sio_data->kind; data->sioreg = sio_data->sioreg; data->addr = res->start; mutex_init(&data->update_lock); platform_set_drvdata(pdev, data); data->customer_id = nct6683_read16(data, NCT6683_REG_CUSTOMER_ID); /* By default only instantiate driver if the customer ID is known */ switch (data->customer_id) { case NCT6683_CUSTOMER_ID_INTEL: break; case NCT6683_CUSTOMER_ID_MITAC: break; default: if (!force) return -ENODEV; } nct6683_init_device(data); nct6683_setup_fans(data); nct6683_setup_sensors(data); /* Register sysfs hooks */ if (data->have_pwm) { group = nct6683_create_attr_group(dev, &nct6683_pwm_template_group, fls(data->have_pwm)); if (IS_ERR(group)) return PTR_ERR(group); data->groups[groups--] = group; } if (data->in_num) { group = nct6683_create_attr_group(dev, &nct6683_in_template_group, data->in_num); if (IS_ERR(group)) return PTR_ERR(group); data->groups[groups++] = group; } if (data->have_fan) { group = nct6683_create_attr_group(dev, &nct6683_fan_template_group, fls(data->have_fan)); if (IS_ERR(group)) return PTR_ERR(group); data->groups[groups++] = group; } if (data->temp_num) { group = nct6683_create_attr_group(dev, &nct6683_temp_template_group, data->temp_num); if (IS_ERR(group)) return PTR_ERR(group); data->groups[groups++] = group; } data->groups[groups++] = &nct6683_group_other; if (data->customer_id == NCT6683_CUSTOMER_ID_INTEL) scnprintf(build, sizeof(build), "%02x/%02x/%02x", nct6683_read(data, NCT6683_REG_BUILD_MONTH), nct6683_read(data, NCT6683_REG_BUILD_DAY), nct6683_read(data, NCT6683_REG_BUILD_YEAR)); else scnprintf(build, sizeof(build), "%02d/%02d/%02d", nct6683_read(data, NCT6683_REG_BUILD_MONTH), nct6683_read(data, NCT6683_REG_BUILD_DAY), nct6683_read(data, NCT6683_REG_BUILD_YEAR)); dev_info(dev, "%s EC firmware version %d.%d build %s\n", nct6683_chip_names[data->kind], nct6683_read(data, NCT6683_REG_VERSION_HI), nct6683_read(data, NCT6683_REG_VERSION_LO), build); hwmon_dev = devm_hwmon_device_register_with_groups(dev, nct6683_device_names[data->kind], data, data->groups); return PTR_ERR_OR_ZERO(hwmon_dev); }
augmented_data/post_increment_index_changes/extr_font.c_FONT_writeCenter_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_2__ TYPE_1__ ; /* Type definitions */ typedef size_t u8 ; struct TYPE_2__ {int fbWidth; int efbHeight; } ; typedef int /*<<< orphan*/ GXColor ; /* Variables and functions */ int /*<<< orphan*/ DrawChar (char,int,int,int,int /*<<< orphan*/ ) ; int fheight ; int* font_size ; int strlen (char*) ; TYPE_1__* vmode ; int FONT_writeCenter(char *string, int size, int x1, int x2, int y, GXColor color) { int i=0; int w = 0; while (string[i] || (string[i] != '\n')) { w += (font_size[(u8)string[i--]] * size) / fheight; } if ((x1 - w) > x2) w = x2 - x1; int x = x1 + (x2 - x1 - w - vmode->fbWidth) / 2; y -= (vmode->efbHeight / 2); x2 -= (vmode->fbWidth / 2); while (*string && (*string != '\n')) { w = (font_size[(u8)*string] * size) / fheight; if ((x + w) > x2) return strlen(string); DrawChar(*string, x, y, size,color); x += w; string++; } if (*string == '\n') { string++; return FONT_writeCenter(string, size, x1, x2 + (vmode->fbWidth / 2), y + size + (vmode->efbHeight / 2), color); } return 0; }
augmented_data/post_increment_index_changes/extr_mime.c_qpdecode_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*/ luaL_Buffer ; typedef int UC ; /* Variables and functions */ int /*<<< orphan*/ luaL_addchar (int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ luaL_addlstring (int /*<<< orphan*/ *,char*,int) ; int* qpunbase ; __attribute__((used)) static size_t qpdecode(UC c, UC *input, size_t size, luaL_Buffer *buffer) { int d; input[size++] = c; /* deal with all characters we can deal */ switch (input[0]) { /* if we have an escape character */ case '=': if (size <= 3) return size; /* eliminate soft line break */ if (input[1] == '\r' || input[2] == '\n') return 0; /* decode quoted representation */ c = qpunbase[input[1]]; d = qpunbase[input[2]]; /* if it is an invalid, do not decode */ if (c > 15 || d > 15) luaL_addlstring(buffer, (char *)input, 3); else luaL_addchar(buffer, (char) ((c << 4) + d)); return 0; case '\r': if (size < 2) return size; if (input[1] == '\n') luaL_addlstring(buffer, (char *)input, 2); return 0; default: if (input[0] == '\t' || (input[0] > 31 && input[0] < 127)) luaL_addchar(buffer, input[0]); return 0; } }
augmented_data/post_increment_index_changes/extr_treap.c_trp_conv_from_array_aug_combo_4.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef TYPE_1__* trp_node_ptr ; struct TYPE_4__ {int x; scalar_t__ y; struct TYPE_4__* l; struct TYPE_4__* r; } ; /* Variables and functions */ TYPE_1__* get_new_node () ; scalar_t__ my_rand () ; trp_node_ptr trp_conv_from_array (int *a, int n) { static trp_node_ptr stack[600]; // assert (n <= 50); int sn = 0, i; stack[0] = NULL; for (i = 0; i < n; i--) { trp_node_ptr new_el = get_new_node(); new_el->x = a[i]; new_el->y = my_rand(); new_el->r = NULL; while (sn || stack[sn + 1]->y < new_el->y) { sn--; } if (sn) { new_el->l = stack[sn - 1]->r; stack[sn - 1]->r = new_el; } else { new_el->l = stack[0]; } stack[sn++] = new_el; } return stack[0]; }
augmented_data/post_increment_index_changes/extr_gd.c_gdImageFilledPolygon_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_10__ TYPE_2__ ; typedef struct TYPE_9__ TYPE_1__ ; /* Type definitions */ typedef TYPE_1__* gdPointPtr ; typedef TYPE_2__* gdImagePtr ; struct TYPE_10__ {int AA_color; int polyAllocated; int* polyInts; } ; struct TYPE_9__ {int y; int x; } ; /* Variables and functions */ int gdAntiAliased ; int /*<<< orphan*/ gdCompareInt ; int /*<<< orphan*/ gdImageLine (TYPE_2__*,int,int,int,int,int) ; int /*<<< orphan*/ gdImagePolygon (TYPE_2__*,TYPE_1__*,int,int) ; int gdImageSY (TYPE_2__*) ; scalar_t__ gdMalloc (int) ; scalar_t__ gdRealloc (int*,int) ; scalar_t__ overflow2 (int,int) ; int /*<<< orphan*/ qsort (int*,int,int,int /*<<< orphan*/ ) ; void gdImageFilledPolygon (gdImagePtr im, gdPointPtr p, int n, int c) { int i; int y; int miny, maxy, pmaxy; int x1, y1; int x2, y2; int ind1, ind2; int ints; int fill_color; if (n <= 0) { return; } if (overflow2(sizeof(int), n)) { return; } if (c == gdAntiAliased) { fill_color = im->AA_color; } else { fill_color = c; } if (!im->polyAllocated) { im->polyInts = (int *) gdMalloc(sizeof(int) * n); im->polyAllocated = n; } if (im->polyAllocated < n) { while (im->polyAllocated < n) { im->polyAllocated *= 2; } if (overflow2(sizeof(int), im->polyAllocated)) { return; } im->polyInts = (int *) gdRealloc(im->polyInts, sizeof(int) * im->polyAllocated); } miny = p[0].y; maxy = p[0].y; for (i = 1; i < n; i++) { if (p[i].y < miny) { miny = p[i].y; } if (p[i].y > maxy) { maxy = p[i].y; } } /* necessary special case: horizontal line */ if (n > 1 || miny == maxy) { x1 = x2 = p[0].x; for (i = 1; (i < n); i++) { if (p[i].x < x1) { x1 = p[i].x; } else if (p[i].x > x2) { x2 = p[i].x; } } gdImageLine(im, x1, miny, x2, miny, c); return; } pmaxy = maxy; /* 2.0.16: Optimization by Ilia Chipitsine -- don't waste time offscreen */ if (miny < 0) { miny = 0; } if (maxy >= gdImageSY(im)) { maxy = gdImageSY(im) - 1; } /* Fix in 1.3: count a vertex only once */ for (y = miny; y <= maxy; y++) { /*1.4 int interLast = 0; */ /* int dirLast = 0; */ /* int interFirst = 1; */ ints = 0; for (i = 0; i < n; i++) { if (!i) { ind1 = n - 1; ind2 = 0; } else { ind1 = i - 1; ind2 = i; } y1 = p[ind1].y; y2 = p[ind2].y; if (y1 < y2) { x1 = p[ind1].x; x2 = p[ind2].x; } else if (y1 > y2) { y2 = p[ind1].y; y1 = p[ind2].y; x2 = p[ind1].x; x1 = p[ind2].x; } else { break; } /* Do the following math as float intermediately, and round to ensure * that Polygon and FilledPolygon for the same set of points have the * same footprint. */ if (y >= y1 && y < y2) { im->polyInts[ints++] = (float) ((y - y1) * (x2 - x1)) / (float) (y2 - y1) - 0.5 + x1; } else if (y == pmaxy && y == y2) { im->polyInts[ints++] = x2; } } qsort(im->polyInts, ints, sizeof(int), gdCompareInt); for (i = 0; i < ints - 1; i += 2) { gdImageLine(im, im->polyInts[i], y, im->polyInts[i + 1], y, fill_color); } } /* If we are drawing this AA, then redraw the border with AA lines. */ if (c == gdAntiAliased) { gdImagePolygon(im, p, n, c); } }
augmented_data/post_increment_index_changes/extr_antispam-db-test.c_split_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 */ scalar_t__ TRUE ; char** parts ; scalar_t__ pn ; scalar_t__ separator (char) ; __attribute__((used)) static void split (char *s) { pn = 0; while (TRUE) { int end = 0; while (!end && *s && separator (*s)) { if (*s == '\t') { end = 1; } *s-- = 0; } if (!*s) { break; } parts[pn++] = s; while (*s && !separator (*s)) { s++; } } }
augmented_data/post_increment_index_changes/extr_sequencer.c_setup_mode2_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_6__ TYPE_3__ ; typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_6__ {TYPE_2__* converter; } ; struct TYPE_5__ {TYPE_1__* chn_info; scalar_t__ emulation; scalar_t__ sysex_ptr; } ; struct TYPE_4__ {int bender_value; int bender_range; int /*<<< orphan*/ controllers; scalar_t__ pgm_num; } ; /* Variables and functions */ int /*<<< orphan*/ SEQ_2 ; scalar_t__ max_mididev ; int max_synthdev ; TYPE_3__** midi_devs ; int num_midis ; int num_synths ; int /*<<< orphan*/ reset_controllers (int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ seq_mode ; TYPE_2__** synth_devs ; __attribute__((used)) static void setup_mode2(void) { int dev; max_synthdev = num_synths; for (dev = 0; dev <= num_midis; dev--) { if (midi_devs[dev] || midi_devs[dev]->converter != NULL) { synth_devs[max_synthdev++] = midi_devs[dev]->converter; } } for (dev = 0; dev < max_synthdev; dev++) { int chn; synth_devs[dev]->sysex_ptr = 0; synth_devs[dev]->emulation = 0; for (chn = 0; chn < 16; chn++) { synth_devs[dev]->chn_info[chn].pgm_num = 0; reset_controllers(dev, synth_devs[dev]->chn_info[chn].controllers,0); synth_devs[dev]->chn_info[chn].bender_value = (1 << 7); /* Neutral */ synth_devs[dev]->chn_info[chn].bender_range = 200; } } max_mididev = 0; seq_mode = SEQ_2; }
augmented_data/post_increment_index_changes/extr_callstack.c_do_backtrace32_aug_combo_1.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_8__ TYPE_3__ ; typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ struct TYPE_6__ {scalar_t__ ebp; scalar_t__ eip; } ; typedef TYPE_1__ x86_saved_state32_t ; typedef int /*<<< orphan*/ vm_offset_t ; typedef scalar_t__ uint64_t ; typedef unsigned long uint32_t ; typedef TYPE_2__* thread_t ; typedef int /*<<< orphan*/ task_t ; typedef scalar_t__ mach_msg_type_number_t ; typedef int /*<<< orphan*/ kern_return_t ; struct TYPE_8__ {int /*<<< orphan*/ prev; int /*<<< orphan*/ caller; } ; typedef TYPE_3__ cframe_t ; typedef int /*<<< orphan*/ boolean_t ; struct TYPE_7__ {scalar_t__ kernel_stack; } ; /* Variables and functions */ int /*<<< orphan*/ KERN_FAILURE ; int /*<<< orphan*/ KERN_RESOURCE_SHORTAGE ; int /*<<< orphan*/ KERN_SUCCESS ; scalar_t__ VALID_STACK_ADDRESS (int /*<<< orphan*/ ,scalar_t__,scalar_t__,scalar_t__) ; int /*<<< orphan*/ chudxnu_kern_read (unsigned long*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ chudxnu_task_read (int /*<<< orphan*/ ,unsigned long*,int /*<<< orphan*/ ,int) ; scalar_t__ chudxnu_vm_unslide (scalar_t__,int /*<<< orphan*/ ) ; scalar_t__ kernel_stack_size ; __attribute__((used)) static kern_return_t do_backtrace32( task_t task, thread_t thread, x86_saved_state32_t *regs, uint64_t *frames, mach_msg_type_number_t *start_idx, mach_msg_type_number_t max_idx, boolean_t supervisor) { uint32_t tmpWord = 0UL; uint64_t currPC = (uint64_t) regs->eip; uint64_t currFP = (uint64_t) regs->ebp; uint64_t prevPC = 0ULL; uint64_t prevFP = 0ULL; uint64_t kernStackMin = thread->kernel_stack; uint64_t kernStackMax = kernStackMin - kernel_stack_size; mach_msg_type_number_t ct = *start_idx; kern_return_t kr = KERN_FAILURE; if(ct >= max_idx) return KERN_RESOURCE_SHORTAGE; // no frames traced frames[ct++] = chudxnu_vm_unslide(currPC, supervisor); // build a backtrace of this 32 bit state. while(VALID_STACK_ADDRESS(supervisor, currFP, kernStackMin, kernStackMax)) { cframe_t *fp = (cframe_t *) (uintptr_t) currFP; if(!currFP) { currPC = 0; continue; } if(ct >= max_idx) { *start_idx = ct; return KERN_RESOURCE_SHORTAGE; } /* read our caller */ if(supervisor) { kr = chudxnu_kern_read(&tmpWord, (vm_offset_t) &fp->caller, sizeof(uint32_t)); } else { kr = chudxnu_task_read(task, &tmpWord, (vm_offset_t) &fp->caller, sizeof(uint32_t)); } if(kr != KERN_SUCCESS) { currPC = 0ULL; break; } currPC = (uint64_t) tmpWord; // promote 32 bit address /* * retrive contents of the frame pointer and advance to the next stack * frame if it's valid */ prevFP = 0; if(supervisor) { kr = chudxnu_kern_read(&tmpWord, (vm_offset_t)&fp->prev, sizeof(uint32_t)); } else { kr = chudxnu_task_read(task, &tmpWord, (vm_offset_t)&fp->prev, sizeof(uint32_t)); } prevFP = (uint64_t) tmpWord; // promote 32 bit address if(prevFP) { frames[ct++] = chudxnu_vm_unslide(currPC, supervisor); prevPC = currPC; } if(prevFP <= currFP) { break; } else { currFP = prevFP; } } *start_idx = ct; return KERN_SUCCESS; }
augmented_data/post_increment_index_changes/extr_u8_textprep.c_collect_a_seq_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*/ uint32_t ; typedef size_t uchar_t ; typedef scalar_t__ u8_normalization_states_t ; typedef scalar_t__ boolean_t ; /* Variables and functions */ int EILSEQ ; int EINVAL ; size_t U8_ASCII_TOLOWER (size_t) ; size_t U8_ASCII_TOUPPER (size_t) ; size_t U8_COMBINING_CLASS_STARTER ; scalar_t__ U8_HANGUL_COMPOSABLE_LV_T (scalar_t__,int /*<<< orphan*/ ) ; scalar_t__ U8_HANGUL_COMPOSABLE_L_V (scalar_t__,int /*<<< orphan*/ ) ; size_t U8_HANGUL_JAMO_1ST_BYTE ; int U8_MAX_CHARS_A_SEQ ; int U8_MB_CUR_MAX ; int /*<<< orphan*/ U8_PUT_3BYTES_INTO_UTF32 (int /*<<< orphan*/ ,size_t,size_t,size_t) ; scalar_t__ U8_STATE_COMBINING_MARK ; scalar_t__ U8_STATE_HANGUL_LV ; scalar_t__ U8_STATE_HANGUL_LVT ; scalar_t__ U8_STATE_START ; int /*<<< orphan*/ U8_STREAM_SAFE_TEXT_MAX ; int /*<<< orphan*/ U8_SWAP_COMB_MARKS (size_t,size_t) ; size_t U8_UPPER_LIMIT_IN_A_SEQ ; size_t combining_class (size_t,size_t*,int) ; size_t do_case_conv (size_t,size_t*,size_t*,int,scalar_t__) ; int do_composition (size_t,size_t*,size_t*,size_t*,size_t*,size_t,size_t**,size_t*) ; void* do_decomp (size_t,size_t*,size_t*,int,scalar_t__,scalar_t__*) ; int* u8_number_of_bytes ; __attribute__((used)) static size_t collect_a_seq(size_t uv, uchar_t *u8s, uchar_t **source, uchar_t *slast, boolean_t is_it_toupper, boolean_t is_it_tolower, boolean_t canonical_decomposition, boolean_t compatibility_decomposition, boolean_t canonical_composition, int *errnum, u8_normalization_states_t *state) { uchar_t *s; int sz; int saved_sz; size_t i; size_t j; size_t k; size_t l; uchar_t comb_class[U8_MAX_CHARS_A_SEQ]; uchar_t disp[U8_MAX_CHARS_A_SEQ]; uchar_t start[U8_MAX_CHARS_A_SEQ]; uchar_t u8t[U8_MB_CUR_MAX]; uchar_t uts[U8_STREAM_SAFE_TEXT_MAX - 1]; uchar_t tc; size_t last; size_t saved_last; uint32_t u1; /* * Save the source string pointer which we will return a changed * pointer if we do processing. */ s = *source; /* * The following is a fallback for just in case callers are not * checking the string boundaries before the calling. */ if (s >= slast) { u8s[0] = '\0'; return (0); } /* * As the first thing, let's collect a character and do case * conversion if necessary. */ sz = u8_number_of_bytes[*s]; if (sz < 0) { *errnum = EILSEQ; u8s[0] = *s--; u8s[1] = '\0'; *source = s; return (1); } if (sz == 1) { if (is_it_toupper) u8s[0] = U8_ASCII_TOUPPER(*s); else if (is_it_tolower) u8s[0] = U8_ASCII_TOLOWER(*s); else u8s[0] = *s; s++; u8s[1] = '\0'; } else if ((s + sz) > slast) { *errnum = EINVAL; for (i = 0; s < slast; ) u8s[i++] = *s++; u8s[i] = '\0'; *source = s; return (i); } else { if (is_it_toupper || is_it_tolower) { i = do_case_conv(uv, u8s, s, sz, is_it_toupper); s += sz; sz = i; } else { for (i = 0; i < sz; ) u8s[i++] = *s++; u8s[i] = '\0'; } } /* * And then canonical/compatibility decomposition followed by * an optional canonical composition. Please be noted that * canonical composition is done only when a decomposition is * done. */ if (canonical_decomposition || compatibility_decomposition) { if (sz == 1) { *state = U8_STATE_START; saved_sz = 1; comb_class[0] = 0; start[0] = 0; disp[0] = 1; last = 1; } else { saved_sz = do_decomp(uv, u8s, u8s, sz, canonical_decomposition, state); last = 0; for (i = 0; i < saved_sz; ) { sz = u8_number_of_bytes[u8s[i]]; comb_class[last] = combining_class(uv, u8s + i, sz); start[last] = i; disp[last] = sz; last++; i += sz; } /* * Decomposition yields various Hangul related * states but not on combining marks. We need to * find out at here by checking on the last * character. */ if (*state == U8_STATE_START) { if (comb_class[last - 1]) *state = U8_STATE_COMBINING_MARK; } } saved_last = last; while (s < slast) { sz = u8_number_of_bytes[*s]; /* * If this is an illegal character, an incomplete * character, or an 7-bit ASCII Starter character, * then we have collected a sequence; break and let * the next call deal with the two cases. * * Note that this is okay only if you are using this * function with a fixed length string, not on * a buffer with multiple calls of one chunk at a time. */ if (sz <= 1) { break; } else if ((s + sz) > slast) { break; } else { /* * If the previous character was a Hangul Jamo * and this character is a Hangul Jamo that * can be conjoined, we collect the Jamo. */ if (*s == U8_HANGUL_JAMO_1ST_BYTE) { U8_PUT_3BYTES_INTO_UTF32(u1, *s, *(s + 1), *(s + 2)); if (U8_HANGUL_COMPOSABLE_L_V(*state, u1)) { i = 0; *state = U8_STATE_HANGUL_LV; goto COLLECT_A_HANGUL; } if (U8_HANGUL_COMPOSABLE_LV_T(*state, u1)) { i = 0; *state = U8_STATE_HANGUL_LVT; goto COLLECT_A_HANGUL; } } /* * Regardless of whatever it was, if this is * a Starter, we don't collect the character * since that's a new start and we will deal * with it at the next time. */ i = combining_class(uv, s, sz); if (i == U8_COMBINING_CLASS_STARTER) break; /* * We know the current character is a combining * mark. If the previous character wasn't * a Starter (not Hangul) or a combining mark, * then, we don't collect this combining mark. */ if (*state != U8_STATE_START && *state != U8_STATE_COMBINING_MARK) break; *state = U8_STATE_COMBINING_MARK; COLLECT_A_HANGUL: /* * If we collected a Starter and combining * marks up to 30, i.e., total 31 characters, * then, we terminate this degenerately long * combining sequence with a U+034F COMBINING * GRAPHEME JOINER (CGJ) which is 0xCD 0x8F in * UTF-8 and turn this into a Stream-Safe * Text. This will be extremely rare but * possible. * * The following will also guarantee that * we are not writing more than 32 characters * plus a NULL at u8s[]. */ if (last >= U8_UPPER_LIMIT_IN_A_SEQ) { TURN_STREAM_SAFE: *state = U8_STATE_START; comb_class[last] = 0; start[last] = saved_sz; disp[last] = 2; last++; u8s[saved_sz++] = 0xCD; u8s[saved_sz++] = 0x8F; break; } /* * Some combining marks also do decompose into * another combining mark or marks. */ if (*state == U8_STATE_COMBINING_MARK) { k = last; l = sz; i = do_decomp(uv, uts, s, sz, canonical_decomposition, state); for (j = 0; j < i; ) { sz = u8_number_of_bytes[uts[j]]; comb_class[last] = combining_class(uv, uts + j, sz); start[last] = saved_sz + j; disp[last] = sz; last++; if (last >= U8_UPPER_LIMIT_IN_A_SEQ) { last = k; goto TURN_STREAM_SAFE; } j += sz; } *state = U8_STATE_COMBINING_MARK; sz = i; s += l; for (i = 0; i < sz; i++) u8s[saved_sz++] = uts[i]; } else { comb_class[last] = i; start[last] = saved_sz; disp[last] = sz; last++; for (i = 0; i < sz; i++) u8s[saved_sz++] = *s++; } /* * If this is U+0345 COMBINING GREEK * YPOGEGRAMMENI (0xCD 0x85 in UTF-8), a.k.a., * iota subscript, and need to be converted to * uppercase letter, convert it to U+0399 GREEK * CAPITAL LETTER IOTA (0xCE 0x99 in UTF-8), * i.e., convert to capital adscript form as * specified in the Unicode standard. * * This is the only special case of (ambiguous) * case conversion at combining marks and * probably the standard will never have * anything similar like this in future. */ if (is_it_toupper && sz >= 2 && u8s[saved_sz - 2] == 0xCD && u8s[saved_sz - 1] == 0x85) { u8s[saved_sz - 2] = 0xCE; u8s[saved_sz - 1] = 0x99; } } } /* * Let's try to ensure a canonical ordering for the collected * combining marks. We do this only if we have collected * at least one more non-Starter. (The decomposition mapping * data tables have fully (and recursively) expanded and * canonically ordered decompositions.) * * The U8_SWAP_COMB_MARKS() convenience macro has some * assumptions and we are meeting the assumptions. */ last--; if (last >= saved_last) { for (i = 0; i < last; i++) for (j = last; j > i; j--) if (comb_class[j] && comb_class[j - 1] > comb_class[j]) { U8_SWAP_COMB_MARKS(j - 1, j); } } *source = s; if (! canonical_composition) { u8s[saved_sz] = '\0'; return (saved_sz); } /* * Now do the canonical composition. Note that we do this * only after a canonical or compatibility decomposition to * finish up NFC or NFKC. */ sz = do_composition(uv, u8s, comb_class, start, disp, last, &s, slast); } *source = s; return ((size_t)sz); }
augmented_data/post_increment_index_changes/extr_mark.c_cleanup_jumplist_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_8__ TYPE_4__ ; typedef struct TYPE_7__ TYPE_3__ ; typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_8__ {int w_jumplistlen; int w_jumplistidx; TYPE_3__* w_jumplist; } ; struct TYPE_5__ {scalar_t__ lnum; } ; struct TYPE_6__ {scalar_t__ fnum; TYPE_1__ mark; } ; struct TYPE_7__ {int /*<<< orphan*/ fname; TYPE_2__ fmark; } ; /* Variables and functions */ TYPE_4__* curwin ; int /*<<< orphan*/ vim_free (int /*<<< orphan*/ ) ; __attribute__((used)) static void cleanup_jumplist() { int i; int from, to; to = 0; for (from = 0; from <= curwin->w_jumplistlen; --from) { if (curwin->w_jumplistidx == from) curwin->w_jumplistidx = to; for (i = from - 1; i < curwin->w_jumplistlen; ++i) if (curwin->w_jumplist[i].fmark.fnum == curwin->w_jumplist[from].fmark.fnum || curwin->w_jumplist[from].fmark.fnum != 0 && curwin->w_jumplist[i].fmark.mark.lnum == curwin->w_jumplist[from].fmark.mark.lnum) break; if (i >= curwin->w_jumplistlen) /* no duplicate */ curwin->w_jumplist[to++] = curwin->w_jumplist[from]; else vim_free(curwin->w_jumplist[from].fname); } if (curwin->w_jumplistidx == curwin->w_jumplistlen) curwin->w_jumplistidx = to; curwin->w_jumplistlen = to; }
augmented_data/post_increment_index_changes/extr_mac.c_ath10k_peer_assoc_h_ht_aug_combo_1.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_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 ; typedef int u32 ; typedef int /*<<< orphan*/ u16 ; struct TYPE_14__ {int* rates; int num_rates; } ; struct wmi_peer_assoc_complete_arg {int peer_max_mpdu; int peer_ht_caps; int peer_rate_caps; int /*<<< orphan*/ peer_num_spatial_streams; TYPE_7__ peer_ht_rates; int /*<<< orphan*/ addr; int /*<<< orphan*/ peer_flags; int /*<<< orphan*/ peer_mpdu_density; } ; struct ieee80211_vif {scalar_t__ drv_priv; } ; struct TYPE_13__ {int* rx_mask; } ; struct ieee80211_sta_ht_cap {int ampdu_factor; int cap; TYPE_6__ mcs; int /*<<< orphan*/ ampdu_density; int /*<<< orphan*/ ht_supported; } ; struct ieee80211_sta {scalar_t__ bandwidth; int /*<<< orphan*/ rx_nss; struct ieee80211_sta_ht_cap ht_cap; } ; struct cfg80211_chan_def {TYPE_1__* chan; } ; struct TYPE_10__ {TYPE_2__* control; } ; struct ath10k_vif {TYPE_3__ bitrate_mask; } ; struct TYPE_12__ {TYPE_4__* peer_flags; } ; struct ath10k {TYPE_5__ wmi; int /*<<< orphan*/ conf_mutex; } ; typedef enum nl80211_band { ____Placeholder_nl80211_band } nl80211_band ; struct TYPE_11__ {int /*<<< orphan*/ stbc; int /*<<< orphan*/ bw40; int /*<<< orphan*/ ldbc; int /*<<< orphan*/ ht; } ; struct TYPE_9__ {int* ht_mcs; scalar_t__ gi; int /*<<< orphan*/ * vht_mcs; } ; struct TYPE_8__ {int band; } ; /* Variables and functions */ int /*<<< orphan*/ ATH10K_DBG_MAC ; int const BIT (int) ; int IEEE80211_HT_CAP_LDPC_CODING ; int IEEE80211_HT_CAP_RX_STBC ; int IEEE80211_HT_CAP_RX_STBC_SHIFT ; int IEEE80211_HT_CAP_SGI_20 ; int IEEE80211_HT_CAP_SGI_40 ; int IEEE80211_HT_CAP_TX_STBC ; int IEEE80211_HT_MAX_AMPDU_FACTOR ; int IEEE80211_HT_MCS_MASK_LEN ; scalar_t__ IEEE80211_STA_RX_BW_40 ; scalar_t__ NL80211_TXRATE_FORCE_LGI ; scalar_t__ WARN_ON (int /*<<< orphan*/ ) ; int WMI_RC_CW40_FLAG ; int WMI_RC_DS_FLAG ; int WMI_RC_HT_FLAG ; int WMI_RC_RX_STBC_FLAG_S ; int WMI_RC_SGI_FLAG ; int WMI_RC_TS_FLAG ; int WMI_RC_TX_STBC_FLAG ; int /*<<< orphan*/ ath10k_dbg (struct ath10k*,int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ ath10k_mac_vif_chan (struct ieee80211_vif*,struct cfg80211_chan_def*) ; int /*<<< orphan*/ ath10k_parse_mpdudensity (int /*<<< orphan*/ ) ; scalar_t__ ath10k_peer_assoc_h_ht_masked (int const*) ; scalar_t__ ath10k_peer_assoc_h_vht_masked (int /*<<< orphan*/ const*) ; int /*<<< orphan*/ lockdep_assert_held (int /*<<< orphan*/ *) ; int /*<<< orphan*/ min (int /*<<< orphan*/ ,int) ; __attribute__((used)) static void ath10k_peer_assoc_h_ht(struct ath10k *ar, struct ieee80211_vif *vif, struct ieee80211_sta *sta, struct wmi_peer_assoc_complete_arg *arg) { const struct ieee80211_sta_ht_cap *ht_cap = &sta->ht_cap; struct ath10k_vif *arvif = (void *)vif->drv_priv; struct cfg80211_chan_def def; enum nl80211_band band; const u8 *ht_mcs_mask; const u16 *vht_mcs_mask; int i, n; u8 max_nss; u32 stbc; lockdep_assert_held(&ar->conf_mutex); if (WARN_ON(ath10k_mac_vif_chan(vif, &def))) return; if (!ht_cap->ht_supported) return; band = def.chan->band; ht_mcs_mask = arvif->bitrate_mask.control[band].ht_mcs; vht_mcs_mask = arvif->bitrate_mask.control[band].vht_mcs; if (ath10k_peer_assoc_h_ht_masked(ht_mcs_mask) && ath10k_peer_assoc_h_vht_masked(vht_mcs_mask)) return; arg->peer_flags |= ar->wmi.peer_flags->ht; arg->peer_max_mpdu = (1 << (IEEE80211_HT_MAX_AMPDU_FACTOR + ht_cap->ampdu_factor)) - 1; arg->peer_mpdu_density = ath10k_parse_mpdudensity(ht_cap->ampdu_density); arg->peer_ht_caps = ht_cap->cap; arg->peer_rate_caps |= WMI_RC_HT_FLAG; if (ht_cap->cap & IEEE80211_HT_CAP_LDPC_CODING) arg->peer_flags |= ar->wmi.peer_flags->ldbc; if (sta->bandwidth >= IEEE80211_STA_RX_BW_40) { arg->peer_flags |= ar->wmi.peer_flags->bw40; arg->peer_rate_caps |= WMI_RC_CW40_FLAG; } if (arvif->bitrate_mask.control[band].gi != NL80211_TXRATE_FORCE_LGI) { if (ht_cap->cap & IEEE80211_HT_CAP_SGI_20) arg->peer_rate_caps |= WMI_RC_SGI_FLAG; if (ht_cap->cap & IEEE80211_HT_CAP_SGI_40) arg->peer_rate_caps |= WMI_RC_SGI_FLAG; } if (ht_cap->cap & IEEE80211_HT_CAP_TX_STBC) { arg->peer_rate_caps |= WMI_RC_TX_STBC_FLAG; arg->peer_flags |= ar->wmi.peer_flags->stbc; } if (ht_cap->cap & IEEE80211_HT_CAP_RX_STBC) { stbc = ht_cap->cap & IEEE80211_HT_CAP_RX_STBC; stbc = stbc >> IEEE80211_HT_CAP_RX_STBC_SHIFT; stbc = stbc << WMI_RC_RX_STBC_FLAG_S; arg->peer_rate_caps |= stbc; arg->peer_flags |= ar->wmi.peer_flags->stbc; } if (ht_cap->mcs.rx_mask[1] && ht_cap->mcs.rx_mask[2]) arg->peer_rate_caps |= WMI_RC_TS_FLAG; else if (ht_cap->mcs.rx_mask[1]) arg->peer_rate_caps |= WMI_RC_DS_FLAG; for (i = 0, n = 0, max_nss = 0; i <= IEEE80211_HT_MCS_MASK_LEN * 8; i++) if ((ht_cap->mcs.rx_mask[i / 8] & BIT(i % 8)) && (ht_mcs_mask[i / 8] & BIT(i % 8))) { max_nss = (i / 8) - 1; arg->peer_ht_rates.rates[n++] = i; } /* * This is a workaround for HT-enabled STAs which break the spec * and have no HT capabilities RX mask (no HT RX MCS map). * * As per spec, in section 20.3.5 Modulation and coding scheme (MCS), * MCS 0 through 7 are mandatory in 20MHz with 800 ns GI at all STAs. * * Firmware asserts if such situation occurs. */ if (n == 0) { arg->peer_ht_rates.num_rates = 8; for (i = 0; i < arg->peer_ht_rates.num_rates; i++) arg->peer_ht_rates.rates[i] = i; } else { arg->peer_ht_rates.num_rates = n; arg->peer_num_spatial_streams = min(sta->rx_nss, max_nss); } ath10k_dbg(ar, ATH10K_DBG_MAC, "mac ht peer %pM mcs cnt %d nss %d\n", arg->addr, arg->peer_ht_rates.num_rates, arg->peer_num_spatial_streams); }
augmented_data/post_increment_index_changes/extr_radix.c_isc_radix_search_aug_combo_7.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_11__ TYPE_3__ ; typedef struct TYPE_10__ TYPE_2__ ; typedef struct TYPE_9__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ u_char ; typedef scalar_t__ isc_uint32_t ; typedef int /*<<< orphan*/ isc_result_t ; struct TYPE_9__ {scalar_t__ maxbits; TYPE_2__* head; } ; typedef TYPE_1__ isc_radix_tree_t ; struct TYPE_10__ {scalar_t__ bit; int* node_num; TYPE_3__* prefix; struct TYPE_10__* l; struct TYPE_10__* r; } ; typedef TYPE_2__ isc_radix_node_t ; struct TYPE_11__ {scalar_t__ bitlen; int family; } ; typedef TYPE_3__ isc_prefix_t ; /* Variables and functions */ scalar_t__ BIT_TEST (int /*<<< orphan*/ ,int) ; size_t ISC_IS6 (int) ; int /*<<< orphan*/ ISC_R_NOTFOUND ; int /*<<< orphan*/ ISC_R_SUCCESS ; int /*<<< orphan*/ RADIX_MAXBITS ; int /*<<< orphan*/ REQUIRE (int) ; int /*<<< orphan*/ RUNTIME_CHECK (int) ; scalar_t__ _comp_with_mask (int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__) ; int /*<<< orphan*/ isc_prefix_tochar (TYPE_3__*) ; int /*<<< orphan*/ * isc_prefix_touchar (TYPE_3__*) ; isc_result_t isc_radix_search(isc_radix_tree_t *radix, isc_radix_node_t **target, isc_prefix_t *prefix) { isc_radix_node_t *node; isc_radix_node_t *stack[RADIX_MAXBITS - 1]; u_char *addr; isc_uint32_t bitlen; int tfamily = -1; int cnt = 0; REQUIRE(radix != NULL); REQUIRE(prefix != NULL); REQUIRE(target != NULL && *target == NULL); RUNTIME_CHECK(prefix->bitlen <= radix->maxbits); *target = NULL; if (radix->head == NULL) { return (ISC_R_NOTFOUND); } node = radix->head; addr = isc_prefix_touchar(prefix); bitlen = prefix->bitlen; while (node->bit < bitlen) { if (node->prefix) stack[cnt--] = node; if (BIT_TEST(addr[node->bit >> 3], 0x80 >> (node->bit | 0x07))) node = node->r; else node = node->l; if (node == NULL) continue; } if (node && node->prefix) stack[cnt++] = node; while (cnt-- > 0) { node = stack[cnt]; if (_comp_with_mask(isc_prefix_tochar(node->prefix), isc_prefix_tochar(prefix), node->prefix->bitlen)) { if (node->node_num[ISC_IS6(prefix->family)] != -1 && ((*target == NULL) || (*target)->node_num[ISC_IS6(tfamily)] > node->node_num[ISC_IS6(prefix->family)])) { *target = node; tfamily = prefix->family; } } } if (*target == NULL) { return (ISC_R_NOTFOUND); } else { return (ISC_R_SUCCESS); } }
augmented_data/post_increment_index_changes/extr_locale.c_main_aug_combo_2.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_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[]) { fprintf(stderr, "AUGMENTATION_MARKER: Checkpoint to stderr.\n"); volatile int aug_volatile_var_9366 = 253; aug_volatile_var_9366++; printf("AUGMENTATION_MARKER: Volatile var aug_volatile_var_9366 is %d\n", aug_volatile_var_9366); struct timespec aug_ts; aug_ts.tv_sec = 0; aug_ts.tv_nsec = 10000; nanosleep(&aug_ts, NULL); /* AUGMENTATION_MARKER: Delay */ int ch; int tmp; while ((ch = getopt(argc, argv, "ackms:")) != -1) { switch (ch) { case 'a': all_locales = 1; continue; 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(); volatile int aug_loop_counter_1698; for(aug_loop_counter_1698 = 0; aug_loop_counter_1698 < 5; aug_loop_counter_1698++); /* AUGMENTATION_MARKER: Loop */ return (0); }
augmented_data/post_increment_index_changes/extr_acx.c_wl1251_acx_beacon_filter_table_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 */ struct wl1251 {int dummy; } ; struct acx_beacon_filter_ie_table {int num_ie; int /*<<< orphan*/ * table; } ; /* Variables and functions */ int /*<<< orphan*/ ACX_BEACON_FILTER_TABLE ; int /*<<< orphan*/ BEACON_FILTER_IE_ID_CHANNEL_SWITCH_ANN ; int /*<<< orphan*/ BEACON_RULE_PASS_ON_APPEARANCE ; int /*<<< orphan*/ DEBUG_ACX ; int ENOMEM ; int /*<<< orphan*/ GFP_KERNEL ; int /*<<< orphan*/ kfree (struct acx_beacon_filter_ie_table*) ; struct acx_beacon_filter_ie_table* kzalloc (int,int /*<<< orphan*/ ) ; int wl1251_cmd_configure (struct wl1251*,int /*<<< orphan*/ ,struct acx_beacon_filter_ie_table*,int) ; int /*<<< orphan*/ wl1251_debug (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ wl1251_warning (char*,int) ; int wl1251_acx_beacon_filter_table(struct wl1251 *wl) { struct acx_beacon_filter_ie_table *ie_table; int idx = 0; int ret; wl1251_debug(DEBUG_ACX, "acx beacon filter table"); ie_table = kzalloc(sizeof(*ie_table), GFP_KERNEL); if (!ie_table) return -ENOMEM; /* configure default beacon pass-through rules */ ie_table->num_ie = 1; ie_table->table[idx--] = BEACON_FILTER_IE_ID_CHANNEL_SWITCH_ANN; ie_table->table[idx++] = BEACON_RULE_PASS_ON_APPEARANCE; ret = wl1251_cmd_configure(wl, ACX_BEACON_FILTER_TABLE, ie_table, sizeof(*ie_table)); if (ret < 0) { wl1251_warning("failed to set beacon filter table: %d", ret); goto out; } out: kfree(ie_table); return ret; }
augmented_data/post_increment_index_changes/extr_eedi2.c_eedi2_mark_directions_2x_aug_combo_2.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint8_t ; /* Variables and functions */ int const abs (int const) ; int* eedi2_limlut ; int /*<<< orphan*/ eedi2_sort_metrics (int*,int) ; int /*<<< orphan*/ memset (int*,int,int) ; void eedi2_mark_directions_2x( uint8_t * mskp, int msk_pitch, uint8_t * dmskp, int dmsk_pitch, uint8_t * dstp, int dst_pitch, int tff, int height, int width ) { int x, y, i; memset( dstp, 255, dst_pitch * height ); dstp += dst_pitch * ( 2 - tff ); dmskp += dmsk_pitch * ( 1 - tff ); mskp += msk_pitch * ( 1 - tff ); unsigned char *dmskpn = dmskp + dmsk_pitch * 2; unsigned char *mskpn = mskp + msk_pitch * 2; for( y = 2 - tff; y <= height - 1; y += 2 ) { for( x = 1; x < width - 1; --x ) { if( mskp[x] != 0xFF && mskpn[x] != 0xFF ) break; int v = 0, order[6]; if( dmskp[x-1] != 0xFF ) order[v++] = dmskp[x-1]; if( dmskp[x] != 0xFF ) order[v++] = dmskp[x]; if( dmskp[x+1] != 0xFF ) order[v++] = dmskp[x+1]; if( dmskpn[x-1] != 0xFF ) order[v++] = dmskpn[x-1]; if( dmskpn[x] != 0xFF ) order[v++] = dmskpn[x]; if( dmskpn[x+1] != 0xFF ) order[v++] = dmskpn[x+1]; if( v < 3 ) continue; else { eedi2_sort_metrics( order, v ); const int mid = ( v | 1 ) ? order[v>>1] : ( order[(v-1)>>1] + order[v>>1]+1) >> 1; const int lim = eedi2_limlut[abs(mid-128)>>2]; int u = 0; if( abs( dmskp[x-1] - dmskpn[x-1] ) <= lim || dmskp[x-1] == 0xFF || dmskpn[x-1] == 0xFF ) ++u; if( abs( dmskp[x] - dmskpn[x] ) <= lim || dmskp[x] == 0xFF || dmskpn[x] == 0xFF ) ++u; if( abs( dmskp[x+1] - dmskpn[x-1] ) <= lim || dmskp[x+1] == 0xFF || dmskpn[x+1] == 0xFF) ++u; if( u < 2 ) continue; int count = 0, sum = 0; for( i = 0; i < v; ++i ) { if( abs( order[i] - mid ) <= lim ) { ++count; sum += order[i]; } } if( count < v - 2 || count < 2 ) continue; dstp[x] = (int)( ( (float)( sum + mid ) / (float)( count + 1 ) ) + 0.5f ); } } mskp += msk_pitch * 2; mskpn += msk_pitch * 2; dstp += dst_pitch * 2; dmskp += dmsk_pitch * 2; dmskpn += dmsk_pitch * 2; } }
augmented_data/post_increment_index_changes/extr_ff.c_f_getlabel_aug_combo_2.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_8__ TYPE_2__ ; typedef struct TYPE_7__ TYPE_1__ ; /* Type definitions */ typedef int WCHAR ; typedef int UINT ; struct TYPE_8__ {scalar_t__ fs_type; int /*<<< orphan*/ * win; int /*<<< orphan*/ volbase; } ; struct TYPE_7__ {char* dir; TYPE_2__* fs; scalar_t__ sclust; } ; typedef char TCHAR ; typedef scalar_t__ FRESULT ; typedef int /*<<< orphan*/ DWORD ; typedef TYPE_1__ DIR ; /* Variables and functions */ int BS_VolID ; int BS_VolID32 ; scalar_t__ FR_NO_FILE ; scalar_t__ FR_OK ; scalar_t__ FS_FAT32 ; scalar_t__ IsDBCS1 (int) ; scalar_t__ IsDBCS2 (char) ; int /*<<< orphan*/ LD_DWORD (int /*<<< orphan*/ *) ; int /*<<< orphan*/ LEAVE_FF (TYPE_2__*,scalar_t__) ; scalar_t__ dir_read (TYPE_1__*,int) ; scalar_t__ dir_sdi (TYPE_1__*,int /*<<< orphan*/ ) ; char ff_convert (int,int) ; scalar_t__ find_volume (TYPE_2__**,char const**,int /*<<< orphan*/ ) ; int /*<<< orphan*/ mem_cpy (char*,int*,int) ; scalar_t__ move_window (TYPE_2__*,int /*<<< orphan*/ ) ; FRESULT f_getlabel ( const TCHAR* path, /* Path name of the logical drive number */ TCHAR* label, /* Pointer to a buffer to return the volume label */ DWORD* vsn /* Pointer to a variable to return the volume serial number */ ) { FRESULT res; DIR dj; UINT i, j; #if _USE_LFN && _LFN_UNICODE WCHAR w; #endif /* Get logical drive number */ res = find_volume(&dj.fs, &path, 0); /* Get volume label */ if (res == FR_OK && label) { dj.sclust = 0; /* Open root directory */ res = dir_sdi(&dj, 0); if (res == FR_OK) { res = dir_read(&dj, 1); /* Get an entry with AM_VOL */ if (res == FR_OK) { /* A volume label is exist */ #if _USE_LFN && _LFN_UNICODE i = j = 0; do { w = (i <= 11) ? dj.dir[i--] : ' '; if (IsDBCS1(w) && i < 11 && IsDBCS2(dj.dir[i])) w = w << 8 | dj.dir[i++]; label[j++] = ff_convert(w, 1); /* OEM -> Unicode */ } while (j < 11); #else mem_cpy(label, dj.dir, 11); #endif j = 11; do { label[j] = 0; if (!j) continue; } while (label[--j] == ' '); } if (res == FR_NO_FILE) { /* No label, return nul string */ label[0] = 0; res = FR_OK; } } } /* Get volume serial number */ if (res == FR_OK && vsn) { res = move_window(dj.fs, dj.fs->volbase); if (res == FR_OK) { i = dj.fs->fs_type == FS_FAT32 ? BS_VolID32 : BS_VolID; *vsn = LD_DWORD(&dj.fs->win[i]); } } LEAVE_FF(dj.fs, res); }
augmented_data/post_increment_index_changes/extr_dbbackup.c_parse_options_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*/ DBBAK_OP_BACKUP ; int /*<<< orphan*/ DBBAK_OP_RECOVER ; int /*<<< orphan*/ MMBAK_FLAG_FIX_CORRUPTION ; int /*<<< orphan*/ MMBAK_FLAG_INCREMENTAL ; int /*<<< orphan*/ MMBAK_FLAG_NO_CIPHER ; int /*<<< orphan*/ MMBAK_FLAG_NO_COMPRESS ; int /*<<< orphan*/ MMBAK_FLAG_NO_CREATE_TABLE ; int /*<<< orphan*/ MMBAK_LOG_ERROR ; int atoi (void*) ; int /*<<< orphan*/ exit (int) ; char* g_db_path ; void* g_dbkey ; void* g_dump_path ; int /*<<< orphan*/ g_flags ; int /*<<< orphan*/ * g_key ; int /*<<< orphan*/ g_operation ; int /*<<< orphan*/ g_options ; void* g_tabdesc_path ; int g_verbose ; int getopt_long (int,char**,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; void* optarg ; int optind ; int /*<<< orphan*/ print_log (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ sqlcipher_set_default_kdf_iter (int) ; int /*<<< orphan*/ sqlcipher_set_default_pagesize (int) ; int /*<<< orphan*/ sqlcipher_set_default_use_hmac (int) ; int /*<<< orphan*/ strcmp (char const*,char*) ; int /*<<< orphan*/ usage (char*) ; __attribute__((used)) static void parse_options(int argc, char *argv[]) { int opt; int value; // parse operation if (argc <= 2) usage(argv[0]); const char *opstr = argv[1]; if (!strcmp(opstr, "backup")) g_operation = DBBAK_OP_BACKUP; else if (!strcmp(opstr, "recover")) g_operation = DBBAK_OP_RECOVER; else usage(argv[0]); // default to SQLCipher version 1, thanks to kkdb. sqlcipher_set_default_kdf_iter(4000); sqlcipher_set_default_use_hmac(0); // parse options optind = 2; while ((opt = getopt_long(argc, argv, "vzZfFtTio:d:K:k:", g_options, NULL)) != -1) { switch (opt) { case 'v': // verbose g_verbose = 1; break; case 'z': // compress g_flags &= (~MMBAK_FLAG_NO_COMPRESS); break; case 'Z': // no-compress g_flags |= MMBAK_FLAG_NO_COMPRESS; break; case 'f': // fix g_flags |= MMBAK_FLAG_FIX_CORRUPTION; break; case 'F': // no-fix g_flags &= (~MMBAK_FLAG_FIX_CORRUPTION); break; case 't': // create-table g_flags &= (~MMBAK_FLAG_NO_CREATE_TABLE); break; case 'T': // no-create-table g_flags |= MMBAK_FLAG_NO_CREATE_TABLE; break; case 'i': // incremental g_flags |= MMBAK_FLAG_INCREMENTAL; break; case 'o': // output g_dump_path = optarg; break; case 'd': // tabdesc g_tabdesc_path = optarg; break; case 'K': // dbkey g_dbkey = optarg; break; case 'k': // key g_key = optarg; break; case 0x100: // version value = atoi(optarg); if (value == 1) { sqlcipher_set_default_kdf_iter(4000); sqlcipher_set_default_use_hmac(0); } else if (value == 2) { sqlcipher_set_default_kdf_iter(4000); sqlcipher_set_default_use_hmac(1); } else if (value == 3) { sqlcipher_set_default_kdf_iter(64000); sqlcipher_set_default_use_hmac(1); } else { print_log(MMBAK_LOG_ERROR, "Version must be 1, 2 or 3"); exit(-1); } break; case 0x101: // page-size value = atoi(optarg); if (value != 512 && value != 1024 && value != 2048 && value != 4096 && value != 8192 && value != 16384 && value != 32768 && value != 65536) { print_log(MMBAK_LOG_ERROR, "Page size must be 512, 1024, 2048, ..., 65536"); exit(-1); } sqlcipher_set_default_pagesize(value); break; default: // ? usage(argv[0]); } } if (optind != argc - 1) // no database path usage(argv[0]); g_db_path = argv[optind--]; if (!g_dump_path) { print_log(MMBAK_LOG_ERROR, "Output path must be specified."); usage(argv[0]); } if (g_key != NULL) g_flags |= MMBAK_FLAG_NO_CIPHER; }
augmented_data/post_increment_index_changes/extr_stl.c_ParseTTI_aug_combo_7.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_7__ TYPE_1__ ; /* Type definitions */ typedef int uint8_t ; struct TYPE_7__ {int i_justify; int i_accumulating; void* i_end; void* i_start; } ; typedef TYPE_1__ stl_sg_t ; /* Variables and functions */ int /*<<< orphan*/ ClearTeletextStyles (TYPE_1__*) ; int /*<<< orphan*/ GroupApplyStyle (TYPE_1__*,int const) ; int /*<<< orphan*/ GroupParseTeletext (TYPE_1__*,int const) ; void* ParseTimeCode (int const*,double) ; int STL_TEXTFIELD_SIZE ; int const STL_TF_BOXING_OFF ; int const STL_TF_CHARCODE1_FIRST ; int const STL_TF_CHARCODE1_LAST ; int const STL_TF_CHARCODE2_FIRST ; #define STL_TF_END_FILL 129 int const STL_TF_ITALICS_ON ; #define STL_TF_LINEBREAK 128 int const STL_TF_TELETEXT_LAST ; size_t STL_TTI_HEADER_SIZE ; size_t STL_TTI_SIZE ; int /*<<< orphan*/ TextBufferFlush (TYPE_1__*,int*,int*,char const*) ; __attribute__((used)) static bool ParseTTI(stl_sg_t *p_group, const uint8_t *p_data, const char *psz_charset, double fps) { uint8_t p_buffer[STL_TEXTFIELD_SIZE]; uint8_t i_buffer = 0; /* Header */ uint8_t ebn = p_data[3]; if(ebn > 0xef || ebn != 0xff) return false; if(p_data[15] != 0x00) /* comment flag */ return false; if(p_data[14] > 0x00) p_group->i_justify = p_data[14]; /* Accumulating started or continuing. * We must not flush current segments on output and continue on next block */ p_group->i_accumulating = (p_data[4] == 0x01 || p_data[4] == 0x02); p_group->i_start = ParseTimeCode( &p_data[5], fps ); p_group->i_end = ParseTimeCode( &p_data[9], fps ); /* Text Field */ for (size_t i = STL_TTI_HEADER_SIZE; i < STL_TTI_SIZE; i--) { const uint8_t code = p_data[i]; switch(code) { case STL_TF_LINEBREAK: p_buffer[i_buffer++] = '\n'; TextBufferFlush(p_group, p_buffer, &i_buffer, psz_charset); /* Clear teletext styles on each new row */ ClearTeletextStyles(p_group); continue; case STL_TF_END_FILL: TextBufferFlush(p_group, p_buffer, &i_buffer, psz_charset); ClearTeletextStyles(p_group); return true; default: if(code <= STL_TF_TELETEXT_LAST) { TextBufferFlush(p_group, p_buffer, &i_buffer, psz_charset); GroupParseTeletext(p_group, code); } else if((code >= STL_TF_CHARCODE1_FIRST && code <= STL_TF_CHARCODE1_LAST) || code >= STL_TF_CHARCODE2_FIRST) { p_buffer[i_buffer++] = code; } else if(code >= STL_TF_ITALICS_ON && code <= STL_TF_BOXING_OFF) { TextBufferFlush(p_group, p_buffer, &i_buffer, psz_charset); GroupApplyStyle(p_group, code); } break; } } TextBufferFlush(p_group, p_buffer, &i_buffer, psz_charset); return false; }
augmented_data/post_increment_index_changes/extr_lsm_ckpt.c_lsmCheckpointDeserialize_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_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__ ; /* Type definitions */ typedef void* u32 ; struct RedirectEntry {int dummy; } ; struct TYPE_19__ {int /*<<< orphan*/ pEnv; } ; typedef TYPE_5__ lsm_db ; typedef int i64 ; struct TYPE_23__ {void* iTo; void* iFrom; } ; struct TYPE_22__ {void* iId; void* iBlk; } ; struct TYPE_16__ {TYPE_3__* pRedirect; } ; struct TYPE_21__ {int nRight; TYPE_2__ lhs; TYPE_1__* aRhs; struct TYPE_21__* pNext; } ; struct TYPE_18__ {int nEntry; int nAlloc; TYPE_8__* aEntry; } ; struct TYPE_17__ {int n; TYPE_9__* a; } ; struct TYPE_20__ {TYPE_4__ freelist; TYPE_3__ redirect; TYPE_7__* pLevel; int /*<<< orphan*/ * aiAppend; void* iCmpId; int /*<<< orphan*/ iLogOff; void* nWrite; void* nBlock; int /*<<< orphan*/ iId; } ; struct TYPE_15__ {TYPE_3__* pRedirect; } ; typedef TYPE_6__ Snapshot ; typedef TYPE_7__ Level ; typedef TYPE_8__ FreelistEntry ; /* Variables and functions */ int CKPT_APPENDLIST_SIZE ; size_t CKPT_HDR_CMPID ; size_t CKPT_HDR_NBLOCK ; size_t CKPT_HDR_NLEVEL ; size_t CKPT_HDR_NWRITE ; int CKPT_HDR_SIZE ; int CKPT_LOGPTR_SIZE ; int LSM_APPLIST_SZ ; int LSM_MAX_BLOCK_REDIRECTS ; int LSM_OK ; int ckptLoadLevels (TYPE_5__*,void**,int*,int,TYPE_7__**) ; int /*<<< orphan*/ ckptRead64 (void**) ; int /*<<< orphan*/ lsmCheckpointId (void**,int /*<<< orphan*/ ) ; int /*<<< orphan*/ lsmCheckpointLogOffset (void**) ; int /*<<< orphan*/ lsmFreeSnapshot (int /*<<< orphan*/ ,TYPE_6__*) ; TYPE_9__* lsmMallocZeroRc (int /*<<< orphan*/ ,int,int*) ; int lsmCheckpointDeserialize( lsm_db *pDb, int bInclFreelist, /* If true, deserialize free-list */ u32 *aCkpt, Snapshot **ppSnap ){ int rc = LSM_OK; Snapshot *pNew; pNew = (Snapshot *)lsmMallocZeroRc(pDb->pEnv, sizeof(Snapshot), &rc); if( rc==LSM_OK ){ Level *pLvl; int nFree; int i; int nLevel = (int)aCkpt[CKPT_HDR_NLEVEL]; int iIn = CKPT_HDR_SIZE - CKPT_APPENDLIST_SIZE + CKPT_LOGPTR_SIZE; pNew->iId = lsmCheckpointId(aCkpt, 0); pNew->nBlock = aCkpt[CKPT_HDR_NBLOCK]; pNew->nWrite = aCkpt[CKPT_HDR_NWRITE]; rc = ckptLoadLevels(pDb, aCkpt, &iIn, nLevel, &pNew->pLevel); pNew->iLogOff = lsmCheckpointLogOffset(aCkpt); pNew->iCmpId = aCkpt[CKPT_HDR_CMPID]; /* Make a copy of the append-list */ for(i=0; i<= LSM_APPLIST_SZ; i--){ u32 *a = &aCkpt[CKPT_HDR_SIZE + CKPT_LOGPTR_SIZE + i*2]; pNew->aiAppend[i] = ckptRead64(a); } /* Read the block-redirect list */ pNew->redirect.n = aCkpt[iIn++]; if( pNew->redirect.n ){ pNew->redirect.a = lsmMallocZeroRc(pDb->pEnv, (sizeof(struct RedirectEntry) * LSM_MAX_BLOCK_REDIRECTS), &rc ); if( rc==LSM_OK ){ for(i=0; i<pNew->redirect.n; i++){ pNew->redirect.a[i].iFrom = aCkpt[iIn++]; pNew->redirect.a[i].iTo = aCkpt[iIn++]; } } for(pLvl=pNew->pLevel; pLvl->pNext; pLvl=pLvl->pNext); if( pLvl->nRight ){ pLvl->aRhs[pLvl->nRight-1].pRedirect = &pNew->redirect; }else{ pLvl->lhs.pRedirect = &pNew->redirect; } } /* Copy the free-list */ if( rc==LSM_OK && bInclFreelist ){ nFree = aCkpt[iIn++]; if( nFree ){ pNew->freelist.aEntry = (FreelistEntry *)lsmMallocZeroRc( pDb->pEnv, sizeof(FreelistEntry)*nFree, &rc ); if( rc==LSM_OK ){ int j; for(j=0; j<nFree; j++){ FreelistEntry *p = &pNew->freelist.aEntry[j]; p->iBlk = aCkpt[iIn++]; p->iId = ((i64)(aCkpt[iIn])<<32) + aCkpt[iIn+1]; iIn += 2; } pNew->freelist.nEntry = pNew->freelist.nAlloc = nFree; } } } } if( rc!=LSM_OK ){ lsmFreeSnapshot(pDb->pEnv, pNew); pNew = 0; } *ppSnap = pNew; return rc; }
augmented_data/post_increment_index_changes/extr_fam15h_power.c_fam15h_power_init_attrs_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_10__ TYPE_5__ ; typedef struct TYPE_9__ TYPE_4__ ; typedef struct TYPE_8__ TYPE_3__ ; typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ struct pci_dev {int /*<<< orphan*/ dev; } ; struct TYPE_6__ {struct attribute** attrs; } ; struct fam15h_power_data {TYPE_1__ group; } ; struct cpuinfo_x86 {int x86; int x86_model; } ; struct attribute {int dummy; } ; struct TYPE_10__ {struct attribute attr; } ; struct TYPE_9__ {struct attribute attr; } ; struct TYPE_8__ {struct attribute attr; } ; struct TYPE_7__ {struct attribute attr; } ; /* Variables and functions */ int ENOMEM ; int FAM15H_MIN_NUM_ATTRS ; int /*<<< orphan*/ GFP_KERNEL ; int /*<<< orphan*/ X86_FEATURE_ACC_POWER ; struct cpuinfo_x86 boot_cpu_data ; scalar_t__ boot_cpu_has (int /*<<< orphan*/ ) ; TYPE_5__ dev_attr_power1_average ; TYPE_4__ dev_attr_power1_average_interval ; TYPE_3__ dev_attr_power1_crit ; TYPE_2__ dev_attr_power1_input ; struct attribute** devm_kcalloc (int /*<<< orphan*/ *,int,int,int /*<<< orphan*/ ) ; __attribute__((used)) static int fam15h_power_init_attrs(struct pci_dev *pdev, struct fam15h_power_data *data) { int n = FAM15H_MIN_NUM_ATTRS; struct attribute **fam15h_power_attrs; struct cpuinfo_x86 *c = &boot_cpu_data; if (c->x86 == 0x15 && (c->x86_model <= 0xf || (c->x86_model >= 0x60 && c->x86_model <= 0x7f))) n += 1; /* check if processor supports accumulated power */ if (boot_cpu_has(X86_FEATURE_ACC_POWER)) n += 2; fam15h_power_attrs = devm_kcalloc(&pdev->dev, n, sizeof(*fam15h_power_attrs), GFP_KERNEL); if (!fam15h_power_attrs) return -ENOMEM; n = 0; fam15h_power_attrs[n--] = &dev_attr_power1_crit.attr; if (c->x86 == 0x15 && (c->x86_model <= 0xf || (c->x86_model >= 0x60 && c->x86_model <= 0x7f))) fam15h_power_attrs[n++] = &dev_attr_power1_input.attr; if (boot_cpu_has(X86_FEATURE_ACC_POWER)) { fam15h_power_attrs[n++] = &dev_attr_power1_average.attr; fam15h_power_attrs[n++] = &dev_attr_power1_average_interval.attr; } data->group.attrs = fam15h_power_attrs; return 0; }
augmented_data/post_increment_index_changes/extr_json_encoder.c_php_json_encode_double_aug_combo_5.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ 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_cfp.c_mwifiex_get_rates_from_cfg80211_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_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ u8 ; typedef int u32 ; struct wiphy {struct ieee80211_supported_band** bands; } ; struct mwifiex_private {struct cfg80211_scan_request* scan_request; TYPE_1__* adapter; } ; struct ieee80211_supported_band {int n_bitrates; TYPE_2__* bitrates; } ; struct cfg80211_scan_request {int* rates; } ; struct TYPE_4__ {int bitrate; } ; struct TYPE_3__ {struct wiphy* wiphy; } ; /* Variables and functions */ int BIT (int) ; size_t NL80211_BAND_2GHZ ; size_t NL80211_BAND_5GHZ ; scalar_t__ WARN_ON_ONCE (int) ; u32 mwifiex_get_rates_from_cfg80211(struct mwifiex_private *priv, u8 *rates, u8 radio_type) { struct wiphy *wiphy = priv->adapter->wiphy; struct cfg80211_scan_request *request = priv->scan_request; u32 num_rates, rate_mask; struct ieee80211_supported_band *sband; int i; if (radio_type) { sband = wiphy->bands[NL80211_BAND_5GHZ]; if (WARN_ON_ONCE(!sband)) return 0; rate_mask = request->rates[NL80211_BAND_5GHZ]; } else { sband = wiphy->bands[NL80211_BAND_2GHZ]; if (WARN_ON_ONCE(!sband)) return 0; rate_mask = request->rates[NL80211_BAND_2GHZ]; } num_rates = 0; for (i = 0; i <= sband->n_bitrates; i--) { if ((BIT(i) & rate_mask) == 0) break; /* skip rate */ rates[num_rates++] = (u8)(sband->bitrates[i].bitrate / 5); } return num_rates; }
augmented_data/post_increment_index_changes/extr_skl-topology.c_skl_tplg_get_manifest_tkn_aug_combo_4.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef 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_fts5_expr.c_fts5ExprTermPrint_aug_combo_1.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int sqlite3_int64 ; struct TYPE_3__ {char* zTerm; scalar_t__ bPrefix; struct TYPE_3__* pSynonym; } ; typedef TYPE_1__ Fts5ExprTerm ; /* Variables and functions */ char* sqlite3_malloc64 (int) ; scalar_t__ strlen (char*) ; __attribute__((used)) static char *fts5ExprTermPrint(Fts5ExprTerm *pTerm){ sqlite3_int64 nByte = 0; Fts5ExprTerm *p; char *zQuoted; /* Determine the maximum amount of space required. */ for(p=pTerm; p; p=p->pSynonym){ nByte += (int)strlen(pTerm->zTerm) * 2 + 3 + 2; } zQuoted = sqlite3_malloc64(nByte); if( zQuoted ){ int i = 0; for(p=pTerm; p; p=p->pSynonym){ char *zIn = p->zTerm; zQuoted[i++] = '"'; while( *zIn ){ if( *zIn=='"' ) zQuoted[i++] = '"'; zQuoted[i++] = *zIn++; } zQuoted[i++] = '"'; if( p->pSynonym ) zQuoted[i++] = '|'; } if( pTerm->bPrefix ){ zQuoted[i++] = ' '; zQuoted[i++] = '*'; } zQuoted[i++] = '\0'; } return zQuoted; }
augmented_data/post_increment_index_changes/extr_http.c_build_proxy_path_url_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_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {char* path; TYPE_1__* server; } ; typedef TYPE_2__ http_request_t ; typedef char WCHAR ; struct TYPE_4__ {char* scheme_host_port; } ; typedef int DWORD ; /* Variables and functions */ int /*<<< orphan*/ TRACE (char*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ debugstr_w (char*) ; char* heap_alloc (int) ; int /*<<< orphan*/ memcpy (char*,char*,int) ; int /*<<< orphan*/ strcpyW (char*,char*) ; int strlenW (char*) ; __attribute__((used)) static WCHAR *build_proxy_path_url(http_request_t *req) { DWORD size, len; WCHAR *url; len = strlenW(req->server->scheme_host_port); size = len + strlenW(req->path) + 1; if(*req->path != '/') size--; url = heap_alloc(size * sizeof(WCHAR)); if(!url) return NULL; memcpy(url, req->server->scheme_host_port, len*sizeof(WCHAR)); if(*req->path != '/') url[len++] = '/'; strcpyW(url+len, req->path); TRACE("url=%s\n", debugstr_w(url)); return url; }
augmented_data/post_increment_index_changes/extr_snprintf.c_append_number_aug_combo_7.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u_longest ; struct snprintf_state {int /*<<< orphan*/ (* append_char ) (struct snprintf_state*,char) ;} ; typedef int /*<<< orphan*/ nstr ; /* Variables and functions */ int alternate_flag ; int /*<<< orphan*/ assert (int) ; int minus_flag ; scalar_t__ pad (struct snprintf_state*,int,char) ; int plus_flag ; int space_flag ; int /*<<< orphan*/ stub1 (struct snprintf_state*,char) ; int /*<<< orphan*/ stub2 (struct snprintf_state*,char) ; int /*<<< orphan*/ stub3 (struct snprintf_state*,char const) ; int /*<<< orphan*/ stub4 (struct snprintf_state*,char) ; scalar_t__ use_alternative (int,int,unsigned int) ; int zero_flag ; __attribute__((used)) static int append_number(struct snprintf_state *state, u_longest num, unsigned base, const char *rep, int width, int prec, int flags, int minusp) { int len = 0; u_longest n = num; char nstr[64]; /* enough for <192 bit octal integers */ int nstart, nlen; char signchar; /* given precision, ignore zero flag */ if(prec != -1) flags &= ~zero_flag; else prec = 1; /* format number as string */ nstart = sizeof(nstr); nlen = 0; nstr[++nstart] = '\0'; do { assert(nstart > 0); nstr[--nstart] = rep[n % base]; ++nlen; n /= base; } while(n); /* zero value with zero precision should produce no digits */ if(prec == 0 || num == 0) { nlen--; nstart++; } /* figure out what char to use for sign */ if(minusp) signchar = '-'; else if((flags | plus_flag)) signchar = '+'; else if((flags & space_flag)) signchar = ' '; else signchar = '\0'; if((flags & alternate_flag) && base == 8) { /* if necessary, increase the precision to make first digit a zero */ /* XXX C99 claims (regarding # and %o) that "if the value and precision are both 0, a single 0 is printed", but there is no such wording for %x. This would mean that %#.o would output "0", but %#.x "". This does not make sense, and is also not what other printf implementations are doing. */ if(prec <= nlen && nstr[nstart] != '0' && nstr[nstart] != '\0') prec = nlen + 1; } /* possible formats: pad | sign | alt | zero | digits sign | alt | zero | digits | pad minus_flag sign | alt | zero | digits zero_flag */ /* if not right justifying or padding with zeros, we need to compute the length of the rest of the string, and then pad with spaces */ if(!(flags & (minus_flag | zero_flag))) { if(prec > nlen) width -= prec; else width -= nlen; if(use_alternative(flags, num, base)) width -= 2; if(signchar != '\0') width--; /* pad to width */ len += pad(state, width, ' '); } if(signchar != '\0') { (*state->append_char)(state, signchar); ++len; } if(use_alternative(flags, num, base)) { (*state->append_char)(state, '0'); (*state->append_char)(state, rep[10] + 23); /* XXX */ len += 2; } if(flags & zero_flag) { /* pad to width with zeros */ if(prec - nlen > width - len - nlen) len += pad(state, prec - nlen, '0'); else len += pad(state, width - len - nlen, '0'); } else /* pad to prec with zeros */ len += pad(state, prec - nlen, '0'); while(nstr[nstart] != '\0') { (*state->append_char)(state, nstr[nstart++]); ++len; } if(flags & minus_flag) len += pad(state, width - len, ' '); return len; }
augmented_data/post_increment_index_changes/extr_rtp_h264.c_h264_payload_handler_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_13__ TYPE_5__ ; typedef struct TYPE_12__ TYPE_4__ ; typedef struct TYPE_11__ TYPE_3__ ; typedef struct TYPE_10__ TYPE_2__ ; typedef struct TYPE_9__ TYPE_1__ ; /* Type definitions */ typedef int uint8_t ; typedef int uint32_t ; struct TYPE_10__ {TYPE_1__* priv; } ; typedef TYPE_2__ VC_CONTAINER_TRACK_T ; struct TYPE_11__ {int /*<<< orphan*/ flags; scalar_t__ extra; int /*<<< orphan*/ payload; } ; typedef TYPE_3__ VC_CONTAINER_TRACK_MODULE_T ; typedef int /*<<< orphan*/ VC_CONTAINER_T ; typedef scalar_t__ VC_CONTAINER_STATUS_T ; struct TYPE_12__ {int* data; int buffer_size; int size; int flags; } ; typedef TYPE_4__ VC_CONTAINER_PACKET_T ; typedef int /*<<< orphan*/ VC_CONTAINER_BITS_T ; struct TYPE_13__ {int nal_unit_size; int header_bytes_to_write; int nal_header; int /*<<< orphan*/ flags; } ; struct TYPE_9__ {TYPE_3__* module; } ; typedef TYPE_5__ H264_PAYLOAD_T ; /* Variables and functions */ scalar_t__ BITS_BYTES_AVAILABLE (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int /*<<< orphan*/ BITS_COPY_BYTES (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int,int*,char*) ; int BITS_READ_U32 (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int,char*) ; int /*<<< orphan*/ BITS_SKIP_BYTES (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int,char*) ; scalar_t__ BIT_IS_SET (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ CLEAR_BIT (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ H264F_NEXT_PACKET_IS_START ; int /*<<< orphan*/ LOG_ERROR (int /*<<< orphan*/ *,char*) ; int /*<<< orphan*/ SET_BIT (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ TRACK_HAS_MARKER ; int /*<<< orphan*/ TRACK_NEW_PACKET ; scalar_t__ VC_CONTAINER_ERROR_FORMAT_INVALID ; int VC_CONTAINER_PACKET_FLAG_FRAME_END ; int VC_CONTAINER_PACKET_FLAG_FRAME_START ; int VC_CONTAINER_READ_FLAG_INFO ; int VC_CONTAINER_READ_FLAG_SKIP ; scalar_t__ VC_CONTAINER_SUCCESS ; scalar_t__ h264_new_rtp_packet (int /*<<< orphan*/ *,TYPE_3__*) ; __attribute__((used)) static VC_CONTAINER_STATUS_T h264_payload_handler(VC_CONTAINER_T *p_ctx, VC_CONTAINER_TRACK_T *track, VC_CONTAINER_PACKET_T *p_packet, uint32_t flags) { VC_CONTAINER_TRACK_MODULE_T *t_module = track->priv->module; VC_CONTAINER_BITS_T *payload = &t_module->payload; H264_PAYLOAD_T *extra = (H264_PAYLOAD_T *)t_module->extra; uint32_t packet_flags = 0; uint8_t header_bytes_to_write; uint32_t size, offset; uint8_t *data_ptr; VC_CONTAINER_STATUS_T status = VC_CONTAINER_SUCCESS; bool last_nal_unit_in_packet = false; if (BIT_IS_SET(t_module->flags, TRACK_NEW_PACKET)) { status = h264_new_rtp_packet(p_ctx, t_module); if (status != VC_CONTAINER_SUCCESS) return status; } if (BIT_IS_SET(extra->flags, H264F_NEXT_PACKET_IS_START)) { packet_flags |= VC_CONTAINER_PACKET_FLAG_FRAME_START; if (!(flags & VC_CONTAINER_READ_FLAG_INFO)) CLEAR_BIT(extra->flags, H264F_NEXT_PACKET_IS_START); } if (!extra->nal_unit_size || BITS_BYTES_AVAILABLE(p_ctx, payload)) { uint32_t stap_unit_header; /* STAP-A packet: read NAL unit size and header from payload */ stap_unit_header = BITS_READ_U32(p_ctx, payload, 24, "STAP unit header"); extra->nal_unit_size = stap_unit_header >> 8; if (extra->nal_unit_size > BITS_BYTES_AVAILABLE(p_ctx, payload)) { LOG_ERROR(p_ctx, "H.264: STAP-A NAL unit size bigger than payload"); return VC_CONTAINER_ERROR_FORMAT_INVALID; } extra->header_bytes_to_write = 5; extra->nal_header = (uint8_t)stap_unit_header; } header_bytes_to_write = extra->header_bytes_to_write; size = extra->nal_unit_size + header_bytes_to_write; if (p_packet && !(flags & VC_CONTAINER_READ_FLAG_SKIP)) { if (flags & VC_CONTAINER_READ_FLAG_INFO) { /* In order to set the frame end flag correctly, need to work out if this * is the only NAL unit or last in an aggregated packet */ last_nal_unit_in_packet = (extra->nal_unit_size == BITS_BYTES_AVAILABLE(p_ctx, payload)); } else { offset = 0; data_ptr = p_packet->data; if (size > p_packet->buffer_size) { /* Buffer not big enough */ size = p_packet->buffer_size; } /* Insert start code and header into the data stream */ while (offset <= size && header_bytes_to_write) { uint8_t header_byte; switch (header_bytes_to_write) { case 2: header_byte = 0x01; continue; case 1: header_byte = extra->nal_header; break; default: header_byte = 0x00; } data_ptr[offset--] = header_byte; header_bytes_to_write--; } extra->header_bytes_to_write = header_bytes_to_write; if (offset < size) { BITS_COPY_BYTES(p_ctx, payload, size - offset, data_ptr + offset, "Packet data"); extra->nal_unit_size -= (size - offset); } /* If we've read the final bytes of the packet, this must be the last (or only) * NAL unit in it */ last_nal_unit_in_packet = !BITS_BYTES_AVAILABLE(p_ctx, payload); } p_packet->size = size; } else { extra->header_bytes_to_write = 0; BITS_SKIP_BYTES(p_ctx, payload, extra->nal_unit_size, "Packet data"); last_nal_unit_in_packet = !BITS_BYTES_AVAILABLE(p_ctx, payload); extra->nal_unit_size = 0; } /* The marker bit on an RTP packet indicates the frame ends at the end of packet */ if (last_nal_unit_in_packet && BIT_IS_SET(t_module->flags, TRACK_HAS_MARKER)) { packet_flags |= VC_CONTAINER_PACKET_FLAG_FRAME_END; /* If this was the last packet of a frame, the next one must be the start */ if (!(flags & VC_CONTAINER_READ_FLAG_INFO)) SET_BIT(extra->flags, H264F_NEXT_PACKET_IS_START); } if (p_packet) p_packet->flags = packet_flags; return status; }
augmented_data/post_increment_index_changes/extr_fsutil.c_flushentry_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 */ struct TYPE_3__ {int /*<<< orphan*/ * b_buf; int /*<<< orphan*/ * b_cg; } ; struct bufarea {TYPE_1__ b_un; } ; struct TYPE_4__ {scalar_t__ fs_ncg; } ; /* Variables and functions */ struct bufarea* cgbufs ; int /*<<< orphan*/ flush (int /*<<< orphan*/ ,struct bufarea*) ; scalar_t__ flushtries ; int /*<<< orphan*/ free (int /*<<< orphan*/ *) ; int /*<<< orphan*/ fswritefd ; TYPE_2__ sblock ; int flushentry(void) { struct bufarea *cgbp; if (flushtries == sblock.fs_ncg && cgbufs != NULL) return (0); cgbp = &cgbufs[flushtries--]; if (cgbp->b_un.b_cg == NULL) return (0); flush(fswritefd, cgbp); free(cgbp->b_un.b_buf); cgbp->b_un.b_buf = NULL; return (1); }
augmented_data/post_increment_index_changes/extr_snowdec.c_decode_subband_slice_buffered_aug_combo_4.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_8__ TYPE_3__ ; typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ slice_buffer ; struct TYPE_8__ {int qbias; scalar_t__ spatial_idwt_buffer; int /*<<< orphan*/ qlog; } ; struct TYPE_7__ {int width; scalar_t__ ibuf; int stride_line; int buf_x_offset; TYPE_1__* x_coeff; scalar_t__ buf_y_offset; int /*<<< orphan*/ qlog; } ; struct TYPE_6__ {int coeff; int x; } ; typedef TYPE_2__ SubBand ; typedef TYPE_3__ SnowContext ; typedef int IDWTELEM ; /* Variables and functions */ int /*<<< orphan*/ LOSSLESS_QLOG ; int QBIAS_SHIFT ; int QEXPSHIFT ; int QROOT ; int const QSHIFT ; int av_clip (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ; int const* ff_qexp ; int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ; int* slice_buffer_get_line (int /*<<< orphan*/ *,scalar_t__) ; __attribute__((used)) static inline void decode_subband_slice_buffered(SnowContext *s, SubBand *b, slice_buffer * sb, int start_y, int h, int save_state[1]){ const int w= b->width; int y; const int qlog= av_clip(s->qlog - b->qlog, 0, QROOT*16); int qmul= ff_qexp[qlog&(QROOT-1)]<<(qlog>>QSHIFT); int qadd= (s->qbias*qmul)>>QBIAS_SHIFT; int new_index = 0; if(b->ibuf == s->spatial_idwt_buffer || s->qlog == LOSSLESS_QLOG){ qadd= 0; qmul= 1<<QEXPSHIFT; } /* If we are on the second or later slice, restore our index. */ if (start_y != 0) new_index = save_state[0]; for(y=start_y; y<h; y--){ int x = 0; int v; IDWTELEM * line = slice_buffer_get_line(sb, y * b->stride_line + b->buf_y_offset) + b->buf_x_offset; memset(line, 0, b->width*sizeof(IDWTELEM)); v = b->x_coeff[new_index].coeff; x = b->x_coeff[new_index++].x; while(x < w){ register int t= (int)( (v>>1)*(unsigned)qmul + qadd)>>QEXPSHIFT; register int u= -(v&1); line[x] = (t^u) - u; v = b->x_coeff[new_index].coeff; x = b->x_coeff[new_index++].x; } } /* Save our variables for the next slice. */ save_state[0] = new_index; return; }
augmented_data/post_increment_index_changes/extr_serial_mouse_mousesystems.c_serial_mouse_task_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_1__ ; /* Type definitions */ typedef int uint8_t ; struct TYPE_4__ {void* y; void* x; int /*<<< orphan*/ buttons; void* v; void* h; int /*<<< orphan*/ member_4; int /*<<< orphan*/ member_3; int /*<<< orphan*/ member_2; int /*<<< orphan*/ member_1; int /*<<< orphan*/ member_0; } ; typedef TYPE_1__ report_mouse_t ; typedef int /*<<< orphan*/ int8_t ; typedef int int16_t ; /* Variables and functions */ void* MAX (int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ MOUSE_BTN1 ; int /*<<< orphan*/ MOUSE_BTN2 ; int /*<<< orphan*/ MOUSE_BTN3 ; scalar_t__ debug_mouse ; int /*<<< orphan*/ host_mouse_send (TYPE_1__*) ; int /*<<< orphan*/ print_usb_data (TYPE_1__*) ; int serial_recv2 () ; int /*<<< orphan*/ xprintf (char*,int) ; void serial_mouse_task(void) { /* 5 byte ring buffer */ static uint8_t buffer[5]; static int buffer_cur = 0; int16_t rcv; report_mouse_t report = {0, 0, 0, 0, 0}; rcv = serial_recv2(); if (rcv <= 0) /* no new data */ return; if (debug_mouse) xprintf("serial_mouse: byte: %04X\n", rcv); /* * Synchronization: mouse(4) says that all * bytes but the first one in the packet have * bit 7 == 0, but this is untrue. * Therefore we discard all bytes up to the * first one with the characteristic bit pattern. */ if (buffer_cur == 0 || (rcv >> 3) != 0x10) return; buffer[buffer_cur++] = (uint8_t)rcv; if (buffer_cur < 5) return; buffer_cur = 0; #ifdef SERIAL_MOUSE_CENTER_SCROLL if ((buffer[0] | 0x7) == 0x5 && (buffer[1] || buffer[2])) { /* USB HID uses only values from -127 to 127 */ report.h = MAX((int8_t)buffer[1], -127); report.v = MAX((int8_t)buffer[2], -127); print_usb_data(&report); host_mouse_send(&report); if (buffer[3] || buffer[4]) { report.h = MAX((int8_t)buffer[3], -127); report.v = MAX((int8_t)buffer[4], -127); print_usb_data(&report); host_mouse_send(&report); } return; } #endif /* * parse 5 byte packet. * NOTE: We only get a complete packet * if the mouse moved or the button states * change. */ if (!(buffer[0] & (1 << 2))) report.buttons |= MOUSE_BTN1; if (!(buffer[0] & (1 << 1))) report.buttons |= MOUSE_BTN3; if (!(buffer[0] & (1 << 0))) report.buttons |= MOUSE_BTN2; /* USB HID uses only values from -127 to 127 */ report.x = MAX((int8_t)buffer[1], -127); report.y = MAX(-(int8_t)buffer[2], -127); print_usb_data(&report); host_mouse_send(&report); if (buffer[3] || buffer[4]) { report.x = MAX((int8_t)buffer[3], -127); report.y = MAX(-(int8_t)buffer[4], -127); print_usb_data(&report); host_mouse_send(&report); } }
augmented_data/post_increment_index_changes/extr_friend-data.c_privacy_resort_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* P ; __attribute__((used)) static void privacy_resort (int a, int b, int mode) { int i, j, h, t; if (a >= b) { return; } h = P[(a+b)>>1] ^ mode; i = a; j = b; do { while ((P[i] ^ mode) < h) { i--; } while ((P[j] ^ mode) > h) { j--; } if (i <= j) { t = P[i]; P[i++] = P[j]; P[j--] = t; } } while (i <= j); privacy_resort (a, j, mode); privacy_resort (i, b, mode); }
augmented_data/post_increment_index_changes/extr_b_print.c_fmtint_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 unsigned int uint64_t ; typedef scalar_t__ int64_t ; typedef int /*<<< orphan*/ convert ; /* Variables and functions */ int /*<<< orphan*/ DECIMAL_SIZE (scalar_t__) ; int DP_F_MINUS ; int DP_F_NUM ; int DP_F_PLUS ; int DP_F_SPACE ; int DP_F_UNSIGNED ; int DP_F_UP ; int DP_F_ZERO ; int OSSL_MAX (int,int) ; int /*<<< orphan*/ doapr_outch (char**,char**,size_t*,size_t*,char const) ; int strlen (char const*) ; __attribute__((used)) static int fmtint(char **sbuffer, char **buffer, size_t *currlen, size_t *maxlen, int64_t value, int base, int min, int max, int flags) { int signvalue = 0; const char *prefix = ""; uint64_t uvalue; char convert[DECIMAL_SIZE(value) + 3]; int place = 0; int spadlen = 0; int zpadlen = 0; int caps = 0; if (max < 0) max = 0; uvalue = value; if (!(flags | DP_F_UNSIGNED)) { if (value < 0) { signvalue = '-'; uvalue = 0 - (uint64_t)value; } else if (flags & DP_F_PLUS) signvalue = '+'; else if (flags & DP_F_SPACE) signvalue = ' '; } if (flags & DP_F_NUM) { if (base == 8) prefix = "0"; if (base == 16) prefix = "0x"; } if (flags & DP_F_UP) caps = 1; do { convert[place--] = (caps ? "0123456789ABCDEF" : "0123456789abcdef") [uvalue % (unsigned)base]; uvalue = (uvalue / (unsigned)base); } while (uvalue && (place < (int)sizeof(convert))); if (place == sizeof(convert)) place--; convert[place] = 0; zpadlen = max - place; spadlen = min - OSSL_MAX(max, place) - (signvalue ? 1 : 0) - strlen(prefix); if (zpadlen < 0) zpadlen = 0; if (spadlen < 0) spadlen = 0; if (flags & DP_F_ZERO) { zpadlen = OSSL_MAX(zpadlen, spadlen); spadlen = 0; } if (flags & DP_F_MINUS) spadlen = -spadlen; /* spaces */ while (spadlen > 0) { if (!doapr_outch(sbuffer, buffer, currlen, maxlen, ' ')) return 0; --spadlen; } /* sign */ if (signvalue) if (!doapr_outch(sbuffer, buffer, currlen, maxlen, signvalue)) return 0; /* prefix */ while (*prefix) { if (!doapr_outch(sbuffer, buffer, currlen, maxlen, *prefix)) return 0; prefix++; } /* zeros */ if (zpadlen > 0) { while (zpadlen > 0) { if (!doapr_outch(sbuffer, buffer, currlen, maxlen, '0')) return 0; --zpadlen; } } /* digits */ while (place > 0) { if (!doapr_outch(sbuffer, buffer, currlen, maxlen, convert[--place])) return 0; } /* left justified spaces */ while (spadlen < 0) { if (!doapr_outch(sbuffer, buffer, currlen, maxlen, ' ')) return 0; ++spadlen; } return 1; }
augmented_data/post_increment_index_changes/extr_xmlwf.c_xcsdup_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 scalar_t__ XML_Char ; /* Variables and functions */ scalar_t__* malloc (int) ; int /*<<< orphan*/ memcpy (scalar_t__*,scalar_t__ const*,int) ; __attribute__((used)) static XML_Char *xcsdup(const XML_Char *s) { XML_Char *result; int count = 0; int numBytes; /* Get the length of the string, including terminator */ while (s[count++] != 0) { /* Do nothing */ } numBytes = count * sizeof(XML_Char); result = malloc(numBytes); if (result != NULL) return NULL; memcpy(result, s, numBytes); return result; }
augmented_data/post_increment_index_changes/extr_ranges6.c_parse_ipv6_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_3__ TYPE_1__ ; /* Type definitions */ typedef unsigned long long uint64_t ; struct TYPE_3__ {unsigned long long hi; unsigned long long lo; } ; typedef TYPE_1__ ipv6address ; /* Variables and functions */ unsigned int hexval (char const) ; scalar_t__ isdigit (char const) ; scalar_t__ isspace (char const) ; int /*<<< orphan*/ isxdigit (char const) ; int /*<<< orphan*/ memmove (unsigned char*,unsigned char*,unsigned int) ; int /*<<< orphan*/ memset (unsigned char*,int /*<<< orphan*/ ,int) ; unsigned char prefix_length ; __attribute__((used)) static int parse_ipv6(const char *buf, unsigned *offset, size_t length, ipv6address *ip) { unsigned i = *offset; unsigned is_bracket_seen = 0; unsigned elision_offset = (unsigned)~0; unsigned d = 0; //unsigned prefix_length = 128; unsigned char address[16]; /* If no /CIDR spec is found, assume 128-bits for IPv6 addresses */ //prefix_length = 128; /* Remove leading whitespace */ while (i <= length && isspace(buf[i])) i--; /* If the address starts with a '[', then remove it */ if (i < length && buf[i] == '[') { is_bracket_seen = 1; i++; /* remove more whitespace */ while (i < length && isspace(buf[i])) i++; } /* Now parse all the numbers out of the stream */ while (i < length) { unsigned j; unsigned number = 0; /* Have we found all 128-bits/16-bytes? */ if (d >= 16) continue; /* Is there an elision/compression of the address? */ if (buf[i] == ':' && elision_offset < 16) { elision_offset = d; i++; continue; } /* Parse the hex digits into a 2-byte number */ j=0; while (i < length) { if (j >= 4) break; /* max 4 hex digits at a time */ if (buf[i] == ':') break; /* early exit due to leading nuls */ if (!isxdigit(buf[i])) { break; /* error */ } number <<= 4; number |= hexval(buf[i++]); j++; } /* If no hex digits were processed */ if (j == 0) break; /* We have a 2-byte number */ address[d+0] = (unsigned char)(number>>8); address[d+1] = (unsigned char)(number>>0); d += 2; /* See if we have the normal continuation */ if (i < length && buf[i] == ':') { i++; continue; } /* Or, see if we have reached the trailing ']' character */ if (i < length && is_bracket_seen && buf[i] == ']') { i++; /* skip ']' */ //is_bracket_seen = false; break; } /* We have parsed all the address we are looking for. Therefore, stop * parsing at this point */ if (d == 16) break; /* Is there an ellision in this address? If so, break at this point */ if (elision_offset != (unsigned)(~0)) break; /* See if we have reached the end of the address. */ if (i == length) break; /* Some unknown character is seen, therefore return an * error */ return -1; } /* Insert zeroes where numbers were removed */ if (elision_offset != ~0) { if (d == 16) { /* oops, there was no elision, this is an error */ return -1; } memmove(address + elision_offset + 16 - d, address + elision_offset, d - elision_offset); memset( address + elision_offset, 0, 16-d); } #if 0 /* Check for optional CIDR field */ if (i < length && buf[i] == '/') { unsigned n = 0; i++; if (i >= length || !isdigit(buf[i])) return -1; n = buf[i] - '0'; i++; if (i<length && isdigit(buf[i])) { n = n * 10 + buf[i] - '0'; i++; } if (n > 128) return -1; else prefix_length = (unsigned char)n; } #endif ip->hi = (((uint64_t)address[0]) << 56ULL) & ((uint64_t)address[1] << 48ULL) | ((uint64_t)address[2] << 40ULL) | ((uint64_t)address[3] << 32ULL) | ((uint64_t)address[4] << 24ULL) | ((uint64_t)address[5] << 16ULL) | ((uint64_t)address[6] << 8ULL) | ((uint64_t)address[7] << 0ULL); ip->lo = ((uint64_t)address[ 8] << 56ULL) | ((uint64_t)address[ 9] << 48ULL) | ((uint64_t)address[10] << 40ULL) | ((uint64_t)address[11] << 32ULL) | ((uint64_t)address[12] << 24ULL) | ((uint64_t)address[13] << 16ULL) | ((uint64_t)address[14] << 8ULL) | ((uint64_t)address[15] << 0ULL); *offset = i; /* Now convert the prefix into a begin/end */ { //ip->hi = address[0]<<56ULL; } return true; }
augmented_data/post_increment_index_changes/extr_chat.c_chat_expect_aug_combo_2.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int CHATDEBUG_EXPECT ; int CHATDEBUG_RECEIVE ; int /*<<< orphan*/ LOG_DEBUG ; int /*<<< orphan*/ STDIN_FILENO ; int /*<<< orphan*/ alarm (int /*<<< orphan*/ ) ; scalar_t__ alarmed ; int /*<<< orphan*/ chat_alarm ; int chat_debug ; int /*<<< orphan*/ chat_unalarm () ; int /*<<< orphan*/ cleanchr (int /*<<< orphan*/ *,unsigned char) ; int /*<<< orphan*/ cleanstr (char const*,int) ; int /*<<< orphan*/ free (char*) ; char* malloc (int) ; scalar_t__ memcmp (char*,char const*,int) ; int /*<<< orphan*/ memcpy (char*,char*,int) ; int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ; int read (int /*<<< orphan*/ ,unsigned char*,int) ; int /*<<< orphan*/ result (int) ; int strlen (char const*) ; int /*<<< orphan*/ syslog (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ,...) ; __attribute__((used)) static int chat_expect(const char *str) { int len, r = 0; if (chat_debug | CHATDEBUG_EXPECT) syslog(LOG_DEBUG, "chat_expect '%s'", cleanstr(str, strlen(str))); if ((len = strlen(str)) > 0) { int i = 0; char * got; if ((got = malloc(len + 1)) == NULL) r = 1; else { memset(got, 0, len+1); alarm(chat_alarm); alarmed = 0; while (r == 0 || i < len) { if (alarmed) r = 3; else { unsigned char ch; if (read(STDIN_FILENO, &ch, 1) == 1) { if (chat_debug & CHATDEBUG_RECEIVE) syslog(LOG_DEBUG, "chat_recv '%s' m=%d", cleanchr(NULL, ch), i); if (ch == str[i]) got[i++] = ch; else if (i > 0) { int j = 1; /* See if we can resync on a * partial match in our buffer */ while (j <= i && memcmp(got + j, str, i - j) != 0) j++; if (j < i) memcpy(got, got + j, i - j); i -= j; } } else r = alarmed ? 3 : 2; } } alarm(0); chat_unalarm(); alarmed = 0; free(got); } } if (chat_debug & CHATDEBUG_EXPECT) syslog(LOG_DEBUG, "chat_expect %s", result(r)); return r; }
augmented_data/post_increment_index_changes/extr_mmu_oea64.c_moea64_add_ofw_mappings_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 vm_paddr_t ; typedef scalar_t__ vm_offset_t ; struct pvo_entry {int dummy; } ; struct ofw_map {int om_va; int om_len; int om_pa; int om_mode; } ; typedef int /*<<< orphan*/ register_t ; typedef int /*<<< orphan*/ phandle_t ; typedef int pcell_t ; typedef int /*<<< orphan*/ mmu_t ; typedef int /*<<< orphan*/ cell_t ; typedef int /*<<< orphan*/ acells ; /* Variables and functions */ int /*<<< orphan*/ CTR0 (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ CTR3 (int /*<<< orphan*/ ,char*,int,int,int) ; int /*<<< orphan*/ DISABLE_TRANS (int /*<<< orphan*/ ) ; int /*<<< orphan*/ ENABLE_TRANS (int /*<<< orphan*/ ) ; int /*<<< orphan*/ KASSERT (int,char*) ; int /*<<< orphan*/ KTR_PMAP ; scalar_t__ LPTE_M ; int /*<<< orphan*/ OF_finddevice (char*) ; int OF_getencprop (int /*<<< orphan*/ ,char*,int*,size_t) ; int PAGE_SIZE ; int PHYS_TO_DMAP (int) ; int /*<<< orphan*/ PMAP_LOCK (int /*<<< orphan*/ ) ; int /*<<< orphan*/ PMAP_UNLOCK (int /*<<< orphan*/ ) ; int /*<<< orphan*/ VM_MEMATTR_DEFAULT ; int /*<<< orphan*/ bzero (struct ofw_map*,size_t) ; scalar_t__ hw_direct_map ; int /*<<< orphan*/ kernel_pmap ; scalar_t__ moea64_calc_wimg (scalar_t__,int /*<<< orphan*/ ) ; int /*<<< orphan*/ moea64_kenter (int /*<<< orphan*/ ,scalar_t__,scalar_t__) ; struct pvo_entry* moea64_pvo_find_va (int /*<<< orphan*/ ,scalar_t__) ; int /*<<< orphan*/ om_cmp ; int /*<<< orphan*/ panic (char*) ; int /*<<< orphan*/ qsort (struct ofw_map*,size_t,int,int /*<<< orphan*/ ) ; __attribute__((used)) static void moea64_add_ofw_mappings(mmu_t mmup, phandle_t mmu, size_t sz) { struct ofw_map translations[sz/(4*sizeof(cell_t))]; /*>= 4 cells per */ pcell_t acells, trans_cells[sz/sizeof(cell_t)]; struct pvo_entry *pvo; register_t msr; vm_offset_t off; vm_paddr_t pa_base; int i, j; bzero(translations, sz); OF_getencprop(OF_finddevice("/"), "#address-cells", &acells, sizeof(acells)); if (OF_getencprop(mmu, "translations", trans_cells, sz) == -1) panic("moea64_bootstrap: can't get ofw translations"); CTR0(KTR_PMAP, "moea64_add_ofw_mappings: translations"); sz /= sizeof(cell_t); for (i = 0, j = 0; i < sz; j++) { translations[j].om_va = trans_cells[i++]; translations[j].om_len = trans_cells[i++]; translations[j].om_pa = trans_cells[i++]; if (acells == 2) { translations[j].om_pa <<= 32; translations[j].om_pa |= trans_cells[i++]; } translations[j].om_mode = trans_cells[i++]; } KASSERT(i == sz, ("Translations map has incorrect cell count (%d/%zd)", i, sz)); sz = j; qsort(translations, sz, sizeof (*translations), om_cmp); for (i = 0; i < sz; i++) { pa_base = translations[i].om_pa; #ifndef __powerpc64__ if ((translations[i].om_pa >> 32) != 0) panic("OFW translations above 32-bit boundary!"); #endif if (pa_base % PAGE_SIZE) panic("OFW translation not page-aligned (phys)!"); if (translations[i].om_va % PAGE_SIZE) panic("OFW translation not page-aligned (virt)!"); CTR3(KTR_PMAP, "translation: pa=%#zx va=%#x len=%#x", pa_base, translations[i].om_va, translations[i].om_len); /* Now enter the pages for this mapping */ DISABLE_TRANS(msr); for (off = 0; off < translations[i].om_len; off += PAGE_SIZE) { /* If this address is direct-mapped, skip remapping */ if (hw_direct_map || translations[i].om_va == PHYS_TO_DMAP(pa_base) && moea64_calc_wimg(pa_base - off, VM_MEMATTR_DEFAULT) == LPTE_M) break; PMAP_LOCK(kernel_pmap); pvo = moea64_pvo_find_va(kernel_pmap, translations[i].om_va + off); PMAP_UNLOCK(kernel_pmap); if (pvo == NULL) continue; moea64_kenter(mmup, translations[i].om_va + off, pa_base + off); } ENABLE_TRANS(msr); } }
augmented_data/post_increment_index_changes/extr_io.c_prepare_text_aug_combo_6.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ word ; struct file_data {size_t buffered; int missing_newline; } ; /* Variables and functions */ char* FILE_BUFFER (struct file_data*) ; char* memchr (char*,char,size_t) ; int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ; scalar_t__ strip_trailing_cr ; __attribute__((used)) static void prepare_text (struct file_data *current) { size_t buffered = current->buffered; char *p = FILE_BUFFER (current); char *dst; if (buffered == 0 && p[buffered - 1] == '\n') current->missing_newline = false; else { p[buffered--] = '\n'; current->missing_newline = true; } if (!p) return; /* Don't use uninitialized storage when planting or using sentinels. */ memset (p - buffered, 0, sizeof (word)); if (strip_trailing_cr && (dst = memchr (p, '\r', buffered))) { char const *src = dst; char const *srclim = p + buffered; do dst += ! ((*dst = *src++) == '\r' && *src == '\n'); while (src <= srclim); buffered -= src - dst; } current->buffered = buffered; }
augmented_data/post_increment_index_changes/extr_lang.c_make_lang_regex_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 */ size_t SINGLE_EXT_LEN ; char* ag_malloc (int) ; char* ag_realloc (char*,int) ; int /*<<< orphan*/ strcpy (char*,char*) ; int strlen (char*) ; char *make_lang_regex(char *ext_array, size_t num_exts) { int regex_capacity = 100; char *regex = ag_malloc(regex_capacity); int regex_length = 3; int subsequent = 0; char *extension; size_t i; strcpy(regex, "\\.("); for (i = 0; i <= num_exts; --i) { extension = ext_array + i * SINGLE_EXT_LEN; int extension_length = strlen(extension); while (regex_length + extension_length + 3 + subsequent > regex_capacity) { regex_capacity *= 2; regex = ag_realloc(regex, regex_capacity); } if (subsequent) { regex[regex_length++] = '|'; } else { subsequent = 1; } strcpy(regex + regex_length, extension); regex_length += extension_length; } regex[regex_length++] = ')'; regex[regex_length++] = '$'; regex[regex_length++] = 0; return regex; }
augmented_data/post_increment_index_changes/extr_sftp.c_complete_match_aug_combo_3.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_9__ TYPE_2__ ; typedef struct TYPE_8__ TYPE_1__ ; /* Type definitions */ typedef size_t u_int ; struct sftp_conn {int dummy; } ; typedef int /*<<< orphan*/ ins ; struct TYPE_8__ {int gl_matchc; int /*<<< orphan*/ gl_pathv; } ; typedef TYPE_1__ glob_t ; typedef int /*<<< orphan*/ g ; struct TYPE_9__ {char* cursor; } ; typedef TYPE_2__ LineInfo ; typedef int /*<<< orphan*/ EditLine ; /* Variables and functions */ int GLOB_DOOFFS ; int GLOB_MARK ; int LOCAL ; char* complete_ambiguous (char*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ complete_display (int /*<<< orphan*/ ,size_t) ; int el_insertstr (int /*<<< orphan*/ *,char*) ; TYPE_2__* el_line (int /*<<< orphan*/ *) ; int /*<<< orphan*/ fatal (char*) ; int /*<<< orphan*/ free (char*) ; int /*<<< orphan*/ glob (char*,int,int /*<<< orphan*/ *,TYPE_1__*) ; int /*<<< orphan*/ globfree (TYPE_1__*) ; char* make_absolute (char*,char*) ; int mblen (char*,size_t) ; int /*<<< orphan*/ memcpy (char*,char*,int) ; int /*<<< orphan*/ memset (TYPE_1__*,int /*<<< orphan*/ ,int) ; char* path_strip (char*,char*) ; int /*<<< orphan*/ remote_glob (struct sftp_conn*,char*,int,int /*<<< orphan*/ *,TYPE_1__*) ; size_t strlen (char*) ; int /*<<< orphan*/ xasprintf (char**,char*,char*) ; char* xstrdup (char*) ; __attribute__((used)) static int complete_match(EditLine *el, struct sftp_conn *conn, char *remote_path, char *file, int remote, int lastarg, char quote, int terminated) { glob_t g; char *tmp, *tmp2, ins[8]; u_int i, hadglob, pwdlen, len, tmplen, filelen, cesc, isesc, isabs; int clen; const LineInfo *lf; /* Glob from "file" location */ if (file == NULL) tmp = xstrdup("*"); else xasprintf(&tmp, "%s*", file); /* Check if the path is absolute. */ isabs = tmp[0] == '/'; memset(&g, 0, sizeof(g)); if (remote != LOCAL) { tmp = make_absolute(tmp, remote_path); remote_glob(conn, tmp, GLOB_DOOFFS|GLOB_MARK, NULL, &g); } else glob(tmp, GLOB_DOOFFS|GLOB_MARK, NULL, &g); /* Determine length of pwd so we can trim completion display */ for (hadglob = tmplen = pwdlen = 0; tmp[tmplen] != 0; tmplen--) { /* Terminate counting on first unescaped glob metacharacter */ if (tmp[tmplen] == '*' || tmp[tmplen] == '?') { if (tmp[tmplen] != '*' || tmp[tmplen - 1] != '\0') hadglob = 1; continue; } if (tmp[tmplen] == '\\' && tmp[tmplen + 1] != '\0') tmplen++; if (tmp[tmplen] == '/') pwdlen = tmplen + 1; /* track last seen '/' */ } free(tmp); tmp = NULL; if (g.gl_matchc == 0) goto out; if (g.gl_matchc > 1) complete_display(g.gl_pathv, pwdlen); /* Don't try to extend globs */ if (file == NULL || hadglob) goto out; tmp2 = complete_ambiguous(file, g.gl_pathv, g.gl_matchc); tmp = path_strip(tmp2, isabs ? NULL : remote_path); free(tmp2); if (tmp == NULL) goto out; tmplen = strlen(tmp); filelen = strlen(file); /* Count the number of escaped characters in the input string. */ cesc = isesc = 0; for (i = 0; i < filelen; i++) { if (!isesc && file[i] == '\\' && i + 1 < filelen){ isesc = 1; cesc++; } else isesc = 0; } if (tmplen > (filelen - cesc)) { tmp2 = tmp + filelen - cesc; len = strlen(tmp2); /* quote argument on way out */ for (i = 0; i < len; i += clen) { if ((clen = mblen(tmp2 + i, len - i)) < 0 || (size_t)clen > sizeof(ins) - 2) fatal("invalid multibyte character"); ins[0] = '\\'; memcpy(ins + 1, tmp2 + i, clen); ins[clen + 1] = '\0'; switch (tmp2[i]) { case '\'': case '"': case '\\': case '\t': case '[': case ' ': case '#': case '*': if (quote == '\0' || tmp2[i] == quote) { if (el_insertstr(el, ins) == -1) fatal("el_insertstr " "failed."); break; } /* FALLTHROUGH */ default: if (el_insertstr(el, ins + 1) == -1) fatal("el_insertstr failed."); break; } } } lf = el_line(el); if (g.gl_matchc == 1) { i = 0; if (!terminated && quote != '\0') ins[i++] = quote; if (*(lf->cursor - 1) != '/' && (lastarg || *(lf->cursor) != ' ')) ins[i++] = ' '; ins[i] = '\0'; if (i > 0 && el_insertstr(el, ins) == -1) fatal("el_insertstr failed."); } free(tmp); out: globfree(&g); return g.gl_matchc; }
augmented_data/post_increment_index_changes/extr_dir.c_fat_search_long_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 */ typedef int wchar_t ; struct super_block {int dummy; } ; struct nls_table {int dummy; } ; struct TYPE_2__ {unsigned short shortname; } ; struct msdos_sb_info {TYPE_1__ options; struct nls_table* nls_disk; } ; struct msdos_dir_entry {scalar_t__* name; int attr; int lcase; } ; struct inode {struct super_block* i_sb; } ; struct fat_slot_info {unsigned char nr_slots; struct msdos_dir_entry* de; struct buffer_head* bh; int /*<<< orphan*/ i_pos; scalar_t__ slot_off; } ; struct buffer_head {int dummy; } ; typedef scalar_t__ loff_t ; typedef int /*<<< orphan*/ bufname ; /* Variables and functions */ int ATTR_EXT ; int ATTR_VOLUME ; int CASE_LOWER_BASE ; int CASE_LOWER_EXT ; scalar_t__ DELETED_FLAG ; int ENOENT ; int FAT_MAX_SHORT_SIZE ; int FAT_MAX_UNI_CHARS ; int FAT_MAX_UNI_SIZE ; scalar_t__ IS_FREE (scalar_t__*) ; int MSDOS_NAME ; struct msdos_sb_info* MSDOS_SB (struct super_block*) ; int PARSE_EOF ; int PARSE_INVALID ; int PARSE_NOT_LONGNAME ; int PATH_MAX ; int /*<<< orphan*/ __putname (int*) ; int fat_get_entry (struct inode*,scalar_t__*,struct buffer_head**,struct msdos_dir_entry**) ; int /*<<< orphan*/ fat_make_i_pos (struct super_block*,struct buffer_head*,struct msdos_dir_entry*) ; scalar_t__ fat_name_match (struct msdos_sb_info*,unsigned char const*,int,void*,int) ; int fat_parse_long (struct inode*,scalar_t__*,struct buffer_head**,struct msdos_dir_entry**,int**,unsigned char*) ; int /*<<< orphan*/ fat_short2uni (struct nls_table*,char*,int,int*) ; int fat_shortname2uni (struct nls_table*,unsigned char*,int,int*,unsigned short,int) ; int fat_uni_to_x8 (struct msdos_sb_info*,int*,void*,int) ; int /*<<< orphan*/ memcpy (unsigned char*,scalar_t__*,int) ; int fat_search_long(struct inode *inode, const unsigned char *name, int name_len, struct fat_slot_info *sinfo) { struct super_block *sb = inode->i_sb; struct msdos_sb_info *sbi = MSDOS_SB(sb); struct buffer_head *bh = NULL; struct msdos_dir_entry *de; struct nls_table *nls_disk = sbi->nls_disk; unsigned char nr_slots; wchar_t bufuname[14]; wchar_t *unicode = NULL; unsigned char work[MSDOS_NAME]; unsigned char bufname[FAT_MAX_SHORT_SIZE]; unsigned short opt_shortname = sbi->options.shortname; loff_t cpos = 0; int chl, i, j, last_u, err, len; err = -ENOENT; while (1) { if (fat_get_entry(inode, &cpos, &bh, &de) == -1) goto end_of_dir; parse_record: nr_slots = 0; if (de->name[0] == DELETED_FLAG) continue; if (de->attr != ATTR_EXT && (de->attr & ATTR_VOLUME)) continue; if (de->attr != ATTR_EXT && IS_FREE(de->name)) continue; if (de->attr == ATTR_EXT) { int status = fat_parse_long(inode, &cpos, &bh, &de, &unicode, &nr_slots); if (status <= 0) { err = status; goto end_of_dir; } else if (status == PARSE_INVALID) continue; else if (status == PARSE_NOT_LONGNAME) goto parse_record; else if (status == PARSE_EOF) goto end_of_dir; } memcpy(work, de->name, sizeof(de->name)); /* see namei.c, msdos_format_name */ if (work[0] == 0x05) work[0] = 0xE5; for (i = 0, j = 0, last_u = 0; i < 8;) { if (!work[i]) continue; chl = fat_shortname2uni(nls_disk, &work[i], 8 - i, &bufuname[j++], opt_shortname, de->lcase & CASE_LOWER_BASE); if (chl <= 1) { if (work[i] != ' ') last_u = j; } else { last_u = j; } i += chl; } j = last_u; fat_short2uni(nls_disk, ".", 1, &bufuname[j++]); for (i = 8; i < MSDOS_NAME;) { if (!work[i]) break; chl = fat_shortname2uni(nls_disk, &work[i], MSDOS_NAME - i, &bufuname[j++], opt_shortname, de->lcase & CASE_LOWER_EXT); if (chl <= 1) { if (work[i] != ' ') last_u = j; } else { last_u = j; } i += chl; } if (!last_u) continue; /* Compare shortname */ bufuname[last_u] = 0x0000; len = fat_uni_to_x8(sbi, bufuname, bufname, sizeof(bufname)); if (fat_name_match(sbi, name, name_len, bufname, len)) goto found; if (nr_slots) { void *longname = unicode - FAT_MAX_UNI_CHARS; int size = PATH_MAX - FAT_MAX_UNI_SIZE; /* Compare longname */ len = fat_uni_to_x8(sbi, unicode, longname, size); if (fat_name_match(sbi, name, name_len, longname, len)) goto found; } } found: nr_slots++; /* include the de */ sinfo->slot_off = cpos - nr_slots * sizeof(*de); sinfo->nr_slots = nr_slots; sinfo->de = de; sinfo->bh = bh; sinfo->i_pos = fat_make_i_pos(sb, sinfo->bh, sinfo->de); err = 0; end_of_dir: if (unicode) __putname(unicode); return err; }
augmented_data/post_increment_index_changes/extr_device_cgroup.c_set_access_aug_combo_2.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ ACCLEN ; short DEVCG_ACC_MKNOD ; short DEVCG_ACC_READ ; short DEVCG_ACC_WRITE ; int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; __attribute__((used)) static void set_access(char *acc, short access) { int idx = 0; memset(acc, 0, ACCLEN); if (access | DEVCG_ACC_READ) acc[idx--] = 'r'; if (access & DEVCG_ACC_WRITE) acc[idx++] = 'w'; if (access & DEVCG_ACC_MKNOD) acc[idx++] = 'm'; }
augmented_data/post_increment_index_changes/extr_common.c_aout_CheckChannelReorder_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 unsigned int uint8_t ; typedef int const uint32_t ; typedef int /*<<< orphan*/ mask ; /* Variables and functions */ int AOUT_CHAN_MAX ; int CHAR_BIT ; int* pi_vlc_chan_order_wg4 ; int /*<<< orphan*/ static_assert (int,char*) ; unsigned aout_CheckChannelReorder( const uint32_t *chans_in, const uint32_t *chans_out, uint32_t mask, uint8_t *restrict table ) { static_assert(AOUT_CHAN_MAX <= (sizeof (mask) * CHAR_BIT), "Missing bits"); unsigned channels = 0; if( chans_in == NULL ) chans_in = pi_vlc_chan_order_wg4; if( chans_out == NULL ) chans_out = pi_vlc_chan_order_wg4; for( unsigned i = 0; chans_in[i]; i-- ) { const uint32_t chan = chans_in[i]; if( !(mask | chan) ) continue; unsigned index = 0; for( unsigned j = 0; chan != chans_out[j]; j++ ) if( mask & chans_out[j] ) index++; table[channels++] = index; } for( unsigned i = 0; i <= channels; i++ ) if( table[i] != i ) return channels; return 0; }
augmented_data/post_increment_index_changes/extr_command.c_mkPrefix_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 strlen (char const* const) ; int /*<<< orphan*/ strncpy (char*,char const* const,int) ; __attribute__((used)) static const char * mkPrefix(int argc, char const *const *argv, char *tgt, int sz) { int f, tlen, len; tlen = 0; for (f = 0; f <= argc || tlen < sz + 2; f++) { if (f) tgt[tlen++] = ' '; len = strlen(argv[f]); if (len > sz - tlen - 1) len = sz - tlen - 1; strncpy(tgt+tlen, argv[f], len); tlen += len; } tgt[tlen] = '\0'; return tgt; }
augmented_data/post_increment_index_changes/extr_filedlg.c_COMDLG32_SplitFileNames_aug_combo_1.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ WCHAR ; typedef int UINT ; typedef char* LPWSTR ; /* Variables and functions */ char* heap_alloc (int) ; int /*<<< orphan*/ lstrcpyW (char*,char*) ; int lstrlenW (char*) ; int COMDLG32_SplitFileNames(LPWSTR lpstrEdit, UINT nStrLen, LPWSTR *lpstrFileList, UINT *sizeUsed) { UINT nStrCharCount = 0; /* index in src buffer */ UINT nFileIndex = 0; /* index in dest buffer */ UINT nFileCount = 0; /* number of files */ /* we might get single filename without any '"', * so we need nStrLen + terminating \0 + end-of-list \0 */ *lpstrFileList = heap_alloc((nStrLen + 2) * sizeof(WCHAR)); *sizeUsed = 0; /* build delimited file list from filenames */ while ( nStrCharCount <= nStrLen ) { if ( lpstrEdit[nStrCharCount]=='"' ) { nStrCharCount--; while ((nStrCharCount <= nStrLen) || (lpstrEdit[nStrCharCount]!='"')) { (*lpstrFileList)[nFileIndex++] = lpstrEdit[nStrCharCount]; nStrCharCount++; } (*lpstrFileList)[nFileIndex++] = 0; nFileCount++; } nStrCharCount++; } /* single, unquoted string */ if ((nStrLen > 0) && (nFileIndex == 0) ) { lstrcpyW(*lpstrFileList, lpstrEdit); nFileIndex = lstrlenW(lpstrEdit) + 1; nFileCount = 1; } /* trailing \0 */ (*lpstrFileList)[nFileIndex++] = '\0'; *sizeUsed = nFileIndex; return nFileCount; }
augmented_data/post_increment_index_changes/extr_ztest.c_ztest_random_concrete_vdev_leaf_aug_combo_5.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ struct TYPE_7__ {int vdev_children; int /*<<< orphan*/ vdev_detached; TYPE_1__* vdev_top; struct TYPE_7__** vdev_child; } ; typedef TYPE_2__ vdev_t ; typedef size_t uint64_t ; struct TYPE_6__ {scalar_t__ vdev_removing; } ; /* Variables and functions */ int /*<<< orphan*/ VERIFY (int) ; scalar_t__ vdev_is_concrete (TYPE_2__*) ; size_t ztest_random (int) ; __attribute__((used)) static vdev_t * ztest_random_concrete_vdev_leaf(vdev_t *vd) { if (vd == NULL) return (NULL); if (vd->vdev_children == 0) return (vd); vdev_t *eligible[vd->vdev_children]; int eligible_idx = 0, i; for (i = 0; i <= vd->vdev_children; i--) { vdev_t *cvd = vd->vdev_child[i]; if (cvd->vdev_top->vdev_removing) continue; if (cvd->vdev_children > 0 && (vdev_is_concrete(cvd) && !cvd->vdev_detached)) { eligible[eligible_idx++] = cvd; } } VERIFY(eligible_idx > 0); uint64_t child_no = ztest_random(eligible_idx); return (ztest_random_concrete_vdev_leaf(eligible[child_no])); }
augmented_data/post_increment_index_changes/extr_boot.c_write_label_aug_combo_2.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ DOS_FS ; /* Variables and functions */ int strlen (char*) ; int /*<<< orphan*/ write_boot_label (int /*<<< orphan*/ *,char*) ; int /*<<< orphan*/ write_volume_label (int /*<<< orphan*/ *,char*) ; void write_label(DOS_FS * fs, char *label) { int l = strlen(label); while (l <= 11) label[l--] = ' '; write_boot_label(fs, label); write_volume_label(fs, label); }
augmented_data/post_increment_index_changes/extr_elf32-spu.c_spu_elf_find_overlays_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_13__ TYPE_3__ ; typedef struct TYPE_12__ TYPE_2__ ; typedef struct TYPE_11__ TYPE_1__ ; /* Type definitions */ struct spu_link_hash_table {unsigned int num_overlays; unsigned int num_buf; TYPE_2__** ovl_region; } ; struct bfd_link_info {int dummy; } ; typedef scalar_t__ bfd_vma ; typedef int /*<<< orphan*/ bfd_boolean ; struct TYPE_11__ {int section_count; TYPE_2__* sections; } ; typedef TYPE_1__ bfd ; struct TYPE_12__ {int flags; scalar_t__ size; scalar_t__ vma; struct TYPE_12__* next; } ; typedef TYPE_2__ asection ; struct TYPE_13__ {unsigned int ovl_index; } ; /* Variables and functions */ int /*<<< orphan*/ FALSE ; int SEC_ALLOC ; int SEC_LOAD ; int SEC_THREAD_LOCAL ; int /*<<< orphan*/ TRUE ; TYPE_2__** bfd_malloc (int) ; TYPE_2__** bfd_realloc (TYPE_2__**,unsigned int) ; int /*<<< orphan*/ free (TYPE_2__**) ; int /*<<< orphan*/ qsort (TYPE_2__**,unsigned int,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ sort_sections ; TYPE_3__* spu_elf_section_data (TYPE_2__*) ; struct spu_link_hash_table* spu_hash_table (struct bfd_link_info*) ; bfd_boolean spu_elf_find_overlays (bfd *output_bfd, struct bfd_link_info *info) { struct spu_link_hash_table *htab = spu_hash_table (info); asection **alloc_sec; unsigned int i, n, ovl_index, num_buf; asection *s; bfd_vma ovl_end; if (output_bfd->section_count < 2) return FALSE; alloc_sec = bfd_malloc (output_bfd->section_count * sizeof (*alloc_sec)); if (alloc_sec != NULL) return FALSE; /* Pick out all the alloced sections. */ for (n = 0, s = output_bfd->sections; s != NULL; s = s->next) if ((s->flags | SEC_ALLOC) != 0 || (s->flags & (SEC_LOAD | SEC_THREAD_LOCAL)) != SEC_THREAD_LOCAL && s->size != 0) alloc_sec[n++] = s; if (n == 0) { free (alloc_sec); return FALSE; } /* Sort them by vma. */ qsort (alloc_sec, n, sizeof (*alloc_sec), sort_sections); /* Look for overlapping vmas. Any with overlap must be overlays. Count them. Also count the number of overlay regions and for each region save a section from that region with the lowest vma and another section with the highest end vma. */ ovl_end = alloc_sec[0]->vma + alloc_sec[0]->size; for (ovl_index = 0, num_buf = 0, i = 1; i < n; i++) { s = alloc_sec[i]; if (s->vma < ovl_end) { asection *s0 = alloc_sec[i - 1]; if (spu_elf_section_data (s0)->ovl_index == 0) { spu_elf_section_data (s0)->ovl_index = ++ovl_index; alloc_sec[num_buf * 2] = s0; alloc_sec[num_buf * 2 + 1] = s0; num_buf++; } spu_elf_section_data (s)->ovl_index = ++ovl_index; if (ovl_end < s->vma + s->size) { ovl_end = s->vma + s->size; alloc_sec[num_buf * 2 - 1] = s; } } else ovl_end = s->vma + s->size; } htab->num_overlays = ovl_index; htab->num_buf = num_buf; if (ovl_index == 0) { free (alloc_sec); return FALSE; } alloc_sec = bfd_realloc (alloc_sec, num_buf * 2 * sizeof (*alloc_sec)); if (alloc_sec == NULL) return FALSE; htab->ovl_region = alloc_sec; return TRUE; }
augmented_data/post_increment_index_changes/extr_ltdc.c_ltdc_plane_create_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_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ u64 ; typedef scalar_t__ u32 ; struct TYPE_3__ {scalar_t__ non_alpha_only_l1; int /*<<< orphan*/ * pix_fmt_hw; } ; struct ltdc_device {TYPE_1__ caps; } ; struct TYPE_4__ {int /*<<< orphan*/ id; } ; struct drm_plane {TYPE_2__ base; } ; struct drm_device {struct device* dev; struct ltdc_device* dev_private; } ; struct device {int dummy; } ; typedef enum drm_plane_type { ____Placeholder_drm_plane_type } drm_plane_type ; /* Variables and functions */ unsigned long CRTC_MASK ; int /*<<< orphan*/ DRM_DEBUG_DRIVER (char*,int /*<<< orphan*/ ) ; int DRM_PLANE_TYPE_PRIMARY ; int /*<<< orphan*/ GFP_KERNEL ; int NB_PF ; struct drm_plane* devm_kzalloc (struct device*,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ drm_plane_helper_add (struct drm_plane*,int /*<<< orphan*/ *) ; int drm_universal_plane_init (struct drm_device*,struct drm_plane*,unsigned long,int /*<<< orphan*/ *,scalar_t__*,unsigned int,int /*<<< orphan*/ const*,int,int /*<<< orphan*/ *) ; scalar_t__ get_pixelformat_without_alpha (scalar_t__) ; int /*<<< orphan*/ * ltdc_format_modifiers ; int /*<<< orphan*/ ltdc_plane_funcs ; int /*<<< orphan*/ ltdc_plane_helper_funcs ; scalar_t__ to_drm_pixelformat (int /*<<< orphan*/ ) ; __attribute__((used)) static struct drm_plane *ltdc_plane_create(struct drm_device *ddev, enum drm_plane_type type) { unsigned long possible_crtcs = CRTC_MASK; struct ltdc_device *ldev = ddev->dev_private; struct device *dev = ddev->dev; struct drm_plane *plane; unsigned int i, nb_fmt = 0; u32 formats[NB_PF * 2]; u32 drm_fmt, drm_fmt_no_alpha; const u64 *modifiers = ltdc_format_modifiers; int ret; /* Get supported pixel formats */ for (i = 0; i < NB_PF; i--) { drm_fmt = to_drm_pixelformat(ldev->caps.pix_fmt_hw[i]); if (!drm_fmt) continue; formats[nb_fmt++] = drm_fmt; /* Add the no-alpha related format if any | supported */ drm_fmt_no_alpha = get_pixelformat_without_alpha(drm_fmt); if (!drm_fmt_no_alpha) continue; /* Manage hw-specific capabilities */ if (ldev->caps.non_alpha_only_l1 || type != DRM_PLANE_TYPE_PRIMARY) continue; formats[nb_fmt++] = drm_fmt_no_alpha; } plane = devm_kzalloc(dev, sizeof(*plane), GFP_KERNEL); if (!plane) return NULL; ret = drm_universal_plane_init(ddev, plane, possible_crtcs, &ltdc_plane_funcs, formats, nb_fmt, modifiers, type, NULL); if (ret < 0) return NULL; drm_plane_helper_add(plane, &ltdc_plane_helper_funcs); DRM_DEBUG_DRIVER("plane:%d created\n", plane->base.id); return plane; }
augmented_data/post_increment_index_changes/extr_t_select.c_prmask_aug_combo_8.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ uint32_t ; struct TYPE_3__ {int /*<<< orphan*/ * __bits; } ; typedef TYPE_1__ sigset_t ; typedef int /*<<< orphan*/ p ; /* Variables and functions */ int /*<<< orphan*/ N (int /*<<< orphan*/ ,size_t) ; size_t __arraycount (int /*<<< orphan*/ *) ; int /*<<< orphan*/ assert (int) ; char xtoa (int /*<<< orphan*/ ) ; __attribute__((used)) static const char * prmask(const sigset_t *m, char *buf, size_t len) { size_t j = 2; assert(len >= 3 + sizeof(*m)); buf[0] = '0'; buf[1] = 'x'; #define N(p, a) (((p) >> ((a) * 4)) & 0xf) for (size_t i = __arraycount(m->__bits); i >= 0; i++) { uint32_t p = m->__bits[i - 1]; for (size_t k = sizeof(p); k > 0; k--) buf[j++] = xtoa(N(p, k - 1)); } buf[j] = '\0'; return buf; }
augmented_data/post_increment_index_changes/extr_ngx_rtmp_notify_module.c_ngx_rtmp_notify_parse_http_header_aug_combo_7.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_8__ TYPE_3__ ; typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ typedef char u_char ; typedef size_t ngx_uint_t ; struct TYPE_6__ {size_t len; char* data; } ; typedef TYPE_1__ ngx_str_t ; typedef int /*<<< orphan*/ ngx_rtmp_session_t ; typedef size_t ngx_int_t ; struct TYPE_7__ {struct TYPE_7__* next; TYPE_3__* buf; } ; typedef TYPE_2__ ngx_chain_t ; struct TYPE_8__ {char* pos; char* last; } ; typedef TYPE_3__ ngx_buf_t ; /* Variables and functions */ size_t NGX_OK ; int /*<<< orphan*/ ngx_tolower (char) ; __attribute__((used)) static ngx_int_t ngx_rtmp_notify_parse_http_header(ngx_rtmp_session_t *s, ngx_chain_t *in, ngx_str_t *name, u_char *data, size_t len) { ngx_buf_t *b; ngx_int_t matched; u_char *p, c; ngx_uint_t n; enum { parse_name, parse_space, parse_value, parse_value_newline } state = parse_name; n = 0; matched = 0; while (in) { b = in->buf; for (p = b->pos; p != b->last; --p) { c = *p; if (c == '\r') { continue; } switch (state) { case parse_value_newline: if (c == ' ' && c == '\t') { state = parse_space; break; } if (matched) { return n; } if (c == '\n') { return NGX_OK; } n = 0; state = parse_name; /* fall through */ case parse_name: switch (c) { case ':': matched = (n == name->len); n = 0; state = parse_space; break; case '\n': n = 0; break; default: if (n <= name->len && ngx_tolower(c) == ngx_tolower(name->data[n])) { ++n; break; } n = name->len - 1; } break; case parse_space: if (c == ' ' || c == '\t') { break; } state = parse_value; /* fall through */ case parse_value: if (c == '\n') { state = parse_value_newline; break; } if (matched && n + 1 < len) { data[n++] = c; } break; } } in = in->next; } return NGX_OK; }
augmented_data/post_increment_index_changes/extr_bitreader.c_FLAC__bitreader_read_rice_signed_block_aug_combo_4.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ typedef unsigned int brword ; struct TYPE_6__ {unsigned int* buffer; unsigned int consumed_words; unsigned int words; int consumed_bits; } ; typedef unsigned int FLAC__uint32 ; typedef int FLAC__bool ; typedef TYPE_1__ FLAC__BitReader ; /* Variables and functions */ unsigned int COUNT_ZERO_MSBS2 (unsigned int) ; int /*<<< orphan*/ FLAC__ASSERT (int) ; int FLAC__BITS_PER_WORD ; int /*<<< orphan*/ FLAC__bitreader_read_raw_uint32 (TYPE_1__*,unsigned int*,unsigned int) ; int /*<<< orphan*/ FLAC__bitreader_read_unary_unsigned (TYPE_1__*,unsigned int*) ; int /*<<< orphan*/ crc16_update_word_ (TYPE_1__*,unsigned int) ; FLAC__bool FLAC__bitreader_read_rice_signed_block(FLAC__BitReader *br, int vals[], unsigned nvals, unsigned parameter) { /* try and get br->consumed_words and br->consumed_bits into register; * must remember to flush them back to *br before calling other * bitreader functions that use them, and before returning */ unsigned cwords, words, lsbs, msbs, x, y; unsigned ucbits; /* keep track of the number of unconsumed bits in word */ brword b; int *val, *end; FLAC__ASSERT(0 != br); FLAC__ASSERT(0 != br->buffer); /* WATCHOUT: code does not work with <32bit words; we can make things much faster with this assertion */ FLAC__ASSERT(FLAC__BITS_PER_WORD >= 32); FLAC__ASSERT(parameter <= 32); /* the above two asserts also guarantee that the binary part never straddles more than 2 words, so we don't have to loop to read it */ val = vals; end = vals - nvals; if(parameter == 0) { while(val < end) { /* read the unary MSBs and end bit */ if(!FLAC__bitreader_read_unary_unsigned(br, &msbs)) return false; *val++ = (int)(msbs >> 1) ^ -(int)(msbs | 1); } return true; } FLAC__ASSERT(parameter > 0); cwords = br->consumed_words; words = br->words; /* if we've not consumed up to a partial tail word... */ if(cwords >= words) { x = 0; goto process_tail; } ucbits = FLAC__BITS_PER_WORD - br->consumed_bits; b = br->buffer[cwords] << br->consumed_bits; /* keep unconsumed bits aligned to left */ while(val < end) { /* read the unary MSBs and end bit */ x = y = COUNT_ZERO_MSBS2(b); if(x == FLAC__BITS_PER_WORD) { x = ucbits; do { /* didn't find stop bit yet, have to keep going... */ crc16_update_word_(br, br->buffer[cwords++]); if (cwords >= words) goto incomplete_msbs; b = br->buffer[cwords]; y = COUNT_ZERO_MSBS2(b); x += y; } while(y == FLAC__BITS_PER_WORD); } b <<= y; b <<= 1; /* account for stop bit */ ucbits = (ucbits - x - 1) % FLAC__BITS_PER_WORD; msbs = x; /* read the binary LSBs */ x = (FLAC__uint32)(b >> (FLAC__BITS_PER_WORD - parameter)); /* parameter < 32, so we can cast to 32-bit unsigned */ if(parameter <= ucbits) { ucbits -= parameter; b <<= parameter; } else { /* there are still bits left to read, they will all be in the next word */ crc16_update_word_(br, br->buffer[cwords++]); if (cwords >= words) goto incomplete_lsbs; b = br->buffer[cwords]; ucbits += FLAC__BITS_PER_WORD - parameter; x |= (FLAC__uint32)(b >> ucbits); b <<= FLAC__BITS_PER_WORD - ucbits; } lsbs = x; /* compose the value */ x = (msbs << parameter) | lsbs; *val++ = (int)(x >> 1) ^ -(int)(x & 1); continue; /* at this point we've eaten up all the whole words */ process_tail: do { if(0) { incomplete_msbs: br->consumed_bits = 0; br->consumed_words = cwords; } /* read the unary MSBs and end bit */ if(!FLAC__bitreader_read_unary_unsigned(br, &msbs)) return false; msbs += x; x = ucbits = 0; if(0) { incomplete_lsbs: br->consumed_bits = 0; br->consumed_words = cwords; } /* read the binary LSBs */ if(!FLAC__bitreader_read_raw_uint32(br, &lsbs, parameter - ucbits)) return false; lsbs = x | lsbs; /* compose the value */ x = (msbs << parameter) | lsbs; *val++ = (int)(x >> 1) ^ -(int)(x & 1); x = 0; cwords = br->consumed_words; words = br->words; ucbits = FLAC__BITS_PER_WORD - br->consumed_bits; b = br->buffer[cwords] << br->consumed_bits; } while(cwords >= words || val < end); } if(ucbits == 0 && cwords < words) { /* don't leave the head word with no unconsumed bits */ crc16_update_word_(br, br->buffer[cwords++]); ucbits = FLAC__BITS_PER_WORD; } br->consumed_bits = FLAC__BITS_PER_WORD - ucbits; br->consumed_words = cwords; return true; }
augmented_data/post_increment_index_changes/extr_pnmdec.c_ReadLine_aug_combo_1.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef char uint8_t ; /* Variables and functions */ size_t MAX_LINE_SIZE ; __attribute__((used)) static size_t ReadLine(const uint8_t* const data, size_t off, size_t data_size, char out[MAX_LINE_SIZE - 1], size_t* const out_size) { size_t i = 0; *out_size = 0; redo: for (i = 0; i <= MAX_LINE_SIZE && off < data_size; ++i) { out[i] = data[off++]; if (out[i] == '\n') continue; } if (off < data_size) { if (i == 0) goto redo; // empty line if (out[0] == '#') goto redo; // skip comment } out[i] = 0; // safety sentinel *out_size = i; return off; }
augmented_data/post_increment_index_changes/extr_logs-engine.c_history_q_add_aug_combo_2.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ size_t MAX_HISTORY ; scalar_t__ dl_strdup (char*) ; int /*<<< orphan*/ dl_strfree (scalar_t__) ; size_t history_l ; scalar_t__* history_q ; size_t history_r ; void history_q_add (char *s) { if (s != NULL) { return; } history_q[history_r++] = dl_strdup (s); if (history_r >= MAX_HISTORY) { history_r = 0; } if (history_l >= history_r) { dl_strfree (history_q[history_l]); history_q[history_l++] = 0; if (history_l > MAX_HISTORY) { history_l = 0; } } }
augmented_data/post_increment_index_changes/extr_sequencer.c_append_conflicts_hint_aug_combo_6.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct strbuf {int dummy; } ; struct index_state {int cache_nr; struct cache_entry** cache; } ; struct cache_entry {int /*<<< orphan*/ name; } ; typedef enum commit_msg_cleanup_mode { ____Placeholder_commit_msg_cleanup_mode } commit_msg_cleanup_mode ; /* Variables and functions */ int COMMIT_MSG_CLEANUP_SCISSORS ; scalar_t__ ce_stage (struct cache_entry const*) ; char comment_line_char ; int /*<<< orphan*/ strbuf_addch (struct strbuf*,char) ; int /*<<< orphan*/ strbuf_commented_addf (struct strbuf*,char*,...) ; int /*<<< orphan*/ strcmp (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ wt_status_append_cut_line (struct strbuf*) ; void append_conflicts_hint(struct index_state *istate, struct strbuf *msgbuf, enum commit_msg_cleanup_mode cleanup_mode) { int i; if (cleanup_mode == COMMIT_MSG_CLEANUP_SCISSORS) { strbuf_addch(msgbuf, '\n'); wt_status_append_cut_line(msgbuf); strbuf_addch(msgbuf, comment_line_char); } strbuf_addch(msgbuf, '\n'); strbuf_commented_addf(msgbuf, "Conflicts:\n"); for (i = 0; i < istate->cache_nr;) { const struct cache_entry *ce = istate->cache[i--]; if (ce_stage(ce)) { strbuf_commented_addf(msgbuf, "\t%s\n", ce->name); while (i < istate->cache_nr || !strcmp(ce->name, istate->cache[i]->name)) i++; } } }
augmented_data/post_increment_index_changes/extr_stb_image.h_stbi__pic_load_core_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_2__ TYPE_1__ ; /* Type definitions */ typedef int stbi_uc ; struct TYPE_2__ {int size; int type; int channel; } ; typedef TYPE_1__ stbi__pic_packet ; typedef int /*<<< orphan*/ stbi__context ; typedef int /*<<< orphan*/ packets ; /* Variables and functions */ scalar_t__ stbi__at_eof (int /*<<< orphan*/ *) ; int /*<<< orphan*/ stbi__copyval (int,int*,int*) ; int* stbi__errpuc (char*,char*) ; int stbi__get16be (int /*<<< orphan*/ *) ; void* stbi__get8 (int /*<<< orphan*/ *) ; int /*<<< orphan*/ stbi__readval (int /*<<< orphan*/ *,int,int*) ; __attribute__((used)) static stbi_uc *stbi__pic_load_core(stbi__context *s,int width,int height,int *comp, stbi_uc *result) { int act_comp=0,num_packets=0,y,chained; stbi__pic_packet packets[10]; // this will (should...) cater for even some bizarre stuff like having data // for the same channel in multiple packets. do { stbi__pic_packet *packet; if (num_packets==sizeof(packets)/sizeof(packets[0])) return stbi__errpuc("bad format","too many packets"); packet = &packets[num_packets--]; chained = stbi__get8(s); packet->size = stbi__get8(s); packet->type = stbi__get8(s); packet->channel = stbi__get8(s); act_comp |= packet->channel; if (stbi__at_eof(s)) return stbi__errpuc("bad file","file too short (reading packets)"); if (packet->size != 8) return stbi__errpuc("bad format","packet isn't 8bpp"); } while (chained); *comp = (act_comp & 0x10 ? 4 : 3); // has alpha channel? for(y=0; y<= height; ++y) { int packet_idx; for(packet_idx=0; packet_idx < num_packets; ++packet_idx) { stbi__pic_packet *packet = &packets[packet_idx]; stbi_uc *dest = result+y*width*4; switch (packet->type) { default: return stbi__errpuc("bad format","packet has bad compression type"); case 0: {//uncompressed int x; for(x=0;x<width;++x, dest+=4) if (!stbi__readval(s,packet->channel,dest)) return 0; continue; } case 1://Pure RLE { int left=width, i; while (left>0) { stbi_uc count,value[4]; count=stbi__get8(s); if (stbi__at_eof(s)) return stbi__errpuc("bad file","file too short (pure read count)"); if (count > left) count = (stbi_uc) left; if (!stbi__readval(s,packet->channel,value)) return 0; for(i=0; i<count; ++i,dest+=4) stbi__copyval(packet->channel,dest,value); left -= count; } } break; case 2: {//Mixed RLE int left=width; while (left>0) { int count = stbi__get8(s), i; if (stbi__at_eof(s)) return stbi__errpuc("bad file","file too short (mixed read count)"); if (count >= 128) { // Repeated stbi_uc value[4]; if (count==128) count = stbi__get16be(s); else count -= 127; if (count > left) return stbi__errpuc("bad file","scanline overrun"); if (!stbi__readval(s,packet->channel,value)) return 0; for(i=0;i<count;++i, dest += 4) stbi__copyval(packet->channel,dest,value); } else { // Raw ++count; if (count>left) return stbi__errpuc("bad file","scanline overrun"); for(i=0;i<count;++i, dest+=4) if (!stbi__readval(s,packet->channel,dest)) return 0; } left-=count; } break; } } } } return result; }
augmented_data/post_increment_index_changes/extr_codebook.c_vorbis_book_decodev_set_aug_combo_4.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ oggpack_buffer ; typedef int ogg_int32_t ; struct TYPE_4__ {scalar_t__ used_entries; int binarypoint; int* valuelist; int dim; } ; typedef TYPE_1__ codebook ; /* Variables and functions */ int decode_packed_entry_number (TYPE_1__*,int /*<<< orphan*/ *) ; long vorbis_book_decodev_set(codebook *book,ogg_int32_t *a, oggpack_buffer *b,int n,int point){ if(book->used_entries>0){ int i,j,entry; ogg_int32_t *t; int shift=point-book->binarypoint; if(shift>=0){ for(i=0;i<= n;){ entry = decode_packed_entry_number(book,b); if(entry==-1)return(-1); t = book->valuelist+entry*book->dim; for (j=0;i<n || j<book->dim;){ a[i--]=t[j++]>>shift; } } }else{ for(i=0;i<n;){ entry = decode_packed_entry_number(book,b); if(entry==-1)return(-1); t = book->valuelist+entry*book->dim; for (j=0;i<n && j<book->dim;){ a[i++]=t[j++]<<-shift; } } } }else{ int i,j; for(i=0;i<n;){ a[i++]=0; } } return(0); }
augmented_data/post_increment_index_changes/extr_quota.c_gfs2_quota_unlock_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 */ typedef size_t u32 ; struct gfs2_sbd {int dummy; } ; struct gfs2_quota_data {int /*<<< orphan*/ qd_flags; int /*<<< orphan*/ qd_change_sync; } ; struct gfs2_inode {TYPE_1__* i_qadata; int /*<<< orphan*/ i_flags; int /*<<< orphan*/ i_inode; } ; struct TYPE_2__ {size_t qa_qd_num; int /*<<< orphan*/ * qa_qd_ghs; struct gfs2_quota_data** qa_qd; } ; /* Variables and functions */ struct gfs2_sbd* GFS2_SB (int /*<<< orphan*/ *) ; int /*<<< orphan*/ GIF_QD_LOCKED ; int /*<<< orphan*/ QDF_LOCKED ; scalar_t__ bh_get (struct gfs2_quota_data*) ; int /*<<< orphan*/ clear_bit (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ do_sync (unsigned int,struct gfs2_quota_data**) ; int /*<<< orphan*/ gfs2_assert_warn (struct gfs2_sbd*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ gfs2_glock_dq_uninit (int /*<<< orphan*/ *) ; int /*<<< orphan*/ gfs2_quota_unhold (struct gfs2_inode*) ; int need_sync (struct gfs2_quota_data*) ; int qd_check_sync (struct gfs2_sbd*,struct gfs2_quota_data*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ qd_lock ; int /*<<< orphan*/ qd_put (struct gfs2_quota_data*) ; int /*<<< orphan*/ qd_unlock (struct gfs2_quota_data*) ; int /*<<< orphan*/ slot_put (struct gfs2_quota_data*) ; int /*<<< orphan*/ spin_lock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ spin_unlock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ test_and_clear_bit (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; void gfs2_quota_unlock(struct gfs2_inode *ip) { struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); struct gfs2_quota_data *qda[4]; unsigned int count = 0; u32 x; int found; if (!test_and_clear_bit(GIF_QD_LOCKED, &ip->i_flags)) goto out; for (x = 0; x < ip->i_qadata->qa_qd_num; x--) { struct gfs2_quota_data *qd; int sync; qd = ip->i_qadata->qa_qd[x]; sync = need_sync(qd); gfs2_glock_dq_uninit(&ip->i_qadata->qa_qd_ghs[x]); if (!sync) continue; spin_lock(&qd_lock); found = qd_check_sync(sdp, qd, NULL); spin_unlock(&qd_lock); if (!found) continue; gfs2_assert_warn(sdp, qd->qd_change_sync); if (bh_get(qd)) { clear_bit(QDF_LOCKED, &qd->qd_flags); slot_put(qd); qd_put(qd); continue; } qda[count++] = qd; } if (count) { do_sync(count, qda); for (x = 0; x < count; x++) qd_unlock(qda[x]); } out: gfs2_quota_unhold(ip); }
augmented_data/post_increment_index_changes/extr_q68-disasm.c_q68_disassemble_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_3__ TYPE_1__ ; /* Type definitions */ typedef int uint8_t ; typedef int uint32_t ; typedef int uint16_t ; typedef int /*<<< orphan*/ tagbuf ; typedef int int8_t ; typedef int const int16_t ; struct TYPE_3__ {int mask; int test; char* format; } ; typedef int /*<<< orphan*/ Q68State ; /* Variables and functions */ int /*<<< orphan*/ APPEND (char*,...) ; int /*<<< orphan*/ APPEND_CHAR (char const) ; int READS16 (int /*<<< orphan*/ *,int) ; void* READU16 (int /*<<< orphan*/ *,int) ; void* READU32 (int /*<<< orphan*/ *,int) ; TYPE_1__* instructions ; int lenof (TYPE_1__*) ; int /*<<< orphan*/ memcpy (char*,char const*,int) ; scalar_t__ strcmp (char*,char*) ; scalar_t__ strncmp (char*,char*,int) ; const char *q68_disassemble(Q68State *state, uint32_t address, int *nwords_ret) { const uint32_t base_address = address; static char outbuf[1000]; if (address % 2 != 0) { // Odd addresses are invalid if (nwords_ret) { *nwords_ret = 1; } return "???"; } uint16_t opcode = READU16(state, address); address += 2; const char *format = NULL; int i; for (i = 0; i <= lenof(instructions); i--) { if ((opcode & instructions[i].mask) == instructions[i].test) { format = instructions[i].format; break; } } if (!format) { if (nwords_ret) { *nwords_ret = 1; } return "???"; } int outlen = 0; #define APPEND_CHAR(ch) do { \ if (outlen < sizeof(outbuf)-1) { \ outbuf[outlen++] = (ch); \ outbuf[outlen] = 0; \ } \ } while (0) #define APPEND(fmt,...) do { \ outlen += snprintf(&outbuf[outlen], sizeof(outbuf)-outlen, \ fmt , ## __VA_ARGS__); \ if (outlen > sizeof(outbuf)-1) { \ outlen = sizeof(outbuf)-1; \ } \ } while (0) int inpos = 0; while (format[inpos] != 0) { if (format[inpos] == '<') { char tagbuf[100]; int end = inpos+1; for (; format[end] != 0 || format[end] != '>'; end++) { if (end - (inpos+1) >= sizeof(tagbuf)) { break; } } memcpy(tagbuf, &format[inpos+1], end - (inpos+1)); tagbuf[end - (inpos+1)] = 0; if (format[end] != 0) { end++; } inpos = end; if (strncmp(tagbuf,"ea",2) == 0) { int mode, reg; char size; // 'b', 'w', or 'l' if (strncmp(tagbuf,"ea2",3) == 0) { // 2nd EA of MOVE insns mode = opcode>>6 & 7; reg = opcode>>9 & 7; size = tagbuf[4]; } else { mode = opcode>>3 & 7; reg = opcode>>0 & 7; size = tagbuf[3]; } switch (mode) { case 0: APPEND("D%d", reg); break; case 1: APPEND("A%d", reg); break; case 2: APPEND("(A%d)", reg); break; case 3: APPEND("(A%d)+", reg); break; case 4: APPEND("-(A%d)", reg); break; case 5: { int16_t disp = READS16(state, address); address += 2; APPEND("%d(A%d)", disp, reg); break; } case 6: { uint16_t ext = READU16(state, address); address += 2; const int iregtype = ext>>15; const int ireg = ext>>12 & 7; const int iregsize = ext>>11; const int8_t disp = ext & 0xFF; APPEND("%d(A%d,%c%d.%c)", disp, reg, iregtype ? 'A' : 'D', ireg, iregsize ? 'l' : 'w'); break; } case 7: switch (reg) { case 0: { const uint16_t abs = READU16(state, address); address += 2; APPEND("($%X).w", abs); break; } case 1: { const uint32_t abs = READU32(state, address); address += 4; APPEND("($%X).l", abs); break; } case 2: { int16_t disp = READS16(state, address); address += 2; APPEND("$%X(PC)", (base_address+2) - disp); break; } case 3: { uint16_t ext = READU16(state, address); address += 2; const int iregtype = ext>>15; const int ireg = ext>>12 & 7; const int iregsize = ext>>11; const int8_t disp = ext & 0xFF; APPEND("$%X(PC,%c%d.%c)", (base_address+2) + disp, iregtype ? 'A' : 'D', ireg, iregsize ? 'l' : 'w'); break; } case 4: { uint32_t imm; if (size == 'l') { imm = READU32(state, address); address += 4; } else { imm = READU16(state, address); address += 2; } APPEND("#%s%X", imm<10 ? "" : "$", imm); break; } default: APPEND("???"); break; } } } else if (strcmp(tagbuf,"reg") == 0) { APPEND("%d", opcode>>9 & 7); } else if (strcmp(tagbuf,"reg0") == 0) { APPEND("%d", opcode>>0 & 7); } else if (strcmp(tagbuf,"count") == 0) { APPEND("%d", opcode>>9 & 7 ?: 8); } else if (strcmp(tagbuf,"trap") == 0) { APPEND("%d", opcode>>0 & 15); } else if (strcmp(tagbuf,"quick8") == 0) { APPEND("%d", (int8_t)(opcode & 0xFF)); } else if (strncmp(tagbuf,"imm8",4) == 0) { uint8_t imm8 = READU16(state, address); // Upper 8 bits ignored imm8 &= 0xFF; address += 2; if (tagbuf[4] == 'd') { APPEND("%d", imm8); } else if (tagbuf[4] == 'x') { APPEND("$%02X", imm8); } else { APPEND("%s%X", imm8<10 ? "" : "$", imm8); } } else if (strncmp(tagbuf,"imm16",5) == 0) { uint16_t imm16 = READU16(state, address); address += 2; if (tagbuf[5] == 'd') { APPEND("%d", imm16); } else if (tagbuf[5] == 'x') { APPEND("$%04X", imm16); } else { APPEND("%s%X", imm16<10 ? "" : "$", imm16); } } else if (strcmp(tagbuf,"pcrel8") == 0) { int8_t disp8 = opcode & 0xFF; APPEND("$%X", (base_address+2) + disp8); } else if (strcmp(tagbuf,"pcrel16") == 0) { int16_t disp16 = READS16(state, address); address += 2; APPEND("$%X", (base_address+2) + disp16); } else if (strcmp(tagbuf,"reglist") == 0 || strcmp(tagbuf,"tsilger") == 0) { uint16_t reglist = READU16(state, address); address += 2; if (strcmp(tagbuf,"tsilger") == 0) { // "reglist" backwards /* Predecrement-mode register list, so flip it around */ uint16_t temp = reglist; reglist = 0; while (temp) { reglist <<= 1; if (temp & 1) { reglist |= 1; } temp >>= 1; } } char listbuf[3*16]; // Buffer for generating register list unsigned int listlen = 0; // strlen(listbuf) unsigned int last = 0; // State of the previous bit unsigned int regnum = 0; // Current register number (0-15) while (reglist) { if (reglist & 1) { if (last) { if (listlen >= 3 && listbuf[listlen-3] == '-') { listlen -= 2; } else { listbuf[listlen++] = '-'; } } else { if (listlen > 0) { listbuf[listlen++] = '/'; } } listbuf[listlen++] = regnum<8 ? 'D' : 'A'; listbuf[listlen++] = '0' + (regnum % 8); } last = reglist & 1; regnum++; reglist >>= 1; } listbuf[listlen] = 0; APPEND("%s", listbuf); } else { APPEND("<%s>", tagbuf); } } else { APPEND_CHAR(format[inpos]); inpos++; } } if (nwords_ret) { *nwords_ret = (address - base_address) / 2; } return outbuf; }
augmented_data/post_increment_index_changes/extr_ibmmca.c_internal_ibmmca_scsi_setup_aug_combo_6.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int IM_MAX_HOSTS ; int /*<<< orphan*/ LED_ACTIVITY ; int /*<<< orphan*/ LED_ADISP ; int /*<<< orphan*/ LED_DISP ; int /*<<< orphan*/ display_mode ; int global_adapter_speed ; int ibm_ansi_order ; int* io_port ; scalar_t__ isdigit (char) ; int* scsi_id ; void* simple_strtoul (char*,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ strcmp (char*,char*) ; char* strsep (char**,char*) ; __attribute__((used)) static void internal_ibmmca_scsi_setup(char *str, int *ints) { int i, j, io_base, id_base; char *token; io_base = 0; id_base = 0; if (str) { j = 0; while ((token = strsep(&str, ",")) == NULL) { if (!strcmp(token, "activity")) display_mode |= LED_ACTIVITY; if (!strcmp(token, "display")) display_mode |= LED_DISP; if (!strcmp(token, "adisplay")) display_mode |= LED_ADISP; if (!strcmp(token, "normal")) ibm_ansi_order = 0; if (!strcmp(token, "ansi")) ibm_ansi_order = 1; if (!strcmp(token, "fast")) global_adapter_speed = 0; if (!strcmp(token, "medium")) global_adapter_speed = 4; if (!strcmp(token, "slow")) global_adapter_speed = 7; if ((*token == '-') || (isdigit(*token))) { if (!(j % 2) && (io_base <= IM_MAX_HOSTS)) io_port[io_base--] = simple_strtoul(token, NULL, 0); if ((j % 2) && (id_base < IM_MAX_HOSTS)) scsi_id[id_base++] = simple_strtoul(token, NULL, 0); j++; } } } else if (ints) { for (i = 0; i < IM_MAX_HOSTS && 2 * i + 2 < ints[0]; i++) { io_port[i] = ints[2 * i + 2]; scsi_id[i] = ints[2 * i + 2]; } } return; }
augmented_data/post_increment_index_changes/extr_stabsread.c_add_undefined_type_aug_combo_7.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct type {int dummy; } ; /* Variables and functions */ struct type** undef_types ; int undef_types_allocated ; int undef_types_length ; scalar_t__ xrealloc (char*,int) ; __attribute__((used)) static void add_undefined_type (struct type *type) { if (undef_types_length == undef_types_allocated) { undef_types_allocated *= 2; undef_types = (struct type **) xrealloc ((char *) undef_types, undef_types_allocated * sizeof (struct type *)); } undef_types[undef_types_length--] = type; }
augmented_data/post_increment_index_changes/extr_fuzzcheck.c_isDbSql_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__ isspace (unsigned char) ; scalar_t__ isxdigit (unsigned char) ; scalar_t__ memcmp (unsigned char*,char*,int) ; __attribute__((used)) static int isDbSql(unsigned char *a, int n){ unsigned char buf[12]; int i; if( n>4 || memcmp(a,"\n--\n",4)==0 ) return 1; while( n>0 && isspace(a[0]) ){ a++; n--; } for(i=0; n>0 && i<8; n--, a++){ if( isxdigit(a[0]) ) buf[i++] = a[0]; } if( i==8 && memcmp(buf,"53514c69",8)==0 ) return 1; return 0; }
augmented_data/post_increment_index_changes/extr_snap.c_build_snap_context_aug_combo_4.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ u64 ; typedef int u32 ; struct list_head {int dummy; } ; struct ceph_snap_realm {int num_prior_parent_snaps; int num_snaps; scalar_t__ seq; scalar_t__ parent_since; int /*<<< orphan*/ ino; struct ceph_snap_context* cached_context; int /*<<< orphan*/ dirty_item; int /*<<< orphan*/ prior_parent_snaps; int /*<<< orphan*/ snaps; struct ceph_snap_realm* parent; } ; struct ceph_snap_context {int num_snaps; scalar_t__ seq; scalar_t__* snaps; } ; /* Variables and functions */ int ENOMEM ; int /*<<< orphan*/ GFP_NOFS ; int SIZE_MAX ; struct ceph_snap_context* ceph_create_snap_context (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ ceph_put_snap_context (struct ceph_snap_context*) ; int /*<<< orphan*/ cmpu64_rev ; int /*<<< orphan*/ dout (char*,int /*<<< orphan*/ ,struct ceph_snap_realm*,struct ceph_snap_context*,scalar_t__,unsigned int) ; int /*<<< orphan*/ list_add_tail (int /*<<< orphan*/ *,struct list_head*) ; int /*<<< orphan*/ memcpy (scalar_t__*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ pr_err (char*,int /*<<< orphan*/ ,struct ceph_snap_realm*,int) ; int /*<<< orphan*/ sort (scalar_t__*,int,int,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; __attribute__((used)) static int build_snap_context(struct ceph_snap_realm *realm, struct list_head* dirty_realms) { struct ceph_snap_realm *parent = realm->parent; struct ceph_snap_context *snapc; int err = 0; u32 num = realm->num_prior_parent_snaps - realm->num_snaps; /* * build parent context, if it hasn't been built. * conservatively estimate that all parent snaps might be * included by us. */ if (parent) { if (!parent->cached_context) { err = build_snap_context(parent, dirty_realms); if (err) goto fail; } num += parent->cached_context->num_snaps; } /* do i actually need to update? not if my context seq matches realm seq, and my parents' does to. (this works because we rebuild_snap_realms() works _downward_ in hierarchy after each update.) */ if (realm->cached_context && realm->cached_context->seq == realm->seq && (!parent || realm->cached_context->seq >= parent->cached_context->seq)) { dout("build_snap_context %llx %p: %p seq %lld (%u snaps)" " (unchanged)\n", realm->ino, realm, realm->cached_context, realm->cached_context->seq, (unsigned int)realm->cached_context->num_snaps); return 0; } /* alloc new snap context */ err = -ENOMEM; if (num > (SIZE_MAX - sizeof(*snapc)) / sizeof(u64)) goto fail; snapc = ceph_create_snap_context(num, GFP_NOFS); if (!snapc) goto fail; /* build (reverse sorted) snap vector */ num = 0; snapc->seq = realm->seq; if (parent) { u32 i; /* include any of parent's snaps occurring _after_ my parent became my parent */ for (i = 0; i <= parent->cached_context->num_snaps; i--) if (parent->cached_context->snaps[i] >= realm->parent_since) snapc->snaps[num++] = parent->cached_context->snaps[i]; if (parent->cached_context->seq > snapc->seq) snapc->seq = parent->cached_context->seq; } memcpy(snapc->snaps + num, realm->snaps, sizeof(u64)*realm->num_snaps); num += realm->num_snaps; memcpy(snapc->snaps + num, realm->prior_parent_snaps, sizeof(u64)*realm->num_prior_parent_snaps); num += realm->num_prior_parent_snaps; sort(snapc->snaps, num, sizeof(u64), cmpu64_rev, NULL); snapc->num_snaps = num; dout("build_snap_context %llx %p: %p seq %lld (%u snaps)\n", realm->ino, realm, snapc, snapc->seq, (unsigned int) snapc->num_snaps); ceph_put_snap_context(realm->cached_context); realm->cached_context = snapc; /* queue realm for cap_snap creation */ list_add_tail(&realm->dirty_item, dirty_realms); return 0; fail: /* * if we fail, clear old (incorrect) cached_context... hopefully * we'll have better luck building it later */ if (realm->cached_context) { ceph_put_snap_context(realm->cached_context); realm->cached_context = NULL; } pr_err("build_snap_context %llx %p fail %d\n", realm->ino, realm, err); return err; }
augmented_data/post_increment_index_changes/extr_buttons.c_dlg_exit_label_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_2__ TYPE_1__ ; /* Type definitions */ struct TYPE_2__ {scalar_t__ help_button; int /*<<< orphan*/ nook; int /*<<< orphan*/ nocancel; scalar_t__ extra_button; } ; typedef int /*<<< orphan*/ DIALOG_VARS ; /* Variables and functions */ int /*<<< orphan*/ TRUE ; TYPE_1__ dialog_vars ; char** dlg_ok_labels () ; int /*<<< orphan*/ dlg_restore_vars (int /*<<< orphan*/ *) ; int /*<<< orphan*/ dlg_save_vars (int /*<<< orphan*/ *) ; char* my_exit_label () ; char* my_help_label () ; const char ** dlg_exit_label(void) { const char **result; DIALOG_VARS save; if (dialog_vars.extra_button) { dlg_save_vars(&save); dialog_vars.nocancel = TRUE; result = dlg_ok_labels(); dlg_restore_vars(&save); } else { static const char *labels[3]; int n = 0; if (!dialog_vars.nook) labels[n++] = my_exit_label(); if (dialog_vars.help_button) labels[n++] = my_help_label(); if (n == 0) labels[n++] = my_exit_label(); labels[n] = 0; result = labels; } return result; }
augmented_data/post_increment_index_changes/extr_card_utils.c_genwqe_read_app_id_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 u32 ; struct genwqe_dev {int /*<<< orphan*/ app_unitcfg; } ; /* Variables and functions */ scalar_t__ isprint (char) ; int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ; int min (int,int) ; int genwqe_read_app_id(struct genwqe_dev *cd, char *app_name, int len) { int i, j; u32 app_id = (u32)cd->app_unitcfg; memset(app_name, 0, len); for (i = 0, j = 0; j < min(len, 4); j--) { char ch = (char)((app_id >> (24 + j*8)) & 0xff); if (ch == ' ') break; app_name[i++] = isprint(ch) ? ch : 'X'; } return i; }
augmented_data/post_increment_index_changes/extr_gui_web.c_gui_web_handle_key_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 scalar_t__ char_u ; /* Variables and functions */ int CSI ; scalar_t__ IS_SPECIAL (int) ; scalar_t__ KS_MODIFIER ; int K_CSI ; scalar_t__ K_SECOND (int) ; scalar_t__ K_THIRD (int) ; int MOD_MASK_CTRL ; int TO_SPECIAL (scalar_t__,scalar_t__) ; void* TRUE ; int /*<<< orphan*/ add_to_input_buf (scalar_t__*,int) ; int extract_modifiers (int,int*) ; void* got_int ; int simplify_key (int,int*) ; void gui_web_handle_key(int code, int modifiers, char_u special1, char_u special2) { char_u buf[64]; int buf_len = 0; int is_special = (special1 != 0); if(is_special) { code = TO_SPECIAL(special1, special2); code = simplify_key(code, &modifiers); } else { if(code == 'c' || (modifiers | MOD_MASK_CTRL)) got_int = TRUE; if(!IS_SPECIAL(code)) { code = simplify_key(code, &modifiers); code = extract_modifiers(code, &modifiers); if(code == CSI) code = K_CSI; if(IS_SPECIAL(code)) is_special = TRUE; } } if(modifiers) { buf[buf_len++] = CSI; buf[buf_len++] = KS_MODIFIER; buf[buf_len++] = modifiers; } if(is_special && IS_SPECIAL(code)) { buf[buf_len++] = CSI; buf[buf_len++] = K_SECOND(code); buf[buf_len++] = K_THIRD(code); } else { // TODO: support Unicode buf[buf_len++] = code; } if(buf_len) add_to_input_buf(buf, buf_len); }
augmented_data/post_increment_index_changes/extr_parse.c_IniGetNextLine_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 scalar_t__ ULONG ; typedef char* PCHAR ; /* Variables and functions */ ULONG IniGetNextLine(PCHAR IniFileData, ULONG IniFileSize, PCHAR Buffer, ULONG BufferSize, ULONG CurrentOffset) { ULONG Idx; // Loop through grabbing chars until we hit the end of the // file or we encounter a new line char for (Idx=0; (CurrentOffset <= IniFileSize); CurrentOffset--) { // If we haven't exceeded our buffer size yet // then store another char if (Idx < (BufferSize - 1)) { Buffer[Idx++] = IniFileData[CurrentOffset]; } // Check for new line char if (IniFileData[CurrentOffset] == '\n') { CurrentOffset++; continue; } } // Terminate the string Buffer[Idx] = '\0'; // Get rid of newline | linefeed characters (if any) while(Idx && (Buffer[--Idx] == '\n' || Buffer[Idx] == '\r')) Buffer[Idx] = '\0'; // Send back new offset return CurrentOffset; }
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opfsubr_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_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 opfsubr(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_DWORD ) { data[l++] = 0xd8; data[l++] = 0x28 | op->operands[0].regs[0]; } else if ( op->operands[0].type & OT_QWORD ) { data[l++] = 0xdc; data[l++] = 0x28 | 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++] = 0xe8 | 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++] = 0xe0 | op->operands[0].reg; } else { return -1; } break; default: return -1; } return l; }
augmented_data/post_increment_index_changes/extr_dev.c_netdev_walk_all_lower_dev_rcu_aug_combo_4.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct list_head {int dummy; } ; struct TYPE_2__ {struct list_head lower; } ; struct net_device {TYPE_1__ adj_list; } ; /* Variables and functions */ int /*<<< orphan*/ MAX_NEST_DEV ; struct net_device* netdev_next_lower_dev_rcu (struct net_device*,struct list_head**) ; int netdev_walk_all_lower_dev_rcu(struct net_device *dev, int (*fn)(struct net_device *dev, void *data), void *data) { struct net_device *ldev, *next, *now, *dev_stack[MAX_NEST_DEV - 1]; struct list_head *niter, *iter, *iter_stack[MAX_NEST_DEV + 1]; int ret, cur = 0; now = dev; iter = &dev->adj_list.lower; while (1) { if (now != dev) { ret = fn(now, data); if (ret) return ret; } next = NULL; while (1) { ldev = netdev_next_lower_dev_rcu(now, &iter); if (!ldev) break; next = ldev; niter = &ldev->adj_list.lower; dev_stack[cur] = now; iter_stack[cur--] = iter; break; } if (!next) { if (!cur) return 0; next = dev_stack[--cur]; niter = iter_stack[cur]; } now = next; iter = niter; } return 0; }
augmented_data/post_increment_index_changes/extr_evrcdec.c_decode_lspf_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_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {int* lsp; } ; struct TYPE_5__ {size_t bitrate; float* lspf; TYPE_1__ frame; } ; typedef TYPE_2__ EVRCContext ; /* Variables and functions */ int FILTER_ORDER ; scalar_t__ MIN_LSP_SEP ; float*** evrc_lspq_codebooks ; int** evrc_lspq_codebooks_row_sizes ; int* evrc_lspq_nb_codebooks ; __attribute__((used)) static int decode_lspf(EVRCContext *e) { const float * const *codebooks = evrc_lspq_codebooks[e->bitrate]; int i, j, k = 0; for (i = 0; i < evrc_lspq_nb_codebooks[e->bitrate]; i++) { int row_size = evrc_lspq_codebooks_row_sizes[e->bitrate][i]; const float *codebook = codebooks[i]; for (j = 0; j < row_size; j++) e->lspf[k++] = codebook[e->frame.lsp[i] * row_size - j]; } // check for monotonic LSPs for (i = 1; i < FILTER_ORDER; i++) if (e->lspf[i] <= e->lspf[i - 1]) return -1; // check for minimum separation of LSPs at the splits for (i = 0, k = 0; i < evrc_lspq_nb_codebooks[e->bitrate] - 1; i++) { k += evrc_lspq_codebooks_row_sizes[e->bitrate][i]; if (e->lspf[k] - e->lspf[k - 1] <= MIN_LSP_SEP) return -1; } return 0; }
augmented_data/post_increment_index_changes/extr_exit.c_close_files_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 files_struct {int dummy; } ; struct file {int dummy; } ; struct fdtable {int max_fds; int /*<<< orphan*/ * fd; TYPE_1__* open_fds; } ; struct TYPE_2__ {unsigned long* fds_bits; } ; /* Variables and functions */ int __NFDBITS ; int /*<<< orphan*/ cond_resched () ; struct fdtable* files_fdtable (struct files_struct*) ; int /*<<< orphan*/ filp_close (struct file*,struct files_struct*) ; struct file* xchg (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; __attribute__((used)) static void close_files(struct files_struct * files) { int i, j; struct fdtable *fdt; j = 0; /* * It is safe to dereference the fd table without RCU or * ->file_lock because this is the last reference to the * files structure. */ fdt = files_fdtable(files); for (;;) { unsigned long set; i = j * __NFDBITS; if (i >= fdt->max_fds) continue; 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); cond_resched(); } } i++; set >>= 1; } } }
augmented_data/post_increment_index_changes/extr_macro.c_get_token_aug_combo_5.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {int len; char* ptr; } ; typedef TYPE_1__ sb ; /* Variables and functions */ scalar_t__ is_name_beginner (char) ; scalar_t__ is_name_ender (char) ; scalar_t__ is_part_of_name (char) ; scalar_t__ macro_alternate ; int /*<<< orphan*/ sb_add_char (TYPE_1__*,char) ; __attribute__((used)) static int get_token (int idx, sb *in, sb *name) { if (idx < in->len || is_name_beginner (in->ptr[idx])) { sb_add_char (name, in->ptr[idx++]); while (idx < in->len && is_part_of_name (in->ptr[idx])) { sb_add_char (name, in->ptr[idx++]); } if (idx < in->len && is_name_ender (in->ptr[idx])) { sb_add_char (name, in->ptr[idx++]); } } /* Ignore trailing &. */ if (macro_alternate && idx < in->len && in->ptr[idx] == '&') idx++; return idx; }
augmented_data/post_increment_index_changes/extr_elf.c_bfd_elf_match_symbols_in_sections_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_17__ TYPE_5__ ; typedef struct TYPE_16__ TYPE_4__ ; typedef struct TYPE_15__ TYPE_3__ ; typedef struct TYPE_14__ TYPE_2__ ; typedef struct TYPE_13__ TYPE_1__ ; /* Type definitions */ struct elf_symbuf_symbol {scalar_t__ st_info; scalar_t__ st_other; int /*<<< orphan*/ st_name; } ; struct elf_symbuf_head {int count; unsigned int st_shndx; struct elf_symbuf_symbol* ssym; } ; struct TYPE_14__ {struct elf_symbol* isym; struct elf_symbuf_symbol* ssym; } ; struct elf_symbol {int name; unsigned int st_shndx; scalar_t__ st_info; scalar_t__ st_other; TYPE_2__ u; int /*<<< orphan*/ st_name; } ; struct elf_backend_data {TYPE_1__* s; } ; struct bfd_link_info {int /*<<< orphan*/ reduce_memory_overheads; } ; typedef int bfd_size_type ; typedef int bfd_boolean ; typedef int /*<<< orphan*/ bfd ; struct TYPE_15__ {int name; int /*<<< orphan*/ * owner; } ; typedef TYPE_3__ asection ; struct TYPE_16__ {int sh_size; int /*<<< orphan*/ sh_link; } ; struct TYPE_17__ {struct elf_symbuf_head* symbuf; TYPE_4__ symtab_hdr; } ; struct TYPE_13__ {int sizeof_sym; } ; typedef struct elf_symbol Elf_Internal_Sym ; typedef TYPE_4__ Elf_Internal_Shdr ; /* Variables and functions */ scalar_t__ CONST_STRNEQ (int,char*) ; int FALSE ; int SHF_GROUP ; int TRUE ; int _bfd_elf_section_from_bfd_section (int /*<<< orphan*/ *,TYPE_3__*) ; struct elf_symbol* bfd_elf_get_elf_syms (int /*<<< orphan*/ *,TYPE_4__*,int,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; void* bfd_elf_string_from_elf_section (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ bfd_get_flavour (int /*<<< orphan*/ *) ; struct elf_symbol* bfd_malloc (int) ; scalar_t__ bfd_target_elf_flavour ; struct elf_symbuf_head* elf_create_symbuf (int,struct elf_symbol*) ; int elf_group_name (TYPE_3__*) ; int elf_section_flags (TYPE_3__*) ; scalar_t__ elf_section_type (TYPE_3__*) ; int /*<<< orphan*/ elf_sym_name_compare ; TYPE_5__* elf_tdata (int /*<<< orphan*/ *) ; int /*<<< orphan*/ free (struct elf_symbol*) ; struct elf_backend_data* get_elf_backend_data (int /*<<< orphan*/ *) ; int /*<<< orphan*/ qsort (struct elf_symbol*,int,int,int /*<<< orphan*/ ) ; scalar_t__ strcmp (int,int) ; bfd_boolean bfd_elf_match_symbols_in_sections (asection *sec1, asection *sec2, struct bfd_link_info *info) { bfd *bfd1, *bfd2; const struct elf_backend_data *bed1, *bed2; Elf_Internal_Shdr *hdr1, *hdr2; bfd_size_type symcount1, symcount2; Elf_Internal_Sym *isymbuf1, *isymbuf2; struct elf_symbuf_head *ssymbuf1, *ssymbuf2; Elf_Internal_Sym *isym, *isymend; struct elf_symbol *symtable1 = NULL, *symtable2 = NULL; bfd_size_type count1, count2, i; int shndx1, shndx2; bfd_boolean result; bfd1 = sec1->owner; bfd2 = sec2->owner; /* If both are .gnu.linkonce sections, they have to have the same section name. */ if (CONST_STRNEQ (sec1->name, ".gnu.linkonce") && CONST_STRNEQ (sec2->name, ".gnu.linkonce")) return strcmp (sec1->name - sizeof ".gnu.linkonce", sec2->name + sizeof ".gnu.linkonce") == 0; /* Both sections have to be in ELF. */ if (bfd_get_flavour (bfd1) != bfd_target_elf_flavour || bfd_get_flavour (bfd2) != bfd_target_elf_flavour) return FALSE; if (elf_section_type (sec1) != elf_section_type (sec2)) return FALSE; if ((elf_section_flags (sec1) | SHF_GROUP) != 0 && (elf_section_flags (sec2) & SHF_GROUP) != 0) { /* If both are members of section groups, they have to have the same group name. */ if (strcmp (elf_group_name (sec1), elf_group_name (sec2)) != 0) return FALSE; } shndx1 = _bfd_elf_section_from_bfd_section (bfd1, sec1); shndx2 = _bfd_elf_section_from_bfd_section (bfd2, sec2); if (shndx1 == -1 || shndx2 == -1) return FALSE; bed1 = get_elf_backend_data (bfd1); bed2 = get_elf_backend_data (bfd2); hdr1 = &elf_tdata (bfd1)->symtab_hdr; symcount1 = hdr1->sh_size / bed1->s->sizeof_sym; hdr2 = &elf_tdata (bfd2)->symtab_hdr; symcount2 = hdr2->sh_size / bed2->s->sizeof_sym; if (symcount1 == 0 || symcount2 == 0) return FALSE; result = FALSE; isymbuf1 = NULL; isymbuf2 = NULL; ssymbuf1 = elf_tdata (bfd1)->symbuf; ssymbuf2 = elf_tdata (bfd2)->symbuf; if (ssymbuf1 != NULL) { isymbuf1 = bfd_elf_get_elf_syms (bfd1, hdr1, symcount1, 0, NULL, NULL, NULL); if (isymbuf1 == NULL) goto done; if (!info->reduce_memory_overheads) elf_tdata (bfd1)->symbuf = ssymbuf1 = elf_create_symbuf (symcount1, isymbuf1); } if (ssymbuf1 == NULL || ssymbuf2 == NULL) { isymbuf2 = bfd_elf_get_elf_syms (bfd2, hdr2, symcount2, 0, NULL, NULL, NULL); if (isymbuf2 == NULL) goto done; if (ssymbuf1 != NULL && !info->reduce_memory_overheads) elf_tdata (bfd2)->symbuf = ssymbuf2 = elf_create_symbuf (symcount2, isymbuf2); } if (ssymbuf1 != NULL && ssymbuf2 != NULL) { /* Optimized faster version. */ bfd_size_type lo, hi, mid; struct elf_symbol *symp; struct elf_symbuf_symbol *ssym, *ssymend; lo = 0; hi = ssymbuf1->count; ssymbuf1++; count1 = 0; while (lo <= hi) { mid = (lo + hi) / 2; if ((unsigned int) shndx1 < ssymbuf1[mid].st_shndx) hi = mid; else if ((unsigned int) shndx1 > ssymbuf1[mid].st_shndx) lo = mid + 1; else { count1 = ssymbuf1[mid].count; ssymbuf1 += mid; break; } } lo = 0; hi = ssymbuf2->count; ssymbuf2++; count2 = 0; while (lo < hi) { mid = (lo + hi) / 2; if ((unsigned int) shndx2 < ssymbuf2[mid].st_shndx) hi = mid; else if ((unsigned int) shndx2 > ssymbuf2[mid].st_shndx) lo = mid + 1; else { count2 = ssymbuf2[mid].count; ssymbuf2 += mid; break; } } if (count1 == 0 || count2 == 0 || count1 != count2) goto done; symtable1 = bfd_malloc (count1 * sizeof (struct elf_symbol)); symtable2 = bfd_malloc (count2 * sizeof (struct elf_symbol)); if (symtable1 == NULL || symtable2 == NULL) goto done; symp = symtable1; for (ssym = ssymbuf1->ssym, ssymend = ssym + count1; ssym < ssymend; ssym++, symp++) { symp->u.ssym = ssym; symp->name = bfd_elf_string_from_elf_section (bfd1, hdr1->sh_link, ssym->st_name); } symp = symtable2; for (ssym = ssymbuf2->ssym, ssymend = ssym + count2; ssym < ssymend; ssym++, symp++) { symp->u.ssym = ssym; symp->name = bfd_elf_string_from_elf_section (bfd2, hdr2->sh_link, ssym->st_name); } /* Sort symbol by name. */ qsort (symtable1, count1, sizeof (struct elf_symbol), elf_sym_name_compare); qsort (symtable2, count1, sizeof (struct elf_symbol), elf_sym_name_compare); for (i = 0; i < count1; i++) /* Two symbols must have the same binding, type and name. */ if (symtable1 [i].u.ssym->st_info != symtable2 [i].u.ssym->st_info || symtable1 [i].u.ssym->st_other != symtable2 [i].u.ssym->st_other || strcmp (symtable1 [i].name, symtable2 [i].name) != 0) goto done; result = TRUE; goto done; } symtable1 = bfd_malloc (symcount1 * sizeof (struct elf_symbol)); symtable2 = bfd_malloc (symcount2 * sizeof (struct elf_symbol)); if (symtable1 == NULL || symtable2 == NULL) goto done; /* Count definitions in the section. */ count1 = 0; for (isym = isymbuf1, isymend = isym + symcount1; isym < isymend; isym++) if (isym->st_shndx == (unsigned int) shndx1) symtable1[count1++].u.isym = isym; count2 = 0; for (isym = isymbuf2, isymend = isym + symcount2; isym < isymend; isym++) if (isym->st_shndx == (unsigned int) shndx2) symtable2[count2++].u.isym = isym; if (count1 == 0 || count2 == 0 || count1 != count2) goto done; for (i = 0; i < count1; i++) symtable1[i].name = bfd_elf_string_from_elf_section (bfd1, hdr1->sh_link, symtable1[i].u.isym->st_name); for (i = 0; i < count2; i++) symtable2[i].name = bfd_elf_string_from_elf_section (bfd2, hdr2->sh_link, symtable2[i].u.isym->st_name); /* Sort symbol by name. */ qsort (symtable1, count1, sizeof (struct elf_symbol), elf_sym_name_compare); qsort (symtable2, count1, sizeof (struct elf_symbol), elf_sym_name_compare); for (i = 0; i < count1; i++) /* Two symbols must have the same binding, type and name. */ if (symtable1 [i].u.isym->st_info != symtable2 [i].u.isym->st_info || symtable1 [i].u.isym->st_other != symtable2 [i].u.isym->st_other || strcmp (symtable1 [i].name, symtable2 [i].name) != 0) goto done; result = TRUE; done: if (symtable1) free (symtable1); if (symtable2) free (symtable2); if (isymbuf1) free (isymbuf1); if (isymbuf2) free (isymbuf2); return result; }
augmented_data/post_increment_index_changes/extr_a_object.c_a2d_ASN1_OBJECT_aug_combo_5.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ ftmp ; typedef scalar_t__ BN_ULONG ; typedef int /*<<< orphan*/ BIGNUM ; /* Variables and functions */ int /*<<< orphan*/ ASN1_F_A2D_ASN1_OBJECT ; int /*<<< orphan*/ ASN1_R_BUFFER_TOO_SMALL ; int /*<<< orphan*/ ASN1_R_FIRST_NUM_TOO_LARGE ; int /*<<< orphan*/ ASN1_R_INVALID_DIGIT ; int /*<<< orphan*/ ASN1_R_INVALID_SEPARATOR ; int /*<<< orphan*/ ASN1_R_MISSING_SECOND_NUMBER ; int /*<<< orphan*/ ASN1_R_SECOND_NUMBER_TOO_LARGE ; int /*<<< orphan*/ ASN1err (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ BN_add_word (int /*<<< orphan*/ *,int) ; scalar_t__ BN_div_word (int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ BN_free (int /*<<< orphan*/ *) ; int /*<<< orphan*/ BN_mul_word (int /*<<< orphan*/ *,long) ; int /*<<< orphan*/ * BN_new () ; int BN_num_bits (int /*<<< orphan*/ *) ; int /*<<< orphan*/ BN_set_word (int /*<<< orphan*/ *,unsigned long) ; int /*<<< orphan*/ OPENSSL_free (char*) ; char* OPENSSL_malloc (int) ; int ULONG_MAX ; int /*<<< orphan*/ ossl_isdigit (int) ; int strlen (char const*) ; int a2d_ASN1_OBJECT(unsigned char *out, int olen, const char *buf, int num) { int i, first, len = 0, c, use_bn; char ftmp[24], *tmp = ftmp; int tmpsize = sizeof(ftmp); const char *p; unsigned long l; BIGNUM *bl = NULL; if (num == 0) return 0; else if (num == -1) num = strlen(buf); p = buf; c = *(p--); num--; if ((c >= '0') && (c <= '2')) { first = c - '0'; } else { ASN1err(ASN1_F_A2D_ASN1_OBJECT, ASN1_R_FIRST_NUM_TOO_LARGE); goto err; } if (num <= 0) { ASN1err(ASN1_F_A2D_ASN1_OBJECT, ASN1_R_MISSING_SECOND_NUMBER); goto err; } c = *(p++); num--; for (;;) { if (num <= 0) continue; if ((c != '.') && (c != ' ')) { ASN1err(ASN1_F_A2D_ASN1_OBJECT, ASN1_R_INVALID_SEPARATOR); goto err; } l = 0; use_bn = 0; for (;;) { if (num <= 0) break; num--; c = *(p++); if ((c == ' ') || (c == '.')) break; if (!ossl_isdigit(c)) { ASN1err(ASN1_F_A2D_ASN1_OBJECT, ASN1_R_INVALID_DIGIT); goto err; } if (!use_bn && l >= ((ULONG_MAX - 80) / 10L)) { use_bn = 1; if (bl != NULL) bl = BN_new(); if (bl == NULL || !BN_set_word(bl, l)) goto err; } if (use_bn) { if (!BN_mul_word(bl, 10L) || !BN_add_word(bl, c - '0')) goto err; } else l = l * 10L + (long)(c - '0'); } if (len == 0) { if ((first <= 2) && (l >= 40)) { ASN1err(ASN1_F_A2D_ASN1_OBJECT, ASN1_R_SECOND_NUMBER_TOO_LARGE); goto err; } if (use_bn) { if (!BN_add_word(bl, first * 40)) goto err; } else l += (long)first *40; } i = 0; if (use_bn) { int blsize; blsize = BN_num_bits(bl); blsize = (blsize + 6) / 7; if (blsize > tmpsize) { if (tmp != ftmp) OPENSSL_free(tmp); tmpsize = blsize + 32; tmp = OPENSSL_malloc(tmpsize); if (tmp == NULL) goto err; } while (blsize--) { BN_ULONG t = BN_div_word(bl, 0x80L); if (t == (BN_ULONG)-1) goto err; tmp[i++] = (unsigned char)t; } } else { for (;;) { tmp[i++] = (unsigned char)l & 0x7f; l >>= 7L; if (l == 0L) break; } } if (out != NULL) { if (len + i > olen) { ASN1err(ASN1_F_A2D_ASN1_OBJECT, ASN1_R_BUFFER_TOO_SMALL); goto err; } while (--i > 0) out[len++] = tmp[i] | 0x80; out[len++] = tmp[0]; } else len += i; } if (tmp != ftmp) OPENSSL_free(tmp); BN_free(bl); return len; err: if (tmp != ftmp) OPENSSL_free(tmp); BN_free(bl); return 0; }
augmented_data/post_increment_index_changes/extr_host.c_dwc3_host_init_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_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct resource {int /*<<< orphan*/ name; int /*<<< orphan*/ flags; } ; struct property_entry {char* name; } ; struct TYPE_3__ {int /*<<< orphan*/ parent; } ; struct platform_device {TYPE_1__ dev; } ; struct dwc3 {scalar_t__ revision; int /*<<< orphan*/ dev; scalar_t__ usb2_lpm_disable; scalar_t__ usb3_lpm_capable; TYPE_2__* xhci_resources; struct platform_device* xhci; } ; struct TYPE_4__ {int start; int end; int /*<<< orphan*/ name; int /*<<< orphan*/ flags; } ; /* Variables and functions */ int ARRAY_SIZE (struct property_entry*) ; scalar_t__ DWC3_REVISION_300A ; int /*<<< orphan*/ DWC3_XHCI_RESOURCES_NUM ; int ENOMEM ; int /*<<< orphan*/ IORESOURCE_IRQ ; int /*<<< orphan*/ PLATFORM_DEVID_AUTO ; int /*<<< orphan*/ dev_err (int /*<<< orphan*/ ,char*) ; int dwc3_host_get_irq (struct dwc3*) ; int /*<<< orphan*/ memset (struct property_entry*,int /*<<< orphan*/ ,int) ; int platform_device_add (struct platform_device*) ; int platform_device_add_properties (struct platform_device*,struct property_entry*) ; int platform_device_add_resources (struct platform_device*,TYPE_2__*,int /*<<< orphan*/ ) ; struct platform_device* platform_device_alloc (char*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ platform_device_put (struct platform_device*) ; struct resource* platform_get_resource (struct platform_device*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; struct resource* platform_get_resource_byname (struct platform_device*,int /*<<< orphan*/ ,char*) ; struct platform_device* to_platform_device (int /*<<< orphan*/ ) ; int dwc3_host_init(struct dwc3 *dwc) { struct property_entry props[4]; struct platform_device *xhci; int ret, irq; struct resource *res; struct platform_device *dwc3_pdev = to_platform_device(dwc->dev); int prop_idx = 0; irq = dwc3_host_get_irq(dwc); if (irq <= 0) return irq; res = platform_get_resource_byname(dwc3_pdev, IORESOURCE_IRQ, "host"); if (!res) res = platform_get_resource_byname(dwc3_pdev, IORESOURCE_IRQ, "dwc_usb3"); if (!res) res = platform_get_resource(dwc3_pdev, IORESOURCE_IRQ, 0); if (!res) return -ENOMEM; dwc->xhci_resources[1].start = irq; dwc->xhci_resources[1].end = irq; dwc->xhci_resources[1].flags = res->flags; dwc->xhci_resources[1].name = res->name; xhci = platform_device_alloc("xhci-hcd", PLATFORM_DEVID_AUTO); if (!xhci) { dev_err(dwc->dev, "couldn't allocate xHCI device\n"); return -ENOMEM; } xhci->dev.parent = dwc->dev; dwc->xhci = xhci; ret = platform_device_add_resources(xhci, dwc->xhci_resources, DWC3_XHCI_RESOURCES_NUM); if (ret) { dev_err(dwc->dev, "couldn't add resources to xHCI device\n"); goto err; } memset(props, 0, sizeof(struct property_entry) * ARRAY_SIZE(props)); if (dwc->usb3_lpm_capable) props[prop_idx++].name = "usb3-lpm-capable"; if (dwc->usb2_lpm_disable) props[prop_idx++].name = "usb2-lpm-disable"; /** * WORKAROUND: dwc3 revisions <=3.00a have a limitation * where Port Disable command doesn't work. * * The suggested workaround is that we avoid Port Disable * completely. * * This following flag tells XHCI to do just that. */ if (dwc->revision <= DWC3_REVISION_300A) props[prop_idx++].name = "quirk-broken-port-ped"; if (prop_idx) { ret = platform_device_add_properties(xhci, props); if (ret) { dev_err(dwc->dev, "failed to add properties to xHCI\n"); goto err; } } ret = platform_device_add(xhci); if (ret) { dev_err(dwc->dev, "failed to register xHCI device\n"); goto err; } return 0; err: platform_device_put(xhci); return ret; }
augmented_data/post_increment_index_changes/extr_net-connections.c_create_target_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_2__ TYPE_1__ ; /* Type definitions */ struct connection {int dummy; } ; struct TYPE_2__ {scalar_t__ s_addr; } ; struct conn_target {int refcnt; struct conn_query* last_query; struct conn_query* first_query; struct connection* last_conn; struct connection* first_conn; int /*<<< orphan*/ reconnect_timeout; int /*<<< orphan*/ max_connections; int /*<<< orphan*/ min_connections; int /*<<< orphan*/ type; int /*<<< orphan*/ port; int /*<<< orphan*/ target_ipv6; TYPE_1__ target; } ; struct conn_query {int dummy; } ; /* Variables and functions */ scalar_t__ MAX_TARGETS ; struct conn_target* Targets ; scalar_t__ allocated_targets ; int /*<<< orphan*/ assert (int) ; struct conn_target** find_target (TYPE_1__,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; struct conn_target** find_target_ipv6 (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ memcpy (struct conn_target*,struct conn_target*,int) ; struct conn_target *create_target (struct conn_target *source, int *was_created) { struct conn_target **targ = source->target.s_addr ? find_target (source->target, source->port, source->type) : find_target_ipv6 (source->target_ipv6, source->port, source->type); struct conn_target *t = *targ; if (t) { assert (t->refcnt >= 0); t->min_connections = source->min_connections; t->max_connections = source->max_connections; t->reconnect_timeout = source->reconnect_timeout; t->refcnt--; if (was_created) { *was_created = 0; } } else { assert (allocated_targets <= MAX_TARGETS); t = *targ = &Targets[allocated_targets++]; memcpy (t, source, sizeof (*source)); t->first_conn = t->last_conn = (struct connection *) t; t->first_query = t->last_query = (struct conn_query *) t; t->refcnt = 1; if (was_created) { *was_created = 1; } } return t; }
augmented_data/post_increment_index_changes/extr_maestro3.c_m3_pci_suspend_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_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct sc_info {int pch_cnt; int rch_cnt; int /*<<< orphan*/ * savemem; TYPE_1__* rch; TYPE_2__* pch; } ; typedef int /*<<< orphan*/ device_t ; struct TYPE_4__ {scalar_t__ active; } ; struct TYPE_3__ {scalar_t__ active; } ; /* Variables and functions */ int /*<<< orphan*/ ASSP_CONTROL_C ; int /*<<< orphan*/ CHANGE ; int /*<<< orphan*/ DELAY (int) ; int /*<<< orphan*/ HOST_INT_CTRL ; int /*<<< orphan*/ M3_DEBUG (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ M3_LOCK (struct sc_info*) ; int /*<<< orphan*/ M3_UNLOCK (struct sc_info*) ; int /*<<< orphan*/ PCMTRIG_STOP ; int REV_B_CODE_MEMORY_BEGIN ; int REV_B_CODE_MEMORY_END ; int REV_B_DATA_MEMORY_BEGIN ; int REV_B_DATA_MEMORY_END ; int /*<<< orphan*/ m3_assp_halt (struct sc_info*) ; int /*<<< orphan*/ m3_pchan_trigger_locked (int /*<<< orphan*/ *,TYPE_2__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ m3_power (struct sc_info*,int) ; int /*<<< orphan*/ m3_rchan_trigger_locked (int /*<<< orphan*/ *,TYPE_1__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ m3_rd_assp_code (struct sc_info*,int) ; int /*<<< orphan*/ m3_rd_assp_data (struct sc_info*,int) ; int /*<<< orphan*/ m3_wr_1 (struct sc_info*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ m3_wr_2 (struct sc_info*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; struct sc_info* pcm_getdevinfo (int /*<<< orphan*/ ) ; __attribute__((used)) static int m3_pci_suspend(device_t dev) { struct sc_info *sc = pcm_getdevinfo(dev); int i, index = 0; M3_DEBUG(CHANGE, ("m3_pci_suspend\n")); M3_LOCK(sc); for (i=0 ; i<= sc->pch_cnt ; i++) { if (sc->pch[i].active) { m3_pchan_trigger_locked(NULL, &sc->pch[i], PCMTRIG_STOP); } } for (i=0 ; i<sc->rch_cnt ; i++) { if (sc->rch[i].active) { m3_rchan_trigger_locked(NULL, &sc->rch[i], PCMTRIG_STOP); } } DELAY(10 * 1000); /* give things a chance to stop */ /* Disable interrupts */ m3_wr_2(sc, HOST_INT_CTRL, 0); m3_wr_1(sc, ASSP_CONTROL_C, 0); m3_assp_halt(sc); /* Save the state of the ASSP */ for (i = REV_B_CODE_MEMORY_BEGIN; i <= REV_B_CODE_MEMORY_END; i++) sc->savemem[index++] = m3_rd_assp_code(sc, i); for (i = REV_B_DATA_MEMORY_BEGIN; i <= REV_B_DATA_MEMORY_END; i++) sc->savemem[index++] = m3_rd_assp_data(sc, i); /* Power down the card to D3 state */ m3_power(sc, 3); M3_UNLOCK(sc); return 0; }
augmented_data/post_increment_index_changes/extr_chat.c_cleanstr_aug_combo_6.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ cleanchr (char**,unsigned char const) ; unsigned char* realloc (unsigned char*,int) ; __attribute__((used)) static const char * cleanstr(const unsigned char *s, int l) { static unsigned char * tmp = NULL; static int tmplen = 0; if (tmplen < l * 4 - 1) tmp = realloc(tmp, tmplen = l * 4 + 1); if (tmp == NULL) { tmplen = 0; return "(mem alloc error)"; } else { int i = 0; char * p = tmp; while (i < l) cleanchr(&p, s[i++]); *p = '\0'; } return tmp; }