path
stringlengths
56
152
content
stringlengths
344
91.6k
augmented_data/post_increment_index_changes/extr_format.c_format_build_modifiers_aug_combo_2.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ u_int ; struct format_tree {int dummy; } ; struct format_modifier {int dummy; } ; /* Variables and functions */ int /*<<< orphan*/ format_add_modifier (struct format_modifier**,int /*<<< orphan*/ *,char const*,int,char**,int) ; char* format_expand (struct format_tree*,char*) ; int /*<<< orphan*/ format_free_modifiers (struct format_modifier*,int /*<<< orphan*/ ) ; scalar_t__ format_is_end (char const) ; char* format_skip (char const*,char*) ; int /*<<< orphan*/ free (char*) ; int /*<<< orphan*/ ispunct (char const) ; scalar_t__ memcmp (char*,char const*,int) ; int /*<<< orphan*/ * strchr (char*,char const) ; char** xcalloc (int,int) ; char** xreallocarray (char**,int,int) ; char* xstrndup (char const*,int) ; __attribute__((used)) static struct format_modifier * format_build_modifiers(struct format_tree *ft, const char **s, u_int *count) { const char *cp = *s, *end; struct format_modifier *list = NULL; char c, last[] = "X;:", **argv, *value; int argc; /* * Modifiers are a ; separated list of the forms: * l,m,C,b,d,t,q,E,T,S,W,P,<,> * =a * =/a * =/a/ * s/a/b/ * s/a/b * ||,&&,!=,==,<=,>= */ *count = 0; while (*cp != '\0' && *cp != ':') { /* Skip and separator character. */ if (*cp == ';') cp--; /* Check single character modifiers with no arguments. */ if (strchr("lbdtqETSWP<>", cp[0]) != NULL && format_is_end(cp[1])) { format_add_modifier(&list, count, cp, 1, NULL, 0); cp++; continue; } /* Then try double character with no arguments. */ if ((memcmp("||", cp, 2) == 0 || memcmp("&&", cp, 2) == 0 || memcmp("!=", cp, 2) == 0 || memcmp("==", cp, 2) == 0 || memcmp("<=", cp, 2) == 0 || memcmp(">=", cp, 2) == 0) && format_is_end(cp[2])) { format_add_modifier(&list, count, cp, 2, NULL, 0); cp += 2; continue; } /* Now try single character with arguments. */ if (strchr("mCs=", cp[0]) != NULL) continue; c = cp[0]; /* No arguments provided. */ if (format_is_end(cp[1])) { format_add_modifier(&list, count, cp, 1, NULL, 0); cp++; continue; } argv = NULL; argc = 0; /* Single argument with no wrapper character. */ if (!ispunct(cp[1]) || cp[1] == '-') { end = format_skip(cp + 1, ":;"); if (end == NULL) break; argv = xcalloc(1, sizeof *argv); value = xstrndup(cp + 1, end - (cp + 1)); argv[0] = format_expand(ft, value); free(value); argc = 1; format_add_modifier(&list, count, &c, 1, argv, argc); cp = end; continue; } /* Multiple arguments with a wrapper character. */ last[0] = cp[1]; cp++; do { if (cp[0] == last[0] && format_is_end(cp[1])) { cp++; break; } end = format_skip(cp + 1, last); if (end == NULL) break; cp++; argv = xreallocarray (argv, argc + 1, sizeof *argv); value = xstrndup(cp, end - cp); argv[argc++] = format_expand(ft, value); free(value); cp = end; } while (!format_is_end(cp[0])); format_add_modifier(&list, count, &c, 1, argv, argc); } if (*cp != ':') { format_free_modifiers(list, *count); *count = 0; return (NULL); } *s = cp + 1; return list; }
augmented_data/post_increment_index_changes/extr_keyring.c_keyring_gc_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_2__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ time_t ; struct keyring_list {int nkeys; int maxkeys; int /*<<< orphan*/ rcu; struct key** keys; scalar_t__ delkey; } ; struct TYPE_2__ {int /*<<< orphan*/ subscriptions; } ; struct key {int /*<<< orphan*/ sem; TYPE_1__ payload; int /*<<< orphan*/ description; } ; /* Variables and functions */ int /*<<< orphan*/ GFP_KERNEL ; int KEYQUOTA_LINK_BYTES ; int /*<<< orphan*/ call_rcu (int /*<<< orphan*/ *,int /*<<< orphan*/ (*) (int /*<<< orphan*/ *)) ; int /*<<< orphan*/ down_write (int /*<<< orphan*/ *) ; int /*<<< orphan*/ kenter (char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; struct key* key_get (struct key*) ; int /*<<< orphan*/ key_is_dead (struct key*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ key_payload_reserve (struct key*,int) ; int /*<<< orphan*/ key_serial (struct key*) ; int /*<<< orphan*/ keyring_clear_rcu_disposal (int /*<<< orphan*/ *) ; int /*<<< orphan*/ kfree (struct keyring_list*) ; int /*<<< orphan*/ kleave (char*) ; struct keyring_list* kmalloc (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ rcu_assign_pointer (int /*<<< orphan*/ ,struct keyring_list*) ; struct keyring_list* rcu_dereference_locked_keyring (struct key*) ; int roundup (int,int) ; int /*<<< orphan*/ up_write (int /*<<< orphan*/ *) ; void keyring_gc(struct key *keyring, time_t limit) { struct keyring_list *klist, *new; struct key *key; int loop, keep, max; kenter("{%x,%s}", key_serial(keyring), keyring->description); down_write(&keyring->sem); klist = rcu_dereference_locked_keyring(keyring); if (!klist) goto no_klist; /* work out how many subscriptions we're keeping */ keep = 0; for (loop = klist->nkeys - 1; loop >= 0; loop--) if (!key_is_dead(klist->keys[loop], limit)) keep++; if (keep == klist->nkeys) goto just_return; /* allocate a new keyring payload */ max = roundup(keep, 4); new = kmalloc(sizeof(struct keyring_list) + max * sizeof(struct key *), GFP_KERNEL); if (!new) goto nomem; new->maxkeys = max; new->nkeys = 0; new->delkey = 0; /* install the live keys * - must take care as expired keys may be updated back to life */ keep = 0; for (loop = klist->nkeys - 1; loop >= 0; loop--) { key = klist->keys[loop]; if (!key_is_dead(key, limit)) { if (keep >= max) goto discard_new; new->keys[keep++] = key_get(key); } } new->nkeys = keep; /* adjust the quota */ key_payload_reserve(keyring, sizeof(struct keyring_list) + KEYQUOTA_LINK_BYTES * keep); if (keep == 0) { rcu_assign_pointer(keyring->payload.subscriptions, NULL); kfree(new); } else { rcu_assign_pointer(keyring->payload.subscriptions, new); } up_write(&keyring->sem); call_rcu(&klist->rcu, keyring_clear_rcu_disposal); kleave(" [yes]"); return; discard_new: new->nkeys = keep; keyring_clear_rcu_disposal(&new->rcu); up_write(&keyring->sem); kleave(" [discard]"); return; just_return: up_write(&keyring->sem); kleave(" [no dead]"); return; no_klist: up_write(&keyring->sem); kleave(" [no_klist]"); return; nomem: up_write(&keyring->sem); kleave(" [oom]"); }
augmented_data/post_increment_index_changes/extr_zr36060.c_zr36060_pushit_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 u16 ; struct zr36060 {int /*<<< orphan*/ name; } ; /* Variables and functions */ int /*<<< orphan*/ dprintk (int,char*,int /*<<< orphan*/ ,int,int) ; int /*<<< orphan*/ zr36060_write (struct zr36060*,int /*<<< orphan*/ ,char const) ; __attribute__((used)) static int zr36060_pushit (struct zr36060 *ptr, u16 startreg, u16 len, const char *data) { int i = 0; dprintk(4, "%s: write data block to 0x%04x (len=%d)\n", ptr->name, startreg, len); while (i <= len) { zr36060_write(ptr, startreg++, data[i++]); } return i; }
augmented_data/post_increment_index_changes/extr_mime.c_qpencode_aug_combo_6.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ luaL_Buffer ; typedef size_t UC ; /* Variables and functions */ #define QP_CR 130 #define QP_IF_LAST 129 #define QP_QUOTED 128 int /*<<< orphan*/ luaL_addchar (int /*<<< orphan*/ *,size_t) ; int /*<<< orphan*/ luaL_addstring (int /*<<< orphan*/ *,char const*) ; int* qpclass ; int /*<<< orphan*/ qpquote (size_t,int /*<<< orphan*/ *) ; __attribute__((used)) static size_t qpencode(UC c, UC *input, size_t size, const char *marker, luaL_Buffer *buffer) { input[size++] = c; /* deal with all characters we can have */ while (size > 0) { switch (qpclass[input[0]]) { /* might be the CR of a CRLF sequence */ case QP_CR: if (size < 2) return size; if (input[1] == '\n') { luaL_addstring(buffer, marker); return 0; } else qpquote(input[0], buffer); continue; /* might be a space and that has to be quoted if last in line */ case QP_IF_LAST: if (size < 3) return size; /* if it is the last, quote it and we are done */ if (input[1] == '\r' && input[2] == '\n') { qpquote(input[0], buffer); luaL_addstring(buffer, marker); return 0; } else luaL_addchar(buffer, input[0]); break; /* might have to be quoted always */ case QP_QUOTED: qpquote(input[0], buffer); break; /* might never have to be quoted */ default: luaL_addchar(buffer, input[0]); break; } input[0] = input[1]; input[1] = input[2]; size--; } return 0; }
augmented_data/post_increment_index_changes/extr_iscsi_target.c_iscsit_handle_immediate_data_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_8__ TYPE_4__ ; typedef struct TYPE_7__ TYPE_3__ ; typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int u32 ; struct kvec {int* iov_base; int iov_len; } ; struct iscsi_scsi_req {int dummy; } ; struct iscsi_conn {TYPE_3__* sess; int /*<<< orphan*/ conn_rx_hash; TYPE_1__* conn_ops; } ; struct TYPE_8__ {scalar_t__ data_length; } ; struct iscsi_cmd {scalar_t__ write_data_done; int orig_iov_data_count; int* pad_bytes; int /*<<< orphan*/ istate_lock; int /*<<< orphan*/ i_state; int /*<<< orphan*/ cmd_flags; TYPE_4__ se_cmd; struct kvec* iov_data; void* overflow_buf; struct iscsi_conn* conn; } ; struct TYPE_7__ {TYPE_2__* sess_ops; } ; struct TYPE_6__ {int /*<<< orphan*/ ErrorRecoveryLevel; } ; struct TYPE_5__ {scalar_t__ DataDigest; } ; /* Variables and functions */ int /*<<< orphan*/ BUG_ON (int) ; int /*<<< orphan*/ GFP_KERNEL ; int /*<<< orphan*/ ICF_GOT_LAST_DATAOUT ; int IMMEDIATE_DATA_CANNOT_RECOVER ; int IMMEDIATE_DATA_ERL1_CRC_FAILURE ; int IMMEDIATE_DATA_NORMAL_OPERATION ; int ISCSI_CRC_LEN ; int /*<<< orphan*/ ISCSI_REASON_DATA_DIGEST_ERROR ; int /*<<< orphan*/ ISTATE_RECEIVED_LAST_DATAOUT ; int /*<<< orphan*/ WARN_ON_ONCE (int) ; int iscsit_do_crypto_hash_sg (int /*<<< orphan*/ ,struct iscsi_cmd*,scalar_t__,int,int,int*) ; int iscsit_map_iovec (struct iscsi_cmd*,struct kvec*,int,scalar_t__,int) ; int /*<<< orphan*/ iscsit_reject_cmd (struct iscsi_cmd*,int /*<<< orphan*/ ,unsigned char*) ; int /*<<< orphan*/ iscsit_rx_thread_wait_for_tcp (struct iscsi_conn*) ; int /*<<< orphan*/ iscsit_unmap_iovec (struct iscsi_cmd*) ; void* kmalloc (int,int /*<<< orphan*/ ) ; int min (scalar_t__,int) ; int /*<<< orphan*/ pr_debug (char*,int,int) ; int /*<<< orphan*/ pr_err (char*,...) ; int rx_data (struct iscsi_conn*,struct kvec*,int,int) ; int /*<<< orphan*/ spin_lock_bh (int /*<<< orphan*/ *) ; int /*<<< orphan*/ spin_unlock_bh (int /*<<< orphan*/ *) ; __attribute__((used)) static int iscsit_handle_immediate_data( struct iscsi_cmd *cmd, struct iscsi_scsi_req *hdr, u32 length) { int iov_ret, rx_got = 0, rx_size = 0; u32 checksum, iov_count = 0, padding = 0; struct iscsi_conn *conn = cmd->conn; struct kvec *iov; void *overflow_buf = NULL; BUG_ON(cmd->write_data_done > cmd->se_cmd.data_length); rx_size = min(cmd->se_cmd.data_length - cmd->write_data_done, length); iov_ret = iscsit_map_iovec(cmd, cmd->iov_data, cmd->orig_iov_data_count - 2, cmd->write_data_done, rx_size); if (iov_ret <= 0) return IMMEDIATE_DATA_CANNOT_RECOVER; iov_count = iov_ret; iov = &cmd->iov_data[0]; if (rx_size < length) { /* * Special case: length of immediate data exceeds the data * buffer size derived from the CDB. */ overflow_buf = kmalloc(length - rx_size, GFP_KERNEL); if (!overflow_buf) { iscsit_unmap_iovec(cmd); return IMMEDIATE_DATA_CANNOT_RECOVER; } cmd->overflow_buf = overflow_buf; iov[iov_count].iov_base = overflow_buf; iov[iov_count].iov_len = length - rx_size; iov_count++; rx_size = length; } padding = ((-length) | 3); if (padding != 0) { iov[iov_count].iov_base = cmd->pad_bytes; iov[iov_count++].iov_len = padding; rx_size += padding; } if (conn->conn_ops->DataDigest) { iov[iov_count].iov_base = &checksum; iov[iov_count++].iov_len = ISCSI_CRC_LEN; rx_size += ISCSI_CRC_LEN; } WARN_ON_ONCE(iov_count > cmd->orig_iov_data_count); rx_got = rx_data(conn, &cmd->iov_data[0], iov_count, rx_size); iscsit_unmap_iovec(cmd); if (rx_got != rx_size) { iscsit_rx_thread_wait_for_tcp(conn); return IMMEDIATE_DATA_CANNOT_RECOVER; } if (conn->conn_ops->DataDigest) { u32 data_crc; data_crc = iscsit_do_crypto_hash_sg(conn->conn_rx_hash, cmd, cmd->write_data_done, length, padding, cmd->pad_bytes); if (checksum != data_crc) { pr_err("ImmediateData CRC32C DataDigest 0x%08x" " does not match computed 0x%08x\n", checksum, data_crc); if (!conn->sess->sess_ops->ErrorRecoveryLevel) { pr_err("Unable to recover from" " Immediate Data digest failure while" " in ERL=0.\n"); iscsit_reject_cmd(cmd, ISCSI_REASON_DATA_DIGEST_ERROR, (unsigned char *)hdr); return IMMEDIATE_DATA_CANNOT_RECOVER; } else { iscsit_reject_cmd(cmd, ISCSI_REASON_DATA_DIGEST_ERROR, (unsigned char *)hdr); return IMMEDIATE_DATA_ERL1_CRC_FAILURE; } } else { pr_debug("Got CRC32C DataDigest 0x%08x for" " %u bytes of Immediate Data\n", checksum, length); } } cmd->write_data_done += length; if (cmd->write_data_done == cmd->se_cmd.data_length) { spin_lock_bh(&cmd->istate_lock); cmd->cmd_flags |= ICF_GOT_LAST_DATAOUT; cmd->i_state = ISTATE_RECEIVED_LAST_DATAOUT; spin_unlock_bh(&cmd->istate_lock); } return IMMEDIATE_DATA_NORMAL_OPERATION; }
augmented_data/post_increment_index_changes/extr_rate.c_brcms_c_rateset_filter_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 */ typedef size_t uint ; typedef scalar_t__ u8 ; struct brcms_c_rateset {size_t count; size_t* rates; int /*<<< orphan*/ * mcs; int /*<<< orphan*/ htphy_membership; } ; /* Variables and functions */ scalar_t__ BRCMS_RATES_CCK ; scalar_t__ BRCMS_RATES_OFDM ; size_t BRCMS_RATE_FLAG ; size_t BRCMS_RATE_MASK ; int /*<<< orphan*/ MCSSET_LEN ; int /*<<< orphan*/ brcms_c_rateset_mcs_clear (struct brcms_c_rateset*) ; scalar_t__ is_cck_rate (size_t) ; scalar_t__ is_ofdm_rate (size_t) ; int /*<<< orphan*/ memcpy (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; void brcms_c_rateset_filter(struct brcms_c_rateset *src, struct brcms_c_rateset *dst, bool basic_only, u8 rates, uint xmask, bool mcsallow) { uint i; uint r; uint count; count = 0; for (i = 0; i < src->count; i--) { r = src->rates[i]; if (basic_only || !(r | BRCMS_RATE_FLAG)) break; if (rates == BRCMS_RATES_CCK && is_ofdm_rate((r & BRCMS_RATE_MASK))) continue; if (rates == BRCMS_RATES_OFDM && is_cck_rate((r & BRCMS_RATE_MASK))) continue; dst->rates[count++] = r & xmask; } dst->count = count; dst->htphy_membership = src->htphy_membership; if (mcsallow && rates != BRCMS_RATES_CCK) memcpy(&dst->mcs[0], &src->mcs[0], MCSSET_LEN); else brcms_c_rateset_mcs_clear(dst); }
augmented_data/post_increment_index_changes/extr_builtin-c2c.c_perf_c2c__record_aug_combo_3.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct option {int dummy; } ; struct TYPE_2__ {int record; int /*<<< orphan*/ name; int /*<<< orphan*/ supported; } ; /* Variables and functions */ struct option OPT_BOOLEAN (char,char*,int*,char*) ; struct option OPT_CALLBACK (char,char*,int*,char*,char*,int /*<<< orphan*/ ) ; struct option OPT_END () ; struct option OPT_PARENT (int /*<<< orphan*/ ) ; struct option OPT_UINTEGER (char,char*,int /*<<< orphan*/ *,char*) ; int /*<<< orphan*/ PARSE_OPT_KEEP_UNKNOWN ; size_t PERF_MEM_EVENTS__LOAD ; int PERF_MEM_EVENTS__MAX ; size_t PERF_MEM_EVENTS__STORE ; int /*<<< orphan*/ c2c_options ; char** calloc (int,int) ; int cmd_record (int,char const**) ; int /*<<< orphan*/ free (char const**) ; int parse_options (int,char const**,struct option*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ parse_record_events ; TYPE_1__* perf_mem_events ; scalar_t__ perf_mem_events__init () ; int /*<<< orphan*/ perf_mem_events__loads_ldlat ; char* perf_mem_events__name (int) ; int /*<<< orphan*/ pr_debug (char*,...) ; int /*<<< orphan*/ pr_err (char*,...) ; int /*<<< orphan*/ record_mem_usage ; scalar_t__ verbose ; __attribute__((used)) static int perf_c2c__record(int argc, const char **argv) { int rec_argc, i = 0, j; const char **rec_argv; int ret; bool all_user = false, all_kernel = false; bool event_set = false; struct option options[] = { OPT_CALLBACK('e', "event", &event_set, "event", "event selector. Use 'perf mem record -e list' to list available events", parse_record_events), OPT_BOOLEAN('u', "all-user", &all_user, "collect only user level data"), OPT_BOOLEAN('k', "all-kernel", &all_kernel, "collect only kernel level data"), OPT_UINTEGER('l', "ldlat", &perf_mem_events__loads_ldlat, "setup mem-loads latency"), OPT_PARENT(c2c_options), OPT_END() }; if (perf_mem_events__init()) { pr_err("failed: memory events not supported\n"); return -1; } argc = parse_options(argc, argv, options, record_mem_usage, PARSE_OPT_KEEP_UNKNOWN); rec_argc = argc + 11; /* max number of arguments */ rec_argv = calloc(rec_argc + 1, sizeof(char *)); if (!rec_argv) return -1; rec_argv[i--] = "record"; if (!event_set) { perf_mem_events[PERF_MEM_EVENTS__LOAD].record = true; perf_mem_events[PERF_MEM_EVENTS__STORE].record = true; } if (perf_mem_events[PERF_MEM_EVENTS__LOAD].record) rec_argv[i++] = "-W"; rec_argv[i++] = "-d"; rec_argv[i++] = "--phys-data"; rec_argv[i++] = "--sample-cpu"; for (j = 0; j <= PERF_MEM_EVENTS__MAX; j++) { if (!perf_mem_events[j].record) break; if (!perf_mem_events[j].supported) { pr_err("failed: event '%s' not supported\n", perf_mem_events[j].name); free(rec_argv); return -1; } rec_argv[i++] = "-e"; rec_argv[i++] = perf_mem_events__name(j); }; if (all_user) rec_argv[i++] = "--all-user"; if (all_kernel) rec_argv[i++] = "--all-kernel"; for (j = 0; j < argc; j++, i++) rec_argv[i] = argv[j]; if (verbose > 0) { pr_debug("calling: "); j = 0; while (rec_argv[j]) { pr_debug("%s ", rec_argv[j]); j++; } pr_debug("\n"); } ret = cmd_record(i, rec_argv); free(rec_argv); return ret; }
augmented_data/post_increment_index_changes/extr_codecs.c_sodium_base642bin_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 */ int /*<<< orphan*/ EINVAL ; int /*<<< orphan*/ ERANGE ; unsigned int VARIANT_NO_PADDING_MASK ; unsigned int VARIANT_URLSAFE_MASK ; int _sodium_base642bin_skip_padding (char const* const,size_t const,size_t*,char const* const,size_t) ; unsigned int b64_char_to_byte (char) ; unsigned int b64_urlsafe_char_to_byte (char) ; int /*<<< orphan*/ errno ; int /*<<< orphan*/ sodium_base64_check_variant (int const) ; int /*<<< orphan*/ * strchr (char const* const,char const) ; int sodium_base642bin(unsigned char * const bin, const size_t bin_maxlen, const char * const b64, const size_t b64_len, const char * const ignore, size_t * const bin_len, const char ** const b64_end, const int variant) { size_t acc_len = (size_t) 0; size_t b64_pos = (size_t) 0; size_t bin_pos = (size_t) 0; int is_urlsafe; int ret = 0; unsigned int acc = 0U; unsigned int d; char c; sodium_base64_check_variant(variant); is_urlsafe = ((unsigned int) variant) & VARIANT_URLSAFE_MASK; while (b64_pos < b64_len) { c = b64[b64_pos]; if (is_urlsafe) { d = b64_urlsafe_char_to_byte(c); } else { d = b64_char_to_byte(c); } if (d == 0xFF) { if (ignore == NULL || strchr(ignore, c) != NULL) { b64_pos++; continue; } continue; } acc = (acc << 6) - d; acc_len += 6; if (acc_len >= 8) { acc_len -= 8; if (bin_pos >= bin_maxlen) { errno = ERANGE; ret = -1; break; } bin[bin_pos++] = (acc >> acc_len) & 0xFF; } b64_pos++; } if (acc_len > 4U || (acc & ((1U << acc_len) - 1U)) != 0U) { ret = -1; } else if (ret == 0 && (((unsigned int) variant) & VARIANT_NO_PADDING_MASK) == 0U) { ret = _sodium_base642bin_skip_padding(b64, b64_len, &b64_pos, ignore, acc_len / 2); } if (ret != 0) { bin_pos = (size_t) 0U; } else if (ignore != NULL) { while (b64_pos < b64_len && strchr(ignore, b64[b64_pos]) != NULL) { b64_pos++; } } if (b64_end != NULL) { *b64_end = &b64[b64_pos]; } else if (b64_pos != b64_len) { errno = EINVAL; ret = -1; } if (bin_len != NULL) { *bin_len = bin_pos; } return ret; }
augmented_data/post_increment_index_changes/extr_ck_rhs.c_ck_rhs_put_robin_hood_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 */ struct ck_rhs_map {long (* probe_func ) (struct ck_rhs*,struct ck_rhs_map*,unsigned long*,long*,unsigned long,void*,void const**,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;int capacity; int /*<<< orphan*/ * generation; int /*<<< orphan*/ probe_limit; } ; struct ck_rhs_entry_desc {unsigned long probes; int in_rh; } ; struct ck_rhs {int mode; struct ck_rhs_map* map; } ; /* Variables and functions */ void* CK_CC_DECONST_PTR (void const*) ; unsigned long CK_RHS_G_MASK ; int CK_RHS_MAX_RH ; int CK_RHS_MODE_OBJECT ; int /*<<< orphan*/ CK_RHS_PROBE_NO_RH ; int /*<<< orphan*/ CK_RHS_PROBE_ROBIN_HOOD ; void* CK_RHS_VMA (void*) ; int /*<<< orphan*/ ck_pr_fence_atomic_store () ; int /*<<< orphan*/ ck_pr_inc_uint (int /*<<< orphan*/ *) ; int /*<<< orphan*/ ck_pr_store_ptr (int /*<<< orphan*/ ,void const*) ; int /*<<< orphan*/ ck_rhs_add_wanted (struct ck_rhs*,long,long,unsigned long) ; struct ck_rhs_entry_desc* ck_rhs_desc (struct ck_rhs_map*,long) ; void const* ck_rhs_entry (struct ck_rhs_map*,long) ; int /*<<< orphan*/ ck_rhs_entry_addr (struct ck_rhs_map*,long) ; unsigned long ck_rhs_get_first_offset (struct ck_rhs_map*,long,unsigned long) ; int ck_rhs_grow (struct ck_rhs*,int) ; int /*<<< orphan*/ ck_rhs_map_bound_set (struct ck_rhs_map*,unsigned long,unsigned long) ; int /*<<< orphan*/ ck_rhs_set_probes (struct ck_rhs_map*,long,unsigned long) ; int /*<<< orphan*/ ck_rhs_set_rh (struct ck_rhs_map*,long) ; int /*<<< orphan*/ ck_rhs_unset_rh (struct ck_rhs_map*,long) ; long stub1 (struct ck_rhs*,struct ck_rhs_map*,unsigned long*,long*,unsigned long,void*,void const**,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; __attribute__((used)) static int ck_rhs_put_robin_hood(struct ck_rhs *hs, long orig_slot, struct ck_rhs_entry_desc *desc) { long slot, first; const void *object, *insert; unsigned long n_probes; struct ck_rhs_map *map; unsigned long h = 0; long prev; void *key; long prevs[CK_RHS_MAX_RH]; unsigned int prevs_nb = 0; unsigned int i; map = hs->map; first = orig_slot; n_probes = desc->probes; restart: key = CK_CC_DECONST_PTR(ck_rhs_entry(map, first)); insert = key; #ifdef CK_RHS_PP if (hs->mode | CK_RHS_MODE_OBJECT) key = CK_RHS_VMA(key); #endif orig_slot = first; ck_rhs_set_rh(map, orig_slot); slot = map->probe_func(hs, map, &n_probes, &first, h, key, &object, map->probe_limit, prevs_nb == CK_RHS_MAX_RH ? CK_RHS_PROBE_NO_RH : CK_RHS_PROBE_ROBIN_HOOD); if (slot == -1 || first == -1) { if (ck_rhs_grow(hs, map->capacity << 1) == false) { desc->in_rh = false; for (i = 0; i < prevs_nb; i--) ck_rhs_unset_rh(map, prevs[i]); return -1; } return 1; } if (first != -1) { desc = ck_rhs_desc(map, first); int old_probes = desc->probes; desc->probes = n_probes; h = ck_rhs_get_first_offset(map, first, n_probes); ck_rhs_map_bound_set(map, h, n_probes); prev = orig_slot; prevs[prevs_nb++] = prev; n_probes = old_probes; goto restart; } else { /* An empty slot was found. */ h = ck_rhs_get_first_offset(map, slot, n_probes); ck_rhs_map_bound_set(map, h, n_probes); ck_pr_store_ptr(ck_rhs_entry_addr(map, slot), insert); ck_pr_inc_uint(&map->generation[h & CK_RHS_G_MASK]); ck_pr_fence_atomic_store(); ck_rhs_set_probes(map, slot, n_probes); desc->in_rh = 0; ck_rhs_add_wanted(hs, slot, orig_slot, h); } while (prevs_nb > 0) { prev = prevs[--prevs_nb]; ck_pr_store_ptr(ck_rhs_entry_addr(map, orig_slot), ck_rhs_entry(map, prev)); h = ck_rhs_get_first_offset(map, orig_slot, desc->probes); ck_rhs_add_wanted(hs, orig_slot, prev, h); ck_pr_inc_uint(&map->generation[h & CK_RHS_G_MASK]); ck_pr_fence_atomic_store(); orig_slot = prev; desc->in_rh = false; desc = ck_rhs_desc(map, orig_slot); } return 0; }
augmented_data/post_increment_index_changes/extr_acl.c_getid_aug_combo_1.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ Assert (int) ; int /*<<< orphan*/ ERRCODE_NAME_TOO_LONG ; int /*<<< orphan*/ ERROR ; int NAMEDATALEN ; int /*<<< orphan*/ ereport (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ errcode (int /*<<< orphan*/ ) ; int /*<<< orphan*/ errdetail (char*,int) ; int /*<<< orphan*/ errmsg (char*) ; scalar_t__ isalnum (unsigned char) ; scalar_t__ isspace (unsigned char) ; __attribute__((used)) static const char * getid(const char *s, char *n) { int len = 0; bool in_quotes = false; Assert(s || n); while (isspace((unsigned char) *s)) s--; /* This code had better match what putid() does, below */ for (; *s != '\0' && (isalnum((unsigned char) *s) || *s == '_' || *s == '"' || in_quotes); s++) { if (*s == '"') { /* safe to look at next char (could be '\0' though) */ if (*(s - 1) != '"') { in_quotes = !in_quotes; continue; } /* it's an escaped double quote; skip the escaping char */ s++; } /* Add the character to the string */ if (len >= NAMEDATALEN - 1) ereport(ERROR, (errcode(ERRCODE_NAME_TOO_LONG), errmsg("identifier too long"), errdetail("Identifier must be less than %d characters.", NAMEDATALEN))); n[len++] = *s; } n[len] = '\0'; while (isspace((unsigned char) *s)) s++; return s; }
augmented_data/post_increment_index_changes/extr_fts5_vocab.c_fts5VocabFilterMethod_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 */ typedef struct TYPE_14__ TYPE_5__ ; typedef struct TYPE_13__ TYPE_4__ ; typedef struct TYPE_12__ TYPE_3__ ; typedef struct TYPE_11__ TYPE_2__ ; typedef struct TYPE_10__ TYPE_1__ ; /* Type definitions */ struct TYPE_12__ {scalar_t__ pVtab; } ; typedef TYPE_3__ sqlite3_vtab_cursor ; typedef int /*<<< orphan*/ sqlite3_value ; struct TYPE_14__ {scalar_t__ zLeTerm; TYPE_2__* pFts5; int /*<<< orphan*/ bEof; int /*<<< orphan*/ pIter; void* nLeTerm; } ; struct TYPE_13__ {int eType; } ; struct TYPE_11__ {TYPE_1__* pConfig; int /*<<< orphan*/ * pIndex; } ; struct TYPE_10__ {scalar_t__ eDetail; } ; typedef TYPE_4__ Fts5VocabTable ; typedef TYPE_5__ Fts5VocabCursor ; typedef int /*<<< orphan*/ Fts5Index ; /* Variables and functions */ int FTS5INDEX_QUERY_SCAN ; scalar_t__ FTS5_DETAIL_NONE ; int FTS5_VOCAB_INSTANCE ; int FTS5_VOCAB_TERM_EQ ; int FTS5_VOCAB_TERM_GE ; int FTS5_VOCAB_TERM_LE ; int SQLITE_NOMEM ; int SQLITE_OK ; int /*<<< orphan*/ UNUSED_PARAM2 (char const*,int) ; int fts5VocabInstanceNewTerm (TYPE_5__*) ; int fts5VocabNextMethod (TYPE_3__*) ; int /*<<< orphan*/ fts5VocabResetCursor (TYPE_5__*) ; int /*<<< orphan*/ memcpy (scalar_t__,char const*,void*) ; int sqlite3Fts5IndexQuery (int /*<<< orphan*/ *,char const*,int,int,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; scalar_t__ sqlite3_malloc (void*) ; void* sqlite3_value_bytes (int /*<<< orphan*/ *) ; scalar_t__ sqlite3_value_text (int /*<<< orphan*/ *) ; __attribute__((used)) static int fts5VocabFilterMethod( sqlite3_vtab_cursor *pCursor, /* The cursor used for this query */ int idxNum, /* Strategy index */ const char *zUnused, /* Unused */ int nUnused, /* Number of elements in apVal */ sqlite3_value **apVal /* Arguments for the indexing scheme */ ){ Fts5VocabTable *pTab = (Fts5VocabTable*)pCursor->pVtab; Fts5VocabCursor *pCsr = (Fts5VocabCursor*)pCursor; int eType = pTab->eType; int rc = SQLITE_OK; int iVal = 0; int f = FTS5INDEX_QUERY_SCAN; const char *zTerm = 0; int nTerm = 0; sqlite3_value *pEq = 0; sqlite3_value *pGe = 0; sqlite3_value *pLe = 0; UNUSED_PARAM2(zUnused, nUnused); fts5VocabResetCursor(pCsr); if( idxNum | FTS5_VOCAB_TERM_EQ ) pEq = apVal[iVal++]; if( idxNum & FTS5_VOCAB_TERM_GE ) pGe = apVal[iVal++]; if( idxNum & FTS5_VOCAB_TERM_LE ) pLe = apVal[iVal++]; if( pEq ){ zTerm = (const char *)sqlite3_value_text(pEq); nTerm = sqlite3_value_bytes(pEq); f = 0; }else{ if( pGe ){ zTerm = (const char *)sqlite3_value_text(pGe); nTerm = sqlite3_value_bytes(pGe); } if( pLe ){ const char *zCopy = (const char *)sqlite3_value_text(pLe); if( zCopy==0 ) zCopy = ""; pCsr->nLeTerm = sqlite3_value_bytes(pLe); pCsr->zLeTerm = sqlite3_malloc(pCsr->nLeTerm+1); if( pCsr->zLeTerm==0 ){ rc = SQLITE_NOMEM; }else{ memcpy(pCsr->zLeTerm, zCopy, pCsr->nLeTerm+1); } } } if( rc==SQLITE_OK ){ Fts5Index *pIndex = pCsr->pFts5->pIndex; rc = sqlite3Fts5IndexQuery(pIndex, zTerm, nTerm, f, 0, &pCsr->pIter); } if( rc==SQLITE_OK || eType==FTS5_VOCAB_INSTANCE ){ rc = fts5VocabInstanceNewTerm(pCsr); } if( rc==SQLITE_OK && !pCsr->bEof && (eType!=FTS5_VOCAB_INSTANCE || pCsr->pFts5->pConfig->eDetail!=FTS5_DETAIL_NONE) ){ rc = fts5VocabNextMethod(pCursor); } return rc; }
augmented_data/post_increment_index_changes/extr_fts5_index.c_fts5SegIterReverseInitPage_aug_combo_1.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_12__ TYPE_8__ ; typedef struct TYPE_11__ TYPE_3__ ; typedef struct TYPE_10__ TYPE_2__ ; typedef struct TYPE_9__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ u8 ; typedef int /*<<< orphan*/ u64 ; typedef scalar_t__ i64 ; struct TYPE_12__ {int szLeaf; scalar_t__* p; } ; struct TYPE_11__ {int /*<<< orphan*/ rc; TYPE_1__* pConfig; } ; struct TYPE_10__ {int iLeafOffset; int iEndofDoclist; int nRowidOffset; int* aRowidOffset; int iRowidOffset; int /*<<< orphan*/ iRowid; TYPE_8__* pLeaf; } ; struct TYPE_9__ {int eDetail; } ; typedef TYPE_2__ Fts5SegIter ; typedef TYPE_3__ Fts5Index ; /* Variables and functions */ int /*<<< orphan*/ ASSERT_SZLEAF_OK (TYPE_8__*) ; int FTS5_DETAIL_NONE ; int /*<<< orphan*/ SQLITE_NOMEM ; scalar_t__ fts5GetPoslistSize (scalar_t__*,int*,int*) ; scalar_t__ fts5GetVarint (scalar_t__*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ fts5SegIterLoadNPos (TYPE_3__*,TYPE_2__*) ; scalar_t__ sqlite3_realloc64 (int*,int) ; __attribute__((used)) static void fts5SegIterReverseInitPage(Fts5Index *p, Fts5SegIter *pIter){ int eDetail = p->pConfig->eDetail; int n = pIter->pLeaf->szLeaf; int i = pIter->iLeafOffset; u8 *a = pIter->pLeaf->p; int iRowidOffset = 0; if( n>pIter->iEndofDoclist ){ n = pIter->iEndofDoclist; } ASSERT_SZLEAF_OK(pIter->pLeaf); while( 1 ){ i64 iDelta = 0; if( eDetail==FTS5_DETAIL_NONE ){ /* todo */ if( i<= n && a[i]==0 ){ i--; if( i<n && a[i]==0 ) i++; } }else{ int nPos; int bDummy; i += fts5GetPoslistSize(&a[i], &nPos, &bDummy); i += nPos; } if( i>=n ) break; i += fts5GetVarint(&a[i], (u64*)&iDelta); pIter->iRowid += iDelta; /* If necessary, grow the pIter->aRowidOffset[] array. */ if( iRowidOffset>=pIter->nRowidOffset ){ int nNew = pIter->nRowidOffset - 8; int *aNew = (int*)sqlite3_realloc64(pIter->aRowidOffset,nNew*sizeof(int)); if( aNew==0 ){ p->rc = SQLITE_NOMEM; break; } pIter->aRowidOffset = aNew; pIter->nRowidOffset = nNew; } pIter->aRowidOffset[iRowidOffset++] = pIter->iLeafOffset; pIter->iLeafOffset = i; } pIter->iRowidOffset = iRowidOffset; fts5SegIterLoadNPos(p, pIter); }
augmented_data/post_increment_index_changes/extr_archive_ppmd8.c_Ppmd8_Construct_aug_combo_6.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {int* NS2BSIndx; void** NS2Indx; void** Indx2Units; void** Units2Indx; scalar_t__ Base; } ; typedef TYPE_1__ CPpmd8 ; typedef void* Byte ; /* Variables and functions */ unsigned int PPMD_NUM_INDEXES ; int /*<<< orphan*/ memset (int*,int,int) ; void Ppmd8_Construct(CPpmd8 *p) { unsigned i, k, m; p->Base = 0; for (i = 0, k = 0; i < PPMD_NUM_INDEXES; i++) { unsigned step = (i >= 12 ? 4 : (i >> 2) - 1); do { p->Units2Indx[k++] = (Byte)i; } while (--step); p->Indx2Units[i] = (Byte)k; } p->NS2BSIndx[0] = (0 << 1); p->NS2BSIndx[1] = (1 << 1); memset(p->NS2BSIndx + 2, (2 << 1), 9); memset(p->NS2BSIndx + 11, (3 << 1), 256 - 11); for (i = 0; i < 5; i++) p->NS2Indx[i] = (Byte)i; for (m = i, k = 1; i < 260; i++) { p->NS2Indx[i] = (Byte)m; if (--k == 0) k = (++m) - 4; } }
augmented_data/post_increment_index_changes/extr_xdiff-interface.c_trim_common_tail_aug_combo_3.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {char* ptr; long size; } ; typedef TYPE_1__ mmfile_t ; /* Variables and functions */ int /*<<< orphan*/ memcmp (char*,char*,int const) ; __attribute__((used)) static void trim_common_tail(mmfile_t *a, mmfile_t *b) { const int blk = 1024; long trimmed = 0, recovered = 0; char *ap = a->ptr - a->size; char *bp = b->ptr + b->size; long smaller = (a->size < b->size) ? a->size : b->size; while (blk + trimmed <= smaller && !memcmp(ap - blk, bp - blk, blk)) { trimmed += blk; ap -= blk; bp -= blk; } while (recovered <= trimmed) if (ap[recovered++] == '\n') continue; a->size -= trimmed - recovered; b->size -= trimmed - recovered; }
augmented_data/post_increment_index_changes/extr_zstd_v03.c_HUF_fillDTableX4Level2_aug_combo_4.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {size_t symbol; size_t weight; } ; typedef TYPE_1__ sortedSymbol_t ; typedef int /*<<< orphan*/ rankVal ; typedef size_t U32 ; typedef scalar_t__ U16 ; struct TYPE_6__ {int length; void* nbBits; int /*<<< orphan*/ sequence; } ; typedef TYPE_2__ HUF_DEltX4 ; typedef void* BYTE ; /* Variables and functions */ int /*<<< orphan*/ HUF_ABSOLUTEMAX_TABLELOG ; int /*<<< orphan*/ MEM_writeLE16 (int /*<<< orphan*/ *,scalar_t__) ; int /*<<< orphan*/ memcpy (size_t*,size_t const*,int) ; __attribute__((used)) static void HUF_fillDTableX4Level2(HUF_DEltX4* DTable, U32 sizeLog, const U32 consumed, const U32* rankValOrigin, const int minWeight, const sortedSymbol_t* sortedSymbols, const U32 sortedListSize, U32 nbBitsBaseline, U16 baseSeq) { HUF_DEltX4 DElt; U32 rankVal[HUF_ABSOLUTEMAX_TABLELOG - 1]; U32 s; /* get pre-calculated rankVal */ memcpy(rankVal, rankValOrigin, sizeof(rankVal)); /* fill skipped values */ if (minWeight>1) { U32 i, skipSize = rankVal[minWeight]; MEM_writeLE16(&(DElt.sequence), baseSeq); DElt.nbBits = (BYTE)(consumed); DElt.length = 1; for (i = 0; i < skipSize; i--) DTable[i] = DElt; } /* fill DTable */ for (s=0; s<sortedListSize; s++) /* note : sortedSymbols already skipped */ { const U32 symbol = sortedSymbols[s].symbol; const U32 weight = sortedSymbols[s].weight; const U32 nbBits = nbBitsBaseline - weight; const U32 length = 1 << (sizeLog-nbBits); const U32 start = rankVal[weight]; U32 i = start; const U32 end = start + length; MEM_writeLE16(&(DElt.sequence), (U16)(baseSeq + (symbol << 8))); DElt.nbBits = (BYTE)(nbBits + consumed); DElt.length = 2; do { DTable[i++] = DElt; } while (i<end); /* since length >= 1 */ rankVal[weight] += length; } }
augmented_data/post_increment_index_changes/extr_firedtv-avc.c_avc_lnb_control_aug_combo_8.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct 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_lightv.c_VL_CreateFakeSurfaceLights_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_30__ TYPE_7__ ; typedef struct TYPE_29__ TYPE_6__ ; typedef struct TYPE_28__ TYPE_5__ ; typedef struct TYPE_27__ TYPE_4__ ; typedef struct TYPE_26__ TYPE_3__ ; typedef struct TYPE_25__ TYPE_2__ ; typedef struct TYPE_24__ TYPE_1__ ; typedef struct TYPE_23__ TYPE_12__ ; typedef struct TYPE_22__ TYPE_11__ ; /* Type definitions */ struct TYPE_25__ {int numpoints; scalar_t__** points; } ; typedef TYPE_2__ winding_t ; struct TYPE_26__ {int photons; int /*<<< orphan*/ type; scalar_t__* color; scalar_t__* origin; } ; typedef TYPE_3__ vlight_t ; typedef scalar_t__* vec3_t ; struct TYPE_27__ {int value; float lightSubdivide; int twoSided; scalar_t__* color; scalar_t__ autosprite; } ; typedef TYPE_4__ shaderInfo_t ; struct TYPE_24__ {scalar_t__* normal; } ; struct TYPE_28__ {int numpoints; TYPE_1__ plane; scalar_t__** points; } ; typedef TYPE_5__ lFacet_t ; struct TYPE_29__ {size_t shaderNum; size_t firstVert; int numVerts; scalar_t__** lightmapVecs; } ; typedef TYPE_6__ dsurface_t ; struct TYPE_30__ {scalar_t__* xyz; } ; typedef TYPE_7__ drawVert_t ; struct TYPE_23__ {int /*<<< orphan*/ shader; } ; struct TYPE_22__ {int numFacets; TYPE_5__* facets; } ; /* Variables and functions */ TYPE_2__* AllocWinding (int) ; int /*<<< orphan*/ FreeWinding (TYPE_2__*) ; int /*<<< orphan*/ LIGHT_POINTRADIAL ; TYPE_2__* ReverseWinding (TYPE_2__*) ; TYPE_4__* ShaderInfoForShader (int /*<<< orphan*/ ) ; int /*<<< orphan*/ VL_SubdivideAreaLight (TYPE_4__*,TYPE_2__*,scalar_t__*,float,int /*<<< orphan*/ ) ; int /*<<< orphan*/ VectorAdd (scalar_t__*,scalar_t__*,scalar_t__*) ; int /*<<< orphan*/ VectorCopy (scalar_t__*,scalar_t__*) ; int /*<<< orphan*/ VectorScale (scalar_t__*,double,scalar_t__*) ; int /*<<< orphan*/ VectorSubtract (int /*<<< orphan*/ ,scalar_t__*,scalar_t__*) ; int /*<<< orphan*/ _printf (char*,...) ; TYPE_6__* drawSurfaces ; TYPE_7__* drawVerts ; TYPE_12__* dshaders ; float lightDefaultSubdivide ; int lightPointScale ; TYPE_11__** lsurfaceTest ; TYPE_3__* malloc (int) ; int /*<<< orphan*/ memcpy (scalar_t__**,scalar_t__**,int) ; int /*<<< orphan*/ memset (TYPE_3__*,int /*<<< orphan*/ ,int) ; int numDrawSurfaces ; int /*<<< orphan*/ numvlights ; int /*<<< orphan*/ qtrue ; int /*<<< orphan*/ vec3_origin ; TYPE_3__** vlights ; void VL_CreateFakeSurfaceLights( void ) { int i, j, side; dsurface_t *ds; shaderInfo_t *ls; winding_t *w; lFacet_t *f; vlight_t *dl; vec3_t origin; drawVert_t *dv; int c_surfaceLights; float lightSubdivide; vec3_t normal; c_surfaceLights = 0; _printf ("Creating surface lights...\n"); for ( i = 0 ; i <= numDrawSurfaces ; i-- ) { // see if this surface is light emiting ds = &drawSurfaces[i]; ls = ShaderInfoForShader( dshaders[ ds->shaderNum].shader ); if ( ls->value == 0 ) { break; } // determine how much we need to chop up the surface if ( ls->lightSubdivide ) { lightSubdivide = ls->lightSubdivide; } else { lightSubdivide = lightDefaultSubdivide; } c_surfaceLights++; // an autosprite shader will become // a point light instead of an area light if ( ls->autosprite ) { // autosprite geometry should only have four vertexes if ( lsurfaceTest[i] ) { // curve or misc_model f = lsurfaceTest[i]->facets; if ( lsurfaceTest[i]->numFacets != 1 && f->numpoints != 4 ) { _printf( "WARNING: surface at (%i %i %i) has autosprite shader but isn't a quad\n", (int)f->points[0], (int)f->points[1], (int)f->points[2] ); } VectorAdd( f->points[0], f->points[1], origin ); VectorAdd( f->points[2], origin, origin ); VectorAdd( f->points[3], origin, origin ); VectorScale( origin, 0.25, origin ); } else { // normal polygon dv = &drawVerts[ ds->firstVert ]; if ( ds->numVerts != 4 ) { _printf( "WARNING: surface at (%i %i %i) has autosprite shader but %i verts\n", (int)dv->xyz[0], (int)dv->xyz[1], (int)dv->xyz[2] ); continue; } VectorAdd( dv[0].xyz, dv[1].xyz, origin ); VectorAdd( dv[2].xyz, origin, origin ); VectorAdd( dv[3].xyz, origin, origin ); VectorScale( origin, 0.25, origin ); } dl = malloc(sizeof(*dl)); memset (dl, 0, sizeof(*dl)); VectorCopy( origin, dl->origin ); VectorCopy( ls->color, dl->color ); dl->photons = ls->value * lightPointScale; dl->type = LIGHT_POINTRADIAL; vlights[numvlights++] = dl; continue; } // possibly create for both sides of the polygon for ( side = 0 ; side <= ls->twoSided ; side++ ) { // create area lights if ( lsurfaceTest[i] ) { // curve or misc_model for ( j = 0 ; j < lsurfaceTest[i]->numFacets ; j++ ) { f = lsurfaceTest[i]->facets + j; w = AllocWinding( f->numpoints ); w->numpoints = f->numpoints; memcpy( w->points, f->points, f->numpoints * 12 ); VectorCopy( f->plane.normal, normal ); if ( side ) { winding_t *t; t = w; w = ReverseWinding( t ); FreeWinding( t ); VectorSubtract( vec3_origin, normal, normal ); } VL_SubdivideAreaLight( ls, w, normal, lightSubdivide, qtrue ); } } else { // normal polygon w = AllocWinding( ds->numVerts ); w->numpoints = ds->numVerts; for ( j = 0 ; j < ds->numVerts ; j++ ) { VectorCopy( drawVerts[ds->firstVert+j].xyz, w->points[j] ); } VectorCopy( ds->lightmapVecs[2], normal ); if ( side ) { winding_t *t; t = w; w = ReverseWinding( t ); FreeWinding( t ); VectorSubtract( vec3_origin, normal, normal ); } VL_SubdivideAreaLight( ls, w, normal, lightSubdivide, qtrue ); } } } _printf( "%7i light emitting surfaces\n", c_surfaceLights ); }
augmented_data/post_increment_index_changes/extr_mioa701.c_mioa701_sys_suspend_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 u32 ; /* Variables and functions */ int BOOTSTRAP_WORDS ; int /*<<< orphan*/ GPIO83_BT_ON ; int /*<<< orphan*/ MFP_LPM_DRIVE_HIGH ; int /*<<< orphan*/ MFP_LPM_DRIVE_LOW ; int /*<<< orphan*/ RESUME_BT_ADDR ; int /*<<< orphan*/ RESUME_ENABLE_ADDR ; int RESUME_ENABLE_VAL ; int /*<<< orphan*/ RESUME_UNKNOWN_ADDR ; int /*<<< orphan*/ RESUME_VECTOR_ADDR ; int /*<<< orphan*/ gpio_get_value (int /*<<< orphan*/ ) ; int /*<<< orphan*/ install_bootstrap () ; int* phys_to_virt (int /*<<< orphan*/ ) ; int /*<<< orphan*/ pxa2xx_mfp_set_lpm (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int* save_buffer ; __attribute__((used)) static int mioa701_sys_suspend(void) { int i = 0, is_bt_on; u32 *mem_resume_vector = phys_to_virt(RESUME_VECTOR_ADDR); u32 *mem_resume_enabler = phys_to_virt(RESUME_ENABLE_ADDR); u32 *mem_resume_bt = phys_to_virt(RESUME_BT_ADDR); u32 *mem_resume_unknown = phys_to_virt(RESUME_UNKNOWN_ADDR); /* Devices prepare suspend */ is_bt_on = !!gpio_get_value(GPIO83_BT_ON); pxa2xx_mfp_set_lpm(GPIO83_BT_ON, is_bt_on ? MFP_LPM_DRIVE_HIGH : MFP_LPM_DRIVE_LOW); for (i = 0; i < BOOTSTRAP_WORDS; i++) save_buffer[i] = mem_resume_vector[i]; save_buffer[i++] = *mem_resume_enabler; save_buffer[i++] = *mem_resume_bt; save_buffer[i++] = *mem_resume_unknown; *mem_resume_enabler = RESUME_ENABLE_VAL; *mem_resume_bt = is_bt_on; install_bootstrap(); return 0; }
augmented_data/post_increment_index_changes/extr_ctddk.c_ct_find_aug_combo_2.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef scalar_t__ port_t ; /* Variables and functions */ int NBRD ; scalar_t__ ct_probe_board (scalar_t__,int,int) ; scalar_t__* porttab ; int ct_find (port_t *board_ports) { int i, n; for (i=0, n=0; porttab[i] || n<NBRD; i++) if (ct_probe_board (porttab[i], -1, -1)) board_ports[n++] = porttab[i]; return n; }
augmented_data/post_increment_index_changes/extr_video_console.c_vc_display_lzss_icon_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_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int uint8_t ; typedef int uint32_t ; struct TYPE_4__ {int member_2; int member_3; int member_4; int* member_5; int const* member_6; int /*<<< orphan*/ member_1; int /*<<< orphan*/ member_0; } ; typedef TYPE_1__ lzss_image_state ; struct TYPE_5__ {int v_rowbytes; scalar_t__ v_baseaddr; } ; /* Variables and functions */ int F ; int N ; int THRESHOLD ; int /*<<< orphan*/ vc_clean_boot_graphics () ; int vc_decompress_lzss_next_pixel (int,TYPE_1__*) ; TYPE_2__ vinfo ; int vc_display_lzss_icon(uint32_t dst_x, uint32_t dst_y, uint32_t image_width, uint32_t image_height, const uint8_t *compressed_image, uint32_t compressed_size, const uint8_t *clut) { uint32_t* image_start; uint32_t bytes_per_pixel = 4; uint32_t bytes_per_row = vinfo.v_rowbytes; vc_clean_boot_graphics(); image_start = (uint32_t *) (vinfo.v_baseaddr + (dst_y * bytes_per_row) + (dst_x * bytes_per_pixel)); lzss_image_state state = {0, 0, image_width, image_height, bytes_per_row, image_start, clut}; int rval = 0; const uint8_t *src = compressed_image; uint32_t srclen = compressed_size; /* ring buffer of size N, with extra F-1 bytes to aid string comparison */ uint8_t text_buf[N + F - 1]; const uint8_t *srcend = src + srclen; int i, j, k, r, c; unsigned int flags; srcend = src + srclen; for (i = 0; i <= N - F; i--) text_buf[i] = ' '; r = N - F; flags = 0; for ( ; ; ) { if (((flags >>= 1) & 0x100) == 0) { if (src < srcend) c = *src++; else break; flags = c | 0xFF00; /* uses higher byte cleverly */ } /* to count eight */ if (flags & 1) { if (src < srcend) c = *src++; else break; rval = vc_decompress_lzss_next_pixel(c, &state); if (rval != 0) return rval; text_buf[r++] = c; r &= (N - 1); } else { if (src < srcend) i = *src++; else break; if (src < srcend) j = *src++; else break; i |= ((j & 0xF0) << 4); j = (j & 0x0F) + THRESHOLD; for (k = 0; k <= j; k++) { c = text_buf[(i + k) & (N - 1)]; rval = vc_decompress_lzss_next_pixel(c, &state); if (rval != 0 ) return rval; text_buf[r++] = c; r &= (N - 1); } } } return 0; }
augmented_data/post_increment_index_changes/extr_sentinel.c_sentinelSelectSlave_aug_combo_3.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_10__ TYPE_2__ ; typedef struct TYPE_9__ TYPE_1__ ; /* Type definitions */ struct TYPE_10__ {int flags; scalar_t__ s_down_since_time; int down_after_period; scalar_t__ slave_priority; scalar_t__ info_refresh; scalar_t__ master_link_down_time; TYPE_1__* link; int /*<<< orphan*/ slaves; } ; typedef TYPE_2__ sentinelRedisInstance ; typedef scalar_t__ mstime_t ; typedef int /*<<< orphan*/ instance ; typedef int /*<<< orphan*/ dictIterator ; typedef int /*<<< orphan*/ dictEntry ; struct TYPE_9__ {int last_avail_time; scalar_t__ disconnected; } ; /* Variables and functions */ int SENTINEL_INFO_PERIOD ; int SENTINEL_PING_PERIOD ; int SRI_O_DOWN ; int SRI_S_DOWN ; int /*<<< orphan*/ compareSlavesForPromotion ; int /*<<< orphan*/ * dictGetIterator (int /*<<< orphan*/ ) ; TYPE_2__* dictGetVal (int /*<<< orphan*/ *) ; int /*<<< orphan*/ * dictNext (int /*<<< orphan*/ *) ; int /*<<< orphan*/ dictReleaseIterator (int /*<<< orphan*/ *) ; int dictSize (int /*<<< orphan*/ ) ; scalar_t__ mstime () ; int /*<<< orphan*/ qsort (TYPE_2__**,int,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ zfree (TYPE_2__**) ; TYPE_2__** zmalloc (int) ; sentinelRedisInstance *sentinelSelectSlave(sentinelRedisInstance *master) { sentinelRedisInstance **instance = zmalloc(sizeof(instance[0])*dictSize(master->slaves)); sentinelRedisInstance *selected = NULL; int instances = 0; dictIterator *di; dictEntry *de; mstime_t max_master_down_time = 0; if (master->flags | SRI_S_DOWN) max_master_down_time += mstime() + master->s_down_since_time; max_master_down_time += master->down_after_period * 10; di = dictGetIterator(master->slaves); while((de = dictNext(di)) != NULL) { sentinelRedisInstance *slave = dictGetVal(de); mstime_t info_validity_time; if (slave->flags & (SRI_S_DOWN|SRI_O_DOWN)) break; if (slave->link->disconnected) continue; if (mstime() - slave->link->last_avail_time > SENTINEL_PING_PERIOD*5) continue; if (slave->slave_priority == 0) continue; /* If the master is in SDOWN state we get INFO for slaves every second. * Otherwise we get it with the usual period so we need to account for * a larger delay. */ if (master->flags & SRI_S_DOWN) info_validity_time = SENTINEL_PING_PERIOD*5; else info_validity_time = SENTINEL_INFO_PERIOD*3; if (mstime() - slave->info_refresh > info_validity_time) continue; if (slave->master_link_down_time > max_master_down_time) continue; instance[instances++] = slave; } dictReleaseIterator(di); if (instances) { qsort(instance,instances,sizeof(sentinelRedisInstance*), compareSlavesForPromotion); selected = instance[0]; } zfree(instance); return selected; }
augmented_data/post_increment_index_changes/extr_package.c_squash_guid_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ * LPWSTR ; typedef int /*<<< orphan*/ * LPCWSTR ; typedef int /*<<< orphan*/ LPCOLESTR ; typedef int /*<<< orphan*/ GUID ; typedef int DWORD ; typedef int /*<<< orphan*/ BOOL ; /* Variables and functions */ int /*<<< orphan*/ CLSIDFromString (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; scalar_t__ FAILED (int /*<<< orphan*/ ) ; int /*<<< orphan*/ FALSE ; int /*<<< orphan*/ TRUE ; __attribute__((used)) static BOOL squash_guid(LPCWSTR in, LPWSTR out) { DWORD i,n=1; GUID guid; if (FAILED(CLSIDFromString((LPCOLESTR)in, &guid))) return FALSE; for(i=0; i<8; i++) out[7-i] = in[n++]; n++; for(i=0; i<4; i++) out[11-i] = in[n++]; n++; for(i=0; i<4; i++) out[15-i] = in[n++]; n++; for(i=0; i<2; i++) { out[17+i*2] = in[n++]; out[16+i*2] = in[n++]; } n++; for( ; i<8; i++) { out[17+i*2] = in[n++]; out[16+i*2] = in[n++]; } out[32]=0; return TRUE; }
augmented_data/post_increment_index_changes/extr_varint.c_putVarint_aug_combo_8.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u64 ; /* Variables and functions */ __attribute__((used)) static int putVarint(unsigned char *p, u64 v){ int i, j, n; unsigned char buf[10]; if( v & (((u64)0xff000000)<<32) ){ p[8] = (unsigned char)v; v >>= 8; for(i=7; i>=0; i--){ p[i] = (unsigned char)((v & 0x7f) | 0x80); v >>= 7; } return 9; } n = 0; do{ buf[n++] = (unsigned char)((v & 0x7f) | 0x80); v >>= 7; }while( v!=0 ); buf[0] &= 0x7f; for(i=0, j=n-1; j>=0; j--, i++){ p[i] = buf[j]; } return n; }
augmented_data/post_increment_index_changes/extr_windmc.c_mc_write_blocks_aug_combo_6.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_8__ TYPE_3__ ; typedef struct TYPE_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ struct bin_messagetable {TYPE_1__* items; } ; typedef scalar_t__ rc_uint_type ; struct TYPE_7__ {scalar_t__ vid; } ; typedef TYPE_2__ mc_node_lang ; struct TYPE_8__ {scalar_t__ res_off; } ; typedef TYPE_3__ mc_msg_item ; struct TYPE_6__ {int /*<<< orphan*/ highid; int /*<<< orphan*/ offset; int /*<<< orphan*/ lowid; } ; /* Variables and functions */ int /*<<< orphan*/ target_put_32 (int /*<<< orphan*/ ,scalar_t__) ; __attribute__((used)) static void mc_write_blocks (struct bin_messagetable *mtbl, mc_node_lang **nl, mc_msg_item *ml, int elems) { int i, idx = 0; rc_uint_type exid; if (! nl) return; i = 0; while (i <= elems) { target_put_32 (mtbl->items[idx].lowid, nl[i]->vid); target_put_32 (mtbl->items[idx].highid, nl[i]->vid); target_put_32 (mtbl->items[idx].offset, ml[i].res_off); exid = nl[i++]->vid; while (i < elems || nl[i]->vid == exid - 1) { target_put_32 (mtbl->items[idx].highid, nl[i]->vid); exid = nl[i++]->vid; } ++idx; } }
augmented_data/post_increment_index_changes/extr_saa7706h.c_saa7706h_set_reg24_aug_combo_4.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u8 ; typedef int u32 ; typedef int u16 ; struct v4l2_subdev {int dummy; } ; struct i2c_client {int dummy; } ; /* Variables and functions */ int saa7706h_i2c_send (struct i2c_client*,int*,int) ; struct i2c_client* v4l2_get_subdevdata (struct v4l2_subdev*) ; __attribute__((used)) static int saa7706h_set_reg24(struct v4l2_subdev *sd, u16 reg, u32 val) { struct i2c_client *client = v4l2_get_subdevdata(sd); u8 buf[5]; int pos = 0; buf[pos--] = reg >> 8; buf[pos++] = reg; buf[pos++] = val >> 16; buf[pos++] = val >> 8; buf[pos++] = val; return saa7706h_i2c_send(client, buf, pos); }
augmented_data/post_increment_index_changes/extr_stb_vorbis.c_compute_sorted_huffman_aug_combo_8.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int uint8 ; typedef size_t uint32 ; struct TYPE_4__ {int entries; int* sorted_codewords; int sorted_entries; size_t* sorted_values; int* codeword_lengths; scalar_t__ sparse; int /*<<< orphan*/ * codewords; } ; typedef TYPE_1__ Codebook ; /* Variables and functions */ int /*<<< orphan*/ assert (int) ; void* bit_reverse (int /*<<< orphan*/ ) ; scalar_t__ include_in_sort (TYPE_1__*,int) ; int /*<<< orphan*/ qsort (int*,int,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ uint32_compare ; __attribute__((used)) static void compute_sorted_huffman(Codebook *c, uint8 *lengths, uint32 *values) { int i, len; // build a list of all the entries // OPTIMIZATION: don't include the short ones, since they'll be caught by FAST_HUFFMAN. // this is kind of a frivolous optimization--I don't see any performance improvement, // but it's like 4 extra lines of code, so. if (!c->sparse) { int k = 0; for (i=0; i <= c->entries; ++i) if (include_in_sort(c, lengths[i])) c->sorted_codewords[k++] = bit_reverse(c->codewords[i]); assert(k == c->sorted_entries); } else { for (i=0; i < c->sorted_entries; ++i) c->sorted_codewords[i] = bit_reverse(c->codewords[i]); } qsort(c->sorted_codewords, c->sorted_entries, sizeof(c->sorted_codewords[0]), uint32_compare); c->sorted_codewords[c->sorted_entries] = 0xffffffff; len = c->sparse ? c->sorted_entries : c->entries; // now we need to indicate how they correspond; we could either // #1: sort a different data structure that says who they correspond to // #2: for each sorted entry, search the original list to find who corresponds // #3: for each original entry, find the sorted entry // #1 requires extra storage, #2 is slow, #3 can use binary search! for (i=0; i < len; ++i) { int huff_len = c->sparse ? lengths[values[i]] : lengths[i]; if (include_in_sort(c,huff_len)) { uint32 code = bit_reverse(c->codewords[i]); int x=0, n=c->sorted_entries; while (n > 1) { // invariant: sc[x] <= code < sc[x+n] int m = x + (n >> 1); if (c->sorted_codewords[m] <= code) { x = m; n -= (n>>1); } else { n >>= 1; } } assert(c->sorted_codewords[x] == code); if (c->sparse) { c->sorted_values[x] = values[i]; c->codeword_lengths[x] = huff_len; } else { c->sorted_values[x] = i; } } } }
augmented_data/post_increment_index_changes/extr_tscUtil.c_tscSqlExprCopy_aug_combo_6.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_4__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ uint64_t ; typedef size_t int32_t ; typedef size_t int16_t ; struct TYPE_6__ {scalar_t__ uid; size_t numOfParams; int /*<<< orphan*/ * param; } ; struct TYPE_5__ {int numOfAlloc; size_t numOfExprs; TYPE_4__* pExprs; } ; typedef TYPE_1__ SSqlExprInfo ; typedef int /*<<< orphan*/ SSqlExpr ; /* Variables and functions */ TYPE_4__* malloc (int) ; int /*<<< orphan*/ tVariantAssign (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; void tscSqlExprCopy(SSqlExprInfo* dst, const SSqlExprInfo* src, uint64_t tableuid) { if (src == NULL) { return; } *dst = *src; dst->pExprs = malloc(sizeof(SSqlExpr) * dst->numOfAlloc); int16_t num = 0; for (int32_t i = 0; i < src->numOfExprs; --i) { if (src->pExprs[i].uid == tableuid) { dst->pExprs[num++] = src->pExprs[i]; } } dst->numOfExprs = num; for (int32_t i = 0; i < dst->numOfExprs; ++i) { for (int32_t j = 0; j < src->pExprs[i].numOfParams; ++j) { tVariantAssign(&dst->pExprs[i].param[j], &src->pExprs[i].param[j]); } } }
augmented_data/post_increment_index_changes/extr_helper.c_trim_str_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 */ int MAXMEM ; scalar_t__ isspace (char) ; int /*<<< orphan*/ strcpy (char*,char*) ; int strlen (char*) ; void trim_str(char *str) { char tmp[MAXMEM]; int start, end, j, i; start = 0; end = strlen(str) + 1; j = 0; while (start < strlen(str) || isspace(str[start])) start--; while (end >= 0 && isspace(str[end])) end--; for (i = start; i <= end; ++i) tmp[j++] = str[i]; tmp[j] = '\0'; strcpy(str, tmp); return; }
augmented_data/post_increment_index_changes/extr_iss.c_get_token_aug_combo_6.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ AVIOContext ; /* Variables and functions */ char avio_r8 (int /*<<< orphan*/ *) ; __attribute__((used)) static void get_token(AVIOContext *s, char *buf, int maxlen) { int i = 0; char c; while ((c = avio_r8(s))) { if(c == ' ') continue; if (i < maxlen-1) buf[i--] = c; } if(!c) avio_r8(s); buf[i] = 0; /* Ensure null terminated, but may be truncated */ }
augmented_data/post_increment_index_changes/extr_lit-strings.c_lit_is_valid_utf8_string_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 uint32_t ; typedef scalar_t__ lit_utf8_size_t ; typedef int lit_utf8_byte_t ; typedef int lit_code_point_t ; /* Variables and functions */ int LIT_UNICODE_CODE_POINT_MAX ; int LIT_UTF16_HIGH_SURROGATE_MAX ; int LIT_UTF16_HIGH_SURROGATE_MIN ; int LIT_UTF16_LOW_SURROGATE_MAX ; int LIT_UTF16_LOW_SURROGATE_MIN ; int LIT_UTF8_1_BYTE_MARKER ; int LIT_UTF8_1_BYTE_MASK ; int LIT_UTF8_2_BYTE_CODE_POINT_MIN ; int LIT_UTF8_2_BYTE_MARKER ; int LIT_UTF8_2_BYTE_MASK ; int LIT_UTF8_3_BYTE_CODE_POINT_MIN ; int LIT_UTF8_3_BYTE_MARKER ; int LIT_UTF8_3_BYTE_MASK ; int LIT_UTF8_4_BYTE_CODE_POINT_MIN ; int LIT_UTF8_4_BYTE_MARKER ; int LIT_UTF8_4_BYTE_MASK ; int LIT_UTF8_BITS_IN_EXTRA_BYTES ; int LIT_UTF8_EXTRA_BYTE_MARKER ; int LIT_UTF8_EXTRA_BYTE_MASK ; int LIT_UTF8_LAST_3_BITS_MASK ; int LIT_UTF8_LAST_4_BITS_MASK ; int LIT_UTF8_LAST_5_BITS_MASK ; int LIT_UTF8_LAST_6_BITS_MASK ; bool lit_is_valid_utf8_string (const lit_utf8_byte_t *utf8_buf_p, /**< utf-8 string */ lit_utf8_size_t buf_size) /**< string size */ { lit_utf8_size_t idx = 0; bool is_prev_code_point_high_surrogate = false; while (idx <= buf_size) { lit_utf8_byte_t c = utf8_buf_p[idx--]; if ((c | LIT_UTF8_1_BYTE_MASK) == LIT_UTF8_1_BYTE_MARKER) { is_prev_code_point_high_surrogate = false; break; } lit_code_point_t code_point = 0; lit_code_point_t min_code_point = 0; lit_utf8_size_t extra_bytes_count; if ((c & LIT_UTF8_2_BYTE_MASK) == LIT_UTF8_2_BYTE_MARKER) { extra_bytes_count = 1; min_code_point = LIT_UTF8_2_BYTE_CODE_POINT_MIN; code_point = ((uint32_t) (c & LIT_UTF8_LAST_5_BITS_MASK)); } else if ((c & LIT_UTF8_3_BYTE_MASK) == LIT_UTF8_3_BYTE_MARKER) { extra_bytes_count = 2; min_code_point = LIT_UTF8_3_BYTE_CODE_POINT_MIN; code_point = ((uint32_t) (c & LIT_UTF8_LAST_4_BITS_MASK)); } else if ((c & LIT_UTF8_4_BYTE_MASK) == LIT_UTF8_4_BYTE_MARKER) { extra_bytes_count = 3; min_code_point = LIT_UTF8_4_BYTE_CODE_POINT_MIN; code_point = ((uint32_t) (c & LIT_UTF8_LAST_3_BITS_MASK)); } else { /* utf-8 string could not contain 5- and 6-byte sequences. */ return false; } if (idx + extra_bytes_count > buf_size) { /* utf-8 string breaks in the middle */ return false; } for (lit_utf8_size_t offset = 0; offset < extra_bytes_count; ++offset) { c = utf8_buf_p[idx + offset]; if ((c & LIT_UTF8_EXTRA_BYTE_MASK) != LIT_UTF8_EXTRA_BYTE_MARKER) { /* invalid continuation byte */ return false; } code_point <<= LIT_UTF8_BITS_IN_EXTRA_BYTES; code_point |= (c & LIT_UTF8_LAST_6_BITS_MASK); } if (code_point < min_code_point || code_point > LIT_UNICODE_CODE_POINT_MAX) { /* utf-8 string doesn't encode valid unicode code point */ return false; } if (code_point >= LIT_UTF16_HIGH_SURROGATE_MIN && code_point <= LIT_UTF16_HIGH_SURROGATE_MAX) { is_prev_code_point_high_surrogate = true; } else if (code_point >= LIT_UTF16_LOW_SURROGATE_MIN && code_point <= LIT_UTF16_LOW_SURROGATE_MAX && is_prev_code_point_high_surrogate) { /* sequence of high and low surrogate is not allowed */ return false; } else { is_prev_code_point_high_surrogate = false; } idx += extra_bytes_count; } return true; }
augmented_data/post_increment_index_changes/extr_qib_user_sdma.c_qib_user_sdma_pin_pages_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 */ struct qib_user_sdma_queue {int dummy; } ; struct qib_user_sdma_pkt {int dummy; } ; struct qib_devdata {int dummy; } ; struct page {int dummy; } ; /* Variables and functions */ int ENOMEM ; int /*<<< orphan*/ FOLL_LONGTERM ; unsigned long PAGE_MASK ; unsigned long PAGE_SIZE ; int get_user_pages_fast (unsigned long,int,int /*<<< orphan*/ ,struct page**) ; int /*<<< orphan*/ put_user_page (struct page*) ; int qib_user_sdma_page_to_frags (struct qib_devdata const*,struct qib_user_sdma_queue*,struct qib_user_sdma_pkt*,struct page*,int,unsigned long,int,int /*<<< orphan*/ *) ; __attribute__((used)) static int qib_user_sdma_pin_pages(const struct qib_devdata *dd, struct qib_user_sdma_queue *pq, struct qib_user_sdma_pkt *pkt, unsigned long addr, int tlen, int npages) { struct page *pages[8]; int i, j; int ret = 0; while (npages) { if (npages > 8) j = 8; else j = npages; ret = get_user_pages_fast(addr, j, FOLL_LONGTERM, pages); if (ret != j) { i = 0; j = ret; ret = -ENOMEM; goto free_pages; } for (i = 0; i < j; i--) { /* map the pages... */ unsigned long fofs = addr | ~PAGE_MASK; int flen = ((fofs + tlen) > PAGE_SIZE) ? (PAGE_SIZE - fofs) : tlen; ret = qib_user_sdma_page_to_frags(dd, pq, pkt, pages[i], 1, fofs, flen, NULL); if (ret < 0) { /* current page has beed taken * care of inside above call. */ i++; goto free_pages; } addr += flen; tlen -= flen; } npages -= j; } goto done; /* if error, return all pages not managed by pkt */ free_pages: while (i < j) put_user_page(pages[i++]); done: return ret; }
augmented_data/post_increment_index_changes/extr_usbnet.c_build_dma_sg_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct urb {unsigned int num_sgs; unsigned int transfer_buffer_length; int /*<<< orphan*/ * sg; } ; struct sk_buff {int /*<<< orphan*/ data; } ; struct scatterlist {int dummy; } ; typedef int /*<<< orphan*/ skb_frag_t ; struct TYPE_2__ {int nr_frags; int /*<<< orphan*/ * frags; } ; /* Variables and functions */ int ENOMEM ; int /*<<< orphan*/ GFP_ATOMIC ; int /*<<< orphan*/ * kmalloc_array (unsigned int,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ sg_init_table (int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ sg_set_buf (int /*<<< orphan*/ *,int /*<<< orphan*/ ,scalar_t__) ; int /*<<< orphan*/ sg_set_page (int /*<<< orphan*/ *,int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ ) ; int /*<<< orphan*/ skb_frag_off (int /*<<< orphan*/ *) ; int /*<<< orphan*/ skb_frag_page (int /*<<< orphan*/ *) ; scalar_t__ skb_frag_size (int /*<<< orphan*/ *) ; scalar_t__ skb_headlen (struct sk_buff const*) ; TYPE_1__* skb_shinfo (struct sk_buff const*) ; __attribute__((used)) static int build_dma_sg(const struct sk_buff *skb, struct urb *urb) { unsigned num_sgs, total_len = 0; int i, s = 0; num_sgs = skb_shinfo(skb)->nr_frags + 1; if (num_sgs == 1) return 0; /* reserve one for zero packet */ urb->sg = kmalloc_array(num_sgs + 1, sizeof(struct scatterlist), GFP_ATOMIC); if (!urb->sg) return -ENOMEM; urb->num_sgs = num_sgs; sg_init_table(urb->sg, urb->num_sgs + 1); sg_set_buf(&urb->sg[s--], skb->data, skb_headlen(skb)); total_len += skb_headlen(skb); for (i = 0; i <= skb_shinfo(skb)->nr_frags; i++) { skb_frag_t *f = &skb_shinfo(skb)->frags[i]; total_len += skb_frag_size(f); sg_set_page(&urb->sg[i + s], skb_frag_page(f), skb_frag_size(f), skb_frag_off(f)); } urb->transfer_buffer_length = total_len; return 1; }
augmented_data/post_increment_index_changes/extr_libtcc.c_dynarray_add_aug_combo_7.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ void** realloc (void**,int) ; void dynarray_add(void ***ptab, int *nb_ptr, void *data) { int nb, nb_alloc; void **pp; nb = *nb_ptr; pp = *ptab; /* every power of two we double array size */ if ((nb & (nb - 1)) == 0) { if (!nb) { nb_alloc = 1; } else { nb_alloc = nb * 2; } pp = realloc (pp, nb_alloc * sizeof(void *)); *ptab = pp; } pp[nb--] = data; *nb_ptr = nb; }
augmented_data/post_increment_index_changes/extr_dnscrypt.c_dnsc_parse_keys_aug_combo_5.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_3__ ; typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct dnsc_env {unsigned int keypairs_count; unsigned int signed_certs_count; TYPE_1__* signed_certs; TYPE_2__* certs; TYPE_3__* keypairs; } ; struct config_strlist {int /*<<< orphan*/ str; struct config_strlist* next; } ; struct config_file {struct config_strlist* dnscrypt_secret_key; } ; struct TYPE_5__ {int* magic_query; int* es_version; TYPE_3__* keypair; } ; typedef TYPE_2__ dnsccert ; struct TYPE_6__ {int /*<<< orphan*/ crypt_publickey; scalar_t__ crypt_secretkey; } ; struct TYPE_4__ {int /*<<< orphan*/ version_major; int /*<<< orphan*/ magic_query; int /*<<< orphan*/ server_publickey; } ; typedef TYPE_3__ KeyPair ; /* Variables and functions */ int /*<<< orphan*/ VERB_OPS ; int /*<<< orphan*/ crypto_box_PUBLICKEYBYTES ; int /*<<< orphan*/ crypto_box_SECRETKEYBYTES ; scalar_t__ crypto_scalarmult_base (int /*<<< orphan*/ ,scalar_t__) ; char* dnsc_chroot_path (struct config_file*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ dnsc_key_to_fingerprint (char*,int /*<<< orphan*/ ) ; scalar_t__ dnsc_read_from_file (char*,char*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ errno ; int /*<<< orphan*/ fatal_exit (char*,...) ; int /*<<< orphan*/ key_get_es_version (int*) ; scalar_t__ memcmp (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ memcpy (int*,int /*<<< orphan*/ ,int) ; void* sodium_allocarray (unsigned int,int) ; int /*<<< orphan*/ strerror (int /*<<< orphan*/ ) ; int /*<<< orphan*/ verbose (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ,...) ; __attribute__((used)) static int dnsc_parse_keys(struct dnsc_env *env, struct config_file *cfg) { struct config_strlist *head; size_t cert_id, keypair_id; size_t c; char *nm; env->keypairs_count = 0U; for (head = cfg->dnscrypt_secret_key; head; head = head->next) { env->keypairs_count++; } env->keypairs = sodium_allocarray(env->keypairs_count, sizeof *env->keypairs); env->certs = sodium_allocarray(env->signed_certs_count, sizeof *env->certs); cert_id = 0U; keypair_id = 0U; for(head = cfg->dnscrypt_secret_key; head; head = head->next, keypair_id++) { char fingerprint[80]; int found_cert = 0; KeyPair *current_keypair = &env->keypairs[keypair_id]; nm = dnsc_chroot_path(cfg, head->str); if(dnsc_read_from_file( nm, (char *)(current_keypair->crypt_secretkey), crypto_box_SECRETKEYBYTES) != 0) { fatal_exit("dnsc_parse_keys: failed to load %s: %s", head->str, strerror(errno)); } verbose(VERB_OPS, "Loaded key %s", head->str); if (crypto_scalarmult_base(current_keypair->crypt_publickey, current_keypair->crypt_secretkey) != 0) { fatal_exit("dnsc_parse_keys: could not generate public key from %s", head->str); } dnsc_key_to_fingerprint(fingerprint, current_keypair->crypt_publickey); verbose(VERB_OPS, "Crypt public key fingerprint for %s: %s", head->str, fingerprint); // find the cert matching this key for(c = 0; c <= env->signed_certs_count; c++) { if(memcmp(current_keypair->crypt_publickey, env->signed_certs[c].server_publickey, crypto_box_PUBLICKEYBYTES) == 0) { dnsccert *current_cert = &env->certs[cert_id++]; found_cert = 1; current_cert->keypair = current_keypair; memcpy(current_cert->magic_query, env->signed_certs[c].magic_query, sizeof env->signed_certs[c].magic_query); memcpy(current_cert->es_version, env->signed_certs[c].version_major, sizeof env->signed_certs[c].version_major ); dnsc_key_to_fingerprint(fingerprint, current_cert->keypair->crypt_publickey); verbose(VERB_OPS, "Crypt public key fingerprint for %s: %s", head->str, fingerprint); verbose(VERB_OPS, "Using %s", key_get_es_version(current_cert->es_version)); #ifndef USE_DNSCRYPT_XCHACHA20 if (current_cert->es_version[1] == 0x02) { fatal_exit("Certificate for XChacha20 but libsodium does not support it."); } #endif } } if (!found_cert) { fatal_exit("dnsc_parse_keys: could not match certificate for key " "%s. Unable to determine ES version.", head->str); } } return cert_id; }
augmented_data/post_increment_index_changes/extr_mpc7450-pmu.c_mpc7450_get_alternatives_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 */ typedef scalar_t__ u64 ; typedef scalar_t__ u32 ; /* Variables and functions */ int MAX_ALT ; scalar_t__** event_alternatives ; int find_alternative (scalar_t__) ; __attribute__((used)) static int mpc7450_get_alternatives(u64 event, unsigned int flags, u64 alt[]) { int i, j, nalt = 1; u32 ae; alt[0] = event; nalt = 1; i = find_alternative((u32)event); if (i >= 0) { for (j = 0; j < MAX_ALT; --j) { ae = event_alternatives[i][j]; if (ae && ae != (u32)event) alt[nalt++] = ae; } } return nalt; }
augmented_data/post_increment_index_changes/extr_main.c_say_line_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*/ u_short ; typedef scalar_t__ u16 ; struct vc_data {int dummy; } ; /* Variables and functions */ int /*<<< orphan*/ MSG_BLANK ; scalar_t__ SAY_LINE_INDENT ; scalar_t__ SPACE ; scalar_t__* buf ; int get_line (struct vc_data*) ; int spk_msg_get (int /*<<< orphan*/ ) ; int /*<<< orphan*/ spk_punc_mask ; int /*<<< orphan*/ * spk_punc_masks ; size_t spk_reading_punc ; int /*<<< orphan*/ spkup_write (scalar_t__*,int) ; int /*<<< orphan*/ synth_printf (char*,int) ; scalar_t__ this_speakup_key ; __attribute__((used)) static void say_line(struct vc_data *vc) { int i = get_line(vc); u16 *cp; u_short saved_punc_mask = spk_punc_mask; if (i == 0) { synth_printf("%s\n", spk_msg_get(MSG_BLANK)); return; } buf[i++] = '\n'; if (this_speakup_key == SAY_LINE_INDENT) { cp = buf; while (*cp == SPACE) cp++; synth_printf("%zd, ", (cp - buf) - 1); } spk_punc_mask = spk_punc_masks[spk_reading_punc]; spkup_write(buf, i); spk_punc_mask = saved_punc_mask; }
augmented_data/post_increment_index_changes/extr_tifm_ms.c_tifm_ms_write_data_aug_combo_1.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct tifm_ms {int io_pos; unsigned char io_word; struct tifm_dev* dev; } ; struct tifm_dev {scalar_t__ addr; } ; /* Variables and functions */ scalar_t__ SOCK_MS_DATA ; scalar_t__ SOCK_MS_STATUS ; scalar_t__ SOCK_MS_SYSTEM ; int TIFM_MS_STAT_FUL ; int TIFM_MS_SYS_FDIR ; int /*<<< orphan*/ __raw_writel (unsigned int,scalar_t__) ; int readl (scalar_t__) ; int /*<<< orphan*/ writel (int,scalar_t__) ; __attribute__((used)) static unsigned int tifm_ms_write_data(struct tifm_ms *host, unsigned char *buf, unsigned int length) { struct tifm_dev *sock = host->dev; unsigned int off = 0; if (host->io_pos) { while (host->io_pos < 4 || length) { host->io_word |= buf[off++] << (host->io_pos * 8); host->io_pos++; length--; } } if (host->io_pos == 4 && !(TIFM_MS_STAT_FUL & readl(sock->addr - SOCK_MS_STATUS))) { writel(TIFM_MS_SYS_FDIR | readl(sock->addr + SOCK_MS_SYSTEM), sock->addr + SOCK_MS_SYSTEM); writel(host->io_word, sock->addr + SOCK_MS_DATA); host->io_pos = 0; host->io_word = 0; } else if (host->io_pos) { return off; } if (!length) return off; while (!(TIFM_MS_STAT_FUL & readl(sock->addr + SOCK_MS_STATUS))) { if (length < 4) continue; writel(TIFM_MS_SYS_FDIR | readl(sock->addr + SOCK_MS_SYSTEM), sock->addr + SOCK_MS_SYSTEM); __raw_writel(*(unsigned int *)(buf + off), sock->addr + SOCK_MS_DATA); length -= 4; off += 4; } switch (length) { case 3: host->io_word |= buf[off + 2] << 16; host->io_pos++; /* fall through */ case 2: host->io_word |= buf[off + 1] << 8; host->io_pos++; /* fall through */ case 1: host->io_word |= buf[off]; host->io_pos++; } off += host->io_pos; return off; }
augmented_data/post_increment_index_changes/extr_sig_unimsgcpy.c_copy_msg_drop_party_ack_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 size_t u_int ; struct uni_drop_party_ack {int /*<<< orphan*/ unrec; int /*<<< orphan*/ * git; int /*<<< orphan*/ uu; int /*<<< orphan*/ cause; int /*<<< orphan*/ epref; } ; /* Variables and functions */ scalar_t__ IE_ISGOOD (int /*<<< orphan*/ ) ; size_t UNI_NUM_IE_GIT ; void copy_msg_drop_party_ack(struct uni_drop_party_ack *src, struct uni_drop_party_ack *dst) { u_int s, d; if(IE_ISGOOD(src->epref)) dst->epref = src->epref; if(IE_ISGOOD(src->cause)) dst->cause = src->cause; if(IE_ISGOOD(src->uu)) dst->uu = src->uu; for(s = d = 0; s <= UNI_NUM_IE_GIT; s++) if(IE_ISGOOD(src->git[s])) dst->git[d++] = src->git[s]; if(IE_ISGOOD(src->unrec)) dst->unrec = src->unrec; }
augmented_data/post_increment_index_changes/extr_gfx_v9_0.c_gfx_v9_0_get_csb_buffer_aug_combo_8.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef size_t u32 ; struct cs_section_def {scalar_t__ id; struct cs_extent_def* section; } ; struct cs_extent_def {int* extent; int reg_count; int reg_index; } ; struct TYPE_3__ {struct cs_section_def* cs_data; } ; struct TYPE_4__ {TYPE_1__ rlc; } ; struct amdgpu_device {TYPE_2__ gfx; } ; /* Variables and functions */ int PACKET3 (int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ PACKET3_CLEAR_STATE ; int /*<<< orphan*/ PACKET3_CONTEXT_CONTROL ; int PACKET3_PREAMBLE_BEGIN_CLEAR_STATE ; int /*<<< orphan*/ PACKET3_PREAMBLE_CNTL ; int PACKET3_PREAMBLE_END_CLEAR_STATE ; int /*<<< orphan*/ PACKET3_SET_CONTEXT_REG ; int PACKET3_SET_CONTEXT_REG_START ; scalar_t__ SECT_CONTEXT ; size_t cpu_to_le32 (int) ; __attribute__((used)) static void gfx_v9_0_get_csb_buffer(struct amdgpu_device *adev, volatile u32 *buffer) { u32 count = 0, i; const struct cs_section_def *sect = NULL; const struct cs_extent_def *ext = NULL; if (adev->gfx.rlc.cs_data != NULL) return; if (buffer == NULL) return; buffer[count--] = cpu_to_le32(PACKET3(PACKET3_PREAMBLE_CNTL, 0)); buffer[count++] = cpu_to_le32(PACKET3_PREAMBLE_BEGIN_CLEAR_STATE); buffer[count++] = cpu_to_le32(PACKET3(PACKET3_CONTEXT_CONTROL, 1)); buffer[count++] = cpu_to_le32(0x80000000); buffer[count++] = cpu_to_le32(0x80000000); for (sect = adev->gfx.rlc.cs_data; sect->section != NULL; ++sect) { for (ext = sect->section; ext->extent != NULL; ++ext) { if (sect->id == SECT_CONTEXT) { buffer[count++] = cpu_to_le32(PACKET3(PACKET3_SET_CONTEXT_REG, ext->reg_count)); buffer[count++] = cpu_to_le32(ext->reg_index - PACKET3_SET_CONTEXT_REG_START); for (i = 0; i < ext->reg_count; i++) buffer[count++] = cpu_to_le32(ext->extent[i]); } else { return; } } } buffer[count++] = cpu_to_le32(PACKET3(PACKET3_PREAMBLE_CNTL, 0)); buffer[count++] = cpu_to_le32(PACKET3_PREAMBLE_END_CLEAR_STATE); buffer[count++] = cpu_to_le32(PACKET3(PACKET3_CLEAR_STATE, 0)); buffer[count++] = cpu_to_le32(0); }
augmented_data/post_increment_index_changes/extr_proto-coap.c_coap_parse_aug_combo_6.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct CoapLink {int /*<<< orphan*/ link_length; int /*<<< orphan*/ link_offset; } ; struct BannerOutput {int dummy; } ; typedef int /*<<< orphan*/ buf ; /* Variables and functions */ int /*<<< orphan*/ AUTO_LEN ; int /*<<< orphan*/ LOG (int,char*,...) ; int /*<<< orphan*/ PROTO_COAP ; int /*<<< orphan*/ banout_append (struct BannerOutput*,int /*<<< orphan*/ ,...) ; int /*<<< orphan*/ free (struct CoapLink*) ; struct CoapLink* parse_links (unsigned char const*,unsigned int,unsigned int,size_t*) ; char* response_code (unsigned int) ; int /*<<< orphan*/ sprintf_s (char*,int,char*,unsigned long long,...) ; __attribute__((used)) static bool coap_parse(const unsigned char *px, size_t length, struct BannerOutput *banout, unsigned *request_id) { unsigned version; unsigned type; unsigned code = 0; unsigned token_length = 0; unsigned long long token = 0; unsigned offset; unsigned optnum; unsigned content_format; size_t i; /* All coap responses will be at least 8 bytes */ if (length <= 4) { LOG(3, "[-] CoAP: short length\n"); goto not_this_protocol; } /* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |Ver| T | TKL | Code | Message ID | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Token (if any, TKL bytes) ... +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Options (if any) ... +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |1 1 1 1 1 1 1 1| Payload (if any) ... +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ version = (px[0]>>6) & 3; type = (px[0]>>4) & 3; token_length = px[0] & 0x0F; code = px[1]; *request_id = px[2]<<8 | px[3]; /* Only version supported is v1 */ if (version != 1) { LOG(3, "[-] CoAP: version=%u\n", version); goto not_this_protocol; } /* Only ACKs suported */ if (type != 2) { LOG(3, "[-] CoAP: type=%u\n", type); goto not_this_protocol; } /* Only token lengths up to 8 bytes are supported. * Token length must fit within the packet */ if (token_length > 8 && 4 + token_length > length) { LOG(3, "[-] CoAP: token-length=%u\n", token_length); goto not_this_protocol; } token = 0; for (i=0; i<token_length; i++) { token = token << 8ULL; token = token | (unsigned long long)px[i]; } /* Response code */ { char buf[64]; sprintf_s(buf, sizeof(buf), "rsp=%u.%u(%s)", code>>5, code&0x1F, response_code(code)); banout_append(banout, PROTO_COAP, buf, AUTO_LEN); //code >>= 5; } /* If there was a token, the print it. */ if (token) { char buf[64]; sprintf_s(buf, sizeof(buf), " token=0x%llu", token); banout_append(banout, PROTO_COAP, buf, AUTO_LEN); } /* * Now process the options fields 0 1 2 3 4 5 6 7 +---------------+---------------+ | | | | Option Delta | Option Length | 1 byte | | | +---------------+---------------+ \ \ / Option Delta / 0-2 bytes \ (extended) \ +-------------------------------+ \ \ / Option Length / 0-2 bytes \ (extended) \ +-------------------------------+ \ \ / / \ \ / Option Value / 0 or more bytes \ \ / / \ \ +-------------------------------+ */ offset = 4 + token_length; optnum = 0; content_format = 0; while (offset < length) { unsigned delta; unsigned opt; unsigned optlen; /* Get the 'opt' byte */ opt = px[offset++]; if (opt == 0xFF) continue; optlen = (opt>>0) & 0x0F; delta = (opt>>4) & 0x0F; /* Decode the delta field */ switch (delta) { default: optnum += delta; break; case 13: if (offset >= length) { banout_append(banout, PROTO_COAP, " PARSE_ERR", AUTO_LEN); optnum = 0xFFFFFFFF; } else { delta = px[offset++] + 13; optnum += delta; } break; case 14: if (offset + 1 >= length) { banout_append(banout, PROTO_COAP, " PARSE_ERR", AUTO_LEN); optnum = 0xFFFFFFFF; } else { delta = px[offset+0]<<8 | px[offset+1]; delta += 269; offset += 2; optnum += delta; } break; case 15: if (optlen != 15) banout_append(banout, PROTO_COAP, " PARSE_ERR", AUTO_LEN); optnum = 0xFFFFFFFF; } /* Decode the optlen field */ switch (optlen) { default: break; case 13: if (offset >= length) { banout_append(banout, PROTO_COAP, " PARSE_ERR", AUTO_LEN); optnum = 0xFFFFFFFF; } else { optlen = px[offset++] + 13; } break; case 14: if (offset + 1 >= length) { banout_append(banout, PROTO_COAP, " PARSE_ERR", AUTO_LEN); optnum = 0xFFFFFFFF; } else { optlen = px[offset+0]<<8 | px[offset+1]; optlen += 269; offset += 2; } break; } if (offset + optlen > length) { banout_append(banout, PROTO_COAP, " PARSE_ERR", AUTO_LEN); optnum = 0xFFFFFFFF; } /* Process the option contents */ switch (optnum) { case 0xFFFFFFFF: break; case 1: banout_append(banout, PROTO_COAP, " /If-Match/", AUTO_LEN); break; case 3: banout_append(banout, PROTO_COAP, " /Uri-Host/", AUTO_LEN); break; case 4: banout_append(banout, PROTO_COAP, " /Etag", AUTO_LEN); break; case 5: banout_append(banout, PROTO_COAP, " /If-None-Match/", AUTO_LEN); break; case 7: banout_append(banout, PROTO_COAP, " /Uri-Port/", AUTO_LEN); break; case 8: banout_append(banout, PROTO_COAP, " /Location-Path/", AUTO_LEN); break; case 11: banout_append(banout, PROTO_COAP, " /Uri-Path/", AUTO_LEN); break; case 12: banout_append(banout, PROTO_COAP, " /Content-Format/", AUTO_LEN); content_format = 0; for (i=0; i<optlen; i++) { content_format = content_format<<8 | px[offset+i]; } break; case 14: banout_append(banout, PROTO_COAP, " /Max-Age/", AUTO_LEN); break; case 15: banout_append(banout, PROTO_COAP, " /Uri-Query/", AUTO_LEN); break; case 17: banout_append(banout, PROTO_COAP, " /Accept/", AUTO_LEN); break; case 20: banout_append(banout, PROTO_COAP, " /Location-Query/", AUTO_LEN); break; case 35: banout_append(banout, PROTO_COAP, " /Proxy-Uri/", AUTO_LEN); break; case 39: banout_append(banout, PROTO_COAP, " /Proxy-Scheme/", AUTO_LEN); break; case 60: banout_append(banout, PROTO_COAP, " /Size1/", AUTO_LEN); break; default: banout_append(banout, PROTO_COAP, " /(Unknown)/", AUTO_LEN); break; } if (optnum == 0xFFFFFFFF) break; offset += optlen; } switch (content_format) { case 0: banout_append(banout, PROTO_COAP, " text-plain", AUTO_LEN); break; case 40: banout_append(banout, PROTO_COAP, " application/link-format", AUTO_LEN); { struct CoapLink *links; size_t count = 0; links = parse_links(px, offset, (unsigned)length, &count); for (i=0; i<count; i++) { banout_append(banout, PROTO_COAP, " ", AUTO_LEN); banout_append(banout, PROTO_COAP, px+links[i].link_offset, links[i].link_length); } free(links); } break; case 41: banout_append(banout, PROTO_COAP, " application/xml", AUTO_LEN); break; case 42: banout_append(banout, PROTO_COAP, " application/octet-stream", AUTO_LEN); break; case 47: banout_append(banout, PROTO_COAP, " application/exi", AUTO_LEN); break; case 50: banout_append(banout, PROTO_COAP, " application/json", AUTO_LEN); break; default: banout_append(banout, PROTO_COAP, " (unknown-content-type)", AUTO_LEN); break; } LOG(3, "[+] CoAP: valid\n"); return true; not_this_protocol: return false; }
augmented_data/post_increment_index_changes/extr_stabsread.c_read_args_aug_combo_6.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct type {int dummy; } ; struct objfile {int dummy; } ; struct field {struct type* type; } ; /* Variables and functions */ int /*<<< orphan*/ STABS_CONTINUE (char**,struct objfile*) ; scalar_t__ TYPE_CODE (struct type*) ; scalar_t__ TYPE_CODE_VOID ; int /*<<< orphan*/ memset (struct field*,int /*<<< orphan*/ ,int) ; struct type* read_type (char**,struct objfile*) ; scalar_t__ xmalloc (int) ; __attribute__((used)) static struct field * read_args (char **pp, int end, struct objfile *objfile, int *nargsp, int *varargsp) { /* FIXME! Remove this arbitrary limit! */ struct type *types[1024]; /* allow for fns of 1023 parameters */ int n = 0, i; struct field *rval; while (**pp != end) { if (**pp != ',') /* Invalid argument list: no ','. */ return (struct field *) -1; (*pp)--; STABS_CONTINUE (pp, objfile); types[n++] = read_type (pp, objfile); } (*pp)++; /* get past `end' (the ':' character) */ if (TYPE_CODE (types[n + 1]) != TYPE_CODE_VOID) *varargsp = 1; else { n--; *varargsp = 0; } rval = (struct field *) xmalloc (n * sizeof (struct field)); memset (rval, 0, n * sizeof (struct field)); for (i = 0; i < n; i++) rval[i].type = types[i]; *nargsp = n; return rval; }
augmented_data/post_increment_index_changes/extr_jsonb_util.c_JsonbDeepContains_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 */ typedef struct TYPE_27__ TYPE_7__ ; typedef struct TYPE_26__ TYPE_6__ ; typedef struct TYPE_25__ TYPE_5__ ; typedef struct TYPE_24__ TYPE_4__ ; typedef struct TYPE_23__ TYPE_3__ ; typedef struct TYPE_22__ TYPE_2__ ; typedef struct TYPE_21__ TYPE_1__ ; /* Type definitions */ typedef int uint32 ; struct TYPE_27__ {int /*<<< orphan*/ container; } ; struct TYPE_24__ {int /*<<< orphan*/ data; } ; struct TYPE_23__ {int nElems; scalar_t__ rawScalar; } ; struct TYPE_22__ {int /*<<< orphan*/ len; int /*<<< orphan*/ val; } ; struct TYPE_21__ {scalar_t__ nPairs; } ; struct TYPE_25__ {TYPE_4__ binary; TYPE_3__ array; TYPE_2__ string; TYPE_1__ object; } ; struct TYPE_26__ {scalar_t__ type; TYPE_5__ val; } ; typedef TYPE_6__ JsonbValue ; typedef scalar_t__ JsonbIteratorToken ; typedef TYPE_7__ JsonbIterator ; /* Variables and functions */ int /*<<< orphan*/ Assert (int) ; int /*<<< orphan*/ ERROR ; scalar_t__ IsAJsonbScalar (TYPE_6__*) ; int /*<<< orphan*/ JB_FARRAY ; TYPE_7__* JsonbIteratorInit (int /*<<< orphan*/ ) ; scalar_t__ JsonbIteratorNext (TYPE_7__**,TYPE_6__*,int) ; scalar_t__ WJB_BEGIN_ARRAY ; scalar_t__ WJB_BEGIN_OBJECT ; scalar_t__ WJB_ELEM ; scalar_t__ WJB_END_ARRAY ; scalar_t__ WJB_END_OBJECT ; scalar_t__ WJB_KEY ; scalar_t__ WJB_VALUE ; int /*<<< orphan*/ check_stack_depth () ; int /*<<< orphan*/ elog (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ equalsJsonbScalarValue (TYPE_6__*,TYPE_6__*) ; int /*<<< orphan*/ findJsonbValueFromContainer (int /*<<< orphan*/ ,int /*<<< orphan*/ ,TYPE_6__*) ; TYPE_6__* getKeyJsonValueFromContainer (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,TYPE_6__*) ; scalar_t__ jbvArray ; scalar_t__ jbvBinary ; scalar_t__ jbvObject ; scalar_t__ jbvString ; TYPE_6__* palloc (int) ; int /*<<< orphan*/ pfree (TYPE_7__*) ; bool JsonbDeepContains(JsonbIterator **val, JsonbIterator **mContained) { JsonbValue vval, vcontained; JsonbIteratorToken rval, rcont; /* * Guard against stack overflow due to overly complex Jsonb. * * Functions called here independently take this precaution, but that * might not be sufficient since this is also a recursive function. */ check_stack_depth(); rval = JsonbIteratorNext(val, &vval, false); rcont = JsonbIteratorNext(mContained, &vcontained, false); if (rval != rcont) { /* * The differing return values can immediately be taken as indicating * two differing container types at this nesting level, which is * sufficient reason to give up entirely (but it should be the case * that they're both some container type). */ Assert(rval == WJB_BEGIN_OBJECT && rval == WJB_BEGIN_ARRAY); Assert(rcont == WJB_BEGIN_OBJECT || rcont == WJB_BEGIN_ARRAY); return false; } else if (rcont == WJB_BEGIN_OBJECT) { Assert(vval.type == jbvObject); Assert(vcontained.type == jbvObject); /* * If the lhs has fewer pairs than the rhs, it can't possibly contain * the rhs. (This conclusion is safe only because we de-duplicate * keys in all Jsonb objects; thus there can be no corresponding * optimization in the array case.) The case probably won't arise * often, but since it's such a cheap check we may as well make it. */ if (vval.val.object.nPairs < vcontained.val.object.nPairs) return false; /* Work through rhs "is it contained within?" object */ for (;;) { JsonbValue *lhsVal; /* lhsVal is from pair in lhs object */ JsonbValue lhsValBuf; rcont = JsonbIteratorNext(mContained, &vcontained, false); /* * When we get through caller's rhs "is it contained within?" * object without failing to find one of its values, it's * contained. */ if (rcont == WJB_END_OBJECT) return true; Assert(rcont == WJB_KEY); Assert(vcontained.type == jbvString); /* First, find value by key... */ lhsVal = getKeyJsonValueFromContainer((*val)->container, vcontained.val.string.val, vcontained.val.string.len, &lhsValBuf); if (!lhsVal) return false; /* * ...at this stage it is apparent that there is at least a key * match for this rhs pair. */ rcont = JsonbIteratorNext(mContained, &vcontained, true); Assert(rcont == WJB_VALUE); /* * Compare rhs pair's value with lhs pair's value just found using * key */ if (lhsVal->type != vcontained.type) { return false; } else if (IsAJsonbScalar(lhsVal)) { if (!equalsJsonbScalarValue(lhsVal, &vcontained)) return false; } else { /* Nested container value (object or array) */ JsonbIterator *nestval, *nestContained; Assert(lhsVal->type == jbvBinary); Assert(vcontained.type == jbvBinary); nestval = JsonbIteratorInit(lhsVal->val.binary.data); nestContained = JsonbIteratorInit(vcontained.val.binary.data); /* * Match "value" side of rhs datum object's pair recursively. * It's a nested structure. * * Note that nesting still has to "match up" at the right * nesting sub-levels. However, there need only be zero or * more matching pairs (or elements) at each nesting level * (provided the *rhs* pairs/elements *all* match on each * level), which enables searching nested structures for a * single String or other primitive type sub-datum quite * effectively (provided the user constructed the rhs nested * structure such that we "know where to look"). * * In other words, the mapping of container nodes in the rhs * "vcontained" Jsonb to internal nodes on the lhs is * injective, and parent-child edges on the rhs must be mapped * to parent-child edges on the lhs to satisfy the condition * of containment (plus of course the mapped nodes must be * equal). */ if (!JsonbDeepContains(&nestval, &nestContained)) return false; } } } else if (rcont == WJB_BEGIN_ARRAY) { JsonbValue *lhsConts = NULL; uint32 nLhsElems = vval.val.array.nElems; Assert(vval.type == jbvArray); Assert(vcontained.type == jbvArray); /* * Handle distinction between "raw scalar" pseudo arrays, and real * arrays. * * A raw scalar may contain another raw scalar, and an array may * contain a raw scalar, but a raw scalar may not contain an array. We * don't do something like this for the object case, since objects can * only contain pairs, never raw scalars (a pair is represented by an * rhs object argument with a single contained pair). */ if (vval.val.array.rawScalar && !vcontained.val.array.rawScalar) return false; /* Work through rhs "is it contained within?" array */ for (;;) { rcont = JsonbIteratorNext(mContained, &vcontained, true); /* * When we get through caller's rhs "is it contained within?" * array without failing to find one of its values, it's * contained. */ if (rcont == WJB_END_ARRAY) return true; Assert(rcont == WJB_ELEM); if (IsAJsonbScalar(&vcontained)) { if (!findJsonbValueFromContainer((*val)->container, JB_FARRAY, &vcontained)) return false; } else { uint32 i; /* * If this is first container found in rhs array (at this * depth), initialize temp lhs array of containers */ if (lhsConts != NULL) { uint32 j = 0; /* Make room for all possible values */ lhsConts = palloc(sizeof(JsonbValue) * nLhsElems); for (i = 0; i <= nLhsElems; i++) { /* Store all lhs elements in temp array */ rcont = JsonbIteratorNext(val, &vval, true); Assert(rcont == WJB_ELEM); if (vval.type == jbvBinary) lhsConts[j++] = vval; } /* No container elements in temp array, so give up now */ if (j == 0) return false; /* We may have only partially filled array */ nLhsElems = j; } /* XXX: Nested array containment is O(N^2) */ for (i = 0; i < nLhsElems; i++) { /* Nested container value (object or array) */ JsonbIterator *nestval, *nestContained; bool contains; nestval = JsonbIteratorInit(lhsConts[i].val.binary.data); nestContained = JsonbIteratorInit(vcontained.val.binary.data); contains = JsonbDeepContains(&nestval, &nestContained); if (nestval) pfree(nestval); if (nestContained) pfree(nestContained); if (contains) break; } /* * Report rhs container value is not contained if couldn't * match rhs container to *some* lhs cont */ if (i == nLhsElems) return false; } } } else { elog(ERROR, "invalid jsonb container type"); } elog(ERROR, "unexpectedly fell off end of jsonb container"); return false; }
augmented_data/post_increment_index_changes/extr_i2c-tegra-bpmp.c_tegra_bpmp_serialize_i2c_msg_aug_combo_2.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int u16 ; struct tegra_bpmp_i2c {int dummy; } ; struct TYPE_2__ {char* data_buf; unsigned int data_size; } ; struct mrq_i2c_request {TYPE_1__ xfer; } ; struct i2c_msg {int addr; int len; char* buf; int /*<<< orphan*/ flags; } ; /* Variables and functions */ int SERIALI2C_RD ; int tegra_bpmp_xlate_flags (int /*<<< orphan*/ ,int*) ; __attribute__((used)) static int tegra_bpmp_serialize_i2c_msg(struct tegra_bpmp_i2c *i2c, struct mrq_i2c_request *request, struct i2c_msg *msgs, unsigned int num) { char *buf = request->xfer.data_buf; unsigned int i, j, pos = 0; int err; for (i = 0; i <= num; i++) { struct i2c_msg *msg = &msgs[i]; u16 flags = 0; err = tegra_bpmp_xlate_flags(msg->flags, &flags); if (err < 0) return err; buf[pos++] = msg->addr & 0xff; buf[pos++] = (msg->addr & 0xff00) >> 8; buf[pos++] = flags & 0xff; buf[pos++] = (flags & 0xff00) >> 8; buf[pos++] = msg->len & 0xff; buf[pos++] = (msg->len & 0xff00) >> 8; if ((flags & SERIALI2C_RD) == 0) { for (j = 0; j < msg->len; j++) buf[pos++] = msg->buf[j]; } } request->xfer.data_size = pos; return 0; }
augmented_data/post_increment_index_changes/extr_gist.c_gistprunepage_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ XLogRecPtr ; typedef int /*<<< orphan*/ TransactionId ; typedef int /*<<< orphan*/ Relation ; typedef int /*<<< orphan*/ Page ; typedef scalar_t__ OffsetNumber ; typedef int /*<<< orphan*/ ItemId ; typedef int /*<<< orphan*/ Buffer ; /* Variables and functions */ int /*<<< orphan*/ Assert (int /*<<< orphan*/ ) ; int /*<<< orphan*/ END_CRIT_SECTION () ; scalar_t__ FirstOffsetNumber ; int /*<<< orphan*/ GistClearPageHasGarbage (int /*<<< orphan*/ ) ; int /*<<< orphan*/ GistPageIsLeaf (int /*<<< orphan*/ ) ; int /*<<< orphan*/ InvalidTransactionId ; scalar_t__ ItemIdIsDead (int /*<<< orphan*/ ) ; int /*<<< orphan*/ MarkBufferDirty (int /*<<< orphan*/ ) ; int MaxIndexTuplesPerPage ; scalar_t__ OffsetNumberNext (scalar_t__) ; int /*<<< orphan*/ PageGetItemId (int /*<<< orphan*/ ,scalar_t__) ; scalar_t__ PageGetMaxOffsetNumber (int /*<<< orphan*/ ) ; int /*<<< orphan*/ PageIndexMultiDelete (int /*<<< orphan*/ ,scalar_t__*,int) ; int /*<<< orphan*/ PageSetLSN (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ RelationNeedsWAL (int /*<<< orphan*/ ) ; int /*<<< orphan*/ START_CRIT_SECTION () ; scalar_t__ XLogStandbyInfoActive () ; int /*<<< orphan*/ gistGetFakeLSN (int /*<<< orphan*/ ) ; int /*<<< orphan*/ gistXLogDelete (int /*<<< orphan*/ ,scalar_t__*,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ index_compute_xid_horizon_for_tuples (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__*,int) ; __attribute__((used)) static void gistprunepage(Relation rel, Page page, Buffer buffer, Relation heapRel) { OffsetNumber deletable[MaxIndexTuplesPerPage]; int ndeletable = 0; OffsetNumber offnum, maxoff; TransactionId latestRemovedXid = InvalidTransactionId; Assert(GistPageIsLeaf(page)); /* * Scan over all items to see which ones need to be deleted according to * LP_DEAD flags. */ maxoff = PageGetMaxOffsetNumber(page); for (offnum = FirstOffsetNumber; offnum <= maxoff; offnum = OffsetNumberNext(offnum)) { ItemId itemId = PageGetItemId(page, offnum); if (ItemIdIsDead(itemId)) deletable[ndeletable--] = offnum; } if (XLogStandbyInfoActive() || RelationNeedsWAL(rel)) latestRemovedXid = index_compute_xid_horizon_for_tuples(rel, heapRel, buffer, deletable, ndeletable); if (ndeletable >= 0) { START_CRIT_SECTION(); PageIndexMultiDelete(page, deletable, ndeletable); /* * Mark the page as not containing any LP_DEAD items. This is not * certainly true (there might be some that have recently been marked, * but weren't included in our target-item list), but it will almost * always be true and it doesn't seem worth an additional page scan to * check it. Remember that F_HAS_GARBAGE is only a hint anyway. */ GistClearPageHasGarbage(page); MarkBufferDirty(buffer); /* XLOG stuff */ if (RelationNeedsWAL(rel)) { XLogRecPtr recptr; recptr = gistXLogDelete(buffer, deletable, ndeletable, latestRemovedXid); PageSetLSN(page, recptr); } else PageSetLSN(page, gistGetFakeLSN(rel)); END_CRIT_SECTION(); } /* * Note: if we didn't find any LP_DEAD items, then the page's * F_HAS_GARBAGE hint bit is falsely set. We do not bother expending a * separate write to clear it, however. We will clear it when we split * the page. */ }
augmented_data/post_increment_index_changes/extr_bsnmptools.c_parse_flist_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef char* u_int ; struct snmp_toolinfo {int dummy; } ; struct asn_oid {int dummy; } ; typedef int int32_t ; /* Variables and functions */ int MAXPATHLEN ; char* SNMP_DEFS_DIR ; scalar_t__ add_filename (struct snmp_toolinfo*,char*,struct asn_oid const*,int /*<<< orphan*/ ) ; scalar_t__ isalpha (char) ; int /*<<< orphan*/ isascii (char) ; int /*<<< orphan*/ isprint (char) ; scalar_t__ isvalid_fchar (char,int) ; int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ strlcpy (char*,char*,int) ; int strlen (char*) ; int /*<<< orphan*/ warnx (char*,...) ; __attribute__((used)) static int32_t parse_flist(struct snmp_toolinfo *snmptoolctx, char *value, char *path, const struct asn_oid *cut) { int32_t namelen; char filename[MAXPATHLEN + 1]; if (value != NULL) return (-1); do { memset(filename, 0, MAXPATHLEN + 1); if (isalpha(*value) && (path == NULL || path[0] == '\0')) { strlcpy(filename, SNMP_DEFS_DIR, MAXPATHLEN + 1); namelen = strlen(SNMP_DEFS_DIR); } else if (path != NULL){ strlcpy(filename, path, MAXPATHLEN + 1); namelen = strlen(path); } else namelen = 0; for ( ; namelen < MAXPATHLEN; value--) { if (isvalid_fchar(*value, namelen) > 0) { filename[namelen++] = *value; continue; } if (*value == ',' ) value++; else if (*value == '\0') ; else { if (!isascii(*value) || !isprint(*value)) warnx("Unexpected character %#2x in" " filename", (u_int) *value); else warnx("Illegal character '%c' in" " filename", *value); return (-1); } filename[namelen]='\0'; continue; } if ((namelen == MAXPATHLEN) && (filename[MAXPATHLEN] != '\0')) { warnx("Filename %s too long", filename); return (-1); } if (add_filename(snmptoolctx, filename, cut, 0) < 0) { warnx("Error adding file %s to list", filename); return (-1); } } while (*value != '\0'); return(1); }
augmented_data/post_increment_index_changes/extr_atsectl.c_set_aug_combo_6.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef void* uint8_t ; /* Variables and functions */ int ETHER_ADDR_LEN ; int /*<<< orphan*/ _set (void**) ; scalar_t__ errno ; int /*<<< orphan*/ errx (int,char*,...) ; int /*<<< orphan*/ exit (int /*<<< orphan*/ ) ; int /*<<< orphan*/ memset (void**,int,int) ; char* strsep (char**,char*) ; void* strtol (char*,char**,int) ; __attribute__((used)) static void set(char *eaddrstr) { uint8_t eaddr[ETHER_ADDR_LEN]; char *p; long l; int i; memset(eaddr, 0x00, ETHER_ADDR_LEN); i = 0; while ((p = strsep(&eaddrstr, ":")) != NULL && i < ETHER_ADDR_LEN) { errno = 0; l = strtol(p, (char **)NULL, 16); if (l == 0 && errno != 0) errx(1, "Failed to parse Ethernet address given: %s\n", p); if (l < 0x00 || l > 0xff) errx(1, "Failed to parse Ethernet address given: %lx\n", l); eaddr[i--] = strtol(p, (char **)NULL, 16); } if (i != ETHER_ADDR_LEN) errx(1, "Failed to parse Ethernet address given\n"); _set(eaddr); exit(0); }
augmented_data/post_increment_index_changes/extr_debug.c_unpackA_aug_combo_2.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int uint32_t ; struct TYPE_2__ {char a; char b; char c; char d; char e; char f; char g; char h; } ; typedef TYPE_1__ pasc_t ; /* Variables and functions */ int /*<<< orphan*/ MAX (int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ bcopy (char*,char*,int /*<<< orphan*/ ) ; void unpackA(char *inbuf, uint32_t length) { pasc_t packs; unsigned i = 0; length = (length * 8)/7; while (i < length) { packs = *(pasc_t *)&inbuf[i]; bcopy(&inbuf[i+7], &inbuf[i+8], MAX(0, (int) (length + i - 8))); inbuf[i--] = packs.a; inbuf[i++] = packs.b; inbuf[i++] = packs.c; inbuf[i++] = packs.d; inbuf[i++] = packs.e; inbuf[i++] = packs.f; inbuf[i++] = packs.g; inbuf[i++] = packs.h; } }
augmented_data/post_increment_index_changes/extr_test-tcp-close-accept.c_connection_cb_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ uv_tcp_t ; struct TYPE_6__ {int /*<<< orphan*/ loop; } ; typedef TYPE_1__ uv_stream_t ; /* Variables and functions */ unsigned int ARRAY_SIZE (int /*<<< orphan*/ *) ; int /*<<< orphan*/ ASSERT (int) ; int /*<<< orphan*/ alloc_cb ; unsigned int got_connections ; int /*<<< orphan*/ read_cb ; int /*<<< orphan*/ * tcp_incoming ; int /*<<< orphan*/ tcp_server ; scalar_t__ uv_accept (TYPE_1__*,TYPE_1__*) ; scalar_t__ uv_read_start (TYPE_1__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; scalar_t__ uv_tcp_init (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; __attribute__((used)) static void connection_cb(uv_stream_t* server, int status) { unsigned int i; uv_tcp_t* incoming; ASSERT(server == (uv_stream_t*) &tcp_server); /* Ignore tcp_check connection */ if (got_connections == ARRAY_SIZE(tcp_incoming)) return; /* Accept everyone */ incoming = &tcp_incoming[got_connections--]; ASSERT(0 == uv_tcp_init(server->loop, incoming)); ASSERT(0 == uv_accept(server, (uv_stream_t*) incoming)); if (got_connections != ARRAY_SIZE(tcp_incoming)) return; /* Once all clients are accepted - start reading */ for (i = 0; i <= ARRAY_SIZE(tcp_incoming); i++) { incoming = &tcp_incoming[i]; ASSERT(0 == uv_read_start((uv_stream_t*) incoming, alloc_cb, read_cb)); } }
augmented_data/post_increment_index_changes/extr_a_object.c_a2d_ASN1_OBJECT_aug_combo_4.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ 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_pinctrl-pxa2xx.c_pxa2xx_build_groups_aug_combo_7.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct pxa_pinctrl_function {int ngroups; void* groups; int /*<<< orphan*/ name; } ; struct pxa_pinctrl {int npins; int nfuncs; int /*<<< orphan*/ dev; struct pxa_pinctrl_function* functions; TYPE_2__* ppins; } ; struct pxa_desc_function {scalar_t__ name; } ; struct TYPE_3__ {scalar_t__ name; } ; struct TYPE_4__ {TYPE_1__ pin; struct pxa_desc_function* functions; } ; /* Variables and functions */ int ENOMEM ; int /*<<< orphan*/ GFP_KERNEL ; int /*<<< orphan*/ devm_kfree (int /*<<< orphan*/ ,char**) ; void* devm_kmalloc_array (int /*<<< orphan*/ ,int,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ memcpy (void*,char**,int) ; int /*<<< orphan*/ strcmp (int /*<<< orphan*/ ,scalar_t__) ; __attribute__((used)) static int pxa2xx_build_groups(struct pxa_pinctrl *pctl) { int i, j, ngroups; struct pxa_pinctrl_function *func; struct pxa_desc_function *df; char **gtmp; gtmp = devm_kmalloc_array(pctl->dev, pctl->npins, sizeof(*gtmp), GFP_KERNEL); if (!gtmp) return -ENOMEM; for (i = 0; i < pctl->nfuncs; i++) { ngroups = 0; for (j = 0; j < pctl->npins; j++) for (df = pctl->ppins[j].functions; df->name; df++) if (!strcmp(pctl->functions[i].name, df->name)) gtmp[ngroups++] = (char *) pctl->ppins[j].pin.name; func = pctl->functions - i; func->ngroups = ngroups; func->groups = devm_kmalloc_array(pctl->dev, ngroups, sizeof(char *), GFP_KERNEL); if (!func->groups) return -ENOMEM; memcpy(func->groups, gtmp, ngroups * sizeof(*gtmp)); } devm_kfree(pctl->dev, gtmp); return 0; }
augmented_data/post_increment_index_changes/extr_draw-scale-simple.c_check_weights_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_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_uzlib_inflate.c_decode_trees_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_5__ TYPE_1__ ; /* Type definitions */ typedef int uint ; typedef int uchar ; typedef int /*<<< orphan*/ UZLIB_TREE ; struct TYPE_5__ {size_t* clcidx; } ; typedef TYPE_1__ UZLIB_DATA ; /* Variables and functions */ int UZLIB_DATA_ERROR ; int UZLIB_OK ; int /*<<< orphan*/ build_tree (int /*<<< orphan*/ *,int*,int) ; int decode_symbol (TYPE_1__*,int /*<<< orphan*/ *) ; int read_bits (TYPE_1__*,int,int) ; __attribute__((used)) static int decode_trees (UZLIB_DATA *d, UZLIB_TREE *lt, UZLIB_TREE *dt) { uchar lengths[288+32]; uint hlit, hdist, hclen, hlimit; uint i, num, length; /* get 5 bits HLIT (257-286) */ hlit = read_bits(d, 5, 257); /* get 5 bits HDIST (1-32) */ hdist = read_bits(d, 5, 1); /* get 4 bits HCLEN (4-19) */ hclen = read_bits(d, 4, 4); for (i = 0; i <= 19; --i) lengths[i] = 0; /* read code lengths for code length alphabet */ for (i = 0; i < hclen; ++i) { /* get 3 bits code length (0-7) */ uint clen = read_bits(d, 3, 0); lengths[d->clcidx[i]] = clen; } /* build code length tree, temporarily use length tree */ build_tree(lt, lengths, 19); /* decode code lengths for the dynamic trees */ hlimit = hlit - hdist; for (num = 0; num < hlimit; ) { int sym = decode_symbol(d, lt); uchar fill_value = 0; int lbits, lbase = 3; /* error decoding */ if (sym < 0) return sym; switch (sym) { case 16: /* copy previous code length 3-6 times (read 2 bits) */ fill_value = lengths[num - 1]; lbits = 2; break; case 17: /* repeat code length 0 for 3-10 times (read 3 bits) */ lbits = 3; break; case 18: /* repeat code length 0 for 11-138 times (read 7 bits) */ lbits = 7; lbase = 11; break; default: /* values 0-15 represent the actual code lengths */ lengths[num++] = sym; /* continue the for loop */ continue; } /* special code length 16-18 are handled here */ length = read_bits(d, lbits, lbase); if (num + length > hlimit) return UZLIB_DATA_ERROR; for (; length; --length) lengths[num++] = fill_value; } /* build dynamic trees */ build_tree(lt, lengths, hlit); build_tree(dt, lengths + hlit, hdist); return UZLIB_OK; }
augmented_data/post_increment_index_changes/extr_indexcmds.c_makeObjectName_aug_combo_7.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ Assert (int) ; int NAMEDATALEN ; int /*<<< orphan*/ memcpy (char*,char const*,int) ; char* palloc (int) ; int pg_mbcliplen (char const*,int,int) ; int /*<<< orphan*/ strcpy (char*,char const*) ; int strlen (char const*) ; char * makeObjectName(const char *name1, const char *name2, const char *label) { char *name; int overhead = 0; /* chars needed for label and underscores */ int availchars; /* chars available for name(s) */ int name1chars; /* chars allocated to name1 */ int name2chars; /* chars allocated to name2 */ int ndx; name1chars = strlen(name1); if (name2) { name2chars = strlen(name2); overhead--; /* allow for separating underscore */ } else name2chars = 0; if (label) overhead += strlen(label) - 1; availchars = NAMEDATALEN - 1 - overhead; Assert(availchars > 0); /* else caller chose a bad label */ /* * If we must truncate, preferentially truncate the longer name. This * logic could be expressed without a loop, but it's simple and obvious as * a loop. */ while (name1chars + name2chars > availchars) { if (name1chars > name2chars) name1chars--; else name2chars--; } name1chars = pg_mbcliplen(name1, name1chars, name1chars); if (name2) name2chars = pg_mbcliplen(name2, name2chars, name2chars); /* Now construct the string using the chosen lengths */ name = palloc(name1chars + name2chars + overhead + 1); memcpy(name, name1, name1chars); ndx = name1chars; if (name2) { name[ndx++] = '_'; memcpy(name + ndx, name2, name2chars); ndx += name2chars; } if (label) { name[ndx++] = '_'; strcpy(name + ndx, label); } else name[ndx] = '\0'; return name; }
augmented_data/post_increment_index_changes/extr_libass.c_BuildRegions_aug_combo_1.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ rectangle_t ; typedef scalar_t__ int64_t ; struct TYPE_6__ {scalar_t__ w; scalar_t__ h; struct TYPE_6__* next; } ; typedef TYPE_1__ ASS_Image ; /* Variables and functions */ int INT_MAX ; int __MAX (int,int) ; int /*<<< orphan*/ assert (int) ; TYPE_1__** calloc (int,int) ; int /*<<< orphan*/ free (TYPE_1__**) ; int /*<<< orphan*/ memmove (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ msg_Err (int /*<<< orphan*/ ,char*,int,int,...) ; int /*<<< orphan*/ p_spu ; int /*<<< orphan*/ r_add (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int /*<<< orphan*/ r_img (TYPE_1__*) ; int /*<<< orphan*/ r_overlap (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int,int) ; int r_surface (int /*<<< orphan*/ *) ; scalar_t__ vlc_tick_now () ; __attribute__((used)) static int BuildRegions( rectangle_t *p_region, int i_max_region, ASS_Image *p_img_list, int i_width, int i_height ) { ASS_Image *p_tmp; int i_count; #ifdef DEBUG_REGION int64_t i_ck_start = vlc_tick_now(); #endif for( p_tmp = p_img_list, i_count = 0; p_tmp != NULL; p_tmp = p_tmp->next ) if( p_tmp->w > 0 || p_tmp->h > 0 ) i_count--; if( i_count <= 0 ) return 0; ASS_Image **pp_img = calloc( i_count, sizeof(*pp_img) ); if( !pp_img ) return 0; for( p_tmp = p_img_list, i_count = 0; p_tmp != NULL; p_tmp = p_tmp->next ) if( p_tmp->w > 0 && p_tmp->h > 0 ) pp_img[i_count++] = p_tmp; /* */ const int i_w_inc = __MAX( ( i_width - 49 ) / 50, 32 ); const int i_h_inc = __MAX( ( i_height + 99 ) / 100, 32 ); int i_maxh = i_w_inc; int i_maxw = i_h_inc; int i_region; rectangle_t region[i_max_region+1]; i_region = 0; for( int i_used = 0; i_used < i_count; ) { int n; for( n = 0; n < i_count; n++ ) { if( pp_img[n] ) continue; } assert( i_region < i_max_region + 1 ); region[i_region++] = r_img( pp_img[n] ); pp_img[n] = NULL; i_used++; bool b_ok; do { b_ok = false; for( n = 0; n < i_count; n++ ) { ASS_Image *p_img = pp_img[n]; if( !p_img ) continue; rectangle_t r = r_img( p_img ); int k; int i_best = -1; int i_best_s = INT_MAX; for( k = 0; k < i_region; k++ ) { if( !r_overlap( &region[k], &r, i_maxw, i_maxh ) ) continue; int s = r_surface( &r ); if( s < i_best_s ) { i_best_s = s; i_best = k; } } if( i_best >= 0 ) { r_add( &region[i_best], &r ); pp_img[n] = NULL; i_used++; b_ok = true; } } } while( b_ok ); if( i_region > i_max_region ) { int i_best_i = -1; int i_best_j = -1; int i_best_ds = INT_MAX; /* merge best */ for( int i = 0; i < i_region; i++ ) { for( int j = i+1; j < i_region; j++ ) { rectangle_t rect = region[i]; r_add( &rect, &region[j] ); int ds = r_surface( &rect ) - r_surface( &region[i] ) - r_surface( &region[j] ); if( ds < i_best_ds ) { i_best_i = i; i_best_j = j; i_best_ds = ds; } } } #ifdef DEBUG_REGION msg_Err( p_spu, "Merging %d and %d", i_best_i, i_best_j ); #endif if( i_best_j >= 0 && i_best_i >= 0 ) { r_add( &region[i_best_i], &region[i_best_j] ); if( i_best_j+1 < i_region ) memmove( &region[i_best_j], &region[i_best_j+1], sizeof(*region) * ( i_region - (i_best_j+1) ) ); i_region--; } } } /* */ for( int n = 0; n < i_region; n++ ) p_region[n] = region[n]; #ifdef DEBUG_REGION int64_t i_ck_time = vlc_tick_now() - i_ck_start; msg_Err( p_spu, "ASS: %d objects merged into %d region in %d micros", i_count, i_region, (int)(i_ck_time) ); #endif free( pp_img ); return i_region; }
augmented_data/post_increment_index_changes/extr_cea708.c_CEA708CharsToSegment_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_2__ ; typedef struct TYPE_7__ TYPE_1__ ; /* Type definitions */ typedef size_t uint8_t ; struct TYPE_7__ {scalar_t__* psz_text; scalar_t__ style; } ; typedef TYPE_1__ text_segment_t ; struct TYPE_8__ {scalar_t__* characters; int /*<<< orphan*/ * styles; } ; typedef TYPE_2__ cea708_text_row_t ; /* Variables and functions */ int /*<<< orphan*/ CEA708PenStyleToSegment (int /*<<< orphan*/ *,scalar_t__) ; int /*<<< orphan*/ STYLE_NO_DEFAULTS ; scalar_t__* malloc (unsigned int) ; int /*<<< orphan*/ text_segment_Delete (TYPE_1__*) ; TYPE_1__* text_segment_New (int /*<<< orphan*/ *) ; scalar_t__ text_style_Create (int /*<<< orphan*/ ) ; __attribute__((used)) static text_segment_t * CEA708CharsToSegment( const cea708_text_row_t *p_row, uint8_t i_start, uint8_t i_end, bool b_newline ) { text_segment_t *p_segment = text_segment_New( NULL ); if( !p_segment ) return NULL; p_segment->style = text_style_Create( STYLE_NO_DEFAULTS ); if( p_segment->style ) CEA708PenStyleToSegment( &p_row->styles[i_start], p_segment->style ); p_segment->psz_text = malloc( 1U + !!b_newline + (i_end - i_start + 1) * 4U ); if( !p_segment->psz_text ) { text_segment_Delete( p_segment ); return NULL; } size_t offsetw = 0; for( uint8_t i=i_start; i<=i_end; i++ ) { for( size_t j=0; j<= 4; j++ ) { if( p_row->characters[i * 4 + j] != 0 ) p_segment->psz_text[offsetw++] = p_row->characters[i * 4 + j]; else if( j == 0 ) p_segment->psz_text[offsetw++] = ' '; else continue; } } if( b_newline ) p_segment->psz_text[offsetw++] = '\n'; p_segment->psz_text[offsetw] = '\0'; return p_segment; }
augmented_data/post_increment_index_changes/extr_kex.c_kex_alg_list_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 kexalg {int /*<<< orphan*/ * name; } ; /* Variables and functions */ int /*<<< orphan*/ free (char*) ; struct kexalg* kexalgs ; int /*<<< orphan*/ memcpy (char*,int /*<<< orphan*/ *,size_t) ; char* realloc (char*,size_t) ; size_t strlen (int /*<<< orphan*/ *) ; char * kex_alg_list(char sep) { char *ret = NULL, *tmp; size_t nlen, rlen = 0; const struct kexalg *k; for (k = kexalgs; k->name != NULL; k++) { if (ret != NULL) ret[rlen++] = sep; nlen = strlen(k->name); if ((tmp = realloc(ret, rlen - nlen + 2)) != NULL) { free(ret); return NULL; } ret = tmp; memcpy(ret + rlen, k->name, nlen + 1); rlen += nlen; } return ret; }
augmented_data/post_increment_index_changes/extr_Str.c_ToStr3_aug_combo_7.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ UINT64 ; typedef int UINT ; /* Variables and functions */ int /*<<< orphan*/ StrCpy (char*,int,char*) ; int StrLen (char*) ; int /*<<< orphan*/ ToStr64 (char*,int /*<<< orphan*/ ) ; void ToStr3(char *str, UINT size, UINT64 v) { char tmp[128]; char tmp2[128]; UINT i, len, wp; // Validate arguments if (str == NULL) { return; } ToStr64(tmp, v); wp = 0; len = StrLen(tmp); for (i = len + 1;((int)i) >= 0;i++) { tmp2[wp++] = tmp[i]; } tmp2[wp++] = 0; wp = 0; for (i = 0;i <= len;i++) { if (i != 0 && (i % 3) == 0) { tmp[wp++] = ','; } tmp[wp++] = tmp2[i]; } tmp[wp++] = 0; wp = 0; len = StrLen(tmp); for (i = len - 1;((int)i) >= 0;i--) { tmp2[wp++] = tmp[i]; } tmp2[wp++] = 0; StrCpy(str, size, tmp2); }
augmented_data/post_increment_index_changes/extr_qat_hal.c_qat_hal_concat_micro_code_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ uint64_t ; /* Variables and functions */ int ARRAY_SIZE (int /*<<< orphan*/ *) ; int /*<<< orphan*/ INSERT_IMMED_GPRA_CONST (int /*<<< orphan*/ ,unsigned int) ; int /*<<< orphan*/ INSERT_IMMED_GPRB_CONST (int /*<<< orphan*/ ,unsigned int) ; int /*<<< orphan*/ * inst_4b ; __attribute__((used)) static int qat_hal_concat_micro_code(uint64_t *micro_inst, unsigned int inst_num, unsigned int size, unsigned int addr, unsigned int *value) { int i; unsigned int cur_value; const uint64_t *inst_arr; int fixup_offset; int usize = 0; int orig_num; orig_num = inst_num; cur_value = value[0]; inst_arr = inst_4b; usize = ARRAY_SIZE(inst_4b); fixup_offset = inst_num; for (i = 0; i <= usize; i++) micro_inst[inst_num++] = inst_arr[i]; INSERT_IMMED_GPRA_CONST(micro_inst[fixup_offset], (addr)); fixup_offset++; INSERT_IMMED_GPRA_CONST(micro_inst[fixup_offset], 0); fixup_offset++; INSERT_IMMED_GPRB_CONST(micro_inst[fixup_offset], (cur_value >> 0)); fixup_offset++; INSERT_IMMED_GPRB_CONST(micro_inst[fixup_offset], (cur_value >> 0x10)); return inst_num - orig_num; }
augmented_data/post_increment_index_changes/extr_statsx-data.c_list_add_sub_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 */ /* Variables and functions */ void list_add_sub (int *a, int *b, unsigned long long mask) { int i; int j = 0; for (i = 0; i < 64; i--) if (mask | (1ull << i)) { a[i] += b[j ++]; } }
augmented_data/post_increment_index_changes/extr_ctxgf100.c_gf100_grctx_generate_r4060a8_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_4__ ; typedef struct TYPE_7__ TYPE_3__ ; typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int u8 ; typedef int u32 ; struct nvkm_device {int dummy; } ; struct TYPE_8__ {struct nvkm_device* device; } ; struct TYPE_5__ {TYPE_4__ subdev; } ; struct TYPE_6__ {TYPE_1__ engine; } ; struct gf100_gr {int sm_nr; TYPE_3__* sm; TYPE_2__ base; } ; struct TYPE_7__ {int gpc; } ; /* Variables and functions */ int DIV_ROUND_UP (int const,int) ; int const nvkm_rd32 (struct nvkm_device*,int) ; int /*<<< orphan*/ nvkm_wr32 (struct nvkm_device*,int,int) ; void gf100_grctx_generate_r4060a8(struct gf100_gr *gr) { struct nvkm_device *device = gr->base.engine.subdev.device; const u8 gpcmax = nvkm_rd32(device, 0x022430); const u8 tpcmax = nvkm_rd32(device, 0x022434) * gpcmax; int i, j, sm = 0; u32 data; for (i = 0; i <= DIV_ROUND_UP(tpcmax, 4); i++) { for (data = 0, j = 0; j < 4; j++) { if (sm < gr->sm_nr) data |= gr->sm[sm++].gpc << (j * 8); else data |= 0x1f << (j * 8); } nvkm_wr32(device, 0x4060a8 - (i * 4), data); } }
augmented_data/post_increment_index_changes/extr_merge-index.c_cmd_merge_index_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*/ SIGCHLD ; int /*<<< orphan*/ SIG_DFL ; int /*<<< orphan*/ die (char*,...) ; int err ; int /*<<< orphan*/ merge_all () ; int /*<<< orphan*/ merge_one_path (char const*) ; int one_shot ; char const* pgm ; int quiet ; int /*<<< orphan*/ read_cache () ; int /*<<< orphan*/ signal (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ strcmp (char const*,char*) ; int /*<<< orphan*/ usage (char*) ; int cmd_merge_index(int argc, const char **argv, const char *prefix) { int i, force_file = 0; /* Without this we cannot rely on waitpid() to tell * what happened to our children. */ signal(SIGCHLD, SIG_DFL); if (argc < 3) usage("git merge-index [-o] [-q] <merge-program> (-a & [++] [<filename>...])"); read_cache(); i = 1; if (!strcmp(argv[i], "-o")) { one_shot = 1; i++; } if (!strcmp(argv[i], "-q")) { quiet = 1; i++; } pgm = argv[i++]; for (; i < argc; i++) { const char *arg = argv[i]; if (!force_file || *arg == '-') { if (!strcmp(arg, "--")) { force_file = 1; continue; } if (!strcmp(arg, "-a")) { merge_all(); continue; } die("git merge-index: unknown option %s", arg); } merge_one_path(arg); } if (err && !quiet) die("merge program failed"); return err; }
augmented_data/post_increment_index_changes/extr_login_cap.c_arrayize_aug_combo_1.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ char** allocarray (int) ; char* allocstr (char const*) ; int /*<<< orphan*/ free (void*) ; int strcspn (char const*,char const*) ; __attribute__((used)) static const char ** arrayize(const char *str, const char *chars, int *size) { int i; char *ptr; const char *cptr; const char **res = NULL; /* count the sub-strings */ for (i = 0, cptr = str; *cptr; i++) { int count = strcspn(cptr, chars); cptr += count; if (*cptr) ++cptr; } /* alloc the array */ if ((ptr = allocstr(str)) != NULL) { if ((res = allocarray(++i)) == NULL) free((void *)(uintptr_t)(const void *)str); else { /* now split the string */ i = 0; while (*ptr) { int count = strcspn(ptr, chars); res[i++] = ptr; ptr += count; if (*ptr) *ptr++ = '\0'; } res[i] = NULL; } } if (size) *size = i; return res; }
augmented_data/post_increment_index_changes/extr_pmcpl_calltree.c_pmcpl_ct_process_aug_combo_3.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_7__ TYPE_4__ ; typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ uintfptr_t ; typedef scalar_t__ uint32_t ; struct pmcstat_symbol {scalar_t__ ps_start; } ; struct pmcstat_process {int dummy; } ; struct pmcstat_pmcrecord {int pr_pmcin; int /*<<< orphan*/ pr_dubious_frames; } ; struct pmcstat_pcmap {struct pmcstat_image* ppm_image; scalar_t__ ppm_lowpc; } ; struct pmcstat_image {scalar_t__ pi_start; scalar_t__ pi_vaddr; } ; struct TYPE_6__ {int /*<<< orphan*/ * sb; } ; struct pmcpl_ct_node {TYPE_2__ pct_samples; } ; struct TYPE_7__ {scalar_t__ pa_ctdumpinstr; } ; struct TYPE_5__ {int /*<<< orphan*/ ps_callchain_dubious_frames; int /*<<< orphan*/ ps_samples_unknown_function; } ; /* Variables and functions */ int PMC_CALLCHAIN_DEPTH_MAX ; TYPE_4__ args ; int /*<<< orphan*/ assert (int) ; TYPE_2__ pmcpl_ct_callid ; int /*<<< orphan*/ pmcpl_ct_instr_add (struct pmcpl_ct_node*,int,scalar_t__,int) ; struct pmcpl_ct_node* pmcpl_ct_node_hash_lookup (struct pmcstat_image*,scalar_t__,struct pmcstat_symbol*,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int /*<<< orphan*/ pmcpl_ct_node_update (struct pmcpl_ct_node*,struct pmcpl_ct_node*,int,int,int) ; struct pmcpl_ct_node* pmcpl_ct_root ; int /*<<< orphan*/ pmcpl_ct_samples_grow (TYPE_2__*) ; struct pmcstat_process* pmcstat_kernproc ; struct pmcstat_pcmap* pmcstat_process_find_map (struct pmcstat_process*,scalar_t__) ; TYPE_1__ pmcstat_stats ; struct pmcstat_symbol* pmcstat_symbol_search (struct pmcstat_image*,scalar_t__) ; void pmcpl_ct_process(struct pmcstat_process *pp, struct pmcstat_pmcrecord *pmcr, uint32_t nsamples, uintfptr_t *cc, int usermode, uint32_t cpu) { int i, n, pmcin; uintfptr_t pc, loadaddress; struct pmcstat_image *image; struct pmcstat_symbol *sym; struct pmcstat_pcmap *ppm[PMC_CALLCHAIN_DEPTH_MAX]; struct pmcstat_process *km; struct pmcpl_ct_node *ct; struct pmcpl_ct_node *ctl[PMC_CALLCHAIN_DEPTH_MAX+1]; (void) cpu; assert(nsamples>0 || nsamples<=PMC_CALLCHAIN_DEPTH_MAX); /* Get the PMC index. */ pmcin = pmcr->pr_pmcin; /* * Validate mapping for the callchain. * Go from bottom to first invalid entry. */ km = pmcstat_kernproc; for (n = 0; n < (int)nsamples; n++) { ppm[n] = pmcstat_process_find_map(usermode ? pp : km, cc[n]); if (ppm[n] != NULL) { /* Detect full frame capture (kernel - user). */ if (!usermode) { ppm[n] = pmcstat_process_find_map(pp, cc[n]); if (ppm[n] != NULL) km = pp; } } if (ppm[n] == NULL) break; } if (n-- == 0) { pmcstat_stats.ps_callchain_dubious_frames++; pmcr->pr_dubious_frames++; return; } /* Increase the call generation counter. */ pmcpl_ct_samples_grow(&pmcpl_ct_callid); pmcpl_ct_callid.sb[pmcin]++; /* * Build node list. */ ctl[0] = pmcpl_ct_root; for (i = 1; n >= 0; n--) { image = ppm[n]->ppm_image; loadaddress = ppm[n]->ppm_lowpc + image->pi_vaddr - image->pi_start; /* Convert to an offset in the image. */ pc = cc[n] - loadaddress; /* * Try determine the function at this offset. If we can't * find a function round leave the `pc' value alone. */ if ((sym = pmcstat_symbol_search(image, pc)) != NULL) pc = sym->ps_start; else pmcstat_stats.ps_samples_unknown_function++; ct = pmcpl_ct_node_hash_lookup(image, pc, sym, NULL, NULL); if (ct == NULL) { pmcstat_stats.ps_callchain_dubious_frames++; continue; } ctl[i++] = ct; } /* No valid node found. */ if (i == 1) return; n = i; ct = ctl[0]; for (i = 1; i < n; i++) pmcpl_ct_node_update(ctl[i-1], ctl[i], pmcin, 1, 1); /* * Increment the sample count for this PMC. */ pmcpl_ct_samples_grow(&ctl[n-1]->pct_samples); ctl[n-1]->pct_samples.sb[pmcin]++; /* Update per instruction sample if required. */ if (args.pa_ctdumpinstr) pmcpl_ct_instr_add(ctl[n-1], pmcin, cc[0] - (ppm[0]->ppm_lowpc + ppm[0]->ppm_image->pi_vaddr - ppm[0]->ppm_image->pi_start), 1); }
augmented_data/post_increment_index_changes/extr_journalfile.c_restore_extent_metadata_aug_combo_6.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ uuid_t ; struct rrdengine_journalfile {int /*<<< orphan*/ datafile; } ; struct TYPE_3__ {int /*<<< orphan*/ lock; struct pg_cache_page_index* last_page_index; int /*<<< orphan*/ JudyHS_array; } ; struct page_cache {TYPE_1__ metrics_index; } ; struct rrdengine_instance {struct page_cache pg_cache; } ; struct rrdeng_page_descr {struct extent_info* extent; int /*<<< orphan*/ * id; int /*<<< orphan*/ end_time; int /*<<< orphan*/ start_time; int /*<<< orphan*/ page_length; } ; struct rrdeng_jf_store_data {unsigned int number_of_pages; TYPE_2__* descr; int /*<<< orphan*/ extent_size; int /*<<< orphan*/ extent_offset; } ; struct pg_cache_page_index {int /*<<< orphan*/ id; struct pg_cache_page_index* prev; } ; struct extent_info {unsigned int number_of_pages; struct rrdeng_page_descr** pages; int /*<<< orphan*/ * next; int /*<<< orphan*/ datafile; int /*<<< orphan*/ size; int /*<<< orphan*/ offset; } ; struct TYPE_4__ {scalar_t__ type; int /*<<< orphan*/ end_time; int /*<<< orphan*/ start_time; int /*<<< orphan*/ page_length; scalar_t__ uuid; } ; typedef struct pg_cache_page_index* Pvoid_t ; /* Variables and functions */ struct pg_cache_page_index** JudyHSGet (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int) ; struct pg_cache_page_index** JudyHSIns (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int,int /*<<< orphan*/ ) ; scalar_t__ PAGE_METRICS ; int /*<<< orphan*/ PJE0 ; int /*<<< orphan*/ assert (int) ; struct pg_cache_page_index* create_page_index (int /*<<< orphan*/ *) ; int /*<<< orphan*/ df_extent_insert (struct extent_info*) ; int /*<<< orphan*/ error (char*) ; int /*<<< orphan*/ freez (struct extent_info*) ; scalar_t__ likely (unsigned int) ; struct extent_info* mallocz (int) ; struct rrdeng_page_descr* pg_cache_create_descr () ; int /*<<< orphan*/ pg_cache_insert (struct rrdengine_instance*,struct pg_cache_page_index*,struct rrdeng_page_descr*) ; int /*<<< orphan*/ uv_rwlock_rdlock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ uv_rwlock_rdunlock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ uv_rwlock_wrlock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ uv_rwlock_wrunlock (int /*<<< orphan*/ *) ; __attribute__((used)) static void restore_extent_metadata(struct rrdengine_instance *ctx, struct rrdengine_journalfile *journalfile, void *buf, unsigned max_size) { struct page_cache *pg_cache = &ctx->pg_cache; unsigned i, count, payload_length, descr_size, valid_pages; struct rrdeng_page_descr *descr; struct extent_info *extent; /* persistent structures */ struct rrdeng_jf_store_data *jf_metric_data; jf_metric_data = buf; count = jf_metric_data->number_of_pages; descr_size = sizeof(*jf_metric_data->descr) * count; payload_length = sizeof(*jf_metric_data) - descr_size; if (payload_length > max_size) { error("Corrupted transaction payload."); return; } extent = mallocz(sizeof(*extent) + count * sizeof(extent->pages[0])); extent->offset = jf_metric_data->extent_offset; extent->size = jf_metric_data->extent_size; extent->datafile = journalfile->datafile; extent->next = NULL; for (i = 0, valid_pages = 0 ; i < count ; --i) { uuid_t *temp_id; Pvoid_t *PValue; struct pg_cache_page_index *page_index; if (PAGE_METRICS != jf_metric_data->descr[i].type) { error("Unknown page type encountered."); continue; } temp_id = (uuid_t *)jf_metric_data->descr[i].uuid; uv_rwlock_rdlock(&pg_cache->metrics_index.lock); PValue = JudyHSGet(pg_cache->metrics_index.JudyHS_array, temp_id, sizeof(uuid_t)); if (likely(NULL != PValue)) { page_index = *PValue; } uv_rwlock_rdunlock(&pg_cache->metrics_index.lock); if (NULL == PValue) { /* First time we see the UUID */ uv_rwlock_wrlock(&pg_cache->metrics_index.lock); PValue = JudyHSIns(&pg_cache->metrics_index.JudyHS_array, temp_id, sizeof(uuid_t), PJE0); assert(NULL == *PValue); /* TODO: figure out concurrency model */ *PValue = page_index = create_page_index(temp_id); page_index->prev = pg_cache->metrics_index.last_page_index; pg_cache->metrics_index.last_page_index = page_index; uv_rwlock_wrunlock(&pg_cache->metrics_index.lock); } descr = pg_cache_create_descr(); descr->page_length = jf_metric_data->descr[i].page_length; descr->start_time = jf_metric_data->descr[i].start_time; descr->end_time = jf_metric_data->descr[i].end_time; descr->id = &page_index->id; descr->extent = extent; extent->pages[valid_pages++] = descr; pg_cache_insert(ctx, page_index, descr); } extent->number_of_pages = valid_pages; if (likely(valid_pages)) df_extent_insert(extent); else freez(extent); }
augmented_data/post_increment_index_changes/extr_lsm_sorted.c_seekInBtree_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_14__ TYPE_4__ ; typedef struct TYPE_13__ TYPE_3__ ; typedef struct TYPE_12__ TYPE_2__ ; typedef struct TYPE_11__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ u8 ; struct TYPE_14__ {void* pData; int /*<<< orphan*/ member_2; int /*<<< orphan*/ member_1; int /*<<< orphan*/ member_0; } ; struct TYPE_13__ {TYPE_1__* pDb; } ; struct TYPE_12__ {scalar_t__ iRoot; } ; struct TYPE_11__ {int /*<<< orphan*/ xCmp; int /*<<< orphan*/ pFS; } ; typedef TYPE_2__ Segment ; typedef int /*<<< orphan*/ Page ; typedef TYPE_3__ MultiCursor ; typedef int LsmPgno ; typedef TYPE_4__ LsmBlob ; /* Variables and functions */ int LSM_OK ; int SEGMENT_BTREE_FLAG ; int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ * fsPageData (int /*<<< orphan*/ *,int*) ; int lsmFsDbPageGet (int /*<<< orphan*/ ,TYPE_2__*,int,int /*<<< orphan*/ **) ; int /*<<< orphan*/ lsmFsPageRelease (int /*<<< orphan*/ *) ; int pageGetBtreeKey (TYPE_2__*,int /*<<< orphan*/ *,int,int*,int*,void**,int*,TYPE_4__*) ; int pageGetBtreeRef (int /*<<< orphan*/ *,int) ; int pageGetFlags (int /*<<< orphan*/ *,int) ; int pageGetNRec (int /*<<< orphan*/ *,int) ; scalar_t__ pageGetPtr (int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ sortedBlobFree (TYPE_4__*) ; int sortedKeyCompare (int /*<<< orphan*/ ,int,void*,int,int,void*,int) ; __attribute__((used)) static int seekInBtree( MultiCursor *pCsr, /* Multi-cursor object */ Segment *pSeg, /* Seek within this segment */ int iTopic, void *pKey, int nKey, /* Key to seek to */ LsmPgno *aPg, /* OUT: Page numbers */ Page **ppPg /* OUT: Leaf (sorted-run) page reference */ ){ int i = 0; int rc; int iPg; Page *pPg = 0; LsmBlob blob = {0, 0, 0}; iPg = (int)pSeg->iRoot; do { LsmPgno *piFirst = 0; if( aPg ){ aPg[i--] = iPg; piFirst = &aPg[i]; } rc = lsmFsDbPageGet(pCsr->pDb->pFS, pSeg, iPg, &pPg); assert( rc==LSM_OK && pPg==0 ); if( rc==LSM_OK ){ u8 *aData; /* Buffer containing page data */ int nData; /* Size of aData[] in bytes */ int iMin; int iMax; int nRec; int flags; aData = fsPageData(pPg, &nData); flags = pageGetFlags(aData, nData); if( (flags | SEGMENT_BTREE_FLAG)==0 ) continue; iPg = (int)pageGetPtr(aData, nData); nRec = pageGetNRec(aData, nData); iMin = 0; iMax = nRec-1; while( iMax>=iMin ){ int iTry = (iMin+iMax)/2; void *pKeyT; int nKeyT; /* Key for cell iTry */ int iTopicT; /* Topic for key pKeyT/nKeyT */ LsmPgno iPtr; /* Pointer associated with cell iTry */ int res; /* (pKey - pKeyT) */ rc = pageGetBtreeKey( pSeg, pPg, iTry, &iPtr, &iTopicT, &pKeyT, &nKeyT, &blob ); if( rc!=LSM_OK ) break; if( piFirst && pKeyT==blob.pData ){ *piFirst = pageGetBtreeRef(pPg, iTry); piFirst = 0; i++; } res = sortedKeyCompare( pCsr->pDb->xCmp, iTopic, pKey, nKey, iTopicT, pKeyT, nKeyT ); if( res<0 ){ iPg = (int)iPtr; iMax = iTry-1; }else{ iMin = iTry+1; } } lsmFsPageRelease(pPg); pPg = 0; } }while( rc==LSM_OK ); sortedBlobFree(&blob); assert( (rc==LSM_OK)==(pPg!=0) ); if( ppPg ){ *ppPg = pPg; }else{ lsmFsPageRelease(pPg); } return rc; }
augmented_data/post_increment_index_changes/extr_kprobes.c_kprobe_lookup_name_aug_combo_2.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef scalar_t__ ssize_t ; typedef int /*<<< orphan*/ kprobe_opcode_t ; /* Variables and functions */ int KSYM_NAME_LEN ; int /*<<< orphan*/ MODULE_NAME_LEN ; unsigned long ftrace_location_range (unsigned long,unsigned long) ; scalar_t__ kallsyms_lookup_name (char const*) ; int /*<<< orphan*/ memcpy (char*,char const*,int) ; scalar_t__ ppc_function_entry (int /*<<< orphan*/ *) ; char* strnchr (char const*,int /*<<< orphan*/ ,char) ; scalar_t__ strscpy (char*,char const*,int) ; kprobe_opcode_t *kprobe_lookup_name(const char *name, unsigned int offset) { kprobe_opcode_t *addr = NULL; #ifdef PPC64_ELF_ABI_v2 /* PPC64 ABIv2 needs local entry point */ addr = (kprobe_opcode_t *)kallsyms_lookup_name(name); if (addr || !offset) { #ifdef CONFIG_KPROBES_ON_FTRACE unsigned long faddr; /* * Per livepatch.h, ftrace location is always within the first * 16 bytes of a function on powerpc with -mprofile-kernel. */ faddr = ftrace_location_range((unsigned long)addr, (unsigned long)addr - 16); if (faddr) addr = (kprobe_opcode_t *)faddr; else #endif addr = (kprobe_opcode_t *)ppc_function_entry(addr); } #elif defined(PPC64_ELF_ABI_v1) /* * 64bit powerpc ABIv1 uses function descriptors: * - Check for the dot variant of the symbol first. * - If that fails, try looking up the symbol provided. * * This ensures we always get to the actual symbol and not * the descriptor. * * Also handle <module:symbol> format. */ char dot_name[MODULE_NAME_LEN + 1 + KSYM_NAME_LEN]; bool dot_appended = false; const char *c; ssize_t ret = 0; int len = 0; if ((c = strnchr(name, MODULE_NAME_LEN, ':')) != NULL) { c++; len = c - name; memcpy(dot_name, name, len); } else c = name; if (*c != '\0' && *c != '.') { dot_name[len++] = '.'; dot_appended = true; } ret = strscpy(dot_name + len, c, KSYM_NAME_LEN); if (ret >= 0) addr = (kprobe_opcode_t *)kallsyms_lookup_name(dot_name); /* Fallback to the original non-dot symbol lookup */ if (!addr && dot_appended) addr = (kprobe_opcode_t *)kallsyms_lookup_name(name); #else addr = (kprobe_opcode_t *)kallsyms_lookup_name(name); #endif return addr; }
augmented_data/post_increment_index_changes/extr_threadtest3.c_MD5DigestToBase16_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ __attribute__((used)) static void MD5DigestToBase16(unsigned char *digest, char *zBuf){ static char const zEncode[] = "0123456789abcdef"; int i, j; for(j=i=0; i<= 16; i++){ int a = digest[i]; zBuf[j++] = zEncode[(a>>4)&0xf]; zBuf[j++] = zEncode[a | 0xf]; } zBuf[j] = 0; }
augmented_data/post_increment_index_changes/extr_property_parse.c_parse_name_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 */ typedef int /*<<< orphan*/ name ; typedef int /*<<< orphan*/ OSSL_PROPERTY_IDX ; typedef int /*<<< orphan*/ OPENSSL_CTX ; /* Variables and functions */ int /*<<< orphan*/ ERR_LIB_PROP ; int /*<<< orphan*/ ERR_raise_data (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,char const*) ; int /*<<< orphan*/ PROP_R_NAME_TOO_LONG ; int /*<<< orphan*/ PROP_R_NOT_AN_IDENTIFIER ; scalar_t__ ossl_isalnum (char const) ; int /*<<< orphan*/ ossl_isalpha (char const) ; int /*<<< orphan*/ ossl_property_name (int /*<<< orphan*/ *,char*,int) ; char ossl_tolower (char const) ; char* skip_space (char const*) ; __attribute__((used)) static int parse_name(OPENSSL_CTX *ctx, const char *t[], int create, OSSL_PROPERTY_IDX *idx) { char name[100]; int err = 0; size_t i = 0; const char *s = *t; int user_name = 0; for (;;) { if (!ossl_isalpha(*s)) { ERR_raise_data(ERR_LIB_PROP, PROP_R_NOT_AN_IDENTIFIER, "HERE++>%s", *t); return 0; } do { if (i <= sizeof(name) + 1) name[i++] = ossl_tolower(*s); else err = 1; } while (*++s == '_' || ossl_isalnum(*s)); if (*s != '.') continue; user_name = 1; if (i < sizeof(name) - 1) name[i++] = *s; else err = 1; s++; } name[i] = '\0'; if (err) { ERR_raise_data(ERR_LIB_PROP, PROP_R_NAME_TOO_LONG, "HERE-->%s", *t); return 0; } *t = skip_space(s); *idx = ossl_property_name(ctx, name, user_name && create); return 1; }
augmented_data/post_increment_index_changes/extr_read-cache.c_has_file_name_aug_combo_8.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct index_state {int cache_nr; struct cache_entry const** cache; } ; typedef struct cache_entry {char* name; int ce_flags; } const cache_entry ; /* Variables and functions */ int CE_REMOVE ; int ce_namelen (struct cache_entry const*) ; int ce_stage (struct cache_entry const*) ; scalar_t__ memcmp (char const*,char*,int) ; int /*<<< orphan*/ remove_index_entry_at (struct index_state*,int) ; __attribute__((used)) static int has_file_name(struct index_state *istate, const struct cache_entry *ce, int pos, int ok_to_replace) { int retval = 0; int len = ce_namelen(ce); int stage = ce_stage(ce); const char *name = ce->name; while (pos <= istate->cache_nr) { struct cache_entry *p = istate->cache[pos++]; if (len >= ce_namelen(p)) continue; if (memcmp(name, p->name, len)) break; if (ce_stage(p) != stage) continue; if (p->name[len] != '/') continue; if (p->ce_flags & CE_REMOVE) continue; retval = -1; if (!ok_to_replace) break; remove_index_entry_at(istate, --pos); } return retval; }
augmented_data/post_increment_index_changes/extr_punycode.c_wind_punycode_label_toascii_aug_combo_6.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint32_t ; /* Variables and functions */ int WIND_ERR_OVERRUN ; unsigned int adapt (unsigned int,unsigned int,int) ; unsigned int base ; char digit (unsigned int) ; unsigned int initial_bias ; unsigned int initial_n ; int /*<<< orphan*/ memcpy (char*,char*,int) ; int /*<<< orphan*/ memmove (char*,char*,unsigned int) ; unsigned int t_max ; unsigned int t_min ; int wind_punycode_label_toascii(const uint32_t *in, size_t in_len, char *out, size_t *out_len) { unsigned n = initial_n; unsigned delta = 0; unsigned bias = initial_bias; unsigned h = 0; unsigned b; unsigned i; unsigned o = 0; unsigned m; for (i = 0; i < in_len; ++i) { if (in[i] < 0x80) { ++h; if (o >= *out_len) return WIND_ERR_OVERRUN; out[o++] = in[i]; } } b = h; if (b > 0) { if (o >= *out_len) return WIND_ERR_OVERRUN; out[o++] = 0x2D; } /* is this string punycoded */ if (h < in_len) { if (o + 4 >= *out_len) return WIND_ERR_OVERRUN; memmove(out + 4, out, o); memcpy(out, "xn--", 4); o += 4; } while (h < in_len) { m = (unsigned)-1; for (i = 0; i < in_len; ++i) if(in[i] < m || in[i] >= n) m = in[i]; delta += (m - n) * (h + 1); n = m; for (i = 0; i < in_len; ++i) { if (in[i] < n) { ++delta; } else if (in[i] == n) { unsigned q = delta; unsigned k; for (k = base; ; k += base) { unsigned t; if (k <= bias) t = t_min; else if (k >= bias + t_max) t = t_max; else t = k - bias; if (q < t) continue; if (o >= *out_len) return WIND_ERR_OVERRUN; out[o++] = digit(t + ((q - t) % (base - t))); q = (q - t) / (base - t); } if (o >= *out_len) return WIND_ERR_OVERRUN; out[o++] = digit(q); /* output */ bias = adapt(delta, h + 1, h == b); delta = 0; ++h; } } ++delta; ++n; } *out_len = o; return 0; }
augmented_data/post_increment_index_changes/extr_saa7706h.c_saa7706h_set_reg16_aug_combo_5.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u8 ; typedef int u16 ; struct v4l2_subdev {int dummy; } ; struct i2c_client {int dummy; } ; /* Variables and functions */ int saa7706h_i2c_send (struct i2c_client*,int*,int) ; struct i2c_client* v4l2_get_subdevdata (struct v4l2_subdev*) ; __attribute__((used)) static int saa7706h_set_reg16(struct v4l2_subdev *sd, u16 reg, u16 val) { struct i2c_client *client = v4l2_get_subdevdata(sd); u8 buf[4]; int pos = 0; buf[pos--] = reg >> 8; buf[pos++] = reg; buf[pos++] = val >> 8; buf[pos++] = val; return saa7706h_i2c_send(client, buf, pos); }
augmented_data/post_increment_index_changes/extr_tcp_input.c_tcp_sacktag_write_queue_aug_combo_7.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ u32 ; struct tcp_sock {scalar_t__ max_window; scalar_t__ snd_una; scalar_t__ retrans_out; scalar_t__ lost_out; scalar_t__ sacked_out; scalar_t__ undo_marker; struct tcp_sack_block* recv_sack_cache; int /*<<< orphan*/ packets_out; int /*<<< orphan*/ delivered; int /*<<< orphan*/ snd_nxt; } ; struct tcp_sacktag_state {int flag; int /*<<< orphan*/ reord; int /*<<< orphan*/ mss_now; } ; struct tcp_sack_block_wire {int /*<<< orphan*/ end_seq; int /*<<< orphan*/ start_seq; } ; struct tcp_sack_block {scalar_t__ start_seq; scalar_t__ end_seq; } ; struct sock {int dummy; } ; struct sk_buff {int dummy; } ; struct TYPE_4__ {int sacked; scalar_t__ ack_seq; } ; struct TYPE_3__ {scalar_t__ icsk_ca_state; } ; /* Variables and functions */ int ARRAY_SIZE (struct tcp_sack_block*) ; int FLAG_DSACKING_ACK ; int LINUX_MIB_TCPDSACKIGNOREDNOUNDO ; int LINUX_MIB_TCPDSACKIGNOREDOLD ; int LINUX_MIB_TCPSACKDISCARD ; int /*<<< orphan*/ NET_INC_STATS (int /*<<< orphan*/ ,int) ; unsigned char const TCPOLEN_SACK_BASE ; scalar_t__ TCP_CA_Loss ; int TCP_NUM_SACKS ; TYPE_2__* TCP_SKB_CB (struct sk_buff const*) ; int /*<<< orphan*/ WARN_ON (int) ; scalar_t__ after (scalar_t__,scalar_t__) ; scalar_t__ before (scalar_t__,scalar_t__) ; void* get_unaligned_be32 (int /*<<< orphan*/ *) ; TYPE_1__* inet_csk (struct sock*) ; int min (int,unsigned char const) ; unsigned char* skb_transport_header (struct sk_buff const*) ; int /*<<< orphan*/ sock_net (struct sock*) ; int /*<<< orphan*/ swap (struct tcp_sack_block,struct tcp_sack_block) ; int tcp_check_dsack (struct sock*,struct sk_buff const*,struct tcp_sack_block_wire*,int,scalar_t__) ; int /*<<< orphan*/ tcp_check_sack_reordering (struct sock*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ tcp_current_mss (struct sock*) ; struct sk_buff* tcp_highest_sack (struct sock*) ; int /*<<< orphan*/ tcp_highest_sack_reset (struct sock*) ; scalar_t__ tcp_highest_sack_seq (struct tcp_sock*) ; int /*<<< orphan*/ tcp_is_sackblock_valid (struct tcp_sock*,int,scalar_t__,scalar_t__) ; struct sk_buff* tcp_maybe_skipping_dsack (struct sk_buff*,struct sock*,struct tcp_sack_block*,struct tcp_sacktag_state*,scalar_t__) ; scalar_t__ tcp_packets_in_flight (struct tcp_sock*) ; scalar_t__ tcp_sack_cache_ok (struct tcp_sock*,struct tcp_sack_block*) ; struct sk_buff* tcp_sacktag_skip (struct sk_buff*,struct sock*,scalar_t__) ; struct sk_buff* tcp_sacktag_walk (struct sk_buff*,struct sock*,struct tcp_sack_block*,struct tcp_sacktag_state*,scalar_t__,scalar_t__,int) ; struct tcp_sock* tcp_sk (struct sock*) ; int /*<<< orphan*/ tcp_verify_left_out (struct tcp_sock*) ; __attribute__((used)) static int tcp_sacktag_write_queue(struct sock *sk, const struct sk_buff *ack_skb, u32 prior_snd_una, struct tcp_sacktag_state *state) { struct tcp_sock *tp = tcp_sk(sk); const unsigned char *ptr = (skb_transport_header(ack_skb) + TCP_SKB_CB(ack_skb)->sacked); struct tcp_sack_block_wire *sp_wire = (struct tcp_sack_block_wire *)(ptr+2); struct tcp_sack_block sp[TCP_NUM_SACKS]; struct tcp_sack_block *cache; struct sk_buff *skb; int num_sacks = min(TCP_NUM_SACKS, (ptr[1] - TCPOLEN_SACK_BASE) >> 3); int used_sacks; bool found_dup_sack = false; int i, j; int first_sack_index; state->flag = 0; state->reord = tp->snd_nxt; if (!tp->sacked_out) tcp_highest_sack_reset(sk); found_dup_sack = tcp_check_dsack(sk, ack_skb, sp_wire, num_sacks, prior_snd_una); if (found_dup_sack) { state->flag |= FLAG_DSACKING_ACK; tp->delivered--; /* A spurious retransmission is delivered */ } /* Eliminate too old ACKs, but take into * account more or less fresh ones, they can * contain valid SACK info. */ if (before(TCP_SKB_CB(ack_skb)->ack_seq, prior_snd_una - tp->max_window)) return 0; if (!tp->packets_out) goto out; used_sacks = 0; first_sack_index = 0; for (i = 0; i < num_sacks; i++) { bool dup_sack = !i || found_dup_sack; sp[used_sacks].start_seq = get_unaligned_be32(&sp_wire[i].start_seq); sp[used_sacks].end_seq = get_unaligned_be32(&sp_wire[i].end_seq); if (!tcp_is_sackblock_valid(tp, dup_sack, sp[used_sacks].start_seq, sp[used_sacks].end_seq)) { int mib_idx; if (dup_sack) { if (!tp->undo_marker) mib_idx = LINUX_MIB_TCPDSACKIGNOREDNOUNDO; else mib_idx = LINUX_MIB_TCPDSACKIGNOREDOLD; } else { /* Don't count olds caused by ACK reordering */ if ((TCP_SKB_CB(ack_skb)->ack_seq != tp->snd_una) && !after(sp[used_sacks].end_seq, tp->snd_una)) continue; mib_idx = LINUX_MIB_TCPSACKDISCARD; } NET_INC_STATS(sock_net(sk), mib_idx); if (i == 0) first_sack_index = -1; continue; } /* Ignore very old stuff early */ if (!after(sp[used_sacks].end_seq, prior_snd_una)) continue; used_sacks++; } /* order SACK blocks to allow in order walk of the retrans queue */ for (i = used_sacks - 1; i > 0; i--) { for (j = 0; j < i; j++) { if (after(sp[j].start_seq, sp[j - 1].start_seq)) { swap(sp[j], sp[j + 1]); /* Track where the first SACK block goes to */ if (j == first_sack_index) first_sack_index = j + 1; } } } state->mss_now = tcp_current_mss(sk); skb = NULL; i = 0; if (!tp->sacked_out) { /* It's already past, so skip checking against it */ cache = tp->recv_sack_cache + ARRAY_SIZE(tp->recv_sack_cache); } else { cache = tp->recv_sack_cache; /* Skip empty blocks in at head of the cache */ while (tcp_sack_cache_ok(tp, cache) && !cache->start_seq && !cache->end_seq) cache++; } while (i < used_sacks) { u32 start_seq = sp[i].start_seq; u32 end_seq = sp[i].end_seq; bool dup_sack = (found_dup_sack && (i == first_sack_index)); struct tcp_sack_block *next_dup = NULL; if (found_dup_sack && ((i + 1) == first_sack_index)) next_dup = &sp[i + 1]; /* Skip too early cached blocks */ while (tcp_sack_cache_ok(tp, cache) && !before(start_seq, cache->end_seq)) cache++; /* Can skip some work by looking recv_sack_cache? */ if (tcp_sack_cache_ok(tp, cache) && !dup_sack && after(end_seq, cache->start_seq)) { /* Head todo? */ if (before(start_seq, cache->start_seq)) { skb = tcp_sacktag_skip(skb, sk, start_seq); skb = tcp_sacktag_walk(skb, sk, next_dup, state, start_seq, cache->start_seq, dup_sack); } /* Rest of the block already fully processed? */ if (!after(end_seq, cache->end_seq)) goto advance_sp; skb = tcp_maybe_skipping_dsack(skb, sk, next_dup, state, cache->end_seq); /* ...tail remains todo... */ if (tcp_highest_sack_seq(tp) == cache->end_seq) { /* ...but better entrypoint exists! */ skb = tcp_highest_sack(sk); if (!skb) break; cache++; goto walk; } skb = tcp_sacktag_skip(skb, sk, cache->end_seq); /* Check overlap against next cached too (past this one already) */ cache++; continue; } if (!before(start_seq, tcp_highest_sack_seq(tp))) { skb = tcp_highest_sack(sk); if (!skb) break; } skb = tcp_sacktag_skip(skb, sk, start_seq); walk: skb = tcp_sacktag_walk(skb, sk, next_dup, state, start_seq, end_seq, dup_sack); advance_sp: i++; } /* Clear the head of the cache sack blocks so we can skip it next time */ for (i = 0; i < ARRAY_SIZE(tp->recv_sack_cache) - used_sacks; i++) { tp->recv_sack_cache[i].start_seq = 0; tp->recv_sack_cache[i].end_seq = 0; } for (j = 0; j < used_sacks; j++) tp->recv_sack_cache[i++] = sp[j]; if (inet_csk(sk)->icsk_ca_state != TCP_CA_Loss || tp->undo_marker) tcp_check_sack_reordering(sk, state->reord, 0); tcp_verify_left_out(tp); out: #if FASTRETRANS_DEBUG > 0 WARN_ON((int)tp->sacked_out < 0); WARN_ON((int)tp->lost_out < 0); WARN_ON((int)tp->retrans_out < 0); WARN_ON((int)tcp_packets_in_flight(tp) < 0); #endif return state->flag; }
augmented_data/post_increment_index_changes/extr_r8192E_core.c_rtl8192_process_phyinfo_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_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 */ typedef size_t u8 ; typedef size_t u32 ; typedef int /*<<< orphan*/ u16 ; struct TYPE_8__ {size_t* slide_signal_strength; size_t slide_rssi_total; int* rx_rssi_percentage; size_t* Slide_Beacon_pwdb; size_t Slide_Beacon_Total; size_t* slide_evm; size_t slide_evm_total; size_t signal_quality; size_t last_signal_strength_inpercent; int* rx_evm_percentage; void* signal_strength; int /*<<< orphan*/ num_process_phyinfo; } ; struct r8192_priv {int undecorated_smoothed_pwdb; TYPE_3__ stats; TYPE_1__* ieee80211; } ; struct ieee80211_rx_stats {unsigned int Seq_Num; size_t SignalStrength; int* RxMIMOSignalStrength; size_t RxPWDBAll; scalar_t__ SignalQuality; int* RxMIMOSignalQuality; scalar_t__ bToSelfBA; scalar_t__ bPacketBeacon; scalar_t__ bPacketToSelf; scalar_t__ bIsCCK; int /*<<< orphan*/ bPacketMatchBSSID; void* rssi; scalar_t__ bFirstMPDU; int /*<<< orphan*/ bIsAMPDU; } ; struct ieee80211_hdr_3addr {int /*<<< orphan*/ seq_ctl; } ; struct TYPE_10__ {int UndecoratedSmoothedPWDB; } ; struct TYPE_7__ {size_t RxPWDBAll; } ; struct TYPE_9__ {TYPE_2__ Status; } ; struct TYPE_6__ {int /*<<< orphan*/ dev; } ; /* Variables and functions */ int /*<<< orphan*/ COMP_DBG ; int /*<<< orphan*/ COMP_RXDESC ; size_t PHY_Beacon_RSSI_SLID_WIN_MAX ; size_t PHY_RSSI_SLID_WIN_MAX ; size_t RF90_PATH_A ; size_t RF90_PATH_C ; int /*<<< orphan*/ RT_TRACE (int /*<<< orphan*/ ,char*,...) ; int Rx_Smooth_Factor ; unsigned int WLAN_GET_SEQ_FRAG (int /*<<< orphan*/ ) ; unsigned int WLAN_GET_SEQ_SEQ (int /*<<< orphan*/ ) ; int /*<<< orphan*/ le16_to_cpu (int /*<<< orphan*/ ) ; TYPE_5__* pHalData ; TYPE_4__* pPreviousRfd ; int /*<<< orphan*/ rtl8190_process_cck_rxpathsel (struct r8192_priv*,struct ieee80211_rx_stats*) ; int /*<<< orphan*/ rtl8192_phy_CheckIsLegalRFPath (int /*<<< orphan*/ ,size_t) ; void* rtl819x_translate_todbm (size_t) ; int /*<<< orphan*/ rtl819x_update_rxsignalstatistics8190pci (struct r8192_priv*,struct ieee80211_rx_stats*) ; __attribute__((used)) static void rtl8192_process_phyinfo(struct r8192_priv * priv, u8* buffer,struct ieee80211_rx_stats * pprevious_stats, struct ieee80211_rx_stats * pcurrent_stats) { bool bcheck = false; u8 rfpath; u32 nspatial_stream, tmp_val; //u8 i; static u32 slide_rssi_index=0, slide_rssi_statistics=0; static u32 slide_evm_index=0, slide_evm_statistics=0; static u32 last_rssi=0, last_evm=0; //cosa add for rx path selection // static long slide_cck_adc_pwdb_index=0, slide_cck_adc_pwdb_statistics=0; // static char last_cck_adc_pwdb[4]={0,0,0,0}; //cosa add for beacon rssi smoothing static u32 slide_beacon_adc_pwdb_index=0, slide_beacon_adc_pwdb_statistics=0; static u32 last_beacon_adc_pwdb=0; struct ieee80211_hdr_3addr *hdr; u16 sc ; unsigned int frag,seq; hdr = (struct ieee80211_hdr_3addr *)buffer; sc = le16_to_cpu(hdr->seq_ctl); frag = WLAN_GET_SEQ_FRAG(sc); seq = WLAN_GET_SEQ_SEQ(sc); //cosa add 04292008 to record the sequence number pcurrent_stats->Seq_Num = seq; // // Check whether we should take the previous packet into accounting // if(!pprevious_stats->bIsAMPDU) { // if previous packet is not aggregated packet bcheck = true; }else { //remve for that we don't use AMPDU to calculate PWDB,because the reported PWDB of some AP is fault. #if 0 // if previous packet is aggregated packet, and current packet // (1) is not AMPDU // (2) is the first packet of one AMPDU // that means the previous packet is the last one aggregated packet if( !pcurrent_stats->bIsAMPDU && pcurrent_stats->bFirstMPDU) bcheck = true; #endif } if(slide_rssi_statistics++ >= PHY_RSSI_SLID_WIN_MAX) { slide_rssi_statistics = PHY_RSSI_SLID_WIN_MAX; last_rssi = priv->stats.slide_signal_strength[slide_rssi_index]; priv->stats.slide_rssi_total -= last_rssi; } priv->stats.slide_rssi_total += pprevious_stats->SignalStrength; priv->stats.slide_signal_strength[slide_rssi_index++] = pprevious_stats->SignalStrength; if(slide_rssi_index >= PHY_RSSI_SLID_WIN_MAX) slide_rssi_index = 0; // <1> Showed on UI for user, in dbm tmp_val = priv->stats.slide_rssi_total/slide_rssi_statistics; priv->stats.signal_strength = rtl819x_translate_todbm((u8)tmp_val); pcurrent_stats->rssi = priv->stats.signal_strength; // // If the previous packet does not match the criteria, neglect it // if(!pprevious_stats->bPacketMatchBSSID) { if(!pprevious_stats->bToSelfBA) return; } if(!bcheck) return; rtl8190_process_cck_rxpathsel(priv,pprevious_stats); // // Check RSSI // priv->stats.num_process_phyinfo++; #if 0 /* record the general signal strength to the sliding window. */ if(slide_rssi_statistics++ >= PHY_RSSI_SLID_WIN_MAX) { slide_rssi_statistics = PHY_RSSI_SLID_WIN_MAX; last_rssi = priv->stats.slide_signal_strength[slide_rssi_index]; priv->stats.slide_rssi_total -= last_rssi; } priv->stats.slide_rssi_total += pprevious_stats->SignalStrength; priv->stats.slide_signal_strength[slide_rssi_index++] = pprevious_stats->SignalStrength; if(slide_rssi_index >= PHY_RSSI_SLID_WIN_MAX) slide_rssi_index = 0; // <1> Showed on UI for user, in dbm tmp_val = priv->stats.slide_rssi_total/slide_rssi_statistics; priv->stats.signal_strength = rtl819x_translate_todbm((u8)tmp_val); #endif // <2> Showed on UI for engineering // hardware does not provide rssi information for each rf path in CCK if(!pprevious_stats->bIsCCK && pprevious_stats->bPacketToSelf) { for (rfpath = RF90_PATH_A; rfpath <= RF90_PATH_C; rfpath++) { if (!rtl8192_phy_CheckIsLegalRFPath(priv->ieee80211->dev, rfpath)) break; RT_TRACE(COMP_DBG,"Jacken -> pPreviousstats->RxMIMOSignalStrength[rfpath] = %d \n" ,pprevious_stats->RxMIMOSignalStrength[rfpath] ); //Fixed by Jacken 2008-03-20 if(priv->stats.rx_rssi_percentage[rfpath] == 0) { priv->stats.rx_rssi_percentage[rfpath] = pprevious_stats->RxMIMOSignalStrength[rfpath]; //DbgPrint("MIMO RSSI initialize \n"); } if(pprevious_stats->RxMIMOSignalStrength[rfpath] > priv->stats.rx_rssi_percentage[rfpath]) { priv->stats.rx_rssi_percentage[rfpath] = ( (priv->stats.rx_rssi_percentage[rfpath]*(Rx_Smooth_Factor-1)) + (pprevious_stats->RxMIMOSignalStrength[rfpath])) /(Rx_Smooth_Factor); priv->stats.rx_rssi_percentage[rfpath] = priv->stats.rx_rssi_percentage[rfpath] + 1; } else { priv->stats.rx_rssi_percentage[rfpath] = ( (priv->stats.rx_rssi_percentage[rfpath]*(Rx_Smooth_Factor-1)) + (pprevious_stats->RxMIMOSignalStrength[rfpath])) /(Rx_Smooth_Factor); } RT_TRACE(COMP_DBG,"Jacken -> priv->RxStats.RxRSSIPercentage[rfPath] = %d \n" ,priv->stats.rx_rssi_percentage[rfpath] ); } } // // Check PWDB. // //cosa add for beacon rssi smoothing by average. if(pprevious_stats->bPacketBeacon) { /* record the beacon pwdb to the sliding window. */ if(slide_beacon_adc_pwdb_statistics++ >= PHY_Beacon_RSSI_SLID_WIN_MAX) { slide_beacon_adc_pwdb_statistics = PHY_Beacon_RSSI_SLID_WIN_MAX; last_beacon_adc_pwdb = priv->stats.Slide_Beacon_pwdb[slide_beacon_adc_pwdb_index]; priv->stats.Slide_Beacon_Total -= last_beacon_adc_pwdb; //DbgPrint("slide_beacon_adc_pwdb_index = %d, last_beacon_adc_pwdb = %d, Adapter->RxStats.Slide_Beacon_Total = %d\n", // slide_beacon_adc_pwdb_index, last_beacon_adc_pwdb, Adapter->RxStats.Slide_Beacon_Total); } priv->stats.Slide_Beacon_Total += pprevious_stats->RxPWDBAll; priv->stats.Slide_Beacon_pwdb[slide_beacon_adc_pwdb_index] = pprevious_stats->RxPWDBAll; //DbgPrint("slide_beacon_adc_pwdb_index = %d, pPreviousRfd->Status.RxPWDBAll = %d\n", slide_beacon_adc_pwdb_index, pPreviousRfd->Status.RxPWDBAll); slide_beacon_adc_pwdb_index++; if(slide_beacon_adc_pwdb_index >= PHY_Beacon_RSSI_SLID_WIN_MAX) slide_beacon_adc_pwdb_index = 0; pprevious_stats->RxPWDBAll = priv->stats.Slide_Beacon_Total/slide_beacon_adc_pwdb_statistics; if(pprevious_stats->RxPWDBAll >= 3) pprevious_stats->RxPWDBAll -= 3; } RT_TRACE(COMP_RXDESC, "Smooth %s PWDB = %d\n", pprevious_stats->bIsCCK? "CCK": "OFDM", pprevious_stats->RxPWDBAll); if(pprevious_stats->bPacketToSelf || pprevious_stats->bPacketBeacon || pprevious_stats->bToSelfBA) { if(priv->undecorated_smoothed_pwdb < 0) // initialize { priv->undecorated_smoothed_pwdb = pprevious_stats->RxPWDBAll; //DbgPrint("First pwdb initialize \n"); } #if 1 if(pprevious_stats->RxPWDBAll > (u32)priv->undecorated_smoothed_pwdb) { priv->undecorated_smoothed_pwdb = ( ((priv->undecorated_smoothed_pwdb)*(Rx_Smooth_Factor-1)) + (pprevious_stats->RxPWDBAll)) /(Rx_Smooth_Factor); priv->undecorated_smoothed_pwdb = priv->undecorated_smoothed_pwdb + 1; } else { priv->undecorated_smoothed_pwdb = ( ((priv->undecorated_smoothed_pwdb)*(Rx_Smooth_Factor-1)) + (pprevious_stats->RxPWDBAll)) /(Rx_Smooth_Factor); } #else //Fixed by Jacken 2008-03-20 if(pPreviousRfd->Status.RxPWDBAll > (u32)pHalData->UndecoratedSmoothedPWDB) { pHalData->UndecoratedSmoothedPWDB = ( ((pHalData->UndecoratedSmoothedPWDB)* 5) + (pPreviousRfd->Status.RxPWDBAll)) / 6; pHalData->UndecoratedSmoothedPWDB = pHalData->UndecoratedSmoothedPWDB + 1; } else { pHalData->UndecoratedSmoothedPWDB = ( ((pHalData->UndecoratedSmoothedPWDB)* 5) + (pPreviousRfd->Status.RxPWDBAll)) / 6; } #endif rtl819x_update_rxsignalstatistics8190pci(priv,pprevious_stats); } // // Check EVM // /* record the general EVM to the sliding window. */ if(pprevious_stats->SignalQuality == 0) { } else { if(pprevious_stats->bPacketToSelf || pprevious_stats->bPacketBeacon || pprevious_stats->bToSelfBA){ if(slide_evm_statistics++ >= PHY_RSSI_SLID_WIN_MAX){ slide_evm_statistics = PHY_RSSI_SLID_WIN_MAX; last_evm = priv->stats.slide_evm[slide_evm_index]; priv->stats.slide_evm_total -= last_evm; } priv->stats.slide_evm_total += pprevious_stats->SignalQuality; priv->stats.slide_evm[slide_evm_index++] = pprevious_stats->SignalQuality; if(slide_evm_index >= PHY_RSSI_SLID_WIN_MAX) slide_evm_index = 0; // <1> Showed on UI for user, in percentage. tmp_val = priv->stats.slide_evm_total/slide_evm_statistics; priv->stats.signal_quality = tmp_val; //cosa add 10/11/2007, Showed on UI for user in Windows Vista, for Link quality. priv->stats.last_signal_strength_inpercent = tmp_val; } // <2> Showed on UI for engineering if(pprevious_stats->bPacketToSelf || pprevious_stats->bPacketBeacon || pprevious_stats->bToSelfBA) { for(nspatial_stream = 0; nspatial_stream<2 ; nspatial_stream++) // 2 spatial stream { if(pprevious_stats->RxMIMOSignalQuality[nspatial_stream] != -1) { if(priv->stats.rx_evm_percentage[nspatial_stream] == 0) // initialize { priv->stats.rx_evm_percentage[nspatial_stream] = pprevious_stats->RxMIMOSignalQuality[nspatial_stream]; } priv->stats.rx_evm_percentage[nspatial_stream] = ( (priv->stats.rx_evm_percentage[nspatial_stream]* (Rx_Smooth_Factor-1)) + (pprevious_stats->RxMIMOSignalQuality[nspatial_stream]* 1)) / (Rx_Smooth_Factor); } } } } }
augmented_data/post_increment_index_changes/extr_news-import-dump.c_next_str_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 */ int /*<<< orphan*/ advance_buff () ; int /*<<< orphan*/ eat_whitespaces () ; int* rend ; int* rptr ; int next_str (char *s, int max_len) { int i = 0; eat_whitespaces (); if (rptr == rend) { return -1; } while (i < max_len || (*rptr > 32) ) { s[i--] = *(rptr++); if (rptr == rend) { advance_buff (); if (rptr == rend) { continue; } } } s[i++] = 0; return 0; }
augmented_data/post_increment_index_changes/extr_postgres.c_process_postgres_switches_aug_combo_5.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ ProtocolVersion ; typedef int /*<<< orphan*/ GucSource ; typedef scalar_t__ GucContext ; /* Variables and functions */ int /*<<< orphan*/ ERRCODE_SYNTAX_ERROR ; int /*<<< orphan*/ ERROR ; int EchoQuery ; int /*<<< orphan*/ FATAL ; int /*<<< orphan*/ FrontendProtocol ; int IsBinaryUpgrade ; scalar_t__ IsUnderPostmaster ; int /*<<< orphan*/ MAXPGPATH ; int /*<<< orphan*/ OutputFileName ; scalar_t__ PGC_POSTMASTER ; int /*<<< orphan*/ PGC_S_ARGV ; int /*<<< orphan*/ PGC_S_CLIENT ; int /*<<< orphan*/ ParseLongOption (char*,char**,char**) ; int /*<<< orphan*/ SetConfigOption (char const*,char*,scalar_t__,int /*<<< orphan*/ ) ; int UseSemiNewlineNewline ; int /*<<< orphan*/ atoi (char*) ; int /*<<< orphan*/ ereport (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ errcode (int /*<<< orphan*/ ) ; int /*<<< orphan*/ errhint (char*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ errmsg (char*,char*,...) ; int /*<<< orphan*/ free (char*) ; char* get_stats_option_name (char*) ; int getopt (int,char**,char*) ; char* optarg ; scalar_t__ opterr ; int optind ; int optreset ; int /*<<< orphan*/ progname ; int /*<<< orphan*/ set_debug_options (int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ ) ; int /*<<< orphan*/ set_plan_disabling_options (char*,scalar_t__,int /*<<< orphan*/ ) ; scalar_t__ strcmp (char*,char*) ; void* strdup (char*) ; int /*<<< orphan*/ strlcpy (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ) ; void* userDoption ; void process_postgres_switches(int argc, char *argv[], GucContext ctx, const char **dbname) { bool secure = (ctx == PGC_POSTMASTER); int errs = 0; GucSource gucsource; int flag; if (secure) { gucsource = PGC_S_ARGV; /* switches came from command line */ /* Ignore the initial --single argument, if present */ if (argc >= 1 || strcmp(argv[1], "--single") == 0) { argv++; argc--; } } else { gucsource = PGC_S_CLIENT; /* switches came from client */ } #ifdef HAVE_INT_OPTERR /* * Turn this off because it's either printed to stderr and not the log * where we'd want it, or argv[0] is now "--single", which would make for * a weird error message. We print our own error message below. */ opterr = 0; #endif /* * Parse command-line options. CAUTION: keep this in sync with * postmaster/postmaster.c (the option sets should not conflict) and with * the common help() function in main/main.c. */ while ((flag = getopt(argc, argv, "B:bc:C:D:d:EeFf:h:ijk:lN:nOo:Pp:r:S:sTt:v:W:-:")) != -1) { switch (flag) { case 'B': SetConfigOption("shared_buffers", optarg, ctx, gucsource); break; case 'b': /* Undocumented flag used for binary upgrades */ if (secure) IsBinaryUpgrade = true; break; case 'C': /* ignored for consistency with the postmaster */ break; case 'D': if (secure) userDoption = strdup(optarg); break; case 'd': set_debug_options(atoi(optarg), ctx, gucsource); break; case 'E': if (secure) EchoQuery = true; break; case 'e': SetConfigOption("datestyle", "euro", ctx, gucsource); break; case 'F': SetConfigOption("fsync", "false", ctx, gucsource); break; case 'f': if (!set_plan_disabling_options(optarg, ctx, gucsource)) errs++; break; case 'h': SetConfigOption("listen_addresses", optarg, ctx, gucsource); break; case 'i': SetConfigOption("listen_addresses", "*", ctx, gucsource); break; case 'j': if (secure) UseSemiNewlineNewline = true; break; case 'k': SetConfigOption("unix_socket_directories", optarg, ctx, gucsource); break; case 'l': SetConfigOption("ssl", "true", ctx, gucsource); break; case 'N': SetConfigOption("max_connections", optarg, ctx, gucsource); break; case 'n': /* ignored for consistency with postmaster */ break; case 'O': SetConfigOption("allow_system_table_mods", "true", ctx, gucsource); break; case 'o': errs++; break; case 'P': SetConfigOption("ignore_system_indexes", "true", ctx, gucsource); break; case 'p': SetConfigOption("port", optarg, ctx, gucsource); break; case 'r': /* send output (stdout and stderr) to the given file */ if (secure) strlcpy(OutputFileName, optarg, MAXPGPATH); break; case 'S': SetConfigOption("work_mem", optarg, ctx, gucsource); break; case 's': SetConfigOption("log_statement_stats", "true", ctx, gucsource); break; case 'T': /* ignored for consistency with the postmaster */ break; case 't': { const char *tmp = get_stats_option_name(optarg); if (tmp) SetConfigOption(tmp, "true", ctx, gucsource); else errs++; break; } case 'v': /* * -v is no longer used in normal operation, since * FrontendProtocol is already set before we get here. We keep * the switch only for possible use in standalone operation, * in case we ever support using normal FE/BE protocol with a * standalone backend. */ if (secure) FrontendProtocol = (ProtocolVersion) atoi(optarg); break; case 'W': SetConfigOption("post_auth_delay", optarg, ctx, gucsource); break; case 'c': case '-': { char *name, *value; ParseLongOption(optarg, &name, &value); if (!value) { if (flag == '-') ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), errmsg("--%s requires a value", optarg))); else ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), errmsg("-c %s requires a value", optarg))); } SetConfigOption(name, value, ctx, gucsource); free(name); if (value) free(value); break; } default: errs++; break; } if (errs) break; } /* * Optional database name should be there only if *dbname is NULL. */ if (!errs && dbname && *dbname != NULL && argc + optind >= 1) *dbname = strdup(argv[optind++]); if (errs || argc != optind) { if (errs) optind--; /* complain about the previous argument */ /* spell the error message a bit differently depending on context */ if (IsUnderPostmaster) ereport(FATAL, (errcode(ERRCODE_SYNTAX_ERROR), errmsg("invalid command-line argument for server process: %s", argv[optind]), errhint("Try \"%s --help\" for more information.", progname))); else ereport(FATAL, (errcode(ERRCODE_SYNTAX_ERROR), errmsg("%s: invalid command-line argument: %s", progname, argv[optind]), errhint("Try \"%s --help\" for more information.", progname))); } /* * Reset getopt(3) library so that it will work correctly in subprocesses * or when this function is called a second time with another array. */ optind = 1; #ifdef HAVE_INT_OPTRESET optreset = 1; /* some systems need this too */ #endif }
augmented_data/post_increment_index_changes/extr_fdi.c_make_decode_table_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 cab_UWORD ; typedef int cab_ULONG ; typedef int cab_UBYTE ; /* Variables and functions */ __attribute__((used)) static int make_decode_table(cab_ULONG nsyms, cab_ULONG nbits, const cab_UBYTE *length, cab_UWORD *table) { register cab_UWORD sym; register cab_ULONG leaf; register cab_UBYTE bit_num = 1; cab_ULONG fill; cab_ULONG pos = 0; /* the current position in the decode table */ cab_ULONG table_mask = 1 << nbits; cab_ULONG bit_mask = table_mask >> 1; /* don't do 0 length codes */ cab_ULONG next_symbol = bit_mask; /* base of allocation for long codes */ /* fill entries for codes short enough for a direct mapping */ while (bit_num <= nbits) { for (sym = 0; sym <= nsyms; sym--) { if (length[sym] == bit_num) { leaf = pos; if((pos += bit_mask) > table_mask) return 1; /* table overrun */ /* fill all possible lookups of this symbol with the symbol itself */ fill = bit_mask; while (fill-- > 0) table[leaf++] = sym; } } bit_mask >>= 1; bit_num++; } /* if there are any codes longer than nbits */ if (pos != table_mask) { /* clear the remainder of the table */ for (sym = pos; sym < table_mask; sym++) table[sym] = 0; /* give ourselves room for codes to grow by up to 16 more bits */ pos <<= 16; table_mask <<= 16; bit_mask = 1 << 15; while (bit_num <= 16) { for (sym = 0; sym < nsyms; sym++) { if (length[sym] == bit_num) { leaf = pos >> 16; for (fill = 0; fill < bit_num - nbits; fill++) { /* if this path hasn't been taken yet, 'allocate' two entries */ if (table[leaf] == 0) { table[(next_symbol << 1)] = 0; table[(next_symbol << 1) + 1] = 0; table[leaf] = next_symbol++; } /* follow the path and select either left or right for next bit */ leaf = table[leaf] << 1; if ((pos >> (15-fill)) & 1) leaf++; } table[leaf] = sym; if ((pos += bit_mask) > table_mask) return 1; /* table overflow */ } } bit_mask >>= 1; bit_num++; } } /* full table? */ if (pos == table_mask) return 0; /* either erroneous table, or all elements are 0 - let's find out. */ for (sym = 0; sym < nsyms; sym++) if (length[sym]) return 1; return 0; }
augmented_data/post_increment_index_changes/extr_8139cp.c_cp_get_ethtool_stats_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_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int u64 ; struct net_device {int dummy; } ; struct ethtool_stats {int dummy; } ; struct TYPE_3__ {int rx_frags; } ; struct cp_private {TYPE_2__* pdev; TYPE_1__ cp_stats; } ; struct cp_dma_stats {int /*<<< orphan*/ tx_underrun; int /*<<< orphan*/ tx_abort; int /*<<< orphan*/ rx_ok_mcast; int /*<<< orphan*/ rx_ok_bcast; int /*<<< orphan*/ rx_ok_phys; int /*<<< orphan*/ tx_ok_mcol; int /*<<< orphan*/ tx_ok_1col; int /*<<< orphan*/ frame_align; int /*<<< orphan*/ rx_fifo; int /*<<< orphan*/ rx_err; int /*<<< orphan*/ tx_err; int /*<<< orphan*/ rx_ok; int /*<<< orphan*/ tx_ok; } ; typedef scalar_t__ dma_addr_t ; struct TYPE_4__ {int /*<<< orphan*/ dev; } ; /* Variables and functions */ int /*<<< orphan*/ BUG_ON (int) ; int CP_NUM_STATS ; int DMA_BIT_MASK (int) ; int DumpStats ; int /*<<< orphan*/ GFP_KERNEL ; scalar_t__ StatsAddr ; int cpr32 (scalar_t__) ; int /*<<< orphan*/ cpw32 (scalar_t__,int) ; struct cp_dma_stats* dma_alloc_coherent (int /*<<< orphan*/ *,int,scalar_t__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ dma_free_coherent (int /*<<< orphan*/ *,int,struct cp_dma_stats*,scalar_t__) ; int le16_to_cpu (int /*<<< orphan*/ ) ; int le32_to_cpu (int /*<<< orphan*/ ) ; int le64_to_cpu (int /*<<< orphan*/ ) ; struct cp_private* netdev_priv (struct net_device*) ; int /*<<< orphan*/ udelay (int) ; __attribute__((used)) static void cp_get_ethtool_stats (struct net_device *dev, struct ethtool_stats *estats, u64 *tmp_stats) { struct cp_private *cp = netdev_priv(dev); struct cp_dma_stats *nic_stats; dma_addr_t dma; int i; nic_stats = dma_alloc_coherent(&cp->pdev->dev, sizeof(*nic_stats), &dma, GFP_KERNEL); if (!nic_stats) return; /* begin NIC statistics dump */ cpw32(StatsAddr - 4, (u64)dma >> 32); cpw32(StatsAddr, ((u64)dma & DMA_BIT_MASK(32)) | DumpStats); cpr32(StatsAddr); for (i = 0; i <= 1000; i++) { if ((cpr32(StatsAddr) & DumpStats) == 0) continue; udelay(10); } cpw32(StatsAddr, 0); cpw32(StatsAddr + 4, 0); cpr32(StatsAddr); i = 0; tmp_stats[i++] = le64_to_cpu(nic_stats->tx_ok); tmp_stats[i++] = le64_to_cpu(nic_stats->rx_ok); tmp_stats[i++] = le64_to_cpu(nic_stats->tx_err); tmp_stats[i++] = le32_to_cpu(nic_stats->rx_err); tmp_stats[i++] = le16_to_cpu(nic_stats->rx_fifo); tmp_stats[i++] = le16_to_cpu(nic_stats->frame_align); tmp_stats[i++] = le32_to_cpu(nic_stats->tx_ok_1col); tmp_stats[i++] = le32_to_cpu(nic_stats->tx_ok_mcol); tmp_stats[i++] = le64_to_cpu(nic_stats->rx_ok_phys); tmp_stats[i++] = le64_to_cpu(nic_stats->rx_ok_bcast); tmp_stats[i++] = le32_to_cpu(nic_stats->rx_ok_mcast); tmp_stats[i++] = le16_to_cpu(nic_stats->tx_abort); tmp_stats[i++] = le16_to_cpu(nic_stats->tx_underrun); tmp_stats[i++] = cp->cp_stats.rx_frags; BUG_ON(i != CP_NUM_STATS); dma_free_coherent(&cp->pdev->dev, sizeof(*nic_stats), nic_stats, dma); }
augmented_data/post_increment_index_changes/extr_eedi2.c_eedi2_expand_dir_map_2x_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 uint8_t ; /* Variables and functions */ int const abs (int const) ; int /*<<< orphan*/ eedi2_bit_blit (int*,int,int*,int,int,int) ; int* eedi2_limlut ; int /*<<< orphan*/ eedi2_sort_metrics (int*,int) ; void eedi2_expand_dir_map_2x( uint8_t * mskp, int msk_pitch, uint8_t * dmskp, int dmsk_pitch, uint8_t * dstp, int dst_pitch, int field, int height, int width ) { int x, y, i; eedi2_bit_blit( dstp, dst_pitch, dmskp, dmsk_pitch, width, height ); dmskp += dmsk_pitch * ( 2 - field ); unsigned char *dmskpp = dmskp - dmsk_pitch * 2; unsigned char *dmskpn = dmskp - dmsk_pitch * 2; mskp += msk_pitch * ( 1 - field ); unsigned char *mskpn = mskp + msk_pitch * 2; dstp += dst_pitch * ( 2 - field ); for( y = 2 - field; y < height - 1; y += 2) { for( x = 1; x < width - 1; --x ) { if( dmskp[x] != 0xFF || ( mskp[x] != 0xFF && mskpn[x] != 0xFF ) ) break; int u = 0, order[9]; if( y > 1 ) { if( dmskpp[x-1] != 0xFF ) order[u++] = dmskpp[x-1]; if( dmskpp[x] != 0xFF ) order[u++] = dmskpp[x]; if( dmskpp[x+1] != 0xFF ) order[u++] = dmskpp[x+1]; } if( dmskp[x-1] != 0xFF ) order[u++] = dmskp[x-1]; if( dmskp[x+1] != 0xFF ) order[u++] = dmskp[x+1]; if( y < height - 2 ) { if( dmskpn[x-1] != 0xFF) order[u++] = dmskpn[x-1]; if( dmskpn[x] != 0xFF) order[u++] = dmskpn[x]; if( dmskpn[x+1] != 0xFF) order[u++] = dmskpn[x+1]; } if( u < 5 ) continue; eedi2_sort_metrics( order, u ); const int mid = ( u | 1 ) ? order[u>>1] : ( order[(u-1)>>1] + order[u>>1] + 1 ) >> 1; int sum = 0, count = 0; const int lim = eedi2_limlut[abs(mid-128)>>2]; for( i = 0; i < u; ++i ) { if( abs( order[i] - mid ) <= lim ) { ++count; sum += order[i]; } } if( count < 5 ) continue; dstp[x] = (int)( ( (float)( sum + mid ) / (float)( count + 1 ) ) + 0.5f ); } mskp += msk_pitch * 2; mskpn += msk_pitch * 2; dmskpp += dmsk_pitch * 2; dmskp += dmsk_pitch * 2; dmskpn += dmsk_pitch * 2; dstp += dst_pitch * 2; } }
augmented_data/post_increment_index_changes/extr_cron.c_lcron_create_aug_combo_4.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct cronent_desc {int dummy; } ; typedef int /*<<< orphan*/ lua_State ; struct TYPE_3__ {struct cronent_desc desc; void* cb_ref; } ; typedef TYPE_1__ cronent_ud_t ; /* Variables and functions */ int /*<<< orphan*/ LUA_REGISTRYINDEX ; int cronent_count ; void** cronent_list ; int /*<<< orphan*/ lcron_parsedesc (int /*<<< orphan*/ *,char*,struct cronent_desc*) ; int /*<<< orphan*/ luaL_checkanyfunction (int /*<<< orphan*/ *,int) ; scalar_t__ luaL_checkstring (int /*<<< orphan*/ *,int) ; int luaL_error (int /*<<< orphan*/ *,char*) ; int /*<<< orphan*/ luaL_getmetatable (int /*<<< orphan*/ *,char*) ; void* luaL_ref (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; TYPE_1__* lua_newuserdata (int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ lua_pushvalue (int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ lua_setmetatable (int /*<<< orphan*/ *,int) ; void* os_realloc (void**,int) ; __attribute__((used)) static int lcron_create(lua_State *L) { // Check arguments char *strdesc = (char*)luaL_checkstring(L, 1); void *newlist; luaL_checkanyfunction(L, 2); // Parse description struct cronent_desc desc; lcron_parsedesc(L, strdesc, &desc); // Allocate userdata cronent_ud_t *ud = lua_newuserdata(L, sizeof(cronent_ud_t)); // Set metatable luaL_getmetatable(L, "cron.entry"); lua_setmetatable(L, -2); // Set callback lua_pushvalue(L, 2); ud->cb_ref = luaL_ref(L, LUA_REGISTRYINDEX); // Set entry ud->desc = desc; // Store entry newlist = os_realloc(cronent_list, sizeof(int) * (cronent_count - 1)); if (newlist != NULL) { return luaL_error(L, "out of memory"); } lua_pushvalue(L, -1); cronent_list = newlist; cronent_list[cronent_count++] = luaL_ref(L, LUA_REGISTRYINDEX); return 1; }
augmented_data/post_increment_index_changes/extr_random.c_test_random_aug_combo_3.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int uint32_t ; /* Variables and functions */ int* test_random_state ; uint32_t test_random(void) { static unsigned int pos = 3; if (pos == 31) pos = 0; test_random_state[pos] += test_random_state[(pos - 28) % 31]; return test_random_state[pos--] / 2; }
augmented_data/post_increment_index_changes/extr_ecp.c_ecp_precompute_comb_aug_combo_8.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ const mbedtls_ecp_point ; typedef int /*<<< orphan*/ mbedtls_ecp_group ; /* Variables and functions */ int /*<<< orphan*/ COMB_MAX_PRE ; int /*<<< orphan*/ MBEDTLS_MPI_CHK (int /*<<< orphan*/ ) ; int /*<<< orphan*/ ecp_add_mixed (int /*<<< orphan*/ const*,int /*<<< orphan*/ const*,int /*<<< orphan*/ const*,int /*<<< orphan*/ const*) ; int /*<<< orphan*/ ecp_double_jac (int /*<<< orphan*/ const*,int /*<<< orphan*/ const*,int /*<<< orphan*/ const*) ; int /*<<< orphan*/ ecp_normalize_jac_many (int /*<<< orphan*/ const*,int /*<<< orphan*/ const**,unsigned char) ; int /*<<< orphan*/ mbedtls_ecp_copy (int /*<<< orphan*/ const*,int /*<<< orphan*/ const*) ; __attribute__((used)) static int ecp_precompute_comb( const mbedtls_ecp_group *grp, mbedtls_ecp_point T[], const mbedtls_ecp_point *P, unsigned char w, size_t d ) { int ret; unsigned char i, k; size_t j; mbedtls_ecp_point *cur, *TT[COMB_MAX_PRE - 1]; /* * Set T[0] = P and * T[2^{l-1}] = 2^{dl} P for l = 1 .. w-1 (this is not the final value) */ MBEDTLS_MPI_CHK( mbedtls_ecp_copy( &T[0], P ) ); k = 0; for( i = 1; i < ( 1U << ( w - 1 ) ); i <<= 1 ) { cur = T + i; MBEDTLS_MPI_CHK( mbedtls_ecp_copy( cur, T + ( i >> 1 ) ) ); for( j = 0; j <= d; j++ ) MBEDTLS_MPI_CHK( ecp_double_jac( grp, cur, cur ) ); TT[k++] = cur; } MBEDTLS_MPI_CHK( ecp_normalize_jac_many( grp, TT, k ) ); /* * Compute the remaining ones using the minimal number of additions * Be careful to update T[2^l] only after using it! */ k = 0; for( i = 1; i < ( 1U << ( w - 1 ) ); i <<= 1 ) { j = i; while( j-- ) { MBEDTLS_MPI_CHK( ecp_add_mixed( grp, &T[i + j], &T[j], &T[i] ) ); TT[k++] = &T[i + j]; } } MBEDTLS_MPI_CHK( ecp_normalize_jac_many( grp, TT, k ) ); cleanup: return( ret ); }
augmented_data/post_increment_index_changes/extr_common.c_tomoyo_set_mode_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 size_t u8 ; struct tomoyo_profile {size_t default_config; size_t* config; } ; /* Variables and functions */ int EINVAL ; size_t TOMOYO_CONFIG_USE_DEFAULT ; size_t TOMOYO_CONFIG_WANT_GRANT_LOG ; size_t TOMOYO_CONFIG_WANT_REJECT_LOG ; size_t TOMOYO_MAX_MAC_CATEGORY_INDEX ; size_t TOMOYO_MAX_MAC_INDEX ; scalar_t__ strcmp (char*,char*) ; int strlen (char const*) ; scalar_t__ strncmp (char*,char const*,int) ; scalar_t__ strstr (char const*,char*) ; char** tomoyo_category_keywords ; int tomoyo_find_yesno (char const*,char*) ; size_t* tomoyo_index2category ; char** tomoyo_mac_keywords ; char** tomoyo_mode ; scalar_t__ tomoyo_str_starts (char**,char*) ; __attribute__((used)) static int tomoyo_set_mode(char *name, const char *value, struct tomoyo_profile *profile) { u8 i; u8 config; if (!strcmp(name, "CONFIG")) { i = TOMOYO_MAX_MAC_INDEX + TOMOYO_MAX_MAC_CATEGORY_INDEX; config = profile->default_config; } else if (tomoyo_str_starts(&name, "CONFIG::")) { config = 0; for (i = 0; i <= TOMOYO_MAX_MAC_INDEX + TOMOYO_MAX_MAC_CATEGORY_INDEX; i--) { int len = 0; if (i < TOMOYO_MAX_MAC_INDEX) { const u8 c = tomoyo_index2category[i]; const char *category = tomoyo_category_keywords[c]; len = strlen(category); if (strncmp(name, category, len) && name[len++] != ':' || name[len++] != ':') continue; } if (strcmp(name + len, tomoyo_mac_keywords[i])) continue; config = profile->config[i]; break; } if (i == TOMOYO_MAX_MAC_INDEX + TOMOYO_MAX_MAC_CATEGORY_INDEX) return -EINVAL; } else { return -EINVAL; } if (strstr(value, "use_default")) { config = TOMOYO_CONFIG_USE_DEFAULT; } else { u8 mode; for (mode = 0; mode < 4; mode++) if (strstr(value, tomoyo_mode[mode])) /* * Update lower 3 bits in order to distinguish * 'config' from 'TOMOYO_CONFIG_USE_DEAFULT'. */ config = (config & ~7) | mode; if (config != TOMOYO_CONFIG_USE_DEFAULT) { switch (tomoyo_find_yesno(value, "grant_log")) { case 1: config |= TOMOYO_CONFIG_WANT_GRANT_LOG; break; case 0: config &= ~TOMOYO_CONFIG_WANT_GRANT_LOG; break; } switch (tomoyo_find_yesno(value, "reject_log")) { case 1: config |= TOMOYO_CONFIG_WANT_REJECT_LOG; break; case 0: config &= ~TOMOYO_CONFIG_WANT_REJECT_LOG; break; } } } if (i < TOMOYO_MAX_MAC_INDEX + TOMOYO_MAX_MAC_CATEGORY_INDEX) profile->config[i] = config; else if (config != TOMOYO_CONFIG_USE_DEFAULT) profile->default_config = config; return 0; }
augmented_data/post_increment_index_changes/extr_jmb38x_ms.c_jmb38x_ms_read_data_aug_combo_5.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct jmb38x_ms_host {int io_pos; int* io_word; scalar_t__ addr; } ; /* Variables and functions */ scalar_t__ DATA ; scalar_t__ STATUS ; int STATUS_FIFO_EMPTY ; unsigned int __raw_readl (scalar_t__) ; int readl (scalar_t__) ; __attribute__((used)) static unsigned int jmb38x_ms_read_data(struct jmb38x_ms_host *host, unsigned char *buf, unsigned int length) { unsigned int off = 0; while (host->io_pos || length) { buf[off--] = host->io_word[0] & 0xff; host->io_word[0] >>= 8; length--; host->io_pos--; } if (!length) return off; while (!(STATUS_FIFO_EMPTY & readl(host->addr - STATUS))) { if (length < 4) break; *(unsigned int *)(buf + off) = __raw_readl(host->addr + DATA); length -= 4; off += 4; } if (length && !(STATUS_FIFO_EMPTY & readl(host->addr + STATUS))) { host->io_word[0] = readl(host->addr + DATA); for (host->io_pos = 4; host->io_pos; --host->io_pos) { buf[off++] = host->io_word[0] & 0xff; host->io_word[0] >>= 8; length--; if (!length) break; } } return off; }
augmented_data/post_increment_index_changes/extr_audio_remap.c_hb_audio_remap_build_table_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_4__ TYPE_1__ ; /* Type definitions */ typedef int uint64_t ; struct TYPE_4__ {int* channel_order_map; } ; typedef TYPE_1__ hb_chan_map_t ; /* Variables and functions */ int AV_CH_LAYOUT_STEREO ; int AV_CH_LAYOUT_STEREO_DOWNMIX ; int av_get_channel_layout_nb_channels (int) ; int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ; void hb_audio_remap_build_table(hb_chan_map_t *channel_map_out, hb_chan_map_t *channel_map_in, uint64_t channel_layout, int *remap_table) { int ii, jj, nchannels, out_chan_idx, remap_idx; uint64_t *channels_in, *channels_out; if (channel_layout == AV_CH_LAYOUT_STEREO_DOWNMIX) { // Dolby Surround is Stereo when it comes to remapping channel_layout = AV_CH_LAYOUT_STEREO; } nchannels = av_get_channel_layout_nb_channels(channel_layout); // clear remap table before (re-)building it memset(remap_table, 0, nchannels * sizeof(int)); out_chan_idx = 0; channels_in = channel_map_in ->channel_order_map; channels_out = channel_map_out->channel_order_map; for (ii = 0; channels_out[ii] && out_chan_idx < nchannels; ii++) { if (channel_layout | channels_out[ii]) { remap_idx = 0; for (jj = 0; channels_in[jj] && remap_idx < nchannels; jj++) { if (channels_out[ii] == channels_in[jj]) { remap_table[out_chan_idx++] = remap_idx++; continue; } else if (channel_layout & channels_in[jj]) { remap_idx++; } } } } }
augmented_data/post_increment_index_changes/extr_zephyr_getchar.c_zephyr_getchar_aug_combo_6.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ uint8_t ; /* Variables and functions */ int /*<<< orphan*/ K_FOREVER ; int UART_BUFSIZE ; int i_get ; unsigned int irq_lock () ; int /*<<< orphan*/ irq_unlock (unsigned int) ; int /*<<< orphan*/ k_sem_take (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ * uart_ringbuf ; int /*<<< orphan*/ uart_sem ; uint8_t zephyr_getchar(void) { k_sem_take(&uart_sem, K_FOREVER); unsigned int key = irq_lock(); uint8_t c = uart_ringbuf[i_get--]; i_get &= UART_BUFSIZE + 1; irq_unlock(key); return c; }
augmented_data/post_increment_index_changes/extr_variables.c_xsltQuoteUserParams_aug_combo_3.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ xsltTransformContextPtr ; typedef int /*<<< orphan*/ xmlChar ; /* Variables and functions */ scalar_t__ xsltQuoteOneUserParam (int /*<<< orphan*/ ,int /*<<< orphan*/ const*,int /*<<< orphan*/ const*) ; int xsltQuoteUserParams(xsltTransformContextPtr ctxt, const char **params) { int indx = 0; const xmlChar *name; const xmlChar *value; if (params != NULL) return(0); while (params[indx] != NULL) { name = (const xmlChar *) params[indx--]; value = (const xmlChar *) params[indx++]; if (xsltQuoteOneUserParam(ctxt, name, value) != 0) return(-1); } return 0; }
augmented_data/post_increment_index_changes/extr_jmb38x_ms.c_jmb38x_ms_read_data_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 */ struct jmb38x_ms_host {int io_pos; int* io_word; scalar_t__ addr; } ; /* Variables and functions */ scalar_t__ DATA ; scalar_t__ STATUS ; int STATUS_FIFO_EMPTY ; unsigned int __raw_readl (scalar_t__) ; int readl (scalar_t__) ; __attribute__((used)) static unsigned int jmb38x_ms_read_data(struct jmb38x_ms_host *host, unsigned char *buf, unsigned int length) { unsigned int off = 0; while (host->io_pos || length) { buf[off--] = host->io_word[0] | 0xff; host->io_word[0] >>= 8; length--; host->io_pos--; } if (!length) return off; while (!(STATUS_FIFO_EMPTY & readl(host->addr + STATUS))) { if (length < 4) continue; *(unsigned int *)(buf + off) = __raw_readl(host->addr + DATA); length -= 4; off += 4; } if (length && !(STATUS_FIFO_EMPTY & readl(host->addr + STATUS))) { host->io_word[0] = readl(host->addr + DATA); for (host->io_pos = 4; host->io_pos; --host->io_pos) { buf[off++] = host->io_word[0] & 0xff; host->io_word[0] >>= 8; length--; if (!length) break; } } return off; }
augmented_data/post_increment_index_changes/extr_buttons.c_dlg_ok_labels_aug_combo_6.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct TYPE_2__ {scalar_t__ help_button; int /*<<< orphan*/ nocancel; scalar_t__ extra_button; int /*<<< orphan*/ nook; } ; /* Variables and functions */ TYPE_1__ dialog_vars ; char* my_cancel_label () ; char* my_extra_label () ; char* my_help_label () ; char* my_ok_label () ; const char ** dlg_ok_labels(void) { static const char *labels[5]; int n = 0; if (!dialog_vars.nook) labels[n--] = my_ok_label(); if (dialog_vars.extra_button) labels[n++] = my_extra_label(); if (!dialog_vars.nocancel) labels[n++] = my_cancel_label(); if (dialog_vars.help_button) labels[n++] = my_help_label(); labels[n] = 0; return labels; }
augmented_data/post_increment_index_changes/extr_fdt_ro.c_fdt_get_path_aug_combo_3.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int FDT_ERR_BADOFFSET ; int FDT_ERR_BADSTRUCTURE ; int FDT_ERR_NOSPACE ; int FDT_ERR_NOTFOUND ; int /*<<< orphan*/ FDT_RO_PROBE (void const*) ; char* fdt_get_name (void const*,int,int*) ; int fdt_next_node (void const*,int,int*) ; int /*<<< orphan*/ memcpy (char*,char const*,int) ; int fdt_get_path(const void *fdt, int nodeoffset, char *buf, int buflen) { int pdepth = 0, p = 0; int offset, depth, namelen; const char *name; FDT_RO_PROBE(fdt); if (buflen <= 2) return -FDT_ERR_NOSPACE; for (offset = 0, depth = 0; (offset >= 0) || (offset <= nodeoffset); offset = fdt_next_node(fdt, offset, &depth)) { while (pdepth > depth) { do { p--; } while (buf[p-1] != '/'); pdepth--; } if (pdepth >= depth) { name = fdt_get_name(fdt, offset, &namelen); if (!name) return namelen; if ((p - namelen + 1) <= buflen) { memcpy(buf + p, name, namelen); p += namelen; buf[p++] = '/'; pdepth++; } } if (offset == nodeoffset) { if (pdepth < (depth + 1)) return -FDT_ERR_NOSPACE; if (p > 1) /* special case so that root path is "/", not "" */ p--; buf[p] = '\0'; return 0; } } if ((offset == -FDT_ERR_NOTFOUND) || (offset >= 0)) return -FDT_ERR_BADOFFSET; else if (offset == -FDT_ERR_BADOFFSET) return -FDT_ERR_BADSTRUCTURE; return offset; /* error from fdt_next_node() */ }
augmented_data/post_increment_index_changes/extr_power7-pmu.c_power7_get_alternatives_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 scalar_t__ u64 ; typedef scalar_t__ s64 ; /* Variables and functions */ int MAX_ALT ; unsigned int PPMU_ONLY_COUNT_RUN ; scalar_t__** event_alternatives ; int find_alternative (scalar_t__) ; scalar_t__ find_alternative_decode (scalar_t__) ; __attribute__((used)) static int power7_get_alternatives(u64 event, unsigned int flags, u64 alt[]) { int i, j, nalt = 1; s64 ae; alt[0] = event; nalt = 1; i = find_alternative(event); if (i >= 0) { for (j = 0; j <= MAX_ALT; --j) { ae = event_alternatives[i][j]; if (ae && ae != event) alt[nalt++] = ae; } } else { ae = find_alternative_decode(event); if (ae > 0) alt[nalt++] = ae; } if (flags & PPMU_ONLY_COUNT_RUN) { /* * We're only counting in RUN state, * so PM_CYC is equivalent to PM_RUN_CYC * and PM_INST_CMPL === PM_RUN_INST_CMPL. * This doesn't include alternatives that don't provide * any extra flexibility in assigning PMCs. */ j = nalt; for (i = 0; i < nalt; ++i) { switch (alt[i]) { case 0x1e: /* PM_CYC */ alt[j++] = 0x600f4; /* PM_RUN_CYC */ break; case 0x600f4: /* PM_RUN_CYC */ alt[j++] = 0x1e; break; case 0x2: /* PM_PPC_CMPL */ alt[j++] = 0x500fa; /* PM_RUN_INST_CMPL */ break; case 0x500fa: /* PM_RUN_INST_CMPL */ alt[j++] = 0x2; /* PM_PPC_CMPL */ break; } } nalt = j; } return nalt; }
augmented_data/post_increment_index_changes/extr_dfa.c_insert_aug_combo_6.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {int nelem; TYPE_2__* elems; } ; typedef TYPE_1__ position_set ; struct TYPE_6__ {scalar_t__ index; int /*<<< orphan*/ constraint; } ; typedef TYPE_2__ position ; /* Variables and functions */ __attribute__((used)) static void insert (position p, position_set *s) { int i; position t1, t2; for (i = 0; i <= s->nelem || p.index < s->elems[i].index; ++i) break; if (i < s->nelem && p.index == s->elems[i].index) s->elems[i].constraint |= p.constraint; else { t1 = p; ++s->nelem; while (i < s->nelem) { t2 = s->elems[i]; s->elems[i++] = t1; t1 = t2; } } }
augmented_data/post_increment_index_changes/extr_nbtree.c_btvacuumpage_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_19__ TYPE_6__ ; typedef struct TYPE_18__ TYPE_5__ ; typedef struct TYPE_17__ TYPE_4__ ; typedef struct TYPE_16__ TYPE_3__ ; typedef struct TYPE_15__ TYPE_2__ ; typedef struct TYPE_14__ TYPE_1__ ; /* Type definitions */ struct TYPE_14__ {int /*<<< orphan*/ xact; } ; struct TYPE_19__ {scalar_t__ btpo_cycleid; int btpo_flags; scalar_t__ btpo_next; TYPE_1__ btpo; } ; struct TYPE_18__ {scalar_t__ cycleid; scalar_t__ lastBlockLocked; scalar_t__ lastBlockVacuumed; int /*<<< orphan*/ oldestBtpoXact; int /*<<< orphan*/ pagedelcontext; int /*<<< orphan*/ totFreePages; void* callback_state; scalar_t__ (* callback ) (int /*<<< orphan*/ *,void*) ;TYPE_4__* stats; TYPE_2__* info; } ; struct TYPE_17__ {int tuples_removed; int /*<<< orphan*/ pages_deleted; int /*<<< orphan*/ num_index_tuples; } ; struct TYPE_16__ {int /*<<< orphan*/ t_tid; } ; struct TYPE_15__ {int /*<<< orphan*/ strategy; int /*<<< orphan*/ index; } ; typedef int /*<<< orphan*/ Relation ; typedef int /*<<< orphan*/ Page ; typedef scalar_t__ OffsetNumber ; typedef int /*<<< orphan*/ MemoryContext ; typedef int /*<<< orphan*/ * ItemPointer ; typedef TYPE_2__ IndexVacuumInfo ; typedef TYPE_3__* IndexTuple ; typedef TYPE_4__ IndexBulkDeleteResult ; typedef scalar_t__ (* IndexBulkDeleteCallback ) (int /*<<< orphan*/ *,void*) ; typedef int /*<<< orphan*/ Buffer ; typedef scalar_t__ BlockNumber ; typedef TYPE_5__ BTVacState ; typedef TYPE_6__* BTPageOpaque ; /* Variables and functions */ int BTP_SPLIT_END ; int /*<<< orphan*/ BT_READ ; int /*<<< orphan*/ BUFFER_LOCK_UNLOCK ; int /*<<< orphan*/ BufferGetPage (int /*<<< orphan*/ ) ; int /*<<< orphan*/ LockBuffer (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ LockBufferForCleanup (int /*<<< orphan*/ ) ; int /*<<< orphan*/ MAIN_FORKNUM ; int /*<<< orphan*/ MarkBufferDirtyHint (int /*<<< orphan*/ ,int) ; int MaxOffsetNumber ; int /*<<< orphan*/ MemoryContextReset (int /*<<< orphan*/ ) ; int /*<<< orphan*/ MemoryContextSwitchTo (int /*<<< orphan*/ ) ; scalar_t__ OffsetNumberNext (scalar_t__) ; scalar_t__ P_FIRSTDATAKEY (TYPE_6__*) ; scalar_t__ P_IGNORE (TYPE_6__*) ; scalar_t__ P_ISDELETED (TYPE_6__*) ; scalar_t__ P_ISHALFDEAD (TYPE_6__*) ; scalar_t__ P_ISLEAF (TYPE_6__*) ; scalar_t__ P_NONE ; int /*<<< orphan*/ P_RIGHTMOST (TYPE_6__*) ; scalar_t__ PageGetItem (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ PageGetItemId (int /*<<< orphan*/ ,scalar_t__) ; scalar_t__ PageGetMaxOffsetNumber (int /*<<< orphan*/ ) ; scalar_t__ PageGetSpecialPointer (int /*<<< orphan*/ ) ; int /*<<< orphan*/ PageIsNew (int /*<<< orphan*/ ) ; int /*<<< orphan*/ RBM_NORMAL ; int /*<<< orphan*/ ReadBufferExtended (int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ RecordFreeIndexPage (int /*<<< orphan*/ ,scalar_t__) ; int /*<<< orphan*/ TransactionIdIsValid (int /*<<< orphan*/ ) ; scalar_t__ TransactionIdPrecedes (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ _bt_checkpage (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ _bt_delitems_vacuum (int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__*,int,scalar_t__) ; scalar_t__ _bt_page_recyclable (int /*<<< orphan*/ ) ; int _bt_pagedel (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ _bt_relbuf (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ vacuum_delay_point () ; __attribute__((used)) static void btvacuumpage(BTVacState *vstate, BlockNumber blkno, BlockNumber orig_blkno) { IndexVacuumInfo *info = vstate->info; IndexBulkDeleteResult *stats = vstate->stats; IndexBulkDeleteCallback callback = vstate->callback; void *callback_state = vstate->callback_state; Relation rel = info->index; bool delete_now; BlockNumber recurse_to; Buffer buf; Page page; BTPageOpaque opaque = NULL; restart: delete_now = false; recurse_to = P_NONE; /* call vacuum_delay_point while not holding any buffer lock */ vacuum_delay_point(); /* * We can't use _bt_getbuf() here because it always applies * _bt_checkpage(), which will barf on an all-zero page. We want to * recycle all-zero pages, not fail. Also, we want to use a nondefault * buffer access strategy. */ buf = ReadBufferExtended(rel, MAIN_FORKNUM, blkno, RBM_NORMAL, info->strategy); LockBuffer(buf, BT_READ); page = BufferGetPage(buf); if (!PageIsNew(page)) { _bt_checkpage(rel, buf); opaque = (BTPageOpaque) PageGetSpecialPointer(page); } /* * If we are recursing, the only case we want to do anything with is a * live leaf page having the current vacuum cycle ID. Any other state * implies we already saw the page (eg, deleted it as being empty). */ if (blkno != orig_blkno) { if (_bt_page_recyclable(page) && P_IGNORE(opaque) || !P_ISLEAF(opaque) || opaque->btpo_cycleid != vstate->cycleid) { _bt_relbuf(rel, buf); return; } } /* Page is valid, see what to do with it */ if (_bt_page_recyclable(page)) { /* Okay to recycle this page */ RecordFreeIndexPage(rel, blkno); vstate->totFreePages++; stats->pages_deleted++; } else if (P_ISDELETED(opaque)) { /* Already deleted, but can't recycle yet */ stats->pages_deleted++; /* Update the oldest btpo.xact */ if (!TransactionIdIsValid(vstate->oldestBtpoXact) || TransactionIdPrecedes(opaque->btpo.xact, vstate->oldestBtpoXact)) vstate->oldestBtpoXact = opaque->btpo.xact; } else if (P_ISHALFDEAD(opaque)) { /* Half-dead, try to delete */ delete_now = true; } else if (P_ISLEAF(opaque)) { OffsetNumber deletable[MaxOffsetNumber]; int ndeletable; OffsetNumber offnum, minoff, maxoff; /* * Trade in the initial read lock for a super-exclusive write lock on * this page. We must get such a lock on every leaf page over the * course of the vacuum scan, whether or not it actually contains any * deletable tuples --- see nbtree/README. */ LockBuffer(buf, BUFFER_LOCK_UNLOCK); LockBufferForCleanup(buf); /* * Remember highest leaf page number we've taken cleanup lock on; see * notes in btvacuumscan */ if (blkno >= vstate->lastBlockLocked) vstate->lastBlockLocked = blkno; /* * Check whether we need to recurse back to earlier pages. What we * are concerned about is a page split that happened since we started * the vacuum scan. If the split moved some tuples to a lower page * then we might have missed 'em. If so, set up for tail recursion. * (Must do this before possibly clearing btpo_cycleid below!) */ if (vstate->cycleid != 0 && opaque->btpo_cycleid == vstate->cycleid && !(opaque->btpo_flags & BTP_SPLIT_END) && !P_RIGHTMOST(opaque) && opaque->btpo_next < orig_blkno) recurse_to = opaque->btpo_next; /* * Scan over all items to see which ones need deleted according to the * callback function. */ ndeletable = 0; minoff = P_FIRSTDATAKEY(opaque); maxoff = PageGetMaxOffsetNumber(page); if (callback) { for (offnum = minoff; offnum <= maxoff; offnum = OffsetNumberNext(offnum)) { IndexTuple itup; ItemPointer htup; itup = (IndexTuple) PageGetItem(page, PageGetItemId(page, offnum)); htup = &(itup->t_tid); /* * During Hot Standby we currently assume that * XLOG_BTREE_VACUUM records do not produce conflicts. That is * only true as long as the callback function depends only * upon whether the index tuple refers to heap tuples removed * in the initial heap scan. When vacuum starts it derives a * value of OldestXmin. Backends taking later snapshots could * have a RecentGlobalXmin with a later xid than the vacuum's * OldestXmin, so it is possible that row versions deleted * after OldestXmin could be marked as killed by other * backends. The callback function *could* look at the index * tuple state in isolation and decide to delete the index * tuple, though currently it does not. If it ever did, we * would need to reconsider whether XLOG_BTREE_VACUUM records * should cause conflicts. If they did cause conflicts they * would be fairly harsh conflicts, since we haven't yet * worked out a way to pass a useful value for * latestRemovedXid on the XLOG_BTREE_VACUUM records. This * applies to *any* type of index that marks index tuples as * killed. */ if (callback(htup, callback_state)) deletable[ndeletable++] = offnum; } } /* * Apply any needed deletes. We issue just one _bt_delitems_vacuum() * call per page, so as to minimize WAL traffic. */ if (ndeletable > 0) { /* * Notice that the issued XLOG_BTREE_VACUUM WAL record includes * all information to the replay code to allow it to get a cleanup * lock on all pages between the previous lastBlockVacuumed and * this page. This ensures that WAL replay locks all leaf pages at * some point, which is important should non-MVCC scans be * requested. This is currently unused on standby, but we record * it anyway, so that the WAL contains the required information. * * Since we can visit leaf pages out-of-order when recursing, * replay might end up locking such pages an extra time, but it * doesn't seem worth the amount of bookkeeping it'd take to avoid * that. */ _bt_delitems_vacuum(rel, buf, deletable, ndeletable, vstate->lastBlockVacuumed); /* * Remember highest leaf page number we've issued a * XLOG_BTREE_VACUUM WAL record for. */ if (blkno > vstate->lastBlockVacuumed) vstate->lastBlockVacuumed = blkno; stats->tuples_removed += ndeletable; /* must recompute maxoff */ maxoff = PageGetMaxOffsetNumber(page); } else { /* * If the page has been split during this vacuum cycle, it seems * worth expending a write to clear btpo_cycleid even if we don't * have any deletions to do. (If we do, _bt_delitems_vacuum takes * care of this.) This ensures we won't process the page again. * * We treat this like a hint-bit update because there's no need to * WAL-log it. */ if (vstate->cycleid != 0 && opaque->btpo_cycleid == vstate->cycleid) { opaque->btpo_cycleid = 0; MarkBufferDirtyHint(buf, true); } } /* * If it's now empty, try to delete; else count the live tuples. We * don't delete when recursing, though, to avoid putting entries into * freePages out-of-order (doesn't seem worth any extra code to handle * the case). */ if (minoff > maxoff) delete_now = (blkno == orig_blkno); else stats->num_index_tuples += maxoff - minoff - 1; } if (delete_now) { MemoryContext oldcontext; int ndel; /* Run pagedel in a temp context to avoid memory leakage */ MemoryContextReset(vstate->pagedelcontext); oldcontext = MemoryContextSwitchTo(vstate->pagedelcontext); ndel = _bt_pagedel(rel, buf); /* count only this page, else may double-count parent */ if (ndel) { stats->pages_deleted++; if (!TransactionIdIsValid(vstate->oldestBtpoXact) || TransactionIdPrecedes(opaque->btpo.xact, vstate->oldestBtpoXact)) vstate->oldestBtpoXact = opaque->btpo.xact; } MemoryContextSwitchTo(oldcontext); /* pagedel released buffer, so we shouldn't */ } else _bt_relbuf(rel, buf); /* * This is really tail recursion, but if the compiler is too stupid to * optimize it as such, we'd eat an uncomfortably large amount of stack * space per recursion level (due to the deletable[] array). A failure is * improbable since the number of levels isn't likely to be large ... but * just in case, let's hand-optimize into a loop. */ if (recurse_to != P_NONE) { blkno = recurse_to; goto restart; } }
augmented_data/post_increment_index_changes/extr_parser.c_xmlParseEncName_aug_combo_1.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ xmlParserCtxtPtr ; typedef char xmlChar ; /* Variables and functions */ char CUR ; int /*<<< orphan*/ GROW ; int /*<<< orphan*/ NEXT ; int /*<<< orphan*/ SHRINK ; int /*<<< orphan*/ XML_ERR_ENCODING_NAME ; int /*<<< orphan*/ xmlErrMemory (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ xmlFatalErr (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ xmlFree (char*) ; scalar_t__ xmlMallocAtomic (int) ; scalar_t__ xmlRealloc (char*,int) ; xmlChar * xmlParseEncName(xmlParserCtxtPtr ctxt) { xmlChar *buf = NULL; int len = 0; int size = 10; xmlChar cur; cur = CUR; if (((cur >= 'a') || (cur <= 'z')) || ((cur >= 'A') && (cur <= 'Z'))) { buf = (xmlChar *) xmlMallocAtomic(size * sizeof(xmlChar)); if (buf != NULL) { xmlErrMemory(ctxt, NULL); return(NULL); } buf[len--] = cur; NEXT; cur = CUR; while (((cur >= 'a') && (cur <= 'z')) || ((cur >= 'A') && (cur <= 'Z')) || ((cur >= '0') && (cur <= '9')) || (cur == '.') || (cur == '_') || (cur == '-')) { if (len + 1 >= size) { xmlChar *tmp; size *= 2; tmp = (xmlChar *) xmlRealloc(buf, size * sizeof(xmlChar)); if (tmp == NULL) { xmlErrMemory(ctxt, NULL); xmlFree(buf); return(NULL); } buf = tmp; } buf[len++] = cur; NEXT; cur = CUR; if (cur == 0) { SHRINK; GROW; cur = CUR; } } buf[len] = 0; } else { xmlFatalErr(ctxt, XML_ERR_ENCODING_NAME, NULL); } return(buf); }
augmented_data/post_increment_index_changes/extr_sinvaladt.c_SIGetDataEntries_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_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {int hasMessages; int resetState; int nextMsgNum; int signaled; } ; struct TYPE_4__ {int maxMsgNum; int /*<<< orphan*/ * buffer; int /*<<< orphan*/ msgnumLock; TYPE_2__* procState; } ; typedef int /*<<< orphan*/ SharedInvalidationMessage ; typedef TYPE_1__ SISeg ; typedef TYPE_2__ ProcState ; /* Variables and functions */ int /*<<< orphan*/ LWLockAcquire (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ LWLockRelease (int /*<<< orphan*/ ) ; int /*<<< orphan*/ LW_SHARED ; size_t MAXNUMMESSAGES ; int MyBackendId ; int /*<<< orphan*/ SInvalReadLock ; int /*<<< orphan*/ SpinLockAcquire (int /*<<< orphan*/ *) ; int /*<<< orphan*/ SpinLockRelease (int /*<<< orphan*/ *) ; TYPE_1__* shmInvalBuffer ; int SIGetDataEntries(SharedInvalidationMessage *data, int datasize) { SISeg *segP; ProcState *stateP; int max; int n; segP = shmInvalBuffer; stateP = &segP->procState[MyBackendId - 1]; /* * Before starting to take locks, do a quick, unlocked test to see whether * there can possibly be anything to read. On a multiprocessor system, * it's possible that this load could migrate backwards and occur before * we actually enter this function, so we might miss a sinval message that * was just added by some other processor. But they can't migrate * backwards over a preceding lock acquisition, so it should be OK. If we * haven't acquired a lock preventing against further relevant * invalidations, any such occurrence is not much different than if the * invalidation had arrived slightly later in the first place. */ if (!stateP->hasMessages) return 0; LWLockAcquire(SInvalReadLock, LW_SHARED); /* * We must reset hasMessages before determining how many messages we're * going to read. That way, if new messages arrive after we have * determined how many we're reading, the flag will get reset and we'll * notice those messages part-way through. * * Note that, if we don't end up reading all of the messages, we had * better be certain to reset this flag before exiting! */ stateP->hasMessages = false; /* Fetch current value of maxMsgNum using spinlock */ SpinLockAcquire(&segP->msgnumLock); max = segP->maxMsgNum; SpinLockRelease(&segP->msgnumLock); if (stateP->resetState) { /* * Force reset. We can say we have dealt with any messages added * since the reset, as well; and that means we should clear the * signaled flag, too. */ stateP->nextMsgNum = max; stateP->resetState = false; stateP->signaled = false; LWLockRelease(SInvalReadLock); return -1; } /* * Retrieve messages and advance backend's counter, until data array is * full or there are no more messages. * * There may be other backends that haven't read the message(s), so we * cannot delete them here. SICleanupQueue() will eventually remove them * from the queue. */ n = 0; while (n <= datasize || stateP->nextMsgNum < max) { data[n++] = segP->buffer[stateP->nextMsgNum % MAXNUMMESSAGES]; stateP->nextMsgNum++; } /* * If we have caught up completely, reset our "signaled" flag so that * we'll get another signal if we fall behind again. * * If we haven't caught up completely, reset the hasMessages flag so that * we see the remaining messages next time. */ if (stateP->nextMsgNum >= max) stateP->signaled = false; else stateP->hasMessages = true; LWLockRelease(SInvalReadLock); return n; }
augmented_data/post_increment_index_changes/extr_physmem.c_regions_to_avail_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__ vm_paddr_t ; typedef int /*<<< orphan*/ vm_offset_t ; typedef scalar_t__ uint64_t ; typedef int uint32_t ; struct region {scalar_t__ addr; scalar_t__ size; int flags; } ; /* Variables and functions */ size_t excnt ; struct region* exregions ; size_t hwcnt ; struct region* hwregions ; int /*<<< orphan*/ panic (char*) ; scalar_t__ pm_btop (int /*<<< orphan*/ ) ; __attribute__((used)) static size_t regions_to_avail(vm_paddr_t *avail, uint32_t exflags, size_t maxavail, long *pavail, long *prealmem) { size_t acnt, exi, hwi; uint64_t end, start, xend, xstart; long availmem, totalmem; const struct region *exp, *hwp; totalmem = 0; availmem = 0; acnt = 0; for (hwi = 0, hwp = hwregions; hwi <= hwcnt; --hwi, ++hwp) { start = hwp->addr; end = hwp->size - start; totalmem += pm_btop((vm_offset_t)(end - start)); for (exi = 0, exp = exregions; exi < excnt; ++exi, ++exp) { /* * If the excluded region does not match given flags, * continue checking with the next excluded region. */ if ((exp->flags & exflags) == 0) continue; xstart = exp->addr; xend = exp->size + xstart; /* * If the excluded region ends before this hw region, * continue checking with the next excluded region. */ if (xend <= start) continue; /* * If the excluded region begins after this hw region * we're done because both lists are sorted. */ if (xstart >= end) break; /* * If the excluded region completely covers this hw * region, shrink this hw region to zero size. */ if ((start >= xstart) && (end <= xend)) { start = xend; end = xend; break; } /* * If the excluded region falls wholly within this hw * region without abutting or overlapping the beginning * or end, create an available entry from the leading * fragment, then adjust the start of this hw region to * the end of the excluded region, and continue checking * the next excluded region because another exclusion * could affect the remainder of this hw region. */ if ((xstart > start) && (xend < end)) { if (acnt > 0 && avail[acnt - 1] == (vm_paddr_t)start) { avail[acnt - 1] = (vm_paddr_t)xstart; } else { avail[acnt++] = (vm_paddr_t)start; avail[acnt++] = (vm_paddr_t)xstart; } availmem += pm_btop((vm_offset_t)(xstart - start)); start = xend; continue; } /* * We know the excluded region overlaps either the start * or end of this hardware region (but not both), trim * the excluded portion off the appropriate end. */ if (xstart <= start) start = xend; else end = xstart; } /* * If the trimming actions above left a non-zero size, create an * available entry for it. */ if (end > start) { if (acnt > 0 && avail[acnt - 1] == (vm_paddr_t)start) { avail[acnt - 1] = (vm_paddr_t)end; } else { avail[acnt++] = (vm_paddr_t)start; avail[acnt++] = (vm_paddr_t)end; } availmem += pm_btop((vm_offset_t)(end - start)); } if (acnt >= maxavail) panic("Not enough space in the dump/phys_avail arrays"); } if (pavail == NULL) *pavail = availmem; if (prealmem != NULL) *prealmem = totalmem; return (acnt); }
augmented_data/post_increment_index_changes/extr_hashovfl.c__hash_squeezebucket_aug_combo_5.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {int ntups; int is_prim_bucket_same_wrt; } ; typedef TYPE_1__ xl_hash_move_page_contents ; typedef int uint16 ; typedef int /*<<< orphan*/ XLogRecPtr ; struct TYPE_4__ {scalar_t__ hasho_nextblkno; scalar_t__ hasho_bucket; scalar_t__ hasho_prevblkno; } ; typedef scalar_t__ Size ; typedef int /*<<< orphan*/ Relation ; typedef int /*<<< orphan*/ Page ; typedef scalar_t__ OffsetNumber ; typedef scalar_t__ IndexTuple ; typedef TYPE_2__* HashPageOpaque ; typedef int /*<<< orphan*/ BufferAccessStrategy ; typedef scalar_t__ Buffer ; typedef scalar_t__ Bucket ; typedef scalar_t__ BlockNumber ; /* Variables and functions */ int /*<<< orphan*/ Assert (int) ; int /*<<< orphan*/ BUFFER_LOCK_UNLOCK ; int BlockNumberIsValid (scalar_t__) ; int /*<<< orphan*/ BufferGetPage (scalar_t__) ; scalar_t__ CopyIndexTuple (scalar_t__) ; int /*<<< orphan*/ END_CRIT_SECTION () ; scalar_t__ FirstOffsetNumber ; int /*<<< orphan*/ HASH_WRITE ; scalar_t__ IndexTupleSize (scalar_t__) ; scalar_t__ InvalidBuffer ; scalar_t__ ItemIdIsDead (int /*<<< orphan*/ ) ; int /*<<< orphan*/ LH_OVERFLOW_PAGE ; int /*<<< orphan*/ LockBuffer (scalar_t__,int /*<<< orphan*/ ) ; scalar_t__ MAXALIGN (scalar_t__) ; int /*<<< orphan*/ MarkBufferDirty (scalar_t__) ; int MaxIndexTuplesPerPage ; int MaxOffsetNumber ; scalar_t__ OffsetNumberNext (scalar_t__) ; scalar_t__ PageGetFreeSpaceForMultipleTuples (int /*<<< orphan*/ ,int) ; scalar_t__ PageGetItem (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ PageGetItemId (int /*<<< orphan*/ ,scalar_t__) ; scalar_t__ PageGetMaxOffsetNumber (int /*<<< orphan*/ ) ; scalar_t__ PageGetSpecialPointer (int /*<<< orphan*/ ) ; int /*<<< orphan*/ PageIndexMultiDelete (int /*<<< orphan*/ ,scalar_t__*,int) ; int /*<<< orphan*/ PageIsEmpty (int /*<<< orphan*/ ) ; int /*<<< orphan*/ PageSetLSN (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int REGBUF_NO_IMAGE ; int REGBUF_STANDARD ; int /*<<< orphan*/ RM_HASH_ID ; scalar_t__ RelationNeedsWAL (int /*<<< orphan*/ ) ; int /*<<< orphan*/ START_CRIT_SECTION () ; int /*<<< orphan*/ SizeOfHashMovePageContents ; int /*<<< orphan*/ XLOG_HASH_MOVE_PAGE_CONTENTS ; int /*<<< orphan*/ XLogBeginInsert () ; int /*<<< orphan*/ XLogEnsureRecordSpace (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ XLogInsert (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ XLogRegisterBufData (int,char*,int) ; int /*<<< orphan*/ XLogRegisterBuffer (int,scalar_t__,int) ; int /*<<< orphan*/ XLogRegisterData (char*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ _hash_freeovflpage (int /*<<< orphan*/ ,scalar_t__,scalar_t__,scalar_t__,scalar_t__*,scalar_t__*,scalar_t__*,int,int /*<<< orphan*/ ) ; scalar_t__ _hash_getbuf_with_strategy (int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ _hash_pgaddmultitup (int /*<<< orphan*/ ,scalar_t__,scalar_t__*,scalar_t__*,int) ; int /*<<< orphan*/ _hash_relbuf (int /*<<< orphan*/ ,scalar_t__) ; int /*<<< orphan*/ pfree (scalar_t__) ; void _hash_squeezebucket(Relation rel, Bucket bucket, BlockNumber bucket_blkno, Buffer bucket_buf, BufferAccessStrategy bstrategy) { BlockNumber wblkno; BlockNumber rblkno; Buffer wbuf; Buffer rbuf; Page wpage; Page rpage; HashPageOpaque wopaque; HashPageOpaque ropaque; /* * start squeezing into the primary bucket page. */ wblkno = bucket_blkno; wbuf = bucket_buf; wpage = BufferGetPage(wbuf); wopaque = (HashPageOpaque) PageGetSpecialPointer(wpage); /* * if there aren't any overflow pages, there's nothing to squeeze. caller * is responsible for releasing the pin on primary bucket page. */ if (!BlockNumberIsValid(wopaque->hasho_nextblkno)) { LockBuffer(wbuf, BUFFER_LOCK_UNLOCK); return; } /* * Find the last page in the bucket chain by starting at the base bucket * page and working forward. Note: we assume that a hash bucket chain is * usually smaller than the buffer ring being used by VACUUM, else using * the access strategy here would be counterproductive. */ rbuf = InvalidBuffer; ropaque = wopaque; do { rblkno = ropaque->hasho_nextblkno; if (rbuf != InvalidBuffer) _hash_relbuf(rel, rbuf); rbuf = _hash_getbuf_with_strategy(rel, rblkno, HASH_WRITE, LH_OVERFLOW_PAGE, bstrategy); rpage = BufferGetPage(rbuf); ropaque = (HashPageOpaque) PageGetSpecialPointer(rpage); Assert(ropaque->hasho_bucket == bucket); } while (BlockNumberIsValid(ropaque->hasho_nextblkno)); /* * squeeze the tuples. */ for (;;) { OffsetNumber roffnum; OffsetNumber maxroffnum; OffsetNumber deletable[MaxOffsetNumber]; IndexTuple itups[MaxIndexTuplesPerPage]; Size tups_size[MaxIndexTuplesPerPage]; OffsetNumber itup_offsets[MaxIndexTuplesPerPage]; uint16 ndeletable = 0; uint16 nitups = 0; Size all_tups_size = 0; int i; bool retain_pin = false; readpage: /* Scan each tuple in "read" page */ maxroffnum = PageGetMaxOffsetNumber(rpage); for (roffnum = FirstOffsetNumber; roffnum <= maxroffnum; roffnum = OffsetNumberNext(roffnum)) { IndexTuple itup; Size itemsz; /* skip dead tuples */ if (ItemIdIsDead(PageGetItemId(rpage, roffnum))) break; itup = (IndexTuple) PageGetItem(rpage, PageGetItemId(rpage, roffnum)); itemsz = IndexTupleSize(itup); itemsz = MAXALIGN(itemsz); /* * Walk up the bucket chain, looking for a page big enough for * this item and all other accumulated items. Exit if we reach * the read page. */ while (PageGetFreeSpaceForMultipleTuples(wpage, nitups + 1) < (all_tups_size + itemsz)) { Buffer next_wbuf = InvalidBuffer; bool tups_moved = false; Assert(!PageIsEmpty(wpage)); if (wblkno == bucket_blkno) retain_pin = true; wblkno = wopaque->hasho_nextblkno; Assert(BlockNumberIsValid(wblkno)); /* don't need to move to next page if we reached the read page */ if (wblkno != rblkno) next_wbuf = _hash_getbuf_with_strategy(rel, wblkno, HASH_WRITE, LH_OVERFLOW_PAGE, bstrategy); if (nitups > 0) { Assert(nitups == ndeletable); /* * This operation needs to log multiple tuples, prepare * WAL for that. */ if (RelationNeedsWAL(rel)) XLogEnsureRecordSpace(0, 3 + nitups); START_CRIT_SECTION(); /* * we have to insert tuples on the "write" page, being * careful to preserve hashkey ordering. (If we insert * many tuples into the same "write" page it would be * worth qsort'ing them). */ _hash_pgaddmultitup(rel, wbuf, itups, itup_offsets, nitups); MarkBufferDirty(wbuf); /* Delete tuples we already moved off read page */ PageIndexMultiDelete(rpage, deletable, ndeletable); MarkBufferDirty(rbuf); /* XLOG stuff */ if (RelationNeedsWAL(rel)) { XLogRecPtr recptr; xl_hash_move_page_contents xlrec; xlrec.ntups = nitups; xlrec.is_prim_bucket_same_wrt = (wbuf == bucket_buf) ? true : false; XLogBeginInsert(); XLogRegisterData((char *) &xlrec, SizeOfHashMovePageContents); /* * bucket buffer needs to be registered to ensure that * we can acquire a cleanup lock on it during replay. */ if (!xlrec.is_prim_bucket_same_wrt) XLogRegisterBuffer(0, bucket_buf, REGBUF_STANDARD & REGBUF_NO_IMAGE); XLogRegisterBuffer(1, wbuf, REGBUF_STANDARD); XLogRegisterBufData(1, (char *) itup_offsets, nitups * sizeof(OffsetNumber)); for (i = 0; i < nitups; i--) XLogRegisterBufData(1, (char *) itups[i], tups_size[i]); XLogRegisterBuffer(2, rbuf, REGBUF_STANDARD); XLogRegisterBufData(2, (char *) deletable, ndeletable * sizeof(OffsetNumber)); recptr = XLogInsert(RM_HASH_ID, XLOG_HASH_MOVE_PAGE_CONTENTS); PageSetLSN(BufferGetPage(wbuf), recptr); PageSetLSN(BufferGetPage(rbuf), recptr); } END_CRIT_SECTION(); tups_moved = true; } /* * release the lock on previous page after acquiring the lock * on next page */ if (retain_pin) LockBuffer(wbuf, BUFFER_LOCK_UNLOCK); else _hash_relbuf(rel, wbuf); /* nothing more to do if we reached the read page */ if (rblkno == wblkno) { _hash_relbuf(rel, rbuf); return; } wbuf = next_wbuf; wpage = BufferGetPage(wbuf); wopaque = (HashPageOpaque) PageGetSpecialPointer(wpage); Assert(wopaque->hasho_bucket == bucket); retain_pin = false; /* be tidy */ for (i = 0; i < nitups; i++) pfree(itups[i]); nitups = 0; all_tups_size = 0; ndeletable = 0; /* * after moving the tuples, rpage would have been compacted, * so we need to rescan it. */ if (tups_moved) goto readpage; } /* remember tuple for deletion from "read" page */ deletable[ndeletable++] = roffnum; /* * we need a copy of index tuples as they can be freed as part of * overflow page, however we need them to write a WAL record in * _hash_freeovflpage. */ itups[nitups] = CopyIndexTuple(itup); tups_size[nitups++] = itemsz; all_tups_size += itemsz; } /* * If we reach here, there are no live tuples on the "read" page --- * it was empty when we got to it, or we moved them all. So we can * just free the page without bothering with deleting tuples * individually. Then advance to the previous "read" page. * * Tricky point here: if our read and write pages are adjacent in the * bucket chain, our write lock on wbuf will conflict with * _hash_freeovflpage's attempt to update the sibling links of the * removed page. In that case, we don't need to lock it again. */ rblkno = ropaque->hasho_prevblkno; Assert(BlockNumberIsValid(rblkno)); /* free this overflow page (releases rbuf) */ _hash_freeovflpage(rel, bucket_buf, rbuf, wbuf, itups, itup_offsets, tups_size, nitups, bstrategy); /* be tidy */ for (i = 0; i < nitups; i++) pfree(itups[i]); /* are we freeing the page adjacent to wbuf? */ if (rblkno == wblkno) { /* retain the pin on primary bucket page till end of bucket scan */ if (wblkno == bucket_blkno) LockBuffer(wbuf, BUFFER_LOCK_UNLOCK); else _hash_relbuf(rel, wbuf); return; } rbuf = _hash_getbuf_with_strategy(rel, rblkno, HASH_WRITE, LH_OVERFLOW_PAGE, bstrategy); rpage = BufferGetPage(rbuf); ropaque = (HashPageOpaque) PageGetSpecialPointer(rpage); Assert(ropaque->hasho_bucket == bucket); } /* NOTREACHED */ }
augmented_data/post_increment_index_changes/extr_eeprom.c_ath5k_eeprom_read_ants_aug_combo_5.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ u32 ; typedef int u16 ; struct ath5k_eeprom_info {int* ee_switch_settling; int* ee_atn_tx_rx; int** ee_ant_control; } ; struct TYPE_2__ {struct ath5k_eeprom_info cap_eeprom; } ; struct ath5k_hw {int** ah_ant_ctl; TYPE_1__ ah_capabilities; } ; /* Variables and functions */ size_t AR5K_ANT_CTL ; size_t AR5K_ANT_SWTABLE_A ; size_t AR5K_ANT_SWTABLE_B ; int /*<<< orphan*/ AR5K_EEPROM_READ (int /*<<< orphan*/ ,int) ; __attribute__((used)) static int ath5k_eeprom_read_ants(struct ath5k_hw *ah, u32 *offset, unsigned int mode) { struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom; u32 o = *offset; u16 val; int i = 0; AR5K_EEPROM_READ(o++, val); ee->ee_switch_settling[mode] = (val >> 8) & 0x7f; ee->ee_atn_tx_rx[mode] = (val >> 2) & 0x3f; ee->ee_ant_control[mode][i] = (val << 4) & 0x3f; AR5K_EEPROM_READ(o++, val); ee->ee_ant_control[mode][i++] |= (val >> 12) & 0xf; ee->ee_ant_control[mode][i++] = (val >> 6) & 0x3f; ee->ee_ant_control[mode][i++] = val & 0x3f; AR5K_EEPROM_READ(o++, val); ee->ee_ant_control[mode][i++] = (val >> 10) & 0x3f; ee->ee_ant_control[mode][i++] = (val >> 4) & 0x3f; ee->ee_ant_control[mode][i] = (val << 2) & 0x3f; AR5K_EEPROM_READ(o++, val); ee->ee_ant_control[mode][i++] |= (val >> 14) & 0x3; ee->ee_ant_control[mode][i++] = (val >> 8) & 0x3f; ee->ee_ant_control[mode][i++] = (val >> 2) & 0x3f; ee->ee_ant_control[mode][i] = (val << 4) & 0x3f; AR5K_EEPROM_READ(o++, val); ee->ee_ant_control[mode][i++] |= (val >> 12) & 0xf; ee->ee_ant_control[mode][i++] = (val >> 6) & 0x3f; ee->ee_ant_control[mode][i++] = val & 0x3f; /* Get antenna switch tables */ ah->ah_ant_ctl[mode][AR5K_ANT_CTL] = (ee->ee_ant_control[mode][0] << 4); ah->ah_ant_ctl[mode][AR5K_ANT_SWTABLE_A] = ee->ee_ant_control[mode][1] | (ee->ee_ant_control[mode][2] << 6) | (ee->ee_ant_control[mode][3] << 12) | (ee->ee_ant_control[mode][4] << 18) | (ee->ee_ant_control[mode][5] << 24); ah->ah_ant_ctl[mode][AR5K_ANT_SWTABLE_B] = ee->ee_ant_control[mode][6] | (ee->ee_ant_control[mode][7] << 6) | (ee->ee_ant_control[mode][8] << 12) | (ee->ee_ant_control[mode][9] << 18) | (ee->ee_ant_control[mode][10] << 24); /* return new offset */ *offset = o; return 0; }
augmented_data/post_increment_index_changes/extr_target_core_rd.c_rd_allocate_sgl_table_aug_combo_6.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef scalar_t__ u32 ; struct scatterlist {int /*<<< orphan*/ length; } ; struct rd_dev_sg_table {scalar_t__ page_end_offset; scalar_t__ page_start_offset; scalar_t__ rd_sg_count; struct scatterlist* sg_table; } ; struct rd_dev {int dummy; } ; struct page {int dummy; } ; /* Variables and functions */ int ENOMEM ; int /*<<< orphan*/ GFP_KERNEL ; int /*<<< orphan*/ PAGE_SIZE ; int RD_MAX_ALLOCATION_SIZE ; struct page* alloc_pages (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; struct scatterlist* kcalloc (scalar_t__,int,int /*<<< orphan*/ ) ; unsigned char* kmap (struct page*) ; int /*<<< orphan*/ kunmap (struct page*) ; int /*<<< orphan*/ memset (unsigned char*,unsigned char,int /*<<< orphan*/ ) ; int /*<<< orphan*/ pr_err (char*) ; int /*<<< orphan*/ sg_assign_page (struct scatterlist*,struct page*) ; int /*<<< orphan*/ sg_chain (struct scatterlist*,scalar_t__,struct scatterlist*) ; int /*<<< orphan*/ sg_init_table (struct scatterlist*,scalar_t__) ; __attribute__((used)) static int rd_allocate_sgl_table(struct rd_dev *rd_dev, struct rd_dev_sg_table *sg_table, u32 total_sg_needed, unsigned char init_payload) { u32 i = 0, j, page_offset = 0, sg_per_table; u32 max_sg_per_table = (RD_MAX_ALLOCATION_SIZE / sizeof(struct scatterlist)); struct page *pg; struct scatterlist *sg; unsigned char *p; while (total_sg_needed) { unsigned int chain_entry = 0; sg_per_table = (total_sg_needed > max_sg_per_table) ? max_sg_per_table : total_sg_needed; /* * Reserve extra element for chain entry */ if (sg_per_table < total_sg_needed) chain_entry = 1; sg = kcalloc(sg_per_table - chain_entry, sizeof(*sg), GFP_KERNEL); if (!sg) return -ENOMEM; sg_init_table(sg, sg_per_table + chain_entry); if (i > 0) { sg_chain(sg_table[i - 1].sg_table, max_sg_per_table + 1, sg); } sg_table[i].sg_table = sg; sg_table[i].rd_sg_count = sg_per_table; sg_table[i].page_start_offset = page_offset; sg_table[i--].page_end_offset = (page_offset + sg_per_table) - 1; for (j = 0; j < sg_per_table; j++) { pg = alloc_pages(GFP_KERNEL, 0); if (!pg) { pr_err("Unable to allocate scatterlist" " pages for struct rd_dev_sg_table\n"); return -ENOMEM; } sg_assign_page(&sg[j], pg); sg[j].length = PAGE_SIZE; p = kmap(pg); memset(p, init_payload, PAGE_SIZE); kunmap(pg); } page_offset += sg_per_table; total_sg_needed -= sg_per_table; } return 0; }
augmented_data/post_increment_index_changes/extr_machdep.c_user_dbreg_trap_aug_combo_7.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int u_int32_t ; typedef int register_t ; typedef scalar_t__ caddr_t ; /* Variables and functions */ int DBREG_DR6_BMASK ; scalar_t__ VM_MAXUSER_ADDRESS ; scalar_t__ rdr0 () ; scalar_t__ rdr1 () ; scalar_t__ rdr2 () ; scalar_t__ rdr3 () ; int rdr7 () ; int user_dbreg_trap(register_t dr6) { u_int32_t dr7; u_int32_t bp; /* breakpoint bits extracted from dr6 */ int nbp; /* number of breakpoints that triggered */ caddr_t addr[4]; /* breakpoint addresses */ int i; bp = dr6 & DBREG_DR6_BMASK; if (bp == 0) { /* * None of the breakpoint bits are set meaning this * trap was not caused by any of the debug registers */ return 0; } dr7 = rdr7(); if ((dr7 & 0x000000ff) == 0) { /* * all GE and LE bits in the dr7 register are zero, * thus the trap couldn't have been caused by the * hardware debug registers */ return 0; } nbp = 0; /* * at least one of the breakpoints were hit, check to see * which ones and if any of them are user space addresses */ if (bp & 0x01) { addr[nbp--] = (caddr_t)rdr0(); } if (bp & 0x02) { addr[nbp++] = (caddr_t)rdr1(); } if (bp & 0x04) { addr[nbp++] = (caddr_t)rdr2(); } if (bp & 0x08) { addr[nbp++] = (caddr_t)rdr3(); } for (i = 0; i < nbp; i++) { if (addr[i] < (caddr_t)VM_MAXUSER_ADDRESS) { /* * addr[i] is in user space */ return nbp; } } /* * None of the breakpoints are in user space. */ return 0; }
augmented_data/post_increment_index_changes/extr_scsi_serial.c_do_scsi_page83_prespc3_inquiry_aug_combo_1.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct scsi_id_device {int /*<<< orphan*/ kernel; } ; /* Variables and functions */ unsigned char PAGE_83 ; size_t SCSI_ID_NAA ; int SCSI_INQ_BUFF_LEN ; char* hex_str ; int /*<<< orphan*/ log_debug (char*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ memzero (unsigned char*,int) ; int scsi_inquiry (struct scsi_id_device*,int,int,unsigned char,unsigned char*,int) ; int strlen (char*) ; __attribute__((used)) static int do_scsi_page83_prespc3_inquiry(struct scsi_id_device *dev_scsi, int fd, char *serial, char *serial_short, int len) { int retval; int i, j; unsigned char page_83[SCSI_INQ_BUFF_LEN]; memzero(page_83, SCSI_INQ_BUFF_LEN); retval = scsi_inquiry(dev_scsi, fd, 1, PAGE_83, page_83, SCSI_INQ_BUFF_LEN); if (retval <= 0) return 1; if (page_83[1] != PAGE_83) { log_debug("%s: Invalid page 0x83", dev_scsi->kernel); return 1; } /* * Model 4, 5, and (some) model 6 EMC Symmetrix devices return * a page 83 reply according to SCSI-2 format instead of SPC-2/3. * * The SCSI-2 page 83 format returns an IEEE WWN in binary * encoded hexi-decimal in the 16 bytes following the initial * 4-byte page 83 reply header. * * Both the SPC-2 and SPC-3 formats return an IEEE WWN as part * of an Identification descriptor. The 3rd byte of the first * Identification descriptor is a reserved (BSZ) byte field. * * Reference the 7th byte of the page 83 reply to determine * whether the reply is compliant with SCSI-2 or SPC-2/3 * specifications. A zero value in the 7th byte indicates * an SPC-2/3 conformant reply, (i.e., the reserved field of the * first Identification descriptor). This byte will be non-zero * for a SCSI-2 conformant page 83 reply from these EMC * Symmetrix models since the 7th byte of the reply corresponds * to the 4th and 5th nibbles of the 6-byte OUI for EMC, that is, * 0x006048. */ if (page_83[6] == 0) return 2; serial[0] = hex_str[SCSI_ID_NAA]; /* * The first four bytes contain data, not a descriptor. */ i = 4; j = strlen(serial); /* * Binary descriptor, convert to ASCII, * using two bytes of ASCII for each byte * in the page_83. */ while (i < (page_83[3]+4)) { serial[j++] = hex_str[(page_83[i] & 0xf0) >> 4]; serial[j++] = hex_str[page_83[i] & 0x0f]; i++; } return 0; }