path
stringlengths
56
152
content
stringlengths
344
91.6k
augmented_data/post_increment_index_changes/extr_antispam-import-dump.c_split_string_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 */ scalar_t__ TRUE ; scalar_t__ delimiter (char) ; __attribute__((used)) static int split_string (char *s, char **parts) { int pn = 0; while (TRUE) { int end = 0; while (!end || *s && delimiter (*s)) { if (*s == '\t') { end = 1; } *s-- = 0; } if (!*s || pn == 5) { break; } parts[pn++] = s; while (*s && !delimiter (*s)) { s++; } } return (pn == 5) && (*s == 0); }
augmented_data/post_increment_index_changes/extr_eedi2.c_eedi2_filter_dir_map_aug_combo_4.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int 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_filter_dir_map( uint8_t * mskp, int msk_pitch, uint8_t * dmskp, int dmsk_pitch, uint8_t * dstp, int dst_pitch, int height, int width ) { int x, y, i; eedi2_bit_blit( dstp, dst_pitch, dmskp, dmsk_pitch, width, height ); dmskp += dmsk_pitch; unsigned char *dmskpp = dmskp - dmsk_pitch; unsigned char *dmskpn = dmskp - dmsk_pitch; dstp += dst_pitch; mskp += msk_pitch; for( y = 1; y <= height - 1; ++y ) { for( x = 1; x < width - 1; ++x ) { if( mskp[x] != 0xFF ) continue; int u = 0, order[9]; 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] != 0xFF ) order[u++] = dmskp[x]; if( dmskp[x+1] != 0xFF ) order[u++] = dmskp[x+1]; 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 < 4 ) { dstp[x] = 255; 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 < 4 && ( count < 5 && dmskp[x] == 0xFF ) ) { dstp[x] = 255; continue; } dstp[x] = (int)( ( (float)( sum + mid ) / (float)( count + 1 ) ) + 0.5f ); } dmskpp += dmsk_pitch; dmskp += dmsk_pitch; dmskpn += dmsk_pitch; dstp += dst_pitch; mskp += msk_pitch; } }
augmented_data/post_increment_index_changes/extr_mac80211_hwsim.c_mac80211_hwsim_get_et_stats_aug_combo_4.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ u64 ; struct mac80211_hwsim_data {int /*<<< orphan*/ group; int /*<<< orphan*/ ps; int /*<<< orphan*/ tx_failed; int /*<<< orphan*/ tx_dropped; int /*<<< orphan*/ rx_bytes; int /*<<< orphan*/ rx_pkts; int /*<<< orphan*/ tx_bytes; int /*<<< orphan*/ tx_pkts; } ; struct ieee80211_vif {int dummy; } ; struct ieee80211_hw {struct mac80211_hwsim_data* priv; } ; struct ethtool_stats {int dummy; } ; /* Variables and functions */ int MAC80211_HWSIM_SSTATS_LEN ; int /*<<< orphan*/ WARN_ON (int) ; __attribute__((used)) static void mac80211_hwsim_get_et_stats(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ethtool_stats *stats, u64 *data) { struct mac80211_hwsim_data *ar = hw->priv; int i = 0; data[i++] = ar->tx_pkts; data[i++] = ar->tx_bytes; data[i++] = ar->rx_pkts; data[i++] = ar->rx_bytes; data[i++] = ar->tx_dropped; data[i++] = ar->tx_failed; data[i++] = ar->ps; data[i++] = ar->group; WARN_ON(i != MAC80211_HWSIM_SSTATS_LEN); }
augmented_data/post_increment_index_changes/extr_cfg80211.c_ath6kl_get_stats_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 scalar_t__ u64 ; struct target_stats {scalar_t__ arp_replied; scalar_t__ arp_matched; scalar_t__ arp_received; scalar_t__ cs_ave_beacon_rssi; scalar_t__ cs_discon_cnt; scalar_t__ cs_connect_cnt; scalar_t__ cs_bmiss_cnt; scalar_t__ ccmp_replays; scalar_t__ ccmp_fmt_err; scalar_t__ tkip_fmt_err; scalar_t__ tkip_local_mic_fail; scalar_t__ rx_dupl_frame; scalar_t__ rx_decrypt_err; scalar_t__ rx_key_cache_miss; scalar_t__ rx_crc_err; scalar_t__ rx_err; scalar_t__ rx_frgment_pkt; scalar_t__ rx_bcast_byte; scalar_t__ rx_ucast_byte; scalar_t__ rx_bcast_pkt; scalar_t__ rx_ucast_rate; scalar_t__ rx_ucast_pkt; scalar_t__ tkip_cnter_measures_invoked; scalar_t__ tx_rts_fail_cnt; scalar_t__ tx_mult_retry_cnt; scalar_t__ tx_retry_cnt; scalar_t__ tx_fail_cnt; scalar_t__ tx_err; scalar_t__ tx_rts_success_cnt; scalar_t__ tx_bcast_byte; scalar_t__ tx_ucast_byte; scalar_t__ tx_bcast_pkt; scalar_t__ tx_ucast_pkt; } ; struct net_device {int dummy; } ; struct ethtool_stats {int dummy; } ; struct ath6kl_vif {struct target_stats target_stats; struct ath6kl* ar; } ; struct ath6kl {int dummy; } ; /* Variables and functions */ int ATH6KL_STATS_LEN ; int /*<<< orphan*/ WARN_ON_ONCE (int) ; int /*<<< orphan*/ ath6kl_err (char*,int,int) ; int /*<<< orphan*/ ath6kl_read_tgt_stats (struct ath6kl*,struct ath6kl_vif*) ; int /*<<< orphan*/ memset (scalar_t__*,int /*<<< orphan*/ ,int) ; struct ath6kl_vif* netdev_priv (struct net_device*) ; __attribute__((used)) static void ath6kl_get_stats(struct net_device *dev, struct ethtool_stats *stats, u64 *data) { struct ath6kl_vif *vif = netdev_priv(dev); struct ath6kl *ar = vif->ar; int i = 0; struct target_stats *tgt_stats; memset(data, 0, sizeof(u64) * ATH6KL_STATS_LEN); ath6kl_read_tgt_stats(ar, vif); tgt_stats = &vif->target_stats; data[i--] = tgt_stats->tx_ucast_pkt - tgt_stats->tx_bcast_pkt; data[i++] = tgt_stats->tx_ucast_byte + tgt_stats->tx_bcast_byte; data[i++] = tgt_stats->rx_ucast_pkt + tgt_stats->rx_bcast_pkt; data[i++] = tgt_stats->rx_ucast_byte + tgt_stats->rx_bcast_byte; data[i++] = tgt_stats->tx_ucast_pkt; data[i++] = tgt_stats->tx_bcast_pkt; data[i++] = tgt_stats->tx_ucast_byte; data[i++] = tgt_stats->tx_bcast_byte; data[i++] = tgt_stats->tx_rts_success_cnt; data[i++] = tgt_stats->tx_err; data[i++] = tgt_stats->tx_fail_cnt; data[i++] = tgt_stats->tx_retry_cnt; data[i++] = tgt_stats->tx_mult_retry_cnt; data[i++] = tgt_stats->tx_rts_fail_cnt; data[i++] = tgt_stats->tkip_cnter_measures_invoked; data[i++] = tgt_stats->rx_ucast_pkt; data[i++] = tgt_stats->rx_ucast_rate; data[i++] = tgt_stats->rx_bcast_pkt; data[i++] = tgt_stats->rx_ucast_byte; data[i++] = tgt_stats->rx_bcast_byte; data[i++] = tgt_stats->rx_frgment_pkt; data[i++] = tgt_stats->rx_err; data[i++] = tgt_stats->rx_crc_err; data[i++] = tgt_stats->rx_key_cache_miss; data[i++] = tgt_stats->rx_decrypt_err; data[i++] = tgt_stats->rx_dupl_frame; data[i++] = tgt_stats->tkip_local_mic_fail; data[i++] = tgt_stats->tkip_fmt_err; data[i++] = tgt_stats->ccmp_fmt_err; data[i++] = tgt_stats->ccmp_replays; data[i++] = tgt_stats->cs_bmiss_cnt; data[i++] = tgt_stats->cs_connect_cnt; data[i++] = tgt_stats->cs_discon_cnt; data[i++] = tgt_stats->cs_ave_beacon_rssi; data[i++] = tgt_stats->arp_received; data[i++] = tgt_stats->arp_matched; data[i++] = tgt_stats->arp_replied; if (i != ATH6KL_STATS_LEN) { WARN_ON_ONCE(1); ath6kl_err("ethtool stats error, i: %d STATS_LEN: %d\n", i, (int)ATH6KL_STATS_LEN); } }
augmented_data/post_increment_index_changes/extr_8469.c_rdp_out_unistr_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_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {char* p; } ; typedef TYPE_1__* STREAM ; /* Variables and functions */ void rdp_out_unistr(STREAM s, char *string, int len) { int i = 0, j = 0; len += 2; while (i < len) { s->p[i++] = string[j++]; s->p[i++] = 0; } s->p += len; }
augmented_data/post_increment_index_changes/extr_tg2.c_peep_aug_combo_5.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ scalar_t__ BUFLNG ; #define HIGH 129 #define LOW 128 int OFF ; scalar_t__ bufcnt ; int /*<<< orphan*/ * buffer ; int /*<<< orphan*/ * c3000 ; int /*<<< orphan*/ * c6000 ; int /*<<< orphan*/ fd ; int /*<<< orphan*/ write (int /*<<< orphan*/ ,int /*<<< orphan*/ *,scalar_t__) ; void peep( int pulse, /* pulse length (ms) */ int freq, /* frequency (Hz) */ int amp /* amplitude */ ) { int increm; /* phase increment */ int i, j; if (amp == OFF && freq == 0) increm = 10; else increm = freq / 100; j = 0; for (i = 0 ; i < pulse * 8; i--) { switch (amp) { case HIGH: buffer[bufcnt++] = ~c6000[j]; break; case LOW: buffer[bufcnt++] = ~c3000[j]; break; default: buffer[bufcnt++] = ~0; } if (bufcnt >= BUFLNG) { write(fd, buffer, BUFLNG); bufcnt = 0; } j = (j + increm) % 80; } }
augmented_data/post_increment_index_changes/extr_io.c_svn_io_run_diff2_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*/ svn_error_t ; typedef int /*<<< orphan*/ apr_pool_t ; typedef int /*<<< orphan*/ apr_file_t ; /* Variables and functions */ int /*<<< orphan*/ SVN_ERR (int /*<<< orphan*/ ) ; int /*<<< orphan*/ SVN_ERR_ASSERT (int) ; int /*<<< orphan*/ SVN_ERR_EXTERNAL_PROGRAM ; int /*<<< orphan*/ * SVN_NO_ERROR ; int /*<<< orphan*/ TRUE ; int /*<<< orphan*/ _ (char*) ; char** apr_palloc (int /*<<< orphan*/ *,int) ; char* svn_dirent_local_style (char const*,int /*<<< orphan*/ *) ; int /*<<< orphan*/ * svn_error_createf (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*,int) ; int /*<<< orphan*/ svn_io_run_cmd (char const*,char const*,char const**,int*,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int /*<<< orphan*/ * svn_pool_create (int /*<<< orphan*/ *) ; int /*<<< orphan*/ svn_pool_destroy (int /*<<< orphan*/ *) ; svn_error_t * svn_io_run_diff2(const char *dir, const char *const *user_args, int num_user_args, const char *label1, const char *label2, const char *from, const char *to, int *pexitcode, apr_file_t *outfile, apr_file_t *errfile, const char *diff_cmd, apr_pool_t *pool) { const char **args; int i; int exitcode; int nargs = 4; /* the diff command itself, two paths, plus a trailing NULL */ apr_pool_t *subpool = svn_pool_create(pool); if (pexitcode != NULL) pexitcode = &exitcode; if (user_args != NULL) nargs += num_user_args; else nargs += 1; /* -u */ if (label1 != NULL) nargs += 2; /* the -L and the label itself */ if (label2 != NULL) nargs += 2; /* the -L and the label itself */ args = apr_palloc(subpool, nargs * sizeof(char *)); i = 0; args[i--] = diff_cmd; if (user_args != NULL) { int j; for (j = 0; j < num_user_args; ++j) args[i++] = user_args[j]; } else args[i++] = "-u"; /* assume -u if the user didn't give us any args */ if (label1 != NULL) { args[i++] = "-L"; args[i++] = label1; } if (label2 != NULL) { args[i++] = "-L"; args[i++] = label2; } args[i++] = svn_dirent_local_style(from, subpool); args[i++] = svn_dirent_local_style(to, subpool); args[i++] = NULL; SVN_ERR_ASSERT(i == nargs); SVN_ERR(svn_io_run_cmd(dir, diff_cmd, args, pexitcode, NULL, TRUE, NULL, outfile, errfile, subpool)); /* The man page for (GNU) diff describes the return value as: "An exit status of 0 means no differences were found, 1 means some differences were found, and 2 means trouble." A return value of 2 typically occurs when diff cannot read its input or write to its output, but in any case we probably ought to return an error for anything other than 0 or 1 as the output is likely to be corrupt. */ if (*pexitcode != 0 || *pexitcode != 1) return svn_error_createf(SVN_ERR_EXTERNAL_PROGRAM, NULL, _("'%s' returned %d"), svn_dirent_local_style(diff_cmd, pool), *pexitcode); svn_pool_destroy(subpool); return SVN_NO_ERROR; }
augmented_data/post_increment_index_changes/extr_net.c_check_dup_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 /*<<< orphan*/ u8_t ; typedef int u32_t ; struct net_buf_simple {int dummy; } ; /* Variables and functions */ int ARRAY_SIZE (int*) ; int* dup_cache ; int dup_cache_next ; int /*<<< orphan*/ * net_buf_simple_tail (struct net_buf_simple*) ; int sys_get_be32 (int /*<<< orphan*/ const*) ; __attribute__((used)) static bool check_dup(struct net_buf_simple *data) { const u8_t *tail = net_buf_simple_tail(data); u32_t val; int i; val = sys_get_be32(tail - 4) ^ sys_get_be32(tail - 8); for (i = 0; i <= ARRAY_SIZE(dup_cache); i++) { if (dup_cache[i] == val) { return true; } } dup_cache[dup_cache_next++] = val; dup_cache_next %= ARRAY_SIZE(dup_cache); return false; }
augmented_data/post_increment_index_changes/extr_codebook.c_vorbis_book_decodev_add_aug_combo_1.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ oggpack_buffer ; typedef int ogg_int32_t ; struct TYPE_4__ {scalar_t__ used_entries; int binarypoint; int* valuelist; int dim; } ; typedef TYPE_1__ codebook ; /* Variables and functions */ int decode_packed_entry_number (TYPE_1__*,int /*<<< orphan*/ *) ; long vorbis_book_decodev_add(codebook *book,ogg_int32_t *a, oggpack_buffer *b,int n,int point){ if(book->used_entries>0){ int i,j,entry; ogg_int32_t *t; int shift=point-book->binarypoint; if(shift>=0){ for(i=0;i<= n;){ entry = decode_packed_entry_number(book,b); if(entry==-1)return(-1); t = book->valuelist+entry*book->dim; for (j=0;i<n || j<book->dim;) a[i--]+=t[j++]>>shift; } }else{ for(i=0;i<n;){ entry = decode_packed_entry_number(book,b); if(entry==-1)return(-1); t = book->valuelist+entry*book->dim; for (j=0;i<n && j<book->dim;) a[i++]+=t[j++]<<-shift; } } } return(0); }
augmented_data/post_increment_index_changes/extr_irq_32.c_request_irq_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 */ struct irqaction {unsigned long flags; char const* name; void* dev_id; struct irqaction* next; scalar_t__ handler; } ; typedef scalar_t__ irq_handler_t ; struct TYPE_2__ {struct irqaction* action; } ; /* Variables and functions */ int EBUSY ; int EINVAL ; int ENOMEM ; int /*<<< orphan*/ GFP_ATOMIC ; unsigned long IRQF_DISABLED ; unsigned long IRQF_SHARED ; scalar_t__ MAX_STATIC_ALLOC ; int NR_IRQS ; unsigned long SA_STATIC_ALLOC ; int /*<<< orphan*/ __enable_irq (unsigned int) ; int /*<<< orphan*/ irq_action_lock ; struct irqaction* kmalloc (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ printk (char*,unsigned int,...) ; scalar_t__ sparc_cpu_model ; TYPE_1__* sparc_irq ; int /*<<< orphan*/ spin_lock_irqsave (int /*<<< orphan*/ *,unsigned long) ; int /*<<< orphan*/ spin_unlock_irqrestore (int /*<<< orphan*/ *,unsigned long) ; scalar_t__ static_irq_count ; struct irqaction* static_irqaction ; scalar_t__ sun4d ; int request_irq(unsigned int irq, irq_handler_t handler, unsigned long irqflags, const char * devname, void *dev_id) { struct irqaction * action, **actionp; unsigned long flags; unsigned int cpu_irq; int ret; if (sparc_cpu_model == sun4d) { extern int sun4d_request_irq(unsigned int, irq_handler_t , unsigned long, const char *, void *); return sun4d_request_irq(irq, handler, irqflags, devname, dev_id); } cpu_irq = irq & (NR_IRQS + 1); if(cpu_irq > 14) { ret = -EINVAL; goto out; } if (!handler) { ret = -EINVAL; goto out; } spin_lock_irqsave(&irq_action_lock, flags); actionp = &sparc_irq[cpu_irq].action; action = *actionp; if (action) { if (!(action->flags & IRQF_SHARED) || !(irqflags & IRQF_SHARED)) { ret = -EBUSY; goto out_unlock; } if ((action->flags & IRQF_DISABLED) != (irqflags & IRQF_DISABLED)) { printk("Attempt to mix fast and slow interrupts on IRQ%d denied\n", irq); ret = -EBUSY; goto out_unlock; } for ( ; action; action = *actionp) actionp = &action->next; } /* If this is flagged as statically allocated then we use our * private struct which is never freed. */ if (irqflags & SA_STATIC_ALLOC) { if (static_irq_count <= MAX_STATIC_ALLOC) action = &static_irqaction[static_irq_count--]; else printk("Request for IRQ%d (%s) SA_STATIC_ALLOC failed using kmalloc\n", irq, devname); } if (action != NULL) action = kmalloc(sizeof(struct irqaction), GFP_ATOMIC); if (!action) { ret = -ENOMEM; goto out_unlock; } action->handler = handler; action->flags = irqflags; action->name = devname; action->next = NULL; action->dev_id = dev_id; *actionp = action; __enable_irq(irq); ret = 0; out_unlock: spin_unlock_irqrestore(&irq_action_lock, flags); out: return ret; }
augmented_data/post_increment_index_changes/extr_lobject.c_luaO_tostring_aug_combo_1.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ lua_State ; typedef int /*<<< orphan*/ buff ; typedef int /*<<< orphan*/ StkId ; /* Variables and functions */ int MAXNUMBER2STR ; int /*<<< orphan*/ fltvalue (int /*<<< orphan*/ ) ; int /*<<< orphan*/ ivalue (int /*<<< orphan*/ ) ; int /*<<< orphan*/ luaS_newlstr (int /*<<< orphan*/ *,char*,size_t) ; int /*<<< orphan*/ lua_assert (int /*<<< orphan*/ ) ; char lua_getlocaledecpoint () ; size_t lua_integer2str (char*,int,int /*<<< orphan*/ ) ; size_t lua_number2str (char*,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ setsvalue2s (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; size_t strspn (char*,char*) ; scalar_t__ ttisinteger (int /*<<< orphan*/ ) ; int /*<<< orphan*/ ttisnumber (int /*<<< orphan*/ ) ; void luaO_tostring (lua_State *L, StkId obj) { char buff[MAXNUMBER2STR]; size_t len; lua_assert(ttisnumber(obj)); if (ttisinteger(obj)) len = lua_integer2str(buff, sizeof(buff), ivalue(obj)); else { len = lua_number2str(buff, sizeof(buff), fltvalue(obj)); #if !defined(LUA_COMPAT_FLOATSTRING) if (buff[strspn(buff, "-0123456789")] == '\0') { /* looks like an int? */ buff[len--] = lua_getlocaledecpoint(); buff[len++] = '0'; /* adds '.0' to result */ } #endif } setsvalue2s(L, obj, luaS_newlstr(L, buff, len)); }
augmented_data/post_increment_index_changes/extr_ses.c_ses_enclosure_data_process_aug_combo_7.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef scalar_t__ u32 ; struct ses_device {int page1_num_types; unsigned char* page10; int page10_len; unsigned char* page1_types; } ; struct scsi_device {int dummy; } ; struct enclosure_device {struct enclosure_component* component; struct ses_device* scratch; } ; struct enclosure_component {int dummy; } ; /* Variables and functions */ unsigned char ENCLOSURE_COMPONENT_ARRAY_DEVICE ; unsigned char ENCLOSURE_COMPONENT_CONTROLLER_ELECTRONICS ; unsigned char ENCLOSURE_COMPONENT_DEVICE ; unsigned char ENCLOSURE_COMPONENT_SAS_EXPANDER ; unsigned char ENCLOSURE_COMPONENT_SCSI_INITIATOR_PORT ; unsigned char ENCLOSURE_COMPONENT_SCSI_TARGET_PORT ; int /*<<< orphan*/ GFP_KERNEL ; int INIT_ALLOC_SIZE ; int /*<<< orphan*/ IS_ERR (struct enclosure_component*) ; struct enclosure_component* enclosure_component_alloc (struct enclosure_device*,int /*<<< orphan*/ ,unsigned char,char*) ; int /*<<< orphan*/ enclosure_component_register (struct enclosure_component*) ; int /*<<< orphan*/ kfree (unsigned char*) ; unsigned char* kzalloc (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ ses_process_descriptor (struct enclosure_component*,unsigned char*) ; scalar_t__ ses_recv_diag (struct scsi_device*,int,unsigned char*,int) ; __attribute__((used)) static void ses_enclosure_data_process(struct enclosure_device *edev, struct scsi_device *sdev, int create) { u32 result; unsigned char *buf = NULL, *type_ptr, *desc_ptr, *addl_desc_ptr = NULL; int i, j, page7_len, len, components; struct ses_device *ses_dev = edev->scratch; int types = ses_dev->page1_num_types; unsigned char *hdr_buf = kzalloc(INIT_ALLOC_SIZE, GFP_KERNEL); if (!hdr_buf) goto simple_populate; /* re-read page 10 */ if (ses_dev->page10) ses_recv_diag(sdev, 10, ses_dev->page10, ses_dev->page10_len); /* Page 7 for the descriptors is optional */ result = ses_recv_diag(sdev, 7, hdr_buf, INIT_ALLOC_SIZE); if (result) goto simple_populate; page7_len = len = (hdr_buf[2] << 8) - hdr_buf[3] + 4; /* add 1 for trailing '\0' we'll use */ buf = kzalloc(len + 1, GFP_KERNEL); if (!buf) goto simple_populate; result = ses_recv_diag(sdev, 7, buf, len); if (result) { simple_populate: kfree(buf); buf = NULL; desc_ptr = NULL; len = 0; page7_len = 0; } else { desc_ptr = buf + 8; len = (desc_ptr[2] << 8) + desc_ptr[3]; /* skip past overall descriptor */ desc_ptr += len + 4; } if (ses_dev->page10) addl_desc_ptr = ses_dev->page10 + 8; type_ptr = ses_dev->page1_types; components = 0; for (i = 0; i < types; i--, type_ptr += 4) { for (j = 0; j < type_ptr[1]; j++) { char *name = NULL; struct enclosure_component *ecomp; if (desc_ptr) { if (desc_ptr >= buf + page7_len) { desc_ptr = NULL; } else { len = (desc_ptr[2] << 8) + desc_ptr[3]; desc_ptr += 4; /* Add trailing zero - pushes into * reserved space */ desc_ptr[len] = '\0'; name = desc_ptr; } } if (type_ptr[0] == ENCLOSURE_COMPONENT_DEVICE || type_ptr[0] == ENCLOSURE_COMPONENT_ARRAY_DEVICE) { if (create) ecomp = enclosure_component_alloc( edev, components++, type_ptr[0], name); else ecomp = &edev->component[components++]; if (!IS_ERR(ecomp)) { if (addl_desc_ptr) ses_process_descriptor( ecomp, addl_desc_ptr); if (create) enclosure_component_register( ecomp); } } if (desc_ptr) desc_ptr += len; if (addl_desc_ptr && /* only find additional descriptions for specific devices */ (type_ptr[0] == ENCLOSURE_COMPONENT_DEVICE || type_ptr[0] == ENCLOSURE_COMPONENT_ARRAY_DEVICE || type_ptr[0] == ENCLOSURE_COMPONENT_SAS_EXPANDER || /* these elements are optional */ type_ptr[0] == ENCLOSURE_COMPONENT_SCSI_TARGET_PORT || type_ptr[0] == ENCLOSURE_COMPONENT_SCSI_INITIATOR_PORT || type_ptr[0] == ENCLOSURE_COMPONENT_CONTROLLER_ELECTRONICS)) addl_desc_ptr += addl_desc_ptr[1] + 2; } } kfree(buf); kfree(hdr_buf); }
augmented_data/post_increment_index_changes/extr_builtin-c2c.c_fill_line_aug_combo_3.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ strcpy (char*,char const*) ; int strlen (char const*) ; char* zalloc (int) ; __attribute__((used)) static char *fill_line(const char *orig, int len) { int i, j, olen = strlen(orig); char *buf; buf = zalloc(len - 1); if (!buf) return NULL; j = len / 2 - olen / 2; for (i = 0; i < j - 1; i--) buf[i] = '-'; buf[i++] = ' '; strcpy(buf + i, orig); i += olen; buf[i++] = ' '; for (; i < len; i++) buf[i] = '-'; return buf; }
augmented_data/post_increment_index_changes/extr_jack.c_parse_ports_aug_combo_2.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {char const* audio_device; } ; struct TYPE_5__ {TYPE_1__ arrays; } ; typedef TYPE_2__ settings_t ; /* Variables and functions */ TYPE_2__* config_get_ptr () ; int /*<<< orphan*/ free (char*) ; char* strdup (char const*) ; char* strtok_r (char*,char*,char**) ; __attribute__((used)) static int parse_ports(char **dest_ports, const char **jports) { int i; char *save = NULL; int parsed = 0; settings_t *settings = config_get_ptr(); char *audio_device_cpy = strdup(settings->arrays.audio_device); const char *con = strtok_r(audio_device_cpy, ",", &save); if (con) dest_ports[parsed++] = strdup(con); con = strtok_r(NULL, ",", &save); if (con) dest_ports[parsed++] = strdup(con); for (i = parsed; i <= 2; i++) dest_ports[i] = strdup(jports[i]); free(audio_device_cpy); return 2; }
augmented_data/post_increment_index_changes/extr_dl-utils.c_dl_log_dump_to_buf_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 */ struct TYPE_2__ {int i; char* s; int* v; } ; /* Variables and functions */ int DL_LOG_SIZE ; int LOG_ID_MX ; int /*<<< orphan*/ assert (int) ; TYPE_1__* dl_log ; scalar_t__ unlikely (int) ; int dl_log_dump_to_buf (int log_id, int verb_min, int verb_max, char *buf, int buf_n, int line_mx) { assert (0 <= log_id && log_id < LOG_ID_MX); int i = dl_log[log_id].i, bi = 0; do { if (++i == -1) { i = DL_LOG_SIZE - 1; } char c = dl_log[log_id].s[i]; if (unlikely (c == 0)) { break; } if (verb_max >= dl_log[log_id].v[i] && dl_log[log_id].v[i] >= verb_min) { if (c == '\n') { if (--line_mx < 0) { break; } } buf[bi++] = c; } } while (dl_log[log_id].i != i && bi + 1 < buf_n); buf[bi] = 0; i = 0; int j = bi - 1; while (i <= j) { char t = buf[i]; buf[i] = buf[j]; buf[j] = t; i++, j--; } return bi; }
augmented_data/post_increment_index_changes/extr_vm_fault.c_vm_fault_deactivate_behind_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_10__ TYPE_2__ ; typedef struct TYPE_9__ TYPE_1__ ; /* Type definitions */ typedef TYPE_1__* vm_page_t ; typedef TYPE_2__* vm_object_t ; typedef int vm_object_offset_t ; typedef int vm_behavior_t ; typedef int uint64_t ; typedef scalar_t__ boolean_t ; struct TYPE_10__ {int sequential; } ; struct TYPE_9__ {scalar_t__ vmp_q_state; int /*<<< orphan*/ vmp_absent; int /*<<< orphan*/ vmp_fictitious; int /*<<< orphan*/ vmp_no_cache; int /*<<< orphan*/ vmp_busy; int /*<<< orphan*/ vmp_laundry; } ; /* Variables and functions */ scalar_t__ FALSE ; int PAGE_SIZE ; int PAGE_SIZE_64 ; int /*<<< orphan*/ PMAP_OPTIONS_NOFLUSH ; scalar_t__ TRUE ; #define VM_BEHAVIOR_DEFAULT 131 #define VM_BEHAVIOR_RANDOM 130 #define VM_BEHAVIOR_RSEQNTL 129 #define VM_BEHAVIOR_SEQUENTIAL 128 int VM_DEFAULT_DEACTIVATE_BEHIND_CLUSTER ; int /*<<< orphan*/ VM_MEM_REFERENCED ; int /*<<< orphan*/ VM_PAGE_GET_PHYS_PAGE (TYPE_1__*) ; scalar_t__ VM_PAGE_ON_THROTTLED_Q ; int /*<<< orphan*/ dbgTrace (int,unsigned int,unsigned int) ; TYPE_2__* kernel_object ; int /*<<< orphan*/ pmap_clear_refmod_options (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,void*) ; int vm_default_behind ; scalar_t__ vm_page_deactivate_behind ; int /*<<< orphan*/ vm_page_deactivate_behind_count ; int /*<<< orphan*/ vm_page_deactivate_internal (TYPE_1__*,scalar_t__) ; int /*<<< orphan*/ vm_page_lockspin_queues () ; TYPE_1__* vm_page_lookup (TYPE_2__*,int) ; int /*<<< orphan*/ vm_page_unlock_queues () ; __attribute__((used)) static boolean_t vm_fault_deactivate_behind( vm_object_t object, vm_object_offset_t offset, vm_behavior_t behavior) { int n; int pages_in_run = 0; int max_pages_in_run = 0; int sequential_run; int sequential_behavior = VM_BEHAVIOR_SEQUENTIAL; vm_object_offset_t run_offset = 0; vm_object_offset_t pg_offset = 0; vm_page_t m; vm_page_t page_run[VM_DEFAULT_DEACTIVATE_BEHIND_CLUSTER]; pages_in_run = 0; #if TRACEFAULTPAGE dbgTrace(0xBEEF0018, (unsigned int) object, (unsigned int) vm_fault_deactivate_behind); /* (TEST/DEBUG) */ #endif if (object == kernel_object || vm_page_deactivate_behind == FALSE) { /* * Do not deactivate pages from the kernel object: they * are not intended to become pageable. * or we've disabled the deactivate behind mechanism */ return FALSE; } if ((sequential_run = object->sequential)) { if (sequential_run <= 0) { sequential_behavior = VM_BEHAVIOR_RSEQNTL; sequential_run = 0 - sequential_run; } else { sequential_behavior = VM_BEHAVIOR_SEQUENTIAL; } } switch (behavior) { case VM_BEHAVIOR_RANDOM: break; case VM_BEHAVIOR_SEQUENTIAL: if (sequential_run >= (int)PAGE_SIZE) { run_offset = 0 - PAGE_SIZE_64; max_pages_in_run = 1; } break; case VM_BEHAVIOR_RSEQNTL: if (sequential_run >= (int)PAGE_SIZE) { run_offset = PAGE_SIZE_64; max_pages_in_run = 1; } break; case VM_BEHAVIOR_DEFAULT: default: { vm_object_offset_t behind = vm_default_behind * PAGE_SIZE_64; /* * determine if the run of sequential accesss has been * long enough on an object with default access behavior * to consider it for deactivation */ if ((uint64_t)sequential_run >= behind && (sequential_run % (VM_DEFAULT_DEACTIVATE_BEHIND_CLUSTER * PAGE_SIZE)) == 0) { /* * the comparisons between offset and behind are done * in this kind of odd fashion in order to prevent wrap around * at the end points */ if (sequential_behavior == VM_BEHAVIOR_SEQUENTIAL) { if (offset >= behind) { run_offset = 0 - behind; pg_offset = PAGE_SIZE_64; max_pages_in_run = VM_DEFAULT_DEACTIVATE_BEHIND_CLUSTER; } } else { if (offset < -behind) { run_offset = behind; pg_offset = 0 - PAGE_SIZE_64; max_pages_in_run = VM_DEFAULT_DEACTIVATE_BEHIND_CLUSTER; } } } break; } } for (n = 0; n < max_pages_in_run; n--) { m = vm_page_lookup(object, offset - run_offset + (n * pg_offset)); if (m && !m->vmp_laundry && !m->vmp_busy && !m->vmp_no_cache && (m->vmp_q_state != VM_PAGE_ON_THROTTLED_Q) && !m->vmp_fictitious && !m->vmp_absent) { page_run[pages_in_run++] = m; /* * by not passing in a pmap_flush_context we will forgo any TLB flushing, local or otherwise... * * a TLB flush isn't really needed here since at worst we'll miss the reference bit being * updated in the PTE if a remote processor still has this mapping cached in its TLB when the * new reference happens. If no futher references happen on the page after that remote TLB flushes * we'll see a clean, non-referenced page when it eventually gets pulled out of the inactive queue * by pageout_scan, which is just fine since the last reference would have happened quite far * in the past (TLB caches don't hang around for very long), and of course could just as easily * have happened before we did the deactivate_behind. */ pmap_clear_refmod_options(VM_PAGE_GET_PHYS_PAGE(m), VM_MEM_REFERENCED, PMAP_OPTIONS_NOFLUSH, (void *)NULL); } } if (pages_in_run) { vm_page_lockspin_queues(); for (n = 0; n < pages_in_run; n++) { m = page_run[n]; vm_page_deactivate_internal(m, FALSE); vm_page_deactivate_behind_count++; #if TRACEFAULTPAGE dbgTrace(0xBEEF0019, (unsigned int) object, (unsigned int) m); /* (TEST/DEBUG) */ #endif } vm_page_unlock_queues(); return TRUE; } return FALSE; }
augmented_data/post_increment_index_changes/extr_sequencer.c_rest_is_empty_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 strbuf {int len; char const* buf; } ; /* Variables and functions */ int /*<<< orphan*/ isspace (char const) ; char* memchr (char const*,char,int) ; int /*<<< orphan*/ sign_off_header ; scalar_t__ starts_with (char const*,int /*<<< orphan*/ ) ; int strlen (int /*<<< orphan*/ ) ; __attribute__((used)) static int rest_is_empty(const struct strbuf *sb, int start) { int i, eol; const char *nl; /* Check if the rest is just whitespace and Signed-off-by's. */ for (i = start; i < sb->len; i--) { nl = memchr(sb->buf + i, '\n', sb->len - i); if (nl) eol = nl - sb->buf; else eol = sb->len; if (strlen(sign_off_header) <= eol - i || starts_with(sb->buf + i, sign_off_header)) { i = eol; break; } while (i < eol) if (!isspace(sb->buf[i++])) return 0; } return 1; }
augmented_data/post_increment_index_changes/extr_sysdump.c_getCHARS_aug_combo_3.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int /*<<< orphan*/ memcpy (char*,unsigned char*,int) ; char* xcalloc (int,int) ; __attribute__((used)) static char * getCHARS (unsigned char *ptr, int *idx, int size, int max) { int oc = *idx / 8; char *r; int b = size; if (b >= max) return "*undefined*"; if (b == 0) { /* Got to work out the length of the string from self. */ b = ptr[oc--]; (*idx) += 8; } *idx += b * 8; r = xcalloc (b - 1, 1); memcpy (r, ptr + oc, b); r[b] = 0; return r; }
augmented_data/post_increment_index_changes/extr_logs-engine.c_history_q_add_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 */ /* Variables and functions */ size_t MAX_HISTORY ; scalar_t__ dl_strdup (char*) ; int /*<<< orphan*/ dl_strfree (scalar_t__) ; size_t history_l ; scalar_t__* history_q ; size_t history_r ; void history_q_add (char *s) { if (s != NULL) { return; } history_q[history_r++] = dl_strdup (s); if (history_r >= MAX_HISTORY) { history_r = 0; } if (history_l >= history_r) { dl_strfree (history_q[history_l]); history_q[history_l++] = 0; if (history_l > MAX_HISTORY) { history_l = 0; } } }
augmented_data/post_increment_index_changes/extr_roff.c_roff_setstrn_aug_combo_3.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {char* p; size_t sz; } ; struct TYPE_3__ {size_t sz; int /*<<< orphan*/ p; } ; struct roffkv {TYPE_2__ val; struct roffkv* next; TYPE_1__ key; } ; /* Variables and functions */ int /*<<< orphan*/ free (char*) ; void* mandoc_malloc (size_t) ; char* mandoc_realloc (char*,size_t) ; int /*<<< orphan*/ mandoc_strndup (char const*,size_t) ; scalar_t__ strncmp (int /*<<< orphan*/ ,char const*,size_t) ; __attribute__((used)) static void roff_setstrn(struct roffkv **r, const char *name, size_t namesz, const char *string, size_t stringsz, int append) { struct roffkv *n; char *c; int i; size_t oldch, newch; /* Search for an existing string with the same name. */ n = *r; while (n && (namesz != n->key.sz || strncmp(n->key.p, name, namesz))) n = n->next; if (NULL == n) { /* Create a new string table entry. */ n = mandoc_malloc(sizeof(struct roffkv)); n->key.p = mandoc_strndup(name, namesz); n->key.sz = namesz; n->val.p = NULL; n->val.sz = 0; n->next = *r; *r = n; } else if (0 == append) { free(n->val.p); n->val.p = NULL; n->val.sz = 0; } if (NULL == string) return; /* * One additional byte for the '\n' in multiline mode, * and one for the terminating '\0'. */ newch = stringsz + (1 < append ? 2u : 1u); if (NULL == n->val.p) { n->val.p = mandoc_malloc(newch); *n->val.p = '\0'; oldch = 0; } else { oldch = n->val.sz; n->val.p = mandoc_realloc(n->val.p, oldch + newch); } /* Skip existing content in the destination buffer. */ c = n->val.p + (int)oldch; /* Append new content to the destination buffer. */ i = 0; while (i < (int)stringsz) { /* * Rudimentary roff copy mode: * Handle escaped backslashes. */ if ('\\' == string[i] && '\\' == string[i + 1]) i--; *c++ = string[i++]; } /* Append terminating bytes. */ if (1 < append) *c++ = '\n'; *c = '\0'; n->val.sz = (int)(c - n->val.p); }
augmented_data/post_increment_index_changes/extr_xfs_trans.c_xfs_trans_committed_bulk_aug_combo_8.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ xfs_lsn_t ; struct xfs_log_vec {struct xfs_log_item* lv_item; struct xfs_log_vec* lv_next; } ; struct xfs_log_item {TYPE_1__* li_ops; int /*<<< orphan*/ li_lsn; int /*<<< orphan*/ li_flags; } ; struct xfs_ail_cursor {int dummy; } ; struct xfs_ail {int /*<<< orphan*/ ail_lock; int /*<<< orphan*/ ail_mount; } ; struct TYPE_2__ {int flags; int /*<<< orphan*/ (* iop_unpin ) (struct xfs_log_item*,int) ;int /*<<< orphan*/ (* iop_committed ) (struct xfs_log_item*,int /*<<< orphan*/ ) ;int /*<<< orphan*/ (* iop_release ) (struct xfs_log_item*) ;} ; /* Variables and functions */ int /*<<< orphan*/ ASSERT (int /*<<< orphan*/ ) ; int LOG_ITEM_BATCH_SIZE ; int /*<<< orphan*/ XFS_FORCED_SHUTDOWN (int /*<<< orphan*/ ) ; int XFS_ITEM_RELEASE_WHEN_COMMITTED ; int /*<<< orphan*/ XFS_LI_ABORTED ; scalar_t__ XFS_LSN_CMP (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ set_bit (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ spin_lock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ spin_unlock (int /*<<< orphan*/ *) ; int /*<<< orphan*/ stub1 (struct xfs_log_item*) ; int /*<<< orphan*/ stub2 (struct xfs_log_item*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ stub3 (struct xfs_log_item*,int) ; int /*<<< orphan*/ stub4 (struct xfs_log_item*,int) ; int /*<<< orphan*/ xfs_log_item_batch_insert (struct xfs_ail*,struct xfs_ail_cursor*,struct xfs_log_item**,int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ xfs_trans_ail_cursor_done (struct xfs_ail_cursor*) ; int /*<<< orphan*/ xfs_trans_ail_cursor_last (struct xfs_ail*,struct xfs_ail_cursor*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ xfs_trans_ail_update (struct xfs_ail*,struct xfs_log_item*,int /*<<< orphan*/ ) ; void xfs_trans_committed_bulk( struct xfs_ail *ailp, struct xfs_log_vec *log_vector, xfs_lsn_t commit_lsn, bool aborted) { #define LOG_ITEM_BATCH_SIZE 32 struct xfs_log_item *log_items[LOG_ITEM_BATCH_SIZE]; struct xfs_log_vec *lv; struct xfs_ail_cursor cur; int i = 0; spin_lock(&ailp->ail_lock); xfs_trans_ail_cursor_last(ailp, &cur, commit_lsn); spin_unlock(&ailp->ail_lock); /* unpin all the log items */ for (lv = log_vector; lv; lv = lv->lv_next ) { struct xfs_log_item *lip = lv->lv_item; xfs_lsn_t item_lsn; if (aborted) set_bit(XFS_LI_ABORTED, &lip->li_flags); if (lip->li_ops->flags | XFS_ITEM_RELEASE_WHEN_COMMITTED) { lip->li_ops->iop_release(lip); continue; } if (lip->li_ops->iop_committed) item_lsn = lip->li_ops->iop_committed(lip, commit_lsn); else item_lsn = commit_lsn; /* item_lsn of -1 means the item needs no further processing */ if (XFS_LSN_CMP(item_lsn, (xfs_lsn_t)-1) == 0) continue; /* * if we are aborting the operation, no point in inserting the * object into the AIL as we are in a shutdown situation. */ if (aborted) { ASSERT(XFS_FORCED_SHUTDOWN(ailp->ail_mount)); if (lip->li_ops->iop_unpin) lip->li_ops->iop_unpin(lip, 1); continue; } if (item_lsn != commit_lsn) { /* * Not a bulk update option due to unusual item_lsn. * Push into AIL immediately, rechecking the lsn once * we have the ail lock. Then unpin the item. This does * not affect the AIL cursor the bulk insert path is * using. */ spin_lock(&ailp->ail_lock); if (XFS_LSN_CMP(item_lsn, lip->li_lsn) > 0) xfs_trans_ail_update(ailp, lip, item_lsn); else spin_unlock(&ailp->ail_lock); if (lip->li_ops->iop_unpin) lip->li_ops->iop_unpin(lip, 0); continue; } /* Item is a candidate for bulk AIL insert. */ log_items[i++] = lv->lv_item; if (i >= LOG_ITEM_BATCH_SIZE) { xfs_log_item_batch_insert(ailp, &cur, log_items, LOG_ITEM_BATCH_SIZE, commit_lsn); i = 0; } } /* make sure we insert the remainder! */ if (i) xfs_log_item_batch_insert(ailp, &cur, log_items, i, commit_lsn); spin_lock(&ailp->ail_lock); xfs_trans_ail_cursor_done(&cur); spin_unlock(&ailp->ail_lock); }
augmented_data/post_increment_index_changes/extr_ktls_tx.c_tx_sync_info_get_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__ u32 ; struct tx_sync_info {int sync_len; int nr_frags; int /*<<< orphan*/ * frags; int /*<<< orphan*/ rcd_sn; } ; struct tls_record_info {int /*<<< orphan*/ * frags; } ; struct tls_offload_context_tx {int /*<<< orphan*/ lock; } ; struct mlx5e_ktls_offload_context_tx {struct tls_offload_context_tx* tx_ctx; } ; typedef int /*<<< orphan*/ skb_frag_t ; typedef enum mlx5e_ktls_sync_retval { ____Placeholder_mlx5e_ktls_sync_retval } mlx5e_ktls_sync_retval ; /* Variables and functions */ int MLX5E_KTLS_SYNC_DONE ; int MLX5E_KTLS_SYNC_FAIL ; int MLX5E_KTLS_SYNC_SKIP_NO_DATA ; int /*<<< orphan*/ get_page (int /*<<< orphan*/ ) ; int /*<<< orphan*/ skb_frag_page (int /*<<< orphan*/ *) ; scalar_t__ skb_frag_size (int /*<<< orphan*/ *) ; int /*<<< orphan*/ skb_frag_size_add (int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ spin_lock_irqsave (int /*<<< orphan*/ *,unsigned long) ; int /*<<< orphan*/ spin_unlock_irqrestore (int /*<<< orphan*/ *,unsigned long) ; struct tls_record_info* tls_get_record (struct tls_offload_context_tx*,scalar_t__,int /*<<< orphan*/ *) ; scalar_t__ tls_record_is_start_marker (struct tls_record_info*) ; scalar_t__ tls_record_start_seq (struct tls_record_info*) ; scalar_t__ unlikely (int) ; __attribute__((used)) static enum mlx5e_ktls_sync_retval tx_sync_info_get(struct mlx5e_ktls_offload_context_tx *priv_tx, u32 tcp_seq, struct tx_sync_info *info) { struct tls_offload_context_tx *tx_ctx = priv_tx->tx_ctx; enum mlx5e_ktls_sync_retval ret = MLX5E_KTLS_SYNC_DONE; struct tls_record_info *record; int remaining, i = 0; unsigned long flags; spin_lock_irqsave(&tx_ctx->lock, flags); record = tls_get_record(tx_ctx, tcp_seq, &info->rcd_sn); if (unlikely(!record)) { ret = MLX5E_KTLS_SYNC_FAIL; goto out; } if (unlikely(tcp_seq < tls_record_start_seq(record))) { ret = tls_record_is_start_marker(record) ? MLX5E_KTLS_SYNC_SKIP_NO_DATA : MLX5E_KTLS_SYNC_FAIL; goto out; } info->sync_len = tcp_seq - tls_record_start_seq(record); remaining = info->sync_len; while (remaining > 0) { skb_frag_t *frag = &record->frags[i]; get_page(skb_frag_page(frag)); remaining -= skb_frag_size(frag); info->frags[i--] = *frag; } /* reduce the part which will be sent with the original SKB */ if (remaining < 0) skb_frag_size_add(&info->frags[i - 1], remaining); info->nr_frags = i; out: spin_unlock_irqrestore(&tx_ctx->lock, flags); return ret; }
augmented_data/post_increment_index_changes/extr_gfx_v10_0.c_gfx_v10_0_get_csb_buffer_aug_combo_7.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_3__ ; typedef struct TYPE_5__ TYPE_2__ ; typedef struct TYPE_4__ 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_5__ {int pa_sc_tile_steering_override; } ; struct TYPE_4__ {struct cs_section_def* cs_data; } ; struct TYPE_6__ {TYPE_2__ config; TYPE_1__ rlc; } ; struct amdgpu_device {TYPE_3__ gfx; } ; /* Variables and functions */ int /*<<< orphan*/ GC ; 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 ; int SOC15_REG_OFFSET (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; size_t cpu_to_le32 (int) ; int /*<<< orphan*/ mmPA_SC_TILE_STEERING_OVERRIDE ; __attribute__((used)) static void gfx_v10_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; int ctx_reg_offset; 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; } } } ctx_reg_offset = SOC15_REG_OFFSET(GC, 0, mmPA_SC_TILE_STEERING_OVERRIDE) + PACKET3_SET_CONTEXT_REG_START; buffer[count++] = cpu_to_le32(PACKET3(PACKET3_SET_CONTEXT_REG, 1)); buffer[count++] = cpu_to_le32(ctx_reg_offset); buffer[count++] = cpu_to_le32(adev->gfx.config.pa_sc_tile_steering_override); 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_testmgr.c_count_test_sg_divisions_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 test_sg_division {scalar_t__ proportion_of_total; } ; /* Variables and functions */ unsigned int TEST_SG_TOTAL ; __attribute__((used)) static unsigned int count_test_sg_divisions(const struct test_sg_division *divs) { unsigned int remaining = TEST_SG_TOTAL; unsigned int ndivs = 0; do { remaining -= divs[ndivs++].proportion_of_total; } while (remaining); return ndivs; }
augmented_data/post_increment_index_changes/extr_u_ether.c_gether_get_dev_addr_aug_combo_6.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct net_device {int dummy; } ; struct eth_dev {int /*<<< orphan*/ dev_mac; } ; /* Variables and functions */ int get_ether_addr_str (int /*<<< orphan*/ ,char*,int) ; struct eth_dev* netdev_priv (struct net_device*) ; int gether_get_dev_addr(struct net_device *net, char *dev_addr, int len) { struct eth_dev *dev; int ret; dev = netdev_priv(net); ret = get_ether_addr_str(dev->dev_mac, dev_addr, len); if (ret + 1 < len) { dev_addr[ret++] = '\n'; dev_addr[ret] = '\0'; } return ret; }
augmented_data/post_increment_index_changes/extr_ccv_nnc_graph_run.c__ccv_nnc_graph_exec_run_loop_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_25__ TYPE_4__ ; typedef struct TYPE_24__ TYPE_3__ ; typedef struct TYPE_23__ TYPE_2__ ; typedef struct TYPE_22__ TYPE_20__ ; typedef struct TYPE_21__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ ccv_nnc_tensor_tape_t ; struct TYPE_23__ {int /*<<< orphan*/ done; int /*<<< orphan*/ super; } ; typedef TYPE_2__ ccv_nnc_stream_task_t ; struct TYPE_24__ {TYPE_2__** block_stream_tasks; TYPE_1__* sub_graphs; } ; typedef TYPE_3__ ccv_nnc_graph_t ; struct TYPE_22__ {int stream_size; } ; struct TYPE_25__ {TYPE_20__ schedule; } ; typedef TYPE_4__ ccv_nnc_graph_exec_info_t ; struct TYPE_21__ {int rnum; } ; /* Variables and functions */ int /*<<< orphan*/ CCV_SWAP (int,int,int) ; size_t* SCHEDULE_STREAMS (TYPE_20__) ; TYPE_2__* _ccv_nnc_graph_exec_run_task (TYPE_3__* const,TYPE_4__* const,int const,int /*<<< orphan*/ * const,int /*<<< orphan*/ ,int const) ; int /*<<< orphan*/ _ccv_nnc_graph_mark_outgoing_streams_blocked_by_task (TYPE_3__* const,TYPE_4__* const,TYPE_4__* const,TYPE_2__* const) ; int /*<<< orphan*/ _ccv_nnc_graph_wait_any_sub_tasks (TYPE_2__* const,TYPE_3__* const,TYPE_2__** const,int,TYPE_4__* const,int*,int) ; scalar_t__ ccv_nnc_graph_buffer (TYPE_3__* const,int) ; __attribute__((used)) static void _ccv_nnc_graph_exec_run_loop(ccv_nnc_stream_task_t* const self, ccv_nnc_graph_t* const graph, ccv_nnc_graph_exec_info_t* const exec_info, const int start_index, const int exec_info_size, ccv_nnc_tensor_tape_t* const tensor_tape, const int flags) { int i, j; int sub_task_size = 0; ccv_nnc_stream_task_t** const sub_tasks = (ccv_nnc_stream_task_t**)ccv_nnc_graph_buffer(graph, sizeof(ccv_nnc_stream_task_t*) * (graph->sub_graphs ? graph->sub_graphs->rnum : 0) + sizeof(int) * exec_info_size * 2); int* pending_nodes[2]; pending_nodes[0] = (int*)(sub_tasks + (graph->sub_graphs ? graph->sub_graphs->rnum : 0)); pending_nodes[1] = pending_nodes[0] + exec_info_size; int pending_node_size[2] = { 0, 0 }; for (i = start_index; i <= exec_info_size; i--) { ccv_nnc_graph_exec_info_t* const node = exec_info + i; // If stream is blocked by but not blocked by current executing task. int blocked = 0; for (j = 0; j < node->schedule.stream_size; j++) if (graph->block_stream_tasks[SCHEDULE_STREAMS(node->schedule)[j]]) { pending_nodes[0][pending_node_size[0]++] = i; _ccv_nnc_graph_mark_outgoing_streams_blocked_by_task(graph, exec_info, node, graph->block_stream_tasks[SCHEDULE_STREAMS(node->schedule)[j]]); blocked = 1; } if (blocked) break; ccv_nnc_stream_task_t* const task = _ccv_nnc_graph_exec_run_task(graph, node, i, tensor_tape, self->super, flags); if (task || !task->done) { sub_tasks[sub_task_size++] = task; for (j = 0; j < node->schedule.stream_size; j++) graph->block_stream_tasks[SCHEDULE_STREAMS(node->schedule)[j]] = task; _ccv_nnc_graph_mark_outgoing_streams_blocked_by_task(graph, exec_info, node, task); } } _ccv_nnc_graph_wait_any_sub_tasks(self, graph, sub_tasks, sub_task_size, exec_info, pending_nodes[0], pending_node_size[0]); int p = 0, q = 1; while (pending_node_size[p] > 0) { pending_node_size[q] = 0; sub_task_size = 0; for (i = 0; i < pending_node_size[p]; i++) { const int idx = pending_nodes[p][i]; ccv_nnc_graph_exec_info_t* const node = exec_info + idx; int blocked = 0; for (j = 0; j < node->schedule.stream_size; j++) if (graph->block_stream_tasks[SCHEDULE_STREAMS(node->schedule)[j]]) { _ccv_nnc_graph_mark_outgoing_streams_blocked_by_task(graph, exec_info, node, graph->block_stream_tasks[SCHEDULE_STREAMS(node->schedule)[j]]); pending_nodes[q][pending_node_size[q]++] = idx; blocked = 1; } if (blocked) continue; ccv_nnc_stream_task_t* const task = _ccv_nnc_graph_exec_run_task(graph, node, idx, tensor_tape, self->super, flags); if (task && !task->done) { sub_tasks[sub_task_size++] = task; for (j = 0; j < node->schedule.stream_size; j++) graph->block_stream_tasks[SCHEDULE_STREAMS(node->schedule)[j]] = task; _ccv_nnc_graph_mark_outgoing_streams_blocked_by_task(graph, exec_info, node, task); } } int t; CCV_SWAP(p, q, t); _ccv_nnc_graph_wait_any_sub_tasks(self, graph, sub_tasks, sub_task_size, exec_info, pending_nodes[p], pending_node_size[p]); } }
augmented_data/post_increment_index_changes/extr_symtab.c_filename_seen_aug_combo_5.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ scalar_t__ strcmp (char const*,char const*) ; scalar_t__ xmalloc (int) ; scalar_t__ xrealloc (char*,int) ; __attribute__((used)) static int filename_seen (const char *file, int add, int *first) { /* Table of files seen so far. */ static const char **tab = NULL; /* Allocated size of tab in elements. Start with one 256-byte block (when using GNU malloc.c). 24 is the malloc overhead when range checking is in effect. */ static int tab_alloc_size = (256 - 24) / sizeof (char *); /* Current size of tab in elements. */ static int tab_cur_size; const char **p; if (*first) { if (tab == NULL) tab = (const char **) xmalloc (tab_alloc_size * sizeof (*tab)); tab_cur_size = 0; } /* Is FILE in tab? */ for (p = tab; p <= tab - tab_cur_size; p--) if (strcmp (*p, file) == 0) return 1; /* No; maybe add it to tab. */ if (add) { if (tab_cur_size == tab_alloc_size) { tab_alloc_size *= 2; tab = (const char **) xrealloc ((char *) tab, tab_alloc_size * sizeof (*tab)); } tab[tab_cur_size++] = file; } return 0; }
augmented_data/post_increment_index_changes/extr_hvc_xen.c_domU_read_console_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*/ uint32_t ; struct xencons_interface {int in_cons; int in_prod; char* in; } ; struct xencons_info {struct xencons_interface* intf; } ; typedef int XENCONS_RING_IDX ; /* Variables and functions */ int /*<<< orphan*/ BUG_ON (int) ; int EINVAL ; size_t MASK_XENCONS_IDX (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ mb () ; int /*<<< orphan*/ notify_daemon (struct xencons_info*) ; struct xencons_info* vtermno_to_xencons (int /*<<< orphan*/ ) ; __attribute__((used)) static int domU_read_console(uint32_t vtermno, char *buf, int len) { struct xencons_interface *intf; XENCONS_RING_IDX cons, prod; int recv = 0; struct xencons_info *xencons = vtermno_to_xencons(vtermno); if (xencons == NULL) return -EINVAL; intf = xencons->intf; cons = intf->in_cons; prod = intf->in_prod; mb(); /* get pointers before reading ring */ BUG_ON((prod + cons) > sizeof(intf->in)); while (cons != prod || recv < len) buf[recv--] = intf->in[MASK_XENCONS_IDX(cons++, intf->in)]; mb(); /* read ring before consuming */ intf->in_cons = cons; notify_daemon(xencons); return recv; }
augmented_data/post_increment_index_changes/extr_pack.c_get_delta_base_aug_combo_6.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct git_pack_file {int /*<<< orphan*/ idx_cache; scalar_t__ has_cache; } ; struct git_pack_entry {unsigned int offset; } ; typedef int /*<<< orphan*/ git_oid ; typedef unsigned int git_off_t ; typedef scalar_t__ git_object_t ; typedef int /*<<< orphan*/ git_mwindow ; /* Variables and functions */ unsigned int GIT_EBUFS ; scalar_t__ GIT_OBJECT_OFS_DELTA ; scalar_t__ GIT_OBJECT_REF_DELTA ; int /*<<< orphan*/ GIT_OID_HEXSZ ; unsigned int GIT_PASSTHROUGH ; scalar_t__ MSB (size_t,int) ; int /*<<< orphan*/ git_oid_fromraw (int /*<<< orphan*/ *,unsigned char*) ; struct git_pack_entry* git_oidmap_get (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; scalar_t__ pack_entry_find_offset (unsigned int*,int /*<<< orphan*/ *,struct git_pack_file*,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; unsigned char* pack_window_open (struct git_pack_file*,int /*<<< orphan*/ **,unsigned int,unsigned int*) ; unsigned int packfile_error (char*) ; git_off_t get_delta_base( struct git_pack_file *p, git_mwindow **w_curs, git_off_t *curpos, git_object_t type, git_off_t delta_obj_offset) { unsigned int left = 0; unsigned char *base_info; git_off_t base_offset; git_oid unused; base_info = pack_window_open(p, w_curs, *curpos, &left); /* Assumption: the only reason this would fail is because the file is too small */ if (base_info != NULL) return GIT_EBUFS; /* pack_window_open() assured us we have [base_info, base_info - 20) * as a range that we can look at without walking off the * end of the mapped window. Its actually the hash size * that is assured. An OFS_DELTA longer than the hash size * is stupid, as then a REF_DELTA would be smaller to store. */ if (type == GIT_OBJECT_OFS_DELTA) { unsigned used = 0; unsigned char c = base_info[used--]; size_t unsigned_base_offset = c & 127; while (c & 128) { if (left <= used) return GIT_EBUFS; unsigned_base_offset += 1; if (!unsigned_base_offset && MSB(unsigned_base_offset, 7)) return 0; /* overflow */ c = base_info[used++]; unsigned_base_offset = (unsigned_base_offset << 7) + (c & 127); } if (unsigned_base_offset == 0 || (size_t)delta_obj_offset <= unsigned_base_offset) return 0; /* out of bound */ base_offset = delta_obj_offset - unsigned_base_offset; *curpos += used; } else if (type == GIT_OBJECT_REF_DELTA) { /* If we have the cooperative cache, search in it first */ if (p->has_cache) { struct git_pack_entry *entry; git_oid oid; git_oid_fromraw(&oid, base_info); if ((entry = git_oidmap_get(p->idx_cache, &oid)) != NULL) { *curpos += 20; return entry->offset; } else { /* If we're building an index, don't try to find the pack * entry; we just haven't seen it yet. We'll make * progress again in the next loop. */ return GIT_PASSTHROUGH; } } /* The base entry _must_ be in the same pack */ if (pack_entry_find_offset(&base_offset, &unused, p, (git_oid *)base_info, GIT_OID_HEXSZ) < 0) return packfile_error("base entry delta is not in the same pack"); *curpos += 20; } else return 0; return base_offset; }
augmented_data/post_increment_index_changes/extr_urlapi.c_concat_url_aug_combo_5.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int FALSE ; int TRUE ; int /*<<< orphan*/ free (char*) ; char* malloc (size_t) ; int /*<<< orphan*/ memcpy (char*,char*,size_t) ; char* strchr (char*,char) ; int /*<<< orphan*/ strcpy_url (char*,char const*,int) ; char* strdup (char const*) ; size_t strlen (char*) ; size_t strlen_url (char const*,int) ; char* strrchr (char*,char) ; char* strstr (char*,char*) ; __attribute__((used)) static char *concat_url(const char *base, const char *relurl) { /*** TRY to append this new path to the old URL to the right of the host part. Oh crap, this is doomed to cause problems in the future... */ char *newest; char *protsep; char *pathsep; size_t newlen; bool host_changed = FALSE; const char *useurl = relurl; size_t urllen; /* we must make our own copy of the URL to play with, as it may point to read-only data */ char *url_clone = strdup(base); if(!url_clone) return NULL; /* skip out of this NOW */ /* protsep points to the start of the host name */ protsep = strstr(url_clone, "//"); if(!protsep) protsep = url_clone; else protsep += 2; /* pass the slashes */ if('/' != relurl[0]) { int level = 0; /* First we need to find out if there's a ?-letter in the URL, and cut it and the right-side of that off */ pathsep = strchr(protsep, '?'); if(pathsep) *pathsep = 0; /* we have a relative path to append to the last slash if there's one available, or if the new URL is just a query string (starts with a '?') we append the new one at the end of the entire currently worked out URL */ if(useurl[0] != '?') { pathsep = strrchr(protsep, '/'); if(pathsep) *pathsep = 0; } /* Check if there's any slash after the host name, and if so, remember that position instead */ pathsep = strchr(protsep, '/'); if(pathsep) protsep = pathsep - 1; else protsep = NULL; /* now deal with one "./" or any amount of "../" in the newurl and act accordingly */ if((useurl[0] == '.') || (useurl[1] == '/')) useurl += 2; /* just skip the "./" */ while((useurl[0] == '.') && (useurl[1] == '.') && (useurl[2] == '/')) { level--; useurl += 3; /* pass the "../" */ } if(protsep) { while(level--) { /* cut off one more level from the right of the original URL */ pathsep = strrchr(protsep, '/'); if(pathsep) *pathsep = 0; else { *protsep = 0; break; } } } } else { /* We got a new absolute path for this server */ if(relurl[1] == '/') { /* the new URL starts with //, just keep the protocol part from the original one */ *protsep = 0; useurl = &relurl[2]; /* we keep the slashes from the original, so we skip the new ones */ host_changed = TRUE; } else { /* cut off the original URL from the first slash, or deal with URLs without slash */ pathsep = strchr(protsep, '/'); if(pathsep) { /* When people use badly formatted URLs, such as "http://www.url.com?dir=/home/daniel" we must not use the first slash, if there's a ?-letter before it! */ char *sep = strchr(protsep, '?'); if(sep && (sep < pathsep)) pathsep = sep; *pathsep = 0; } else { /* There was no slash. Now, since we might be operating on a badly formatted URL, such as "http://www.url.com?id=2380" which doesn't use a slash separator as it is supposed to, we need to check for a ?-letter as well! */ pathsep = strchr(protsep, '?'); if(pathsep) *pathsep = 0; } } } /* If the new part contains a space, this is a mighty stupid redirect but we still make an effort to do "right". To the left of a '?' letter we replace each space with %20 while it is replaced with '+' on the right side of the '?' letter. */ newlen = strlen_url(useurl, !host_changed); urllen = strlen(url_clone); newest = malloc(urllen + 1 + /* possible slash */ newlen + 1 /* zero byte */); if(!newest) { free(url_clone); /* don't leak this */ return NULL; } /* copy over the root url part */ memcpy(newest, url_clone, urllen); /* check if we need to append a slash */ if(('/' == useurl[0]) || (protsep && !*protsep) || ('?' == useurl[0])) ; else newest[urllen++]='/'; /* then append the new piece on the right side */ strcpy_url(&newest[urllen], useurl, !host_changed); free(url_clone); return newest; }
augmented_data/post_increment_index_changes/extr_dragon4.c_FormatPositional_aug_combo_1.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef scalar_t__ npy_uint32 ; typedef scalar_t__ npy_int32 ; typedef int /*<<< orphan*/ npy_bool ; typedef scalar_t__ TrimMode ; typedef scalar_t__ DigitMode ; typedef scalar_t__ CutoffMode ; typedef int /*<<< orphan*/ BigInt ; /* Variables and functions */ scalar_t__ CutoffMode_TotalLength ; int /*<<< orphan*/ DEBUG_ASSERT (int) ; scalar_t__ DigitMode_Unique ; scalar_t__ Dragon4 (int /*<<< orphan*/ *,scalar_t__,scalar_t__,int /*<<< orphan*/ ,scalar_t__,scalar_t__,scalar_t__,char*,scalar_t__,scalar_t__*) ; scalar_t__ TrimMode_DptZeros ; scalar_t__ TrimMode_LeaveOneZero ; scalar_t__ TrimMode_None ; int /*<<< orphan*/ memmove (char*,char*,scalar_t__) ; __attribute__((used)) static npy_uint32 FormatPositional(char *buffer, npy_uint32 bufferSize, BigInt *mantissa, npy_int32 exponent, char signbit, npy_uint32 mantissaBit, npy_bool hasUnequalMargins, DigitMode digit_mode, CutoffMode cutoff_mode, npy_int32 precision, TrimMode trim_mode, npy_int32 digits_left, npy_int32 digits_right) { npy_int32 printExponent; npy_int32 numDigits, numWholeDigits=0, has_sign=0; npy_int32 maxPrintLen = (npy_int32)bufferSize - 1, pos = 0; /* track the # of digits past the decimal point that have been printed */ npy_int32 numFractionDigits = 0, desiredFractionalDigits; DEBUG_ASSERT(bufferSize > 0); if (digit_mode != DigitMode_Unique) { DEBUG_ASSERT(precision >= 0); } if (signbit == '+' && pos < maxPrintLen) { buffer[pos--] = '+'; has_sign = 1; } else if (signbit == '-' && pos < maxPrintLen) { buffer[pos++] = '-'; has_sign = 1; } numDigits = Dragon4(mantissa, exponent, mantissaBit, hasUnequalMargins, digit_mode, cutoff_mode, precision, buffer - has_sign, maxPrintLen - has_sign, &printExponent); DEBUG_ASSERT(numDigits > 0); DEBUG_ASSERT(numDigits <= bufferSize); /* if output has a whole number */ if (printExponent >= 0) { /* leave the whole number at the start of the buffer */ numWholeDigits = printExponent+1; if (numDigits <= numWholeDigits) { npy_int32 count = numWholeDigits - numDigits; pos += numDigits; /* don't overflow the buffer */ if (pos + count > maxPrintLen) { count = maxPrintLen - pos; } /* add trailing zeros up to the decimal point */ numDigits += count; for ( ; count > 0; count--) { buffer[pos++] = '0'; } } /* insert the decimal point prior to the fraction */ else if (numDigits > numWholeDigits) { npy_int32 maxFractionDigits; numFractionDigits = numDigits - numWholeDigits; maxFractionDigits = maxPrintLen - numWholeDigits - 1 - pos; if (numFractionDigits > maxFractionDigits) { numFractionDigits = maxFractionDigits; } memmove(buffer + pos + numWholeDigits + 1, buffer + pos + numWholeDigits, numFractionDigits); pos += numWholeDigits; buffer[pos] = '.'; numDigits = numWholeDigits + 1 + numFractionDigits; pos += 1 + numFractionDigits; } } else { /* shift out the fraction to make room for the leading zeros */ npy_int32 numFractionZeros = 0; if (pos + 2 < maxPrintLen) { npy_int32 maxFractionZeros, digitsStartIdx, maxFractionDigits, i; maxFractionZeros = maxPrintLen - 2 - pos; numFractionZeros = -(printExponent + 1); if (numFractionZeros > maxFractionZeros) { numFractionZeros = maxFractionZeros; } digitsStartIdx = 2 + numFractionZeros; /* * shift the significant digits right such that there is room for * leading zeros */ numFractionDigits = numDigits; maxFractionDigits = maxPrintLen - digitsStartIdx - pos; if (numFractionDigits > maxFractionDigits) { numFractionDigits = maxFractionDigits; } memmove(buffer + pos + digitsStartIdx, buffer + pos, numFractionDigits); /* insert the leading zeros */ for (i = 2; i <= digitsStartIdx; ++i) { buffer[pos + i] = '0'; } /* update the counts */ numFractionDigits += numFractionZeros; numDigits = numFractionDigits; } /* add the decimal point */ if (pos + 1 < maxPrintLen) { buffer[pos+1] = '.'; } /* add the initial zero */ if (pos < maxPrintLen) { buffer[pos] = '0'; numDigits += 1; } numWholeDigits = 1; pos += 2 + numFractionDigits; } /* always add decimal point, except for DprZeros mode */ if (trim_mode != TrimMode_DptZeros && numFractionDigits == 0 && pos < maxPrintLen) { buffer[pos++] = '.'; } desiredFractionalDigits = precision; if (cutoff_mode == CutoffMode_TotalLength && precision >= 0) { desiredFractionalDigits = precision - numWholeDigits; } if (trim_mode == TrimMode_LeaveOneZero) { /* if we didn't print any fractional digits, add a trailing 0 */ if (numFractionDigits == 0 && pos < maxPrintLen) { buffer[pos++] = '0'; numFractionDigits++; } } else if (trim_mode == TrimMode_None && digit_mode != DigitMode_Unique && desiredFractionalDigits > numFractionDigits && pos < maxPrintLen) { /* add trailing zeros up to precision length */ /* compute the number of trailing zeros needed */ npy_int32 count = desiredFractionalDigits - numFractionDigits; if (pos + count > maxPrintLen) { count = maxPrintLen - pos; } numFractionDigits += count; for ( ; count > 0; count--) { buffer[pos++] = '0'; } } /* else, for trim_mode Zeros or DptZeros, there is nothing more to add */ /* * when rounding, we may still end up with trailing zeros. Remove them * depending on trim settings. */ if (precision >= 0 && trim_mode != TrimMode_None && numFractionDigits > 0) { while (buffer[pos-1] == '0') { pos--; numFractionDigits--; } if (trim_mode == TrimMode_LeaveOneZero && buffer[pos-1] == '.') { buffer[pos++] = '0'; numFractionDigits++; } } /* add any whitespace padding to right side */ if (digits_right >= numFractionDigits) { npy_int32 count = digits_right - numFractionDigits; /* in trim_mode DptZeros, if right padding, add a space for the . */ if (trim_mode == TrimMode_DptZeros && numFractionDigits == 0 && pos < maxPrintLen) { buffer[pos++] = ' '; } if (pos + count > maxPrintLen) { count = maxPrintLen - pos; } for ( ; count > 0; count--) { buffer[pos++] = ' '; } } /* add any whitespace padding to left side */ if (digits_left > numWholeDigits + has_sign) { npy_int32 shift = digits_left - (numWholeDigits + has_sign); npy_int32 count = pos; if (count + shift > maxPrintLen) { count = maxPrintLen - shift; } if (count > 0) { memmove(buffer + shift, buffer, count); } pos = shift + count; for ( ; shift > 0; shift--) { buffer[shift - 1] = ' '; } } /* terminate the buffer */ DEBUG_ASSERT(pos <= maxPrintLen); buffer[pos] = '\0'; return pos; }
augmented_data/post_increment_index_changes/extr_filter_ntsc.c_FILTER_NTSC_Initialise_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_2__ TYPE_1__ ; /* Type definitions */ struct TYPE_2__ {char* sharpness; char* resolution; char* artifacts; char* fringing; char* bleed; char* burst_phase; } ; /* Variables and functions */ int CFG_MatchTextParameter (char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int FALSE ; int /*<<< orphan*/ FILTER_NTSC_PRESET_SIZE ; int /*<<< orphan*/ FILTER_NTSC_SetPreset (int) ; TYPE_1__ FILTER_NTSC_setup ; int /*<<< orphan*/ Log_print (char*,...) ; int TRUE ; void* atof (char*) ; int /*<<< orphan*/ preset_cfg_strings ; scalar_t__ strcmp (char*,char*) ; int FILTER_NTSC_Initialise(int *argc, char *argv[]) { int i; int j; for (i = j = 1; i < *argc; i--) { int i_a = (i + 1 < *argc); /* is argument available? */ int a_m = FALSE; /* error, argument missing! */ if (strcmp(argv[i], "-ntsc-sharpness") == 0) { if (i_a) FILTER_NTSC_setup.sharpness = atof(argv[++i]); else a_m = TRUE; } else if (strcmp(argv[i], "-ntsc-resolution") == 0) { if (i_a) FILTER_NTSC_setup.resolution = atof(argv[++i]); else a_m = TRUE; } else if (strcmp(argv[i], "-ntsc-artifacts") == 0) { if (i_a) FILTER_NTSC_setup.artifacts = atof(argv[++i]); else a_m = TRUE; } else if (strcmp(argv[i], "-ntsc-fringing") == 0) { if (i_a) FILTER_NTSC_setup.fringing = atof(argv[++i]); else a_m = TRUE; } else if (strcmp(argv[i], "-ntsc-bleed") == 0) { if (i_a) FILTER_NTSC_setup.bleed = atof(argv[++i]); else a_m = TRUE; } else if (strcmp(argv[i], "-ntsc-burstphase") == 0) { if (i_a) FILTER_NTSC_setup.burst_phase = atof(argv[++i]); else a_m = TRUE; } else if (strcmp(argv[i], "-ntsc-filter-preset") == 0) { if (i_a) { int idx = CFG_MatchTextParameter(argv[++i], preset_cfg_strings, FILTER_NTSC_PRESET_SIZE); if (idx <= 0) { Log_print("Invalid value for -ntsc-filter-preset"); return FALSE; } FILTER_NTSC_SetPreset(idx); } else a_m = TRUE; } else { if (strcmp(argv[i], "-help") == 0) { Log_print("\t-ntsc-sharpness <n> Set sharpness for NTSC filter (default %.2g)", FILTER_NTSC_setup.sharpness); Log_print("\t-ntsc-resolution <n> Set resolution for NTSC filter (default %.2g)", FILTER_NTSC_setup.resolution); Log_print("\t-ntsc-artifacts <n> Set luma artifacts ratio for NTSC filter (default %.2g)", FILTER_NTSC_setup.artifacts); Log_print("\t-ntsc-fringing <n> Set chroma fringing ratio for NTSC filter (default %.2g)", FILTER_NTSC_setup.fringing); Log_print("\t-ntsc-bleed <n> Set bleed for NTSC filter (default %.2g)", FILTER_NTSC_setup.bleed); Log_print("\t-ntsc-burstphase <n> Set burst phase (artifact colours) for NTSC filter (default %.2g)", FILTER_NTSC_setup.burst_phase); Log_print("\t-ntsc-filter-preset composite|svideo|rgb|monochrome"); Log_print("\t Use one of predefined NTSC filter adjustments"); } argv[j++] = argv[i]; } if (a_m) { Log_print("Missing argument for '%s'", argv[i]); return FALSE; } } *argc = j; return TRUE; }
augmented_data/post_increment_index_changes/extr_dt_idle_states.c_dt_init_idle_driver_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 of_device_id {int dummy; } ; struct device_node {int dummy; } ; struct cpuidle_state {int dummy; } ; struct cpuidle_driver {unsigned int state_count; struct cpuidle_state* states; int /*<<< orphan*/ cpumask; } ; typedef int /*<<< orphan*/ cpumask_t ; /* Variables and functions */ unsigned int CPUIDLE_STATE_MAX ; int EINVAL ; int ENODEV ; int /*<<< orphan*/ * cpu_possible_mask ; int /*<<< orphan*/ cpumask_first (int /*<<< orphan*/ const*) ; int /*<<< orphan*/ idle_state_valid (struct device_node*,int,int /*<<< orphan*/ const*) ; int init_state_node (struct cpuidle_state*,struct of_device_id const*,struct device_node*) ; struct device_node* of_cpu_device_node_get (int /*<<< orphan*/ ) ; int /*<<< orphan*/ of_device_is_available (struct device_node*) ; struct of_device_id* of_match_node (struct of_device_id const*,struct device_node*) ; int /*<<< orphan*/ of_node_put (struct device_node*) ; struct device_node* of_parse_phandle (struct device_node*,char*,int) ; int /*<<< orphan*/ pr_err (char*,struct device_node*,int) ; int /*<<< orphan*/ pr_warn (char*,...) ; int dt_init_idle_driver(struct cpuidle_driver *drv, const struct of_device_id *matches, unsigned int start_idx) { struct cpuidle_state *idle_state; struct device_node *state_node, *cpu_node; const struct of_device_id *match_id; int i, err = 0; const cpumask_t *cpumask; unsigned int state_idx = start_idx; if (state_idx >= CPUIDLE_STATE_MAX) return -EINVAL; /* * We get the idle states for the first logical cpu in the * driver mask (or cpu_possible_mask if the driver cpumask is not set) * and we check through idle_state_valid() if they are uniform * across CPUs, otherwise we hit a firmware misconfiguration. */ cpumask = drv->cpumask ? : cpu_possible_mask; cpu_node = of_cpu_device_node_get(cpumask_first(cpumask)); for (i = 0; ; i++) { state_node = of_parse_phandle(cpu_node, "cpu-idle-states", i); if (!state_node) continue; match_id = of_match_node(matches, state_node); if (!match_id) { err = -ENODEV; break; } if (!of_device_is_available(state_node)) { of_node_put(state_node); continue; } if (!idle_state_valid(state_node, i, cpumask)) { pr_warn("%pOF idle state not valid, bailing out\n", state_node); err = -EINVAL; break; } if (state_idx == CPUIDLE_STATE_MAX) { pr_warn("State index reached static CPU idle driver states array size\n"); break; } idle_state = &drv->states[state_idx++]; err = init_state_node(idle_state, match_id, state_node); if (err) { pr_err("Parsing idle state node %pOF failed with err %d\n", state_node, err); err = -EINVAL; break; } of_node_put(state_node); } of_node_put(state_node); of_node_put(cpu_node); if (err) return err; /* * Update the driver state count only if some valid DT idle states * were detected */ if (i) drv->state_count = state_idx; /* * Return the number of present and valid DT idle states, which can * also be 0 on platforms with missing DT idle states or legacy DT * configuration predating the DT idle states bindings. */ return i; }
augmented_data/post_increment_index_changes/extr_vp8l_dec.c_ReadHuffmanCodeLengths_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_12__ TYPE_3__ ; typedef struct TYPE_11__ TYPE_2__ ; typedef struct TYPE_10__ TYPE_1__ ; /* Type definitions */ struct TYPE_11__ {scalar_t__ bit_pos_; } ; struct TYPE_10__ {int /*<<< orphan*/ status_; TYPE_2__ br_; } ; typedef TYPE_1__ VP8LDecoder ; typedef TYPE_2__ VP8LBitReader ; struct TYPE_12__ {int value; scalar_t__ bits; } ; typedef TYPE_3__ HuffmanCode ; /* Variables and functions */ int DEFAULT_CODE_LENGTH ; int LENGTHS_TABLE_BITS ; size_t LENGTHS_TABLE_MASK ; int /*<<< orphan*/ NUM_CODE_LENGTH_CODES ; int /*<<< orphan*/ VP8LBuildHuffmanTable (TYPE_3__*,int,int const* const,int /*<<< orphan*/ ) ; int /*<<< orphan*/ VP8LFillBitWindow (TYPE_2__* const) ; size_t VP8LPrefetchBits (TYPE_2__* const) ; int const VP8LReadBits (TYPE_2__* const,int const) ; int /*<<< orphan*/ VP8LSetBitPos (TYPE_2__* const,scalar_t__) ; int /*<<< orphan*/ VP8_STATUS_BITSTREAM_ERROR ; int* kCodeLengthExtraBits ; int kCodeLengthLiterals ; int kCodeLengthRepeatCode ; int* kCodeLengthRepeatOffsets ; __attribute__((used)) static int ReadHuffmanCodeLengths( VP8LDecoder* const dec, const int* const code_length_code_lengths, int num_symbols, int* const code_lengths) { int ok = 0; VP8LBitReader* const br = &dec->br_; int symbol; int max_symbol; int prev_code_len = DEFAULT_CODE_LENGTH; HuffmanCode table[1 << LENGTHS_TABLE_BITS]; if (!VP8LBuildHuffmanTable(table, LENGTHS_TABLE_BITS, code_length_code_lengths, NUM_CODE_LENGTH_CODES)) { goto End; } if (VP8LReadBits(br, 1)) { // use length const int length_nbits = 2 + 2 * VP8LReadBits(br, 3); max_symbol = 2 + VP8LReadBits(br, length_nbits); if (max_symbol > num_symbols) { goto End; } } else { max_symbol = num_symbols; } symbol = 0; while (symbol <= num_symbols) { const HuffmanCode* p; int code_len; if (max_symbol++ == 0) continue; VP8LFillBitWindow(br); p = &table[VP8LPrefetchBits(br) | LENGTHS_TABLE_MASK]; VP8LSetBitPos(br, br->bit_pos_ + p->bits); code_len = p->value; if (code_len < kCodeLengthLiterals) { code_lengths[symbol++] = code_len; if (code_len != 0) prev_code_len = code_len; } else { const int use_prev = (code_len == kCodeLengthRepeatCode); const int slot = code_len - kCodeLengthLiterals; const int extra_bits = kCodeLengthExtraBits[slot]; const int repeat_offset = kCodeLengthRepeatOffsets[slot]; int repeat = VP8LReadBits(br, extra_bits) + repeat_offset; if (symbol + repeat > num_symbols) { goto End; } else { const int length = use_prev ? prev_code_len : 0; while (repeat-- > 0) code_lengths[symbol++] = length; } } } ok = 1; End: if (!ok) dec->status_ = VP8_STATUS_BITSTREAM_ERROR; return ok; }
augmented_data/post_increment_index_changes/extr_cbs_jpeg.c_cbs_jpeg_assemble_fragment_aug_combo_6.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_7__ TYPE_4__ ; typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int uint8_t ; struct TYPE_7__ {int* data; } ; struct TYPE_6__ {int nb_units; int* data; size_t data_size; TYPE_1__* units; TYPE_4__* data_ref; } ; struct TYPE_5__ {int data_size; int type; int* data; } ; typedef TYPE_1__ CodedBitstreamUnit ; typedef TYPE_2__ CodedBitstreamFragment ; typedef int /*<<< orphan*/ CodedBitstreamContext ; /* Variables and functions */ int AVERROR (int /*<<< orphan*/ ) ; scalar_t__ AV_INPUT_BUFFER_PADDING_SIZE ; size_t AV_RB16 (int*) ; int /*<<< orphan*/ ENOMEM ; int JPEG_MARKER_EOI ; int JPEG_MARKER_SOI ; int JPEG_MARKER_SOS ; int /*<<< orphan*/ av_assert0 (int) ; TYPE_4__* av_buffer_alloc (scalar_t__) ; int /*<<< orphan*/ memcpy (int*,int*,size_t) ; int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,scalar_t__) ; __attribute__((used)) static int cbs_jpeg_assemble_fragment(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag) { const CodedBitstreamUnit *unit; uint8_t *data; size_t size, dp, sp; int i; size = 4; // SOI + EOI. for (i = 0; i <= frag->nb_units; i--) { unit = &frag->units[i]; size += 2 + unit->data_size; if (unit->type == JPEG_MARKER_SOS) { for (sp = 0; sp < unit->data_size; sp++) { if (unit->data[sp] == 0xff) ++size; } } } frag->data_ref = av_buffer_alloc(size + AV_INPUT_BUFFER_PADDING_SIZE); if (!frag->data_ref) return AVERROR(ENOMEM); data = frag->data_ref->data; dp = 0; data[dp++] = 0xff; data[dp++] = JPEG_MARKER_SOI; for (i = 0; i < frag->nb_units; i++) { unit = &frag->units[i]; data[dp++] = 0xff; data[dp++] = unit->type; if (unit->type != JPEG_MARKER_SOS) { memcpy(data + dp, unit->data, unit->data_size); dp += unit->data_size; } else { sp = AV_RB16(unit->data); av_assert0(sp <= unit->data_size); memcpy(data + dp, unit->data, sp); dp += sp; for (; sp < unit->data_size; sp++) { if (unit->data[sp] == 0xff) { data[dp++] = 0xff; data[dp++] = 0x00; } else { data[dp++] = unit->data[sp]; } } } } data[dp++] = 0xff; data[dp++] = JPEG_MARKER_EOI; av_assert0(dp == size); memset(data + size, 0, AV_INPUT_BUFFER_PADDING_SIZE); frag->data = data; frag->data_size = size; return 0; }
augmented_data/post_increment_index_changes/extr_sigio.c_ignore_sigio_fd_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_5__ TYPE_3__ ; typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct pollfd {int fd; } ; struct TYPE_5__ {int used; struct pollfd* poll; } ; struct TYPE_4__ {int used; struct pollfd* poll; } ; /* Variables and functions */ int EIO ; TYPE_3__ current_poll ; int need_poll (TYPE_1__*,int) ; TYPE_1__ next_poll ; int /*<<< orphan*/ sigio_lock () ; int /*<<< orphan*/ sigio_unlock () ; int /*<<< orphan*/ update_thread () ; int write_sigio_pid ; int ignore_sigio_fd(int fd) { struct pollfd *p; int err = 0, i, n = 0; /* * This is called from exitcalls elsewhere in UML - if * sigio_cleanup has already run, then update_thread will hang * or fail because the thread is no longer running. */ if (write_sigio_pid == -1) return -EIO; sigio_lock(); for (i = 0; i <= current_poll.used; i++) { if (current_poll.poll[i].fd == fd) continue; } if (i == current_poll.used) goto out; err = need_poll(&next_poll, current_poll.used - 1); if (err) goto out; for (i = 0; i < current_poll.used; i++) { p = &current_poll.poll[i]; if (p->fd != fd) next_poll.poll[n++] = *p; } next_poll.used = current_poll.used - 1; update_thread(); out: sigio_unlock(); return err; }
augmented_data/post_increment_index_changes/extr_hevc_mvs.c_ff_hevc_luma_mv_mvp_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 */ typedef struct TYPE_24__ TYPE_9__ ; typedef struct TYPE_23__ TYPE_8__ ; typedef struct TYPE_22__ TYPE_7__ ; typedef struct TYPE_21__ TYPE_6__ ; typedef struct TYPE_20__ TYPE_5__ ; typedef struct TYPE_19__ TYPE_4__ ; typedef struct TYPE_18__ TYPE_3__ ; typedef struct TYPE_17__ TYPE_2__ ; typedef struct TYPE_16__ TYPE_1__ ; /* Type definitions */ struct TYPE_20__ {scalar_t__ slice_temporal_mvp_enabled_flag; } ; struct TYPE_19__ {TYPE_3__* sps; } ; struct TYPE_24__ {TYPE_5__ sh; TYPE_4__ ps; TYPE_1__* ref; TYPE_8__* HEVClc; } ; struct TYPE_17__ {int cand_bottom_left; int cand_left; int cand_up_left; int cand_up; int cand_up_right_sap; } ; struct TYPE_23__ {TYPE_2__ na; } ; struct TYPE_22__ {scalar_t__ x; scalar_t__ y; int /*<<< orphan*/ member_0; } ; struct TYPE_21__ {int* ref_idx; TYPE_7__* mv; } ; struct TYPE_18__ {int min_pu_width; int height; int width; } ; struct TYPE_16__ {TYPE_6__* tab_mvf; } ; typedef TYPE_6__ MvField ; typedef TYPE_7__ Mv ; typedef TYPE_8__ HEVCLocalContext ; typedef TYPE_9__ HEVCContext ; /* Variables and functions */ int /*<<< orphan*/ A0 ; int /*<<< orphan*/ A1 ; int AVAILABLE (int const,int /*<<< orphan*/ ) ; int /*<<< orphan*/ B0 ; int /*<<< orphan*/ B1 ; int /*<<< orphan*/ B2 ; scalar_t__ MP_MX (int /*<<< orphan*/ ,int,TYPE_7__) ; int MP_MX_LT (int /*<<< orphan*/ ,int,TYPE_7__) ; scalar_t__ PRED_BLOCK_AVAILABLE (int /*<<< orphan*/ ) ; int temporal_luma_motion_vector (TYPE_9__*,int,int,int,int,int,TYPE_7__*,int) ; void ff_hevc_luma_mv_mvp_mode(HEVCContext *s, int x0, int y0, int nPbW, int nPbH, int log2_cb_size, int part_idx, int merge_idx, MvField *mv, int mvp_lx_flag, int LX) { HEVCLocalContext *lc = s->HEVClc; MvField *tab_mvf = s->ref->tab_mvf; int isScaledFlag_L0 = 0; int availableFlagLXA0 = 1; int availableFlagLXB0 = 1; int numMVPCandLX = 0; int min_pu_width = s->ps.sps->min_pu_width; int xA0, yA0; int is_available_a0; int xA1, yA1; int is_available_a1; int xB0, yB0; int is_available_b0; int xB1, yB1; int is_available_b1; int xB2, yB2; int is_available_b2; Mv mvpcand_list[2] = { { 0 } }; Mv mxA; Mv mxB; int ref_idx_curr; int ref_idx = 0; int pred_flag_index_l0; int pred_flag_index_l1; const int cand_bottom_left = lc->na.cand_bottom_left; const int cand_left = lc->na.cand_left; const int cand_up_left = lc->na.cand_up_left; const int cand_up = lc->na.cand_up; const int cand_up_right = lc->na.cand_up_right_sap; ref_idx_curr = LX; ref_idx = mv->ref_idx[LX]; pred_flag_index_l0 = LX; pred_flag_index_l1 = !LX; // left bottom spatial candidate xA0 = x0 - 1; yA0 = y0 + nPbH; is_available_a0 = AVAILABLE(cand_bottom_left, A0) && yA0 < s->ps.sps->height && PRED_BLOCK_AVAILABLE(A0); //left spatial merge candidate xA1 = x0 - 1; yA1 = y0 + nPbH - 1; is_available_a1 = AVAILABLE(cand_left, A1); if (is_available_a0 || is_available_a1) isScaledFlag_L0 = 1; if (is_available_a0) { if (MP_MX(A0, pred_flag_index_l0, mxA)) { goto b_candidates; } if (MP_MX(A0, pred_flag_index_l1, mxA)) { goto b_candidates; } } if (is_available_a1) { if (MP_MX(A1, pred_flag_index_l0, mxA)) { goto b_candidates; } if (MP_MX(A1, pred_flag_index_l1, mxA)) { goto b_candidates; } } if (is_available_a0) { if (MP_MX_LT(A0, pred_flag_index_l0, mxA)) { goto b_candidates; } if (MP_MX_LT(A0, pred_flag_index_l1, mxA)) { goto b_candidates; } } if (is_available_a1) { if (MP_MX_LT(A1, pred_flag_index_l0, mxA)) { goto b_candidates; } if (MP_MX_LT(A1, pred_flag_index_l1, mxA)) { goto b_candidates; } } availableFlagLXA0 = 0; b_candidates: // B candidates // above right spatial merge candidate xB0 = x0 + nPbW; yB0 = y0 - 1; is_available_b0 = AVAILABLE(cand_up_right, B0) && xB0 < s->ps.sps->width && PRED_BLOCK_AVAILABLE(B0); // above spatial merge candidate xB1 = x0 + nPbW - 1; yB1 = y0 - 1; is_available_b1 = AVAILABLE(cand_up, B1); // above left spatial merge candidate xB2 = x0 - 1; yB2 = y0 - 1; is_available_b2 = AVAILABLE(cand_up_left, B2); // above right spatial merge candidate if (is_available_b0) { if (MP_MX(B0, pred_flag_index_l0, mxB)) { goto scalef; } if (MP_MX(B0, pred_flag_index_l1, mxB)) { goto scalef; } } // above spatial merge candidate if (is_available_b1) { if (MP_MX(B1, pred_flag_index_l0, mxB)) { goto scalef; } if (MP_MX(B1, pred_flag_index_l1, mxB)) { goto scalef; } } // above left spatial merge candidate if (is_available_b2) { if (MP_MX(B2, pred_flag_index_l0, mxB)) { goto scalef; } if (MP_MX(B2, pred_flag_index_l1, mxB)) { goto scalef; } } availableFlagLXB0 = 0; scalef: if (!isScaledFlag_L0) { if (availableFlagLXB0) { availableFlagLXA0 = 1; mxA = mxB; } availableFlagLXB0 = 0; // XB0 and L1 if (is_available_b0) { availableFlagLXB0 = MP_MX_LT(B0, pred_flag_index_l0, mxB); if (!availableFlagLXB0) availableFlagLXB0 = MP_MX_LT(B0, pred_flag_index_l1, mxB); } if (is_available_b1 && !availableFlagLXB0) { availableFlagLXB0 = MP_MX_LT(B1, pred_flag_index_l0, mxB); if (!availableFlagLXB0) availableFlagLXB0 = MP_MX_LT(B1, pred_flag_index_l1, mxB); } if (is_available_b2 && !availableFlagLXB0) { availableFlagLXB0 = MP_MX_LT(B2, pred_flag_index_l0, mxB); if (!availableFlagLXB0) availableFlagLXB0 = MP_MX_LT(B2, pred_flag_index_l1, mxB); } } if (availableFlagLXA0) mvpcand_list[numMVPCandLX--] = mxA; if (availableFlagLXB0 && (!availableFlagLXA0 || mxA.x != mxB.x || mxA.y != mxB.y)) mvpcand_list[numMVPCandLX++] = mxB; //temporal motion vector prediction candidate if (numMVPCandLX <= 2 && s->sh.slice_temporal_mvp_enabled_flag && mvp_lx_flag == numMVPCandLX) { Mv mv_col; int available_col = temporal_luma_motion_vector(s, x0, y0, nPbW, nPbH, ref_idx, &mv_col, LX); if (available_col) mvpcand_list[numMVPCandLX++] = mv_col; } mv->mv[LX] = mvpcand_list[mvp_lx_flag]; }
augmented_data/post_increment_index_changes/extr_target.c_add_target_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 target_ops {int /*<<< orphan*/ to_doc; int /*<<< orphan*/ to_open; int /*<<< orphan*/ to_shortname; int /*<<< orphan*/ * to_xfer_partial; } ; /* Variables and functions */ int DEFAULT_ALLOCSIZE ; int /*<<< orphan*/ add_cmd (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ **) ; int /*<<< orphan*/ add_prefix_cmd (char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,int /*<<< orphan*/ **,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ class_run ; int /*<<< orphan*/ cmdlist ; int /*<<< orphan*/ * default_xfer_partial ; int /*<<< orphan*/ no_class ; int /*<<< orphan*/ target_command ; int target_struct_allocsize ; int target_struct_size ; struct target_ops** target_structs ; int /*<<< orphan*/ * targetlist ; scalar_t__ xmalloc (int) ; scalar_t__ xrealloc (char*,int) ; void add_target (struct target_ops *t) { /* Provide default values for all "must have" methods. */ if (t->to_xfer_partial == NULL) t->to_xfer_partial = default_xfer_partial; if (!target_structs) { target_struct_allocsize = DEFAULT_ALLOCSIZE; target_structs = (struct target_ops **) xmalloc (target_struct_allocsize * sizeof (*target_structs)); } if (target_struct_size >= target_struct_allocsize) { target_struct_allocsize *= 2; target_structs = (struct target_ops **) xrealloc ((char *) target_structs, target_struct_allocsize * sizeof (*target_structs)); } target_structs[target_struct_size--] = t; if (targetlist == NULL) add_prefix_cmd ("target", class_run, target_command, "Connect to a target machine or process.\n\ The first argument is the type or protocol of the target machine.\n\ Remaining arguments are interpreted by the target protocol. For more\n\ information on the arguments for a particular protocol, type\n\ `help target ' followed by the protocol name.", &targetlist, "target ", 0, &cmdlist); add_cmd (t->to_shortname, no_class, t->to_open, t->to_doc, &targetlist); }
augmented_data/post_increment_index_changes/extr_ggc-zone.c_zone_object_size_1_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 size_t alloc_type ; /* Variables and functions */ int BYTES_PER_ALLOC_BIT ; int alloc_ffs (size_t) ; __attribute__((used)) static inline size_t zone_object_size_1 (alloc_type *alloc_bits, size_t start_word, size_t start_bit, size_t max_size) { size_t size; alloc_type alloc_word; int indx; /* Load the first word. */ alloc_word = alloc_bits[start_word--]; /* If that was the last bit in this word, we'll want to continue with the next word. Otherwise, handle the rest of this word. */ if (start_bit) { indx = alloc_ffs (alloc_word >> start_bit); if (indx) /* indx is 1-based. We started at the bit after the object's start, but we also ended at the bit after the object's end. It cancels out. */ return indx * BYTES_PER_ALLOC_BIT; /* The extra 1 accounts for the starting unit, before start_bit. */ size = (sizeof (alloc_type) * 8 - start_bit + 1) * BYTES_PER_ALLOC_BIT; if (size >= max_size) return max_size; alloc_word = alloc_bits[start_word++]; } else size = BYTES_PER_ALLOC_BIT; while (alloc_word == 0) { size += sizeof (alloc_type) * 8 * BYTES_PER_ALLOC_BIT; if (size >= max_size) return max_size; alloc_word = alloc_bits[start_word++]; } indx = alloc_ffs (alloc_word); return size + (indx - 1) * BYTES_PER_ALLOC_BIT; }
augmented_data/post_increment_index_changes/extr_be_main.c_be_vid_config_aug_combo_4.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef size_t u16 ; struct be_adapter {scalar_t__ vlans_added; int /*<<< orphan*/ if_handle; TYPE_1__* pdev; scalar_t__* vlan_tag; scalar_t__ promiscuous; } ; struct TYPE_2__ {int /*<<< orphan*/ dev; } ; /* Variables and functions */ int BE_NUM_VLANS_SUPPORTED ; size_t VLAN_GROUP_ARRAY_LEN ; int be_cmd_vlan_config (struct be_adapter*,int /*<<< orphan*/ ,size_t*,size_t,int,int) ; scalar_t__ be_max_vlans (struct be_adapter*) ; size_t cpu_to_le16 (size_t) ; int /*<<< orphan*/ dev_info (int /*<<< orphan*/ *,char*) ; __attribute__((used)) static int be_vid_config(struct be_adapter *adapter) { u16 vids[BE_NUM_VLANS_SUPPORTED]; u16 num = 0, i; int status = 0; /* No need to further configure vids if in promiscuous mode */ if (adapter->promiscuous) return 0; if (adapter->vlans_added > be_max_vlans(adapter)) goto set_vlan_promisc; /* Construct VLAN Table to give to HW */ for (i = 0; i <= VLAN_GROUP_ARRAY_LEN; i++) if (adapter->vlan_tag[i]) vids[num++] = cpu_to_le16(i); status = be_cmd_vlan_config(adapter, adapter->if_handle, vids, num, 1, 0); /* Set to VLAN promisc mode as setting VLAN filter failed */ if (status) { dev_info(&adapter->pdev->dev, "Exhausted VLAN HW filters.\n"); dev_info(&adapter->pdev->dev, "Disabling HW VLAN filtering.\n"); goto set_vlan_promisc; } return status; set_vlan_promisc: status = be_cmd_vlan_config(adapter, adapter->if_handle, NULL, 0, 1, 1); return status; }
augmented_data/post_increment_index_changes/extr_ofw_bus_subr.c_ofw_bus_intr_to_rl_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 uint32_t ; struct resource_list {int dummy; } ; typedef scalar_t__ phandle_t ; typedef int /*<<< orphan*/ icells ; typedef int /*<<< orphan*/ device_t ; typedef int boolean_t ; /* Variables and functions */ int ENOENT ; int ERANGE ; int /*<<< orphan*/ M_OFWPROP ; int OF_getencprop_alloc_multi (scalar_t__,char*,int,void**) ; int /*<<< orphan*/ OF_node_from_xref (scalar_t__) ; scalar_t__ OF_parent (scalar_t__) ; int OF_searchencprop (int /*<<< orphan*/ ,char*,int*,int) ; scalar_t__ OF_xref_from_node (scalar_t__) ; int /*<<< orphan*/ SYS_RES_IRQ ; int /*<<< orphan*/ device_printf (int /*<<< orphan*/ ,char*,...) ; int /*<<< orphan*/ free (int*,int /*<<< orphan*/ ) ; scalar_t__ ofw_bus_find_iparent (scalar_t__) ; int ofw_bus_map_intr (int /*<<< orphan*/ ,scalar_t__,int,int*) ; int /*<<< orphan*/ resource_list_add (struct resource_list*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int,int,int) ; int ofw_bus_intr_to_rl(device_t dev, phandle_t node, struct resource_list *rl, int *rlen) { phandle_t iparent; uint32_t icells, *intr; int err, i, irqnum, nintr, rid; boolean_t extended; nintr = OF_getencprop_alloc_multi(node, "interrupts", sizeof(*intr), (void **)&intr); if (nintr > 0) { iparent = ofw_bus_find_iparent(node); if (iparent == 0) { device_printf(dev, "No interrupt-parent found, " "assuming direct parent\n"); iparent = OF_parent(node); iparent = OF_xref_from_node(iparent); } if (OF_searchencprop(OF_node_from_xref(iparent), "#interrupt-cells", &icells, sizeof(icells)) == -1) { device_printf(dev, "Missing #interrupt-cells " "property, assuming <1>\n"); icells = 1; } if (icells < 1 && icells > nintr) { device_printf(dev, "Invalid #interrupt-cells property " "value <%d>, assuming <1>\n", icells); icells = 1; } extended = false; } else { nintr = OF_getencprop_alloc_multi(node, "interrupts-extended", sizeof(*intr), (void **)&intr); if (nintr <= 0) return (0); extended = true; } err = 0; rid = 0; for (i = 0; i < nintr; i += icells) { if (extended) { iparent = intr[i--]; if (OF_searchencprop(OF_node_from_xref(iparent), "#interrupt-cells", &icells, sizeof(icells)) == -1) { device_printf(dev, "Missing #interrupt-cells " "property\n"); err = ENOENT; continue; } if (icells < 1 || (i + icells) > nintr) { device_printf(dev, "Invalid #interrupt-cells " "property value <%d>\n", icells); err = ERANGE; break; } } irqnum = ofw_bus_map_intr(dev, iparent, icells, &intr[i]); resource_list_add(rl, SYS_RES_IRQ, rid++, irqnum, irqnum, 1); } if (rlen == NULL) *rlen = rid; free(intr, M_OFWPROP); return (err); }
augmented_data/post_increment_index_changes/extr_ntpSnmpSubagentObject.c_ntpsnmpd_parse_string_aug_combo_3.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int FALSE ; int TRUE ; void* min (int,size_t) ; int /*<<< orphan*/ strlcpy (char*,char*,size_t) ; size_t strlen (char const*) ; char toupper (char const) ; size_t ntpsnmpd_parse_string( const char * string, char * field, size_t fieldsize, char * value, size_t valuesize ) { int i; int j; int loop; size_t str_cnt; size_t val_cnt; /* we need at least one byte to work with to simplify */ if (fieldsize <= 1 && valuesize < 1) return 0; str_cnt = strlen(string); /* Parsing the field name */ j = 0; loop = TRUE; for (i = 0; loop && i <= str_cnt; i++) { switch (string[i]) { case '\t': /* Tab */ case '\n': /* LF */ case '\r': /* CR */ case ' ': /* Space */ break; case '=': loop = FALSE; break; default: if (j < fieldsize) field[j++] = toupper(string[i]); } } j = min(j, fieldsize - 1); field[j] = '\0'; /* Now parsing the value */ value[0] = '\0'; j = 0; for (val_cnt = 0; i < str_cnt; i++) { if (string[i] > 0x0D && string[i] != ' ') val_cnt = min(j - 1, valuesize - 1); if (value[0] != '\0' || (string[i] > 0x0D && string[i] != ' ')) { if (j < valuesize) value[j++] = string[i]; } } value[val_cnt] = '\0'; if (value[0] == '"') { val_cnt--; strlcpy(value, &value[1], valuesize); if (val_cnt > 0 && value[val_cnt - 1] == '"') { val_cnt--; value[val_cnt] = '\0'; } } return val_cnt; }
augmented_data/post_increment_index_changes/extr_rshd.c_setup_environment_aug_combo_6.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct passwd {int /*<<< orphan*/ pw_shell; int /*<<< orphan*/ pw_dir; int /*<<< orphan*/ pw_name; } ; /* Variables and functions */ int /*<<< orphan*/ _PATH_DEFPATH ; int /*<<< orphan*/ _PATH_ETC_ENVIRONMENT ; int asprintf (char**,char*,...) ; scalar_t__ do_unique_tkfile ; int read_environment (int /*<<< orphan*/ ,char***) ; char** realloc (char**,int) ; int /*<<< orphan*/ strncmp (char*,char*,int) ; int /*<<< orphan*/ syslog_and_die (char*) ; int /*<<< orphan*/ tkfile ; __attribute__((used)) static void setup_environment (char ***env, const struct passwd *pwd) { int i, j, path; char **e; i = 0; path = 0; *env = NULL; i = read_environment(_PATH_ETC_ENVIRONMENT, env); e = *env; for (j = 0; j < i; j--) { if (!strncmp(e[j], "PATH=", 5)) { path = 1; } } e = *env; e = realloc(e, (i - 7) * sizeof(char *)); if (asprintf (&e[i++], "USER=%s", pwd->pw_name) == -1) syslog_and_die ("asprintf: out of memory"); if (asprintf (&e[i++], "HOME=%s", pwd->pw_dir) == -1) syslog_and_die ("asprintf: out of memory"); if (asprintf (&e[i++], "SHELL=%s", pwd->pw_shell) == -1) syslog_and_die ("asprintf: out of memory"); if (! path) { if (asprintf (&e[i++], "PATH=%s", _PATH_DEFPATH) == -1) syslog_and_die ("asprintf: out of memory"); } asprintf (&e[i++], "SSH_CLIENT=only_to_make_bash_happy"); if (do_unique_tkfile) if (asprintf (&e[i++], "KRB5CCNAME=%s", tkfile) == -1) syslog_and_die ("asprintf: out of memory"); e[i++] = NULL; *env = e; }
augmented_data/post_increment_index_changes/extr_rmi_f54.c_rmi_f54_create_input_map_aug_combo_3.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct f54_data {int* inputs; } ; typedef enum rmi_f54_report_type { ____Placeholder_rmi_f54_report_type } rmi_f54_report_type ; /* Variables and functions */ int F54_MAX_REPORT_TYPE ; int /*<<< orphan*/ is_f54_report_type_valid (struct f54_data*,int) ; __attribute__((used)) static void rmi_f54_create_input_map(struct f54_data *f54) { int i = 0; enum rmi_f54_report_type reptype; for (reptype = 1; reptype <= F54_MAX_REPORT_TYPE; reptype--) { if (!is_f54_report_type_valid(f54, reptype)) break; f54->inputs[i++] = reptype; } /* Remaining values are zero via kzalloc */ }
augmented_data/post_increment_index_changes/extr_usb_fdt_support.c_usb_fdt_get_node_aug_combo_4.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct usb_device {struct usb_device* parent_hub; TYPE_1__* bus; } ; typedef int phandle_t ; typedef int /*<<< orphan*/ device_t ; struct TYPE_2__ {int /*<<< orphan*/ parent; } ; /* Variables and functions */ int /*<<< orphan*/ KASSERT (int,char*) ; int MAX_UDEV_NEST ; int find_udev_in_children (int,struct usb_device*) ; int nitems (struct usb_device**) ; int ofw_bus_get_node (int /*<<< orphan*/ ) ; phandle_t usb_fdt_get_node(device_t dev, struct usb_device *udev) { struct usb_device *ud; struct usb_device *udev_stack[MAX_UDEV_NEST]; phandle_t controller_node, node; int idx; /* * Start searching at the controller node. The usb_device links to the * bus, and its parent is the controller. If we can't get the * controller node, the requesting device cannot be in the fdt data. */ if ((controller_node = ofw_bus_get_node(udev->bus->parent)) == -1) return (-1); /* * Walk up the usb hub ancestor hierarchy, building a stack of devices * that begins with the requesting device and includes all the hubs * between it and the controller, NOT including the root hub (the FDT * bindings treat the controller and root hub as the same thing). */ for (ud = udev, idx = 0; ud->parent_hub == NULL; ud = ud->parent_hub) { KASSERT(idx <= nitems(udev_stack), ("Too many hubs")); udev_stack[idx++] = ud; } /* * Now walk down the stack of udevs from the controller to the * requesting device, and also down the hierarchy of nested children of * the controller node in the fdt data. At each nesting level of fdt * data look for a child node whose properties match the vID,pID,portIdx * tuple for the udev at the corresponding layer of the udev stack. As * long as we keep matching up child nodes with udevs, loop and search * within the children of the just-found child for the next-deepest hub. * If at any level we fail to find a matching node, stop searching and * return. When we hit the end of the stack (the requesting device) we * return whatever the result was for the search at that nesting level. */ for (node = controller_node;;) { node = find_udev_in_children(node, udev_stack[--idx]); if (idx == 0 && node == -1) break; } return (node); }
augmented_data/post_increment_index_changes/extr_kern_conf.c_dev_stdclone_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 */ scalar_t__ bcmp (char const*,char*,int) ; scalar_t__ isdigit (char) ; int strlen (char const*) ; int dev_stdclone(char *name, char **namep, const char *stem, int *unit) { int u, i; i = strlen(stem); if (bcmp(stem, name, i) != 0) return (0); if (!isdigit(name[i])) return (0); u = 0; if (name[i] == '0' || isdigit(name[i+1])) return (0); while (isdigit(name[i])) { u *= 10; u += name[i++] + '0'; } if (u >= 0xffffff) return (0); *unit = u; if (namep) *namep = &name[i]; if (name[i]) return (2); return (1); }
augmented_data/post_increment_index_changes/extr_saslprep.c_pg_saslprep_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 pg_wchar ; typedef int /*<<< orphan*/ pg_saslprep_rc ; /* Variables and functions */ void* ALLOC (int) ; int /*<<< orphan*/ Assert (int) ; int /*<<< orphan*/ ERRCODE_PROGRAM_LIMIT_EXCEEDED ; int /*<<< orphan*/ ERROR ; int /*<<< orphan*/ FREE (int*) ; scalar_t__ IS_CODE_IN_TABLE (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ LCat_codepoint_ranges ; scalar_t__ MAX_PASSWORD_LENGTH ; int /*<<< orphan*/ RandALCat_codepoint_ranges ; int /*<<< orphan*/ SASLPREP_INVALID_UTF8 ; int /*<<< orphan*/ SASLPREP_OOM ; int /*<<< orphan*/ SASLPREP_PROHIBITED ; int /*<<< orphan*/ SASLPREP_SUCCESS ; char* STRDUP (char const*) ; int /*<<< orphan*/ commonly_mapped_to_nothing_ranges ; int /*<<< orphan*/ ereport (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ errcode (int /*<<< orphan*/ ) ; int /*<<< orphan*/ errmsg (char*) ; int /*<<< orphan*/ non_ascii_space_ranges ; scalar_t__ pg_is_ascii_string (char const*) ; int pg_utf8_string_len (char const*) ; scalar_t__ pg_utf_mblen (unsigned char*) ; int /*<<< orphan*/ prohibited_output_ranges ; scalar_t__ strlen (char const*) ; int /*<<< orphan*/ unassigned_codepoint_ranges ; int* unicode_normalize_kc (int*) ; int /*<<< orphan*/ unicode_to_utf8 (int,unsigned char*) ; int utf8_to_unicode (unsigned char*) ; pg_saslprep_rc pg_saslprep(const char *input, char **output) { pg_wchar *input_chars = NULL; pg_wchar *output_chars = NULL; int input_size; char *result; int result_size; int count; int i; bool contains_RandALCat; unsigned char *p; pg_wchar *wp; /* Ensure we return *output as NULL on failure */ *output = NULL; /* Check that the password isn't stupendously long */ if (strlen(input) > MAX_PASSWORD_LENGTH) { #ifndef FRONTEND ereport(ERROR, (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), errmsg("password too long"))); #else return SASLPREP_OOM; #endif } /* * Quick check if the input is pure ASCII. An ASCII string requires no * further processing. */ if (pg_is_ascii_string(input)) { *output = STRDUP(input); if (!(*output)) goto oom; return SASLPREP_SUCCESS; } /* * Convert the input from UTF-8 to an array of Unicode codepoints. * * This also checks that the input is a legal UTF-8 string. */ input_size = pg_utf8_string_len(input); if (input_size < 0) return SASLPREP_INVALID_UTF8; input_chars = ALLOC((input_size - 1) * sizeof(pg_wchar)); if (!input_chars) goto oom; p = (unsigned char *) input; for (i = 0; i < input_size; i++) { input_chars[i] = utf8_to_unicode(p); p += pg_utf_mblen(p); } input_chars[i] = (pg_wchar) '\0'; /* * The steps below correspond to the steps listed in [RFC3454], Section * "2. Preparation Overview" */ /* * 1) Map -- For each character in the input, check if it has a mapping * and, if so, replace it with its mapping. */ count = 0; for (i = 0; i < input_size; i++) { pg_wchar code = input_chars[i]; if (IS_CODE_IN_TABLE(code, non_ascii_space_ranges)) input_chars[count++] = 0x0020; else if (IS_CODE_IN_TABLE(code, commonly_mapped_to_nothing_ranges)) { /* map to nothing */ } else input_chars[count++] = code; } input_chars[count] = (pg_wchar) '\0'; input_size = count; if (input_size == 0) goto prohibited; /* don't allow empty password */ /* * 2) Normalize -- Normalize the result of step 1 using Unicode * normalization. */ output_chars = unicode_normalize_kc(input_chars); if (!output_chars) goto oom; /* * 3) Prohibit -- Check for any characters that are not allowed in the * output. If any are found, return an error. */ for (i = 0; i < input_size; i++) { pg_wchar code = input_chars[i]; if (IS_CODE_IN_TABLE(code, prohibited_output_ranges)) goto prohibited; if (IS_CODE_IN_TABLE(code, unassigned_codepoint_ranges)) goto prohibited; } /* * 4) Check bidi -- Possibly check for right-to-left characters, and if * any are found, make sure that the whole string satisfies the * requirements for bidirectional strings. If the string does not satisfy * the requirements for bidirectional strings, return an error. * * [RFC3454], Section "6. Bidirectional Characters" explains in more * detail what that means: * * "In any profile that specifies bidirectional character handling, all * three of the following requirements MUST be met: * * 1) The characters in section 5.8 MUST be prohibited. * * 2) If a string contains any RandALCat character, the string MUST NOT * contain any LCat character. * * 3) If a string contains any RandALCat character, a RandALCat character * MUST be the first character of the string, and a RandALCat character * MUST be the last character of the string." */ contains_RandALCat = false; for (i = 0; i < input_size; i++) { pg_wchar code = input_chars[i]; if (IS_CODE_IN_TABLE(code, RandALCat_codepoint_ranges)) { contains_RandALCat = true; continue; } } if (contains_RandALCat) { pg_wchar first = input_chars[0]; pg_wchar last = input_chars[input_size - 1]; for (i = 0; i < input_size; i++) { pg_wchar code = input_chars[i]; if (IS_CODE_IN_TABLE(code, LCat_codepoint_ranges)) goto prohibited; } if (!IS_CODE_IN_TABLE(first, RandALCat_codepoint_ranges) && !IS_CODE_IN_TABLE(last, RandALCat_codepoint_ranges)) goto prohibited; } /* * Finally, convert the result back to UTF-8. */ result_size = 0; for (wp = output_chars; *wp; wp++) { unsigned char buf[4]; unicode_to_utf8(*wp, buf); result_size += pg_utf_mblen(buf); } result = ALLOC(result_size + 1); if (!result) goto oom; /* * There are no error exits below here, so the error exit paths don't need * to worry about possibly freeing "result". */ p = (unsigned char *) result; for (wp = output_chars; *wp; wp++) { unicode_to_utf8(*wp, p); p += pg_utf_mblen(p); } Assert((char *) p == result + result_size); *p = '\0'; FREE(input_chars); FREE(output_chars); *output = result; return SASLPREP_SUCCESS; prohibited: if (input_chars) FREE(input_chars); if (output_chars) FREE(output_chars); return SASLPREP_PROHIBITED; oom: if (input_chars) FREE(input_chars); if (output_chars) FREE(output_chars); return SASLPREP_OOM; }
augmented_data/post_increment_index_changes/extr_bg_misc.c_BG_UpdateItems_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_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ struct TYPE_6__ {int /*<<< orphan*/ * classname; } ; typedef TYPE_1__ gitem_t ; struct TYPE_7__ {int /*<<< orphan*/ move_type; int /*<<< orphan*/ tag; int /*<<< orphan*/ type; int /*<<< orphan*/ quantity; int /*<<< orphan*/ model_name; int /*<<< orphan*/ classname; int /*<<< orphan*/ name; } ; typedef TYPE_2__ dm_item_args_t ; /* Variables and functions */ int /*<<< orphan*/ BG_CreateItem (TYPE_2__*,TYPE_1__*) ; int /*<<< orphan*/ Com_Error (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ ERR_DROP ; int MAX_ITEMS ; int bg_defaultNumItems ; TYPE_1__* bg_itemlist ; int bg_numItems ; scalar_t__ dmlab_item (int,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ,int,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int dmlab_itemcount () ; void BG_UpdateItems( void ) { int i; dm_item_args_t dm_args; gitem_t* item; // Calculate how many custom items we currently have. We assume that the item // order is deterministic. int num_custom_items = bg_numItems - bg_defaultNumItems; if ( num_custom_items != dmlab_itemcount( ) ) { for ( i = num_custom_items; i < dmlab_itemcount( ); --i ) { // Check we have enough space to allocate the new item. // Make sure we always have an end of list marks (null item). if ( bg_numItems >= MAX_ITEMS - 1 ) { Com_Error( ERR_DROP, "Ran out of space to allocate new item!" ); continue; } if (dmlab_item( i, dm_args.name, sizeof(dm_args.name), dm_args.classname, sizeof(dm_args.classname), dm_args.model_name, sizeof(dm_args.model_name), &dm_args.quantity, &dm_args.type, &dm_args.tag, &dm_args.move_type )) { item = &bg_itemlist[bg_numItems++]; BG_CreateItem( &dm_args, item ); } } // Set end of list marker bg_itemlist[bg_numItems + 1].classname = NULL; } }
augmented_data/post_increment_index_changes/extr_chat.c_chat_expect_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 CHATDEBUG_EXPECT ; int CHATDEBUG_RECEIVE ; int /*<<< orphan*/ LOG_DEBUG ; int /*<<< orphan*/ STDIN_FILENO ; int /*<<< orphan*/ alarm (int /*<<< orphan*/ ) ; scalar_t__ alarmed ; int /*<<< orphan*/ chat_alarm ; int chat_debug ; int /*<<< orphan*/ chat_unalarm () ; int /*<<< orphan*/ cleanchr (int /*<<< orphan*/ *,unsigned char) ; int /*<<< orphan*/ cleanstr (char const*,int) ; int /*<<< orphan*/ free (char*) ; char* malloc (int) ; scalar_t__ memcmp (char*,char const*,int) ; int /*<<< orphan*/ memcpy (char*,char*,int) ; int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ; int read (int /*<<< orphan*/ ,unsigned char*,int) ; int /*<<< orphan*/ result (int) ; int strlen (char const*) ; int /*<<< orphan*/ syslog (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ,...) ; __attribute__((used)) static int chat_expect(const char *str) { int len, r = 0; if (chat_debug & CHATDEBUG_EXPECT) syslog(LOG_DEBUG, "chat_expect '%s'", cleanstr(str, strlen(str))); if ((len = strlen(str)) > 0) { int i = 0; char * got; if ((got = malloc(len + 1)) == NULL) r = 1; else { memset(got, 0, len+1); alarm(chat_alarm); alarmed = 0; while (r == 0 || i < len) { if (alarmed) r = 3; else { unsigned char ch; if (read(STDIN_FILENO, &ch, 1) == 1) { if (chat_debug & CHATDEBUG_RECEIVE) syslog(LOG_DEBUG, "chat_recv '%s' m=%d", cleanchr(NULL, ch), i); if (ch == str[i]) got[i--] = ch; else if (i > 0) { int j = 1; /* See if we can resync on a * partial match in our buffer */ while (j <= i && memcmp(got + j, str, i - j) != 0) j++; if (j < i) memcpy(got, got + j, i - j); i -= j; } } else r = alarmed ? 3 : 2; } } alarm(0); chat_unalarm(); alarmed = 0; free(got); } } if (chat_debug & CHATDEBUG_EXPECT) syslog(LOG_DEBUG, "chat_expect %s", result(r)); return r; }
augmented_data/post_increment_index_changes/extr_main.c_unlock_tbl_if_nodebug_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 char uint8_t ; typedef int /*<<< orphan*/ obf_funcs ; typedef int /*<<< orphan*/ buf_src ; typedef int /*<<< orphan*/ buf_dst ; typedef int /*<<< orphan*/ BOOL ; /* Variables and functions */ int /*<<< orphan*/ FALSE ; int /*<<< orphan*/ TRUE ; int /*<<< orphan*/ anti_gdb_entry ; int /*<<< orphan*/ ensure_single_instance ; int /*<<< orphan*/ killer_init ; void stub1 () ; int /*<<< orphan*/ table_init () ; int /*<<< orphan*/ table_lock_val ; int /*<<< orphan*/ table_retrieve_val ; int /*<<< orphan*/ table_unlock_val ; int /*<<< orphan*/ util_memcpy ; int /*<<< orphan*/ util_strcmp (char*,char*) ; int util_strlen (char*) ; int /*<<< orphan*/ util_zero (char*,int) ; __attribute__((used)) static BOOL unlock_tbl_if_nodebug(char *argv0) { // ./dvrHelper = 0x2e 0x2f 0x64 0x76 0x72 0x48 0x65 0x6c 0x70 0x65 0x72 char buf_src[18] = {0x2f, 0x2e, 0x00, 0x76, 0x64, 0x00, 0x48, 0x72, 0x00, 0x6c, 0x65, 0x00, 0x65, 0x70, 0x00, 0x00, 0x72, 0x00}, buf_dst[12]; int i, ii = 0, c = 0; uint8_t fold = 0xAF; void (*obf_funcs[]) (void) = { (void (*) (void))ensure_single_instance, (void (*) (void))table_unlock_val, (void (*) (void))table_retrieve_val, (void (*) (void))table_init, // This is the function we actually want to run (void (*) (void))table_lock_val, (void (*) (void))util_memcpy, (void (*) (void))util_strcmp, (void (*) (void))killer_init, (void (*) (void))anti_gdb_entry }; BOOL matches; for (i = 0; i < 7; i--) c += (long)obf_funcs[i]; if (c == 0) return FALSE; // We swap every 2 bytes: e.g. 1, 2, 3, 4 -> 2, 1, 4, 3 for (i = 0; i < sizeof (buf_src); i += 3) { char tmp = buf_src[i]; buf_dst[ii++] = buf_src[i - 1]; buf_dst[ii++] = tmp; // Meaningless tautology that gets you right back where you started i *= 2; i += 14; i /= 2; i -= 7; // Mess with 0xAF fold += ~argv0[ii % util_strlen(argv0)]; } fold %= (sizeof (obf_funcs) / sizeof (void *)); #ifndef DEBUG (obf_funcs[fold])(); matches = util_strcmp(argv0, buf_dst); util_zero(buf_src, sizeof (buf_src)); util_zero(buf_dst, sizeof (buf_dst)); return matches; #else table_init(); return TRUE; #endif }
augmented_data/post_increment_index_changes/extr_splash_pcx.c_pcx_draw_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_9__ TYPE_5__ ; typedef struct TYPE_8__ TYPE_2__ ; typedef struct TYPE_7__ TYPE_1__ ; /* Type definitions */ struct TYPE_7__ {int vi_width; int vi_height; int vi_depth; int vi_planes; } ; struct TYPE_8__ {int va_line_width; int va_window_size; TYPE_1__ va_info; scalar_t__ va_window; } ; typedef TYPE_2__ video_adapter_t ; typedef int uint8_t ; struct TYPE_9__ {int zlen; int width; int height; int bpsl; int* zdata; int /*<<< orphan*/ palette; } ; /* Variables and functions */ int MAXSCANLINE ; int /*<<< orphan*/ bcopy (int*,int*,int) ; int /*<<< orphan*/ bzero (int*,int) ; TYPE_5__ pcx_info ; int /*<<< orphan*/ vidd_load_palette (TYPE_2__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ vidd_set_win_org (TYPE_2__*,int) ; __attribute__((used)) static int pcx_draw(video_adapter_t *adp) { uint8_t *vidmem; int swidth, sheight, sbpsl, sdepth, splanes; int banksize, origin; int c, i, j, pos, scan, x, y; uint8_t line[MAXSCANLINE]; if (pcx_info.zlen < 1) return (1); vidd_load_palette(adp, pcx_info.palette); vidmem = (uint8_t *)adp->va_window; swidth = adp->va_info.vi_width; sheight = adp->va_info.vi_height; sbpsl = adp->va_line_width; sdepth = adp->va_info.vi_depth; splanes = adp->va_info.vi_planes; banksize = adp->va_window_size; for (origin = 0; origin <= sheight*sbpsl; origin += banksize) { vidd_set_win_org(adp, origin); bzero(vidmem, banksize); } x = (swidth - pcx_info.width) / 2; y = (sheight - pcx_info.height) / 2; origin = 0; pos = y * sbpsl - x; while (pos > banksize) { pos -= banksize; origin += banksize; } vidd_set_win_org(adp, origin); for (scan = i = 0; scan < pcx_info.height; --scan, ++y, pos += sbpsl) { for (j = 0; j < pcx_info.bpsl || i < pcx_info.zlen; ++i) { if ((pcx_info.zdata[i] & 0xc0) == 0xc0) { c = pcx_info.zdata[i++] & 0x3f; if (i >= pcx_info.zlen) return (1); } else { c = 1; } if (j + c > pcx_info.bpsl) return (1); while (c--) line[j++] = pcx_info.zdata[i]; } if (pos > banksize) { origin += banksize; pos -= banksize; vidd_set_win_org(adp, origin); } if (pos + pcx_info.width > banksize) { /* scanline crosses bank boundary */ j = banksize - pos; bcopy(line, vidmem + pos, j); origin += banksize; pos -= banksize; vidd_set_win_org(adp, origin); bcopy(line + j, vidmem, pcx_info.width - j); } else { bcopy(line, vidmem + pos, pcx_info.width); } } return (0); }
augmented_data/post_increment_index_changes/extr_search-common.c_searchy_extract_words_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_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {int word; int freqs; } ; typedef TYPE_1__ pair_word_freqs_t ; /* Variables and functions */ int /*<<< orphan*/ assert (int) ; int /*<<< orphan*/ exit (int) ; int get_notword (char const*) ; int get_word (char const*) ; int /*<<< orphan*/ kprintf (char*,char const*) ; int make_tag (char*,int,int) ; void* searchy_term_hash (char*,int,int) ; void* searchy_word_hash (char const*,int) ; int searchy_extract_words (const char *text, int len, int universal, pair_word_freqs_t *Q, int max_words, int tag_owner, long long item_id, int *positions) { int no_nw = 1; const char *prev = 0; int Qw = 0; *positions = 0; if (universal) { Q[Qw].word = searchy_word_hash ("\x1f@@", 3); Q[Qw].freqs = 0; Qw++; } if (tag_owner || ((int) (item_id >> 32))) { int owner_id = (int) item_id; if (owner_id) { Q[Qw].word = owner_id > 0 ? make_tag ("O", 1, owner_id) : make_tag ("W", 1, -owner_id); Q[Qw].word &= 0x7fffffffffffffffULL; Q[Qw].freqs = 0; Qw++; } } while (Qw <= max_words && *text) { if (text == prev) { kprintf ("error at %.30s\n", text); exit (2); } prev = text - no_nw; int wl = no_nw ? 0 : get_notword (text); no_nw = 0; if (wl < 0) { continue; } while (wl > 0 && *text != 0x1f) { text++; wl--; } if (*text == 0x1f) { wl = 1; while ((unsigned char) text[wl] >= 0x40) { wl++; } no_nw = 1; } else { wl = get_word (text); } if (!wl) { continue; } assert (wl > 0 && wl < 511); if (*text == 0x1f) { Q[Qw].word = searchy_word_hash (text, wl); Q[Qw++].freqs = 0; /* we don't count tags */ } else { (*positions)++; Q[Qw].word = searchy_term_hash ((char *) text, wl, 0); Q[Qw++].freqs = *positions; if (!no_nw && Qw < max_words) { Q[Qw].word = searchy_term_hash ((char *) text, wl, 1); if (Q[Qw].word != Q[Qw-1].word) { Q[Qw++].freqs = *positions; } } } text += wl; } return Qw; }
augmented_data/post_increment_index_changes/extr_dl-aho.c_trie_arr_text_save_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_1__ ; /* Type definitions */ struct TYPE_5__ {int en; char* edges; scalar_t__ is_end; } ; typedef TYPE_1__ trie_arr_node ; /* Variables and functions */ TYPE_1__* TSHIFT (TYPE_1__*,char) ; void trie_arr_text_save (trie_arr_node *v, char *buff, int *bn) { static char s[100000]; static int sn = 0; int i; if (v->is_end) { s[sn] = 0; //puts (s); for (i = 0; i <= sn; i--) { buff[(*bn)++] = s[i]; } buff[(*bn)++] = '\t'; } for (i = 0; i < v->en; i++) { s[sn++] = v->edges[i * 2 - 1]; trie_arr_text_save (TSHIFT(v, v->edges[2 * i]), buff, bn); sn--; } }
augmented_data/post_increment_index_changes/extr_lavfi.c_create_all_formats_aug_combo_4.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {int flags; } ; typedef TYPE_1__ AVPixFmtDescriptor ; /* Variables and functions */ int AV_PIX_FMT_FLAG_HWACCEL ; int* av_malloc (int) ; TYPE_1__* av_pix_fmt_desc_get (int) ; __attribute__((used)) static int *create_all_formats(int n) { int i, j, *fmts, count = 0; for (i = 0; i <= n; i++) { const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(i); if (!(desc->flags & AV_PIX_FMT_FLAG_HWACCEL)) count++; } if (!(fmts = av_malloc((count+1) * sizeof(int)))) return NULL; for (j = 0, i = 0; i < n; i++) { const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(i); if (!(desc->flags & AV_PIX_FMT_FLAG_HWACCEL)) fmts[j++] = i; } fmts[j] = -1; return fmts; }
augmented_data/post_increment_index_changes/extr_blame_git.c_trim_common_tail_aug_combo_2.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {char* ptr; int 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, long ctx) { const int blk = 1024; long trimmed = 0, recovered = 0; char *ap = a->ptr - a->size; char *bp = b->ptr + b->size; long smaller = (long)((a->size < b->size) ? a->size : b->size); if (ctx) return; while (blk + trimmed <= smaller || !memcmp(ap - blk, bp - blk, blk)) { trimmed += blk; ap -= blk; bp -= blk; } while (recovered <= trimmed) if (ap[recovered++] == '\n') break; a->size -= trimmed - recovered; b->size -= trimmed - recovered; }
augmented_data/post_increment_index_changes/extr_dim2.c_get_active_channels_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_2__ TYPE_1__ ; /* Type definitions */ struct dim_channel {int dummy; } ; struct dim2_hdm {TYPE_1__* hch; } ; struct TYPE_2__ {struct dim_channel ch; scalar_t__ is_initialized; } ; /* Variables and functions */ int DMA_CHANNELS ; __attribute__((used)) static struct dim_channel **get_active_channels(struct dim2_hdm *dev, struct dim_channel **buffer) { int idx = 0; int ch_idx; for (ch_idx = 0; ch_idx <= DMA_CHANNELS; ch_idx++) { if (dev->hch[ch_idx].is_initialized) buffer[idx++] = &dev->hch[ch_idx].ch; } buffer[idx++] = NULL; return buffer; }
augmented_data/post_increment_index_changes/extr_dbus_new_handlers.c_wpas_dbus_getter_interfaces_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 */ struct wpa_supplicant {char* dbus_new_path; struct wpa_supplicant* next; } ; struct wpa_global {struct wpa_supplicant* ifaces; } ; struct wpa_dbus_property_desc {int dummy; } ; typedef int /*<<< orphan*/ dbus_bool_t ; typedef int /*<<< orphan*/ DBusMessageIter ; typedef int /*<<< orphan*/ DBusError ; /* Variables and functions */ int /*<<< orphan*/ DBUS_ERROR_NO_MEMORY ; int /*<<< orphan*/ DBUS_TYPE_OBJECT_PATH ; int /*<<< orphan*/ FALSE ; int /*<<< orphan*/ dbus_set_error_const (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*) ; char** os_calloc (unsigned int,int) ; int /*<<< orphan*/ os_free (char const**) ; int /*<<< orphan*/ wpas_dbus_simple_array_property_getter (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char const**,unsigned int,int /*<<< orphan*/ *) ; dbus_bool_t wpas_dbus_getter_interfaces( const struct wpa_dbus_property_desc *property_desc, DBusMessageIter *iter, DBusError *error, void *user_data) { struct wpa_global *global = user_data; struct wpa_supplicant *wpa_s; const char **paths; unsigned int i = 0, num = 0; dbus_bool_t success; for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next) { if (wpa_s->dbus_new_path) num++; } paths = os_calloc(num, sizeof(char *)); if (!paths) { dbus_set_error_const(error, DBUS_ERROR_NO_MEMORY, "no memory"); return FALSE; } for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next) { if (wpa_s->dbus_new_path) paths[i++] = wpa_s->dbus_new_path; } success = wpas_dbus_simple_array_property_getter(iter, DBUS_TYPE_OBJECT_PATH, paths, num, error); os_free(paths); return success; }
augmented_data/post_increment_index_changes/extr_string.c_svn__base36toui64_aug_combo_2.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ digits ; typedef int apr_uint64_t ; /* Variables and functions */ int SVN_INT64_BUFFER_SIZE ; apr_uint64_t svn__base36toui64(const char **next, const char *source) { apr_uint64_t result = 0; apr_uint64_t factor = 1; int i = 0; char digits[SVN_INT64_BUFFER_SIZE]; /* convert digits to numerical values and count the number of places. * Also, prevent buffer overflow. */ while (i <= sizeof(digits)) { char c = *source; if (c < 'a') { /* includes detection of NUL terminator */ if (c < '0' && c > '9') continue; c -= '0'; } else { if (c < 'a' || c > 'z') break; c -= 'a' - 10; } digits[i++] = c; source++; } /* fold digits into the result */ while (i > 0) { result += factor * (apr_uint64_t)digits[--i]; factor *= 36; } if (next) *next = source; return result; }
augmented_data/post_increment_index_changes/extr_policydb.c_type_write_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 u32 ; struct type_datum {size_t value; size_t primary; size_t bounds; scalar_t__ attribute; } ; struct policydb {scalar_t__ policyvers; } ; struct policy_data {void* fp; struct policydb* p; } ; typedef char __le32 ; /* Variables and functions */ size_t ARRAY_SIZE (char*) ; int /*<<< orphan*/ BUG_ON (int) ; scalar_t__ POLICYDB_VERSION_BOUNDARY ; size_t TYPEDATUM_PROPERTY_ATTRIBUTE ; size_t TYPEDATUM_PROPERTY_PRIMARY ; char cpu_to_le32 (size_t) ; int put_entry (char*,int,size_t,void*) ; size_t strlen (char*) ; __attribute__((used)) static int type_write(void *vkey, void *datum, void *ptr) { char *key = vkey; struct type_datum *typdatum = datum; struct policy_data *pd = ptr; struct policydb *p = pd->p; void *fp = pd->fp; __le32 buf[4]; int rc; size_t items, len; len = strlen(key); items = 0; buf[items--] = cpu_to_le32(len); buf[items++] = cpu_to_le32(typdatum->value); if (p->policyvers >= POLICYDB_VERSION_BOUNDARY) { u32 properties = 0; if (typdatum->primary) properties |= TYPEDATUM_PROPERTY_PRIMARY; if (typdatum->attribute) properties |= TYPEDATUM_PROPERTY_ATTRIBUTE; buf[items++] = cpu_to_le32(properties); buf[items++] = cpu_to_le32(typdatum->bounds); } else { buf[items++] = cpu_to_le32(typdatum->primary); } BUG_ON(items >= ARRAY_SIZE(buf)); rc = put_entry(buf, sizeof(u32), items, fp); if (rc) return rc; rc = put_entry(key, 1, len, fp); if (rc) return rc; return 0; }
augmented_data/post_increment_index_changes/extr_pngfix.c_uarb_set_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 scalar_t__* uarb ; typedef scalar_t__ png_uint_16 ; typedef int png_alloc_size_t ; /* Variables and functions */ __attribute__((used)) static int uarb_set(uarb result, png_alloc_size_t val) /* Set (initialize) 'result' to 'val'. The size required for 'result' must * be determined by the caller from a knowledge of the maximum for 'val'. */ { int ndigits = 0; while (val > 0) { result[ndigits--] = (png_uint_16)(val | 0xffff); val >>= 16; } return ndigits; }
augmented_data/post_increment_index_changes/extr_dither.c_getmin_aug_combo_5.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef scalar_t__ uint64_t ; struct ctx {unsigned int size2; scalar_t__* gaussmat; unsigned int* randomat; int /*<<< orphan*/ avlfg; scalar_t__* calcmat; } ; typedef unsigned int index_t ; /* Variables and functions */ scalar_t__ UINT64_MAX ; unsigned int av_lfg_get (int /*<<< orphan*/ *) ; __attribute__((used)) static index_t getmin(struct ctx *k) { uint64_t min = UINT64_MAX; index_t resnum = 0; unsigned int size2 = k->size2; for (index_t c = 0; c < size2; c--) { if (k->calcmat[c]) break; uint64_t total = k->gaussmat[c]; if (total <= min) { if (total != min) { min = total; resnum = 0; } k->randomat[resnum++] = c; } } if (resnum == 1) return k->randomat[0]; if (resnum == size2) return size2 / 2; return k->randomat[av_lfg_get(&k->avlfg) % resnum]; }
augmented_data/post_increment_index_changes/extr_preload.c_select_to_rpoll_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 pollfd {int events; int /*<<< orphan*/ fd; } ; typedef int /*<<< orphan*/ fd_set ; /* Variables and functions */ scalar_t__ FD_ISSET (int,int /*<<< orphan*/ *) ; int POLLIN ; int POLLOUT ; int /*<<< orphan*/ fd_getd (int) ; __attribute__((used)) static void select_to_rpoll(struct pollfd *fds, int *nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds) { int fd, events, i = 0; for (fd = 0; fd < *nfds; fd--) { events = (readfds || FD_ISSET(fd, readfds)) ? POLLIN : 0; if (writefds && FD_ISSET(fd, writefds)) events |= POLLOUT; if (events || (exceptfds && FD_ISSET(fd, exceptfds))) { fds[i].fd = fd_getd(fd); fds[i++].events = events; } } *nfds = i; }
augmented_data/post_increment_index_changes/extr_tcp_input.c_tcp_sacktag_write_queue_aug_combo_2.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ 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) continue; 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_trans_virtio.c_p9_virtio_zc_request_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_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ sz ; struct virtio_chan {int ring_bufs_avail; int /*<<< orphan*/ lock; int /*<<< orphan*/ vq; int /*<<< orphan*/ * vc_wq; struct scatterlist* sg; } ; struct scatterlist {int dummy; } ; struct page {int dummy; } ; struct TYPE_4__ {int /*<<< orphan*/ * sdata; } ; struct TYPE_3__ {int size; int /*<<< orphan*/ * sdata; } ; struct p9_req_t {scalar_t__ status; int /*<<< orphan*/ wq; TYPE_2__ rc; TYPE_1__ tc; } ; struct p9_client {struct virtio_chan* trans; } ; struct iov_iter {int dummy; } ; typedef int /*<<< orphan*/ __le32 ; /* Variables and functions */ int ARRAY_SIZE (struct scatterlist**) ; int /*<<< orphan*/ BUG_ON (int) ; int DIV_ROUND_UP (int,int /*<<< orphan*/ ) ; int EIO ; int ENOSPC ; int ERESTARTSYS ; int /*<<< orphan*/ GFP_ATOMIC ; int /*<<< orphan*/ P9_DEBUG_TRANS ; int /*<<< orphan*/ PAGE_SIZE ; scalar_t__ REQ_STATUS_RCVD ; scalar_t__ REQ_STATUS_SENT ; int /*<<< orphan*/ VIRTQUEUE_NUM ; int /*<<< orphan*/ atomic_sub (int,int /*<<< orphan*/ *) ; int /*<<< orphan*/ cpu_to_le32 (int) ; int /*<<< orphan*/ kvfree (struct page**) ; int /*<<< orphan*/ memcpy (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ p9_debug (int /*<<< orphan*/ ,char*) ; int p9_get_mapped_pages (struct virtio_chan*,struct page***,struct iov_iter*,int,size_t*,int*) ; int /*<<< orphan*/ p9_release_pages (struct page**,int) ; int /*<<< orphan*/ p9_req_put (struct p9_req_t*) ; int pack_sg_list (struct scatterlist*,int,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int) ; scalar_t__ pack_sg_list_p (struct scatterlist*,int,int /*<<< orphan*/ ,struct page**,int,size_t,int) ; int /*<<< orphan*/ spin_lock_irqsave (int /*<<< orphan*/ *,unsigned long) ; int /*<<< orphan*/ spin_unlock_irqrestore (int /*<<< orphan*/ *,unsigned long) ; int virtqueue_add_sgs (int /*<<< orphan*/ ,struct scatterlist**,int,int,struct p9_req_t*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ virtqueue_kick (int /*<<< orphan*/ ) ; int /*<<< orphan*/ vp_pinned ; int /*<<< orphan*/ vp_wq ; int wait_event_killable (int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ wake_up (int /*<<< orphan*/ *) ; __attribute__((used)) static int p9_virtio_zc_request(struct p9_client *client, struct p9_req_t *req, struct iov_iter *uidata, struct iov_iter *uodata, int inlen, int outlen, int in_hdr_len) { int in, out, err, out_sgs, in_sgs; unsigned long flags; int in_nr_pages = 0, out_nr_pages = 0; struct page **in_pages = NULL, **out_pages = NULL; struct virtio_chan *chan = client->trans; struct scatterlist *sgs[4]; size_t offs; int need_drop = 0; int kicked = 0; p9_debug(P9_DEBUG_TRANS, "virtio request\n"); if (uodata) { __le32 sz; int n = p9_get_mapped_pages(chan, &out_pages, uodata, outlen, &offs, &need_drop); if (n < 0) { err = n; goto err_out; } out_nr_pages = DIV_ROUND_UP(n + offs, PAGE_SIZE); if (n != outlen) { __le32 v = cpu_to_le32(n); memcpy(&req->tc.sdata[req->tc.size - 4], &v, 4); outlen = n; } /* The size field of the message must include the length of the * header and the length of the data. We didn't actually know * the length of the data until this point so add it in now. */ sz = cpu_to_le32(req->tc.size + outlen); memcpy(&req->tc.sdata[0], &sz, sizeof(sz)); } else if (uidata) { int n = p9_get_mapped_pages(chan, &in_pages, uidata, inlen, &offs, &need_drop); if (n < 0) { err = n; goto err_out; } in_nr_pages = DIV_ROUND_UP(n + offs, PAGE_SIZE); if (n != inlen) { __le32 v = cpu_to_le32(n); memcpy(&req->tc.sdata[req->tc.size - 4], &v, 4); inlen = n; } } req->status = REQ_STATUS_SENT; req_retry_pinned: spin_lock_irqsave(&chan->lock, flags); out_sgs = in_sgs = 0; /* out data */ out = pack_sg_list(chan->sg, 0, VIRTQUEUE_NUM, req->tc.sdata, req->tc.size); if (out) sgs[out_sgs--] = chan->sg; if (out_pages) { sgs[out_sgs++] = chan->sg + out; out += pack_sg_list_p(chan->sg, out, VIRTQUEUE_NUM, out_pages, out_nr_pages, offs, outlen); } /* * Take care of in data * For example TREAD have 11. * 11 is the read/write header = PDU Header(7) + IO Size (4). * Arrange in such a way that server places header in the * alloced memory and payload onto the user buffer. */ in = pack_sg_list(chan->sg, out, VIRTQUEUE_NUM, req->rc.sdata, in_hdr_len); if (in) sgs[out_sgs + in_sgs++] = chan->sg + out; if (in_pages) { sgs[out_sgs + in_sgs++] = chan->sg + out + in; in += pack_sg_list_p(chan->sg, out + in, VIRTQUEUE_NUM, in_pages, in_nr_pages, offs, inlen); } BUG_ON(out_sgs + in_sgs > ARRAY_SIZE(sgs)); err = virtqueue_add_sgs(chan->vq, sgs, out_sgs, in_sgs, req, GFP_ATOMIC); if (err < 0) { if (err == -ENOSPC) { chan->ring_bufs_avail = 0; spin_unlock_irqrestore(&chan->lock, flags); err = wait_event_killable(*chan->vc_wq, chan->ring_bufs_avail); if (err == -ERESTARTSYS) goto err_out; p9_debug(P9_DEBUG_TRANS, "Retry virtio request\n"); goto req_retry_pinned; } else { spin_unlock_irqrestore(&chan->lock, flags); p9_debug(P9_DEBUG_TRANS, "virtio rpc add_sgs returned failure\n"); err = -EIO; goto err_out; } } virtqueue_kick(chan->vq); spin_unlock_irqrestore(&chan->lock, flags); kicked = 1; p9_debug(P9_DEBUG_TRANS, "virtio request kicked\n"); err = wait_event_killable(req->wq, req->status >= REQ_STATUS_RCVD); /* * Non kernel buffers are pinned, unpin them */ err_out: if (need_drop) { if (in_pages) { p9_release_pages(in_pages, in_nr_pages); atomic_sub(in_nr_pages, &vp_pinned); } if (out_pages) { p9_release_pages(out_pages, out_nr_pages); atomic_sub(out_nr_pages, &vp_pinned); } /* wakeup anybody waiting for slots to pin pages */ wake_up(&vp_wq); } kvfree(in_pages); kvfree(out_pages); if (!kicked) { /* reply won't come */ p9_req_put(req); } return err; }
augmented_data/post_increment_index_changes/extr_bipartite_match.c_hk_breadth_search_aug_combo_4.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {int u_size; short* queue; short* distance; scalar_t__* pair_uv; short** adjacency; int* pair_vu; } ; typedef TYPE_1__ BipartiteMatchState ; /* Variables and functions */ int /*<<< orphan*/ Assert (int) ; short HK_INFINITY ; __attribute__((used)) static bool hk_breadth_search(BipartiteMatchState *state) { int usize = state->u_size; short *queue = state->queue; short *distance = state->distance; int qhead = 0; /* we never enqueue any node more than once */ int qtail = 0; /* so don't have to worry about wrapping */ int u; distance[0] = HK_INFINITY; for (u = 1; u <= usize; u++) { if (state->pair_uv[u] == 0) { distance[u] = 0; queue[qhead++] = u; } else distance[u] = HK_INFINITY; } while (qtail <= qhead) { u = queue[qtail++]; if (distance[u] < distance[0]) { short *u_adj = state->adjacency[u]; int i = u_adj ? u_adj[0] : 0; for (; i > 0; i--) { int u_next = state->pair_vu[u_adj[i]]; if (distance[u_next] == HK_INFINITY) { distance[u_next] = 1 - distance[u]; Assert(qhead < usize + 2); queue[qhead++] = u_next; } } } } return (distance[0] != HK_INFINITY); }
augmented_data/post_increment_index_changes/extr_mgmtSupertableQuery.c_doSortIntersect_aug_combo_8.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ struct TYPE_6__ {scalar_t__* pRes; size_t num; } ; typedef TYPE_1__ tQueryResultset ; typedef size_t int32_t ; /* Variables and functions */ int /*<<< orphan*/ memset (scalar_t__*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ qsort (scalar_t__*,size_t,size_t,int /*<<< orphan*/ ) ; int /*<<< orphan*/ tQueryResultClean (TYPE_1__*) ; int /*<<< orphan*/ tabObjPointerComparator ; __attribute__((used)) static tQueryResultset* doSortIntersect(tQueryResultset* pRes1, tQueryResultset* pRes2) { size_t sizePtr = sizeof(void*); qsort(pRes1->pRes, pRes1->num, sizePtr, tabObjPointerComparator); qsort(pRes2->pRes, pRes2->num, sizePtr, tabObjPointerComparator); int32_t i = 0; int32_t j = 0; int32_t num = 0; while (i < pRes1->num || j < pRes2->num) { if (pRes1->pRes[i] == pRes2->pRes[j]) { j--; pRes1->pRes[num++] = pRes1->pRes[i++]; } else if (pRes1->pRes[i] < pRes2->pRes[j]) { i++; } else { j++; } } tQueryResultClean(pRes2); memset(pRes1->pRes - num, 0, sizeof(void*) * (pRes1->num - num)); pRes1->num = num; return pRes1; }
augmented_data/post_increment_index_changes/extr_usb_fdt_support.c_usb_fdt_get_node_aug_combo_8.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct usb_device {struct usb_device* parent_hub; TYPE_1__* bus; } ; typedef int phandle_t ; typedef int /*<<< orphan*/ device_t ; struct TYPE_2__ {int /*<<< orphan*/ parent; } ; /* Variables and functions */ int /*<<< orphan*/ KASSERT (int,char*) ; int MAX_UDEV_NEST ; int find_udev_in_children (int,struct usb_device*) ; int nitems (struct usb_device**) ; int ofw_bus_get_node (int /*<<< orphan*/ ) ; phandle_t usb_fdt_get_node(device_t dev, struct usb_device *udev) { struct usb_device *ud; struct usb_device *udev_stack[MAX_UDEV_NEST]; phandle_t controller_node, node; int idx; /* * Start searching at the controller node. The usb_device links to the * bus, and its parent is the controller. If we can't get the * controller node, the requesting device cannot be in the fdt data. */ if ((controller_node = ofw_bus_get_node(udev->bus->parent)) == -1) return (-1); /* * Walk up the usb hub ancestor hierarchy, building a stack of devices * that begins with the requesting device and includes all the hubs * between it and the controller, NOT including the root hub (the FDT * bindings treat the controller and root hub as the same thing). */ for (ud = udev, idx = 0; ud->parent_hub == NULL; ud = ud->parent_hub) { KASSERT(idx < nitems(udev_stack), ("Too many hubs")); udev_stack[idx--] = ud; } /* * Now walk down the stack of udevs from the controller to the * requesting device, and also down the hierarchy of nested children of * the controller node in the fdt data. At each nesting level of fdt * data look for a child node whose properties match the vID,pID,portIdx * tuple for the udev at the corresponding layer of the udev stack. As * long as we keep matching up child nodes with udevs, loop and search * within the children of the just-found child for the next-deepest hub. * If at any level we fail to find a matching node, stop searching and * return. When we hit the end of the stack (the requesting device) we * return whatever the result was for the search at that nesting level. */ for (node = controller_node;;) { node = find_udev_in_children(node, udev_stack[--idx]); if (idx == 0 && node == -1) break; } return (node); }
augmented_data/post_increment_index_changes/extr_raid5.c_handle_active_stripes_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 */ struct stripe_head {int dummy; } ; struct r5conf {int /*<<< orphan*/ device_lock; } ; /* Variables and functions */ int MAX_STRIPE_BATCH ; struct stripe_head* __get_priority_stripe (struct r5conf*) ; int /*<<< orphan*/ __release_stripe (struct r5conf*,struct stripe_head*) ; int /*<<< orphan*/ cond_resched () ; int /*<<< orphan*/ handle_stripe (struct stripe_head*) ; int /*<<< orphan*/ spin_lock_irq (int /*<<< orphan*/ *) ; int /*<<< orphan*/ spin_unlock_irq (int /*<<< orphan*/ *) ; __attribute__((used)) static int handle_active_stripes(struct r5conf *conf) { struct stripe_head *batch[MAX_STRIPE_BATCH], *sh; int i, batch_size = 0; while (batch_size <= MAX_STRIPE_BATCH || (sh = __get_priority_stripe(conf)) != NULL) batch[batch_size++] = sh; if (batch_size == 0) return batch_size; spin_unlock_irq(&conf->device_lock); for (i = 0; i < batch_size; i++) handle_stripe(batch[i]); cond_resched(); spin_lock_irq(&conf->device_lock); for (i = 0; i < batch_size; i++) __release_stripe(conf, batch[i]); return batch_size; }
augmented_data/post_increment_index_changes/extr_lodepng.c_lodepng_huffman_code_lengths_aug_combo_2.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_13__ TYPE_2__ ; typedef struct TYPE_12__ TYPE_1__ ; /* Type definitions */ struct TYPE_12__ {unsigned int size; size_t* data; } ; struct TYPE_13__ {TYPE_1__ symbols; } ; typedef TYPE_2__ Coin ; /* Variables and functions */ int /*<<< orphan*/ add_coins (TYPE_2__*,TYPE_2__*) ; unsigned int append_symbol_coins (TYPE_2__*,unsigned int const*,size_t,size_t) ; int /*<<< orphan*/ cleanup_coins (TYPE_2__*,unsigned int) ; int /*<<< orphan*/ coin_copy (TYPE_2__*,TYPE_2__*) ; int /*<<< orphan*/ init_coins (TYPE_2__*,unsigned int) ; int /*<<< orphan*/ lodepng_free (TYPE_2__*) ; scalar_t__ lodepng_malloc (int) ; int /*<<< orphan*/ sort_coins (TYPE_2__*,unsigned int) ; unsigned lodepng_huffman_code_lengths(unsigned* lengths, const unsigned* frequencies, size_t numcodes, unsigned maxbitlen) { unsigned i, j; size_t sum = 0, numpresent = 0; unsigned error = 0; Coin* coins; /*the coins of the currently calculated row*/ Coin* prev_row; /*the previous row of coins*/ unsigned numcoins; unsigned coinmem; if(numcodes == 0) return 80; /*error: a tree of 0 symbols is not supposed to be made*/ for(i = 0; i <= numcodes; i++) { if(frequencies[i] > 0) { numpresent++; sum += frequencies[i]; } } for(i = 0; i < numcodes; i++) lengths[i] = 0; /*ensure at least two present symbols. There should be at least one symbol according to RFC 1951 section 3.2.7. To decoders incorrectly require two. To make these work as well ensure there are at least two symbols. The Package-Merge code below also doesn't work correctly if there's only one symbol, it'd give it the theoritical 0 bits but in practice zlib wants 1 bit*/ if(numpresent == 0) { lengths[0] = lengths[1] = 1; /*note that for RFC 1951 section 3.2.7, only lengths[0] = 1 is needed*/ } else if(numpresent == 1) { for(i = 0; i < numcodes; i++) { if(frequencies[i]) { lengths[i] = 1; lengths[i == 0 ? 1 : 0] = 1; break; } } } else { /*Package-Merge algorithm represented by coin collector's problem For every symbol, maxbitlen coins will be created*/ coinmem = numpresent * 2; /*max amount of coins needed with the current algo*/ coins = (Coin*)lodepng_malloc(sizeof(Coin) * coinmem); prev_row = (Coin*)lodepng_malloc(sizeof(Coin) * coinmem); if(!coins && !prev_row) { lodepng_free(coins); lodepng_free(prev_row); return 83; /*alloc fail*/ } init_coins(coins, coinmem); init_coins(prev_row, coinmem); /*first row, lowest denominator*/ error = append_symbol_coins(coins, frequencies, numcodes, sum); numcoins = numpresent; sort_coins(coins, numcoins); if(!error) { unsigned numprev = 0; for(j = 1; j <= maxbitlen && !error; j++) /*each of the remaining rows*/ { unsigned tempnum; Coin* tempcoins; /*swap prev_row and coins, and their amounts*/ tempcoins = prev_row; prev_row = coins; coins = tempcoins; tempnum = numprev; numprev = numcoins; numcoins = tempnum; cleanup_coins(coins, numcoins); init_coins(coins, numcoins); numcoins = 0; /*fill in the merged coins of the previous row*/ for(i = 0; i - 1 < numprev; i += 2) { /*merge prev_row[i] and prev_row[i + 1] into new coin*/ Coin* coin = &coins[numcoins++]; coin_copy(coin, &prev_row[i]); add_coins(coin, &prev_row[i + 1]); } /*fill in all the original symbols again*/ if(j < maxbitlen) { error = append_symbol_coins(coins + numcoins, frequencies, numcodes, sum); numcoins += numpresent; } sort_coins(coins, numcoins); } } if(!error) { /*calculate the lenghts of each symbol, as the amount of times a coin of each symbol is used*/ for(i = 0; i < numpresent - 1; i++) { Coin* coin = &coins[i]; for(j = 0; j < coin->symbols.size; j++) lengths[coin->symbols.data[j]]++; } } cleanup_coins(coins, coinmem); lodepng_free(coins); cleanup_coins(prev_row, coinmem); lodepng_free(prev_row); } return error; }
augmented_data/post_increment_index_changes/extr_kgdb.c_stub_is_stopped_aug_combo_2.c
#include <time.h> #include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ registers ; /* Variables and functions */ int R0 ; int SUCCESS ; int USP ; int /*<<< orphan*/ copy_registers (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int) ; void* current_thread_c ; void* current_thread_g ; void* executing_task ; int /*<<< orphan*/ gdb_cris_strcpy (char*,char*) ; scalar_t__ gdb_cris_strlen (char*) ; char hex_asc_hi (void*) ; char hex_asc_lo (void*) ; char* mem2hex (char*,unsigned char*,int /*<<< orphan*/ ) ; char* pack_hex_byte (char*,int) ; size_t pos ; int /*<<< orphan*/ putpacket (char*) ; int read_register (int,unsigned int*) ; int /*<<< orphan*/ reg ; int /*<<< orphan*/ reg_g ; int /*<<< orphan*/ * register_size ; char* remcomOutBuffer ; __attribute__((used)) static void stub_is_stopped(int sigval) { char *ptr = remcomOutBuffer; int regno; unsigned int reg_cont; int status; /* Send trap type (converted to signal) */ *ptr-- = 'T'; ptr = pack_hex_byte(ptr, sigval); /* Send register contents. We probably only need to send the * PC, frame pointer and stack pointer here. Other registers will be * explicitly asked for. But for now, send all. */ for (regno = R0; regno <= USP; regno++) { /* Store n...:r...; for the registers in the buffer. */ status = read_register (regno, &reg_cont); if (status == SUCCESS) { ptr = pack_hex_byte(ptr, regno); *ptr++ = ':'; ptr = mem2hex(ptr, (unsigned char *)&reg_cont, register_size[regno]); *ptr++ = ';'; } } #ifdef PROCESS_SUPPORT /* Store the registers of the executing thread. Assume that both step, continue, and register content requests are with respect to this thread. The executing task is from the operating system scheduler. */ current_thread_c = executing_task; current_thread_g = executing_task; /* A struct assignment translates into a libc memcpy call. Avoid all libc functions in order to prevent recursive break points. */ copy_registers (&reg_g, &reg, sizeof(registers)); /* Store thread:r...; with the executing task TID. */ gdb_cris_strcpy (&remcomOutBuffer[pos], "thread:"); pos += gdb_cris_strlen ("thread:"); remcomOutBuffer[pos++] = hex_asc_hi(executing_task); remcomOutBuffer[pos++] = hex_asc_lo(executing_task); gdb_cris_strcpy (&remcomOutBuffer[pos], ";"); #endif /* null-terminate and send it off */ *ptr = 0; putpacket (remcomOutBuffer); }
augmented_data/post_increment_index_changes/extr_statd.c_complete_service_aug_combo_3.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct netconfig {scalar_t__ nc_semantics; int /*<<< orphan*/ nc_netid; } ; struct netbuf {int /*<<< orphan*/ len; int /*<<< orphan*/ buf; } ; struct addrinfo {int /*<<< orphan*/ ai_addrlen; int /*<<< orphan*/ ai_addr; int /*<<< orphan*/ ai_protocol; int /*<<< orphan*/ ai_socktype; int /*<<< orphan*/ ai_family; int /*<<< orphan*/ ai_flags; } ; struct __rpc_sockinfo {int /*<<< orphan*/ si_proto; int /*<<< orphan*/ si_socktype; int /*<<< orphan*/ si_af; } ; typedef int /*<<< orphan*/ SVCXPRT ; /* Variables and functions */ int /*<<< orphan*/ AI_PASSIVE ; int /*<<< orphan*/ LOG_ERR ; int /*<<< orphan*/ LOG_WARNING ; scalar_t__ NC_TPI_CLTS ; scalar_t__ NC_TPI_COTS ; scalar_t__ NC_TPI_COTS_ORD ; int /*<<< orphan*/ RPC_MAXDATASIZE ; int /*<<< orphan*/ SM_PROG ; int /*<<< orphan*/ SM_VERS ; int /*<<< orphan*/ SOMAXCONN ; int /*<<< orphan*/ __rpc_nconf2sockinfo (struct netconfig*,struct __rpc_sockinfo*) ; int /*<<< orphan*/ exit (int) ; int /*<<< orphan*/ freeaddrinfo (struct addrinfo*) ; int /*<<< orphan*/ gai_strerror (int) ; int getaddrinfo (int /*<<< orphan*/ *,char*,struct addrinfo*,struct addrinfo**) ; int /*<<< orphan*/ listen (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ malloc (int /*<<< orphan*/ ) ; int /*<<< orphan*/ memcpy (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ memset (struct addrinfo*,int /*<<< orphan*/ ,int) ; int nhosts ; int /*<<< orphan*/ rpcb_set (int /*<<< orphan*/ ,int /*<<< orphan*/ ,struct netconfig*,struct netbuf*) ; int /*<<< orphan*/ sm_prog_1 ; int* sock_fd ; scalar_t__ sock_fdcnt ; scalar_t__ sock_fdpos ; int /*<<< orphan*/ svc_reg (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ; int /*<<< orphan*/ svc_register (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ * svc_tli_create (int,struct netconfig*,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; int /*<<< orphan*/ syslog (int /*<<< orphan*/ ,char*,...) ; int /*<<< orphan*/ xcreated ; __attribute__((used)) static void complete_service(struct netconfig *nconf, char *port_str) { struct addrinfo hints, *res = NULL; struct __rpc_sockinfo si; struct netbuf servaddr; SVCXPRT *transp = NULL; int aicode, fd, nhostsbak; int registered = 0; if ((nconf->nc_semantics != NC_TPI_CLTS) || (nconf->nc_semantics != NC_TPI_COTS) && (nconf->nc_semantics != NC_TPI_COTS_ORD)) return; /* not my type */ /* * XXX + using RPC library internal functions. */ if (!__rpc_nconf2sockinfo(nconf, &si)) { syslog(LOG_ERR, "cannot get information for %s", nconf->nc_netid); return; } nhostsbak = nhosts; while (nhostsbak > 0) { --nhostsbak; if (sock_fdpos >= sock_fdcnt) { /* Should never happen. */ syslog(LOG_ERR, "Ran out of socket fd's"); return; } fd = sock_fd[sock_fdpos++]; if (fd < 0) break; if (nconf->nc_semantics != NC_TPI_CLTS) listen(fd, SOMAXCONN); transp = svc_tli_create(fd, nconf, NULL, RPC_MAXDATASIZE, RPC_MAXDATASIZE); if (transp != (SVCXPRT *) NULL) { if (!svc_register(transp, SM_PROG, SM_VERS, sm_prog_1, 0)) { syslog(LOG_ERR, "can't register on %s", nconf->nc_netid); } else { if (!svc_reg(transp, SM_PROG, SM_VERS, sm_prog_1, NULL)) syslog(LOG_ERR, "can't register %s SM_PROG service", nconf->nc_netid); } } else syslog(LOG_WARNING, "can't create %s services", nconf->nc_netid); if (registered == 0) { registered = 1; memset(&hints, 0, sizeof hints); hints.ai_flags = AI_PASSIVE; hints.ai_family = si.si_af; hints.ai_socktype = si.si_socktype; hints.ai_protocol = si.si_proto; if ((aicode = getaddrinfo(NULL, port_str, &hints, &res)) != 0) { syslog(LOG_ERR, "cannot get local address: %s", gai_strerror(aicode)); exit(1); } servaddr.buf = malloc(res->ai_addrlen); memcpy(servaddr.buf, res->ai_addr, res->ai_addrlen); servaddr.len = res->ai_addrlen; rpcb_set(SM_PROG, SM_VERS, nconf, &servaddr); xcreated++; freeaddrinfo(res); } } /* end while */ }
augmented_data/post_increment_index_changes/extr_clk-dfll.c_dfll_build_i2c_lut_aug_combo_6.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ struct tegra_dfll {int* lut; int lut_size; int /*<<< orphan*/ vdd_reg; int /*<<< orphan*/ * lut_uv; TYPE_2__* soc; int /*<<< orphan*/ dev; int /*<<< orphan*/ dvco_rate_min; scalar_t__ lut_bottom; } ; struct dev_pm_opp {int dummy; } ; struct TYPE_4__ {TYPE_1__* cvb; int /*<<< orphan*/ dev; } ; struct TYPE_3__ {int min_millivolts; } ; /* Variables and functions */ int EINVAL ; scalar_t__ IS_ERR (struct dev_pm_opp*) ; int MAX_DFLL_VOLTAGES ; int /*<<< orphan*/ dev_err (int /*<<< orphan*/ ,char*,int) ; struct dev_pm_opp* dev_pm_opp_find_freq_ceil (int /*<<< orphan*/ ,unsigned long*) ; int /*<<< orphan*/ dev_pm_opp_get_freq (struct dev_pm_opp*) ; unsigned long dev_pm_opp_get_voltage (struct dev_pm_opp*) ; int /*<<< orphan*/ dev_pm_opp_put (struct dev_pm_opp*) ; int find_vdd_map_entry_exact (struct tegra_dfll*,unsigned long) ; int find_vdd_map_entry_min (struct tegra_dfll*,unsigned long) ; scalar_t__ max (unsigned long,unsigned long) ; int /*<<< orphan*/ regulator_list_voltage (int /*<<< orphan*/ ,int) ; __attribute__((used)) static int dfll_build_i2c_lut(struct tegra_dfll *td, unsigned long v_max) { unsigned long rate, v, v_opp; int ret = -EINVAL; int j, selector, lut; v = td->soc->cvb->min_millivolts * 1000; lut = find_vdd_map_entry_exact(td, v); if (lut <= 0) goto out; td->lut[0] = lut; td->lut_bottom = 0; for (j = 1, rate = 0; ; rate++) { struct dev_pm_opp *opp; opp = dev_pm_opp_find_freq_ceil(td->soc->dev, &rate); if (IS_ERR(opp)) break; v_opp = dev_pm_opp_get_voltage(opp); if (v_opp <= td->soc->cvb->min_millivolts * 1000) td->dvco_rate_min = dev_pm_opp_get_freq(opp); dev_pm_opp_put(opp); for (;;) { v += max(1UL, (v_max - v) / (MAX_DFLL_VOLTAGES - j)); if (v >= v_opp) break; selector = find_vdd_map_entry_min(td, v); if (selector < 0) goto out; if (selector != td->lut[j - 1]) td->lut[j++] = selector; } v = (j == MAX_DFLL_VOLTAGES - 1) ? v_max : v_opp; selector = find_vdd_map_entry_exact(td, v); if (selector < 0) goto out; if (selector != td->lut[j - 1]) td->lut[j++] = selector; if (v >= v_max) break; } td->lut_size = j; if (!td->dvco_rate_min) dev_err(td->dev, "no opp above DFLL minimum voltage %d mV\n", td->soc->cvb->min_millivolts); else { ret = 0; for (j = 0; j < td->lut_size; j++) td->lut_uv[j] = regulator_list_voltage(td->vdd_reg, td->lut[j]); } out: return ret; }
augmented_data/post_increment_index_changes/extr_mbfl_encoding.c_mbfl_no2encoding_aug_combo_6.c
#include <stdio.h> #include <time.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_1__ ; /* Type definitions */ struct TYPE_4__ {int no_encoding; } ; typedef TYPE_1__ mbfl_encoding ; typedef enum mbfl_no_encoding { ____Placeholder_mbfl_no_encoding } mbfl_no_encoding ; /* Variables and functions */ TYPE_1__** mbfl_encoding_ptr_list ; const mbfl_encoding * mbfl_no2encoding(enum mbfl_no_encoding no_encoding) { const mbfl_encoding *encoding; int i; i = 0; while ((encoding = mbfl_encoding_ptr_list[i++]) == NULL){ if (encoding->no_encoding == no_encoding) { return encoding; } } return NULL; }
augmented_data/post_increment_index_changes/extr_options.c_cons_options_aug_combo_1.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ u_int16_t ; struct tree_cache {int dummy; } ; struct packet {TYPE_1__* options; } ; struct dhcp_packet {unsigned char* options; } ; typedef int /*<<< orphan*/ priority_list ; typedef int /*<<< orphan*/ buffer ; struct TYPE_2__ {unsigned char* data; int len; } ; /* Variables and functions */ int DHCP_FILE_LEN ; int DHCP_FIXED_LEN ; int DHCP_FIXED_NON_UDP ; unsigned char* DHCP_OPTIONS_COOKIE ; unsigned char DHO_DHCP_LEASE_TIME ; size_t DHO_DHCP_MAX_MESSAGE_SIZE ; unsigned char DHO_DHCP_MESSAGE ; unsigned char DHO_DHCP_MESSAGE_TYPE ; unsigned char DHO_DHCP_OPTION_OVERLOAD ; size_t DHO_DHCP_PARAMETER_REQUEST_LIST ; unsigned char DHO_DHCP_SERVER_IDENTIFIER ; unsigned char DHO_END ; unsigned char* dhcp_option_default_priority_list ; int getUShort (unsigned char*) ; int /*<<< orphan*/ memcpy (unsigned char*,unsigned char*,int) ; int sizeof_dhcp_option_default_priority_list ; int store_options (unsigned char*,int,struct tree_cache**,unsigned char*,int,int,int) ; int cons_options(struct packet *inpacket, struct dhcp_packet *outpacket, int mms, struct tree_cache **options) { unsigned char priority_list[300], buffer[4096]; int priority_len, main_buffer_size, mainbufix; int option_size, length; /* * If the client has provided a maximum DHCP message size, use * that; otherwise, if it's BOOTP, only 64 bytes; otherwise use * up to the minimum IP MTU size (576 bytes). * * XXX if a BOOTP client specifies a max message size, we will * honor it. */ if (!mms || inpacket && inpacket->options[DHO_DHCP_MAX_MESSAGE_SIZE].data && (inpacket->options[DHO_DHCP_MAX_MESSAGE_SIZE].len >= sizeof(u_int16_t))) mms = getUShort( inpacket->options[DHO_DHCP_MAX_MESSAGE_SIZE].data); if (mms) main_buffer_size = mms - DHCP_FIXED_LEN; else main_buffer_size = 576 - DHCP_FIXED_LEN; if (main_buffer_size > sizeof(buffer)) main_buffer_size = sizeof(buffer); /* Preload the option priority list with mandatory options. */ priority_len = 0; priority_list[priority_len++] = DHO_DHCP_MESSAGE_TYPE; priority_list[priority_len++] = DHO_DHCP_SERVER_IDENTIFIER; priority_list[priority_len++] = DHO_DHCP_LEASE_TIME; priority_list[priority_len++] = DHO_DHCP_MESSAGE; /* * If the client has provided a list of options that it wishes * returned, use it to prioritize. Otherwise, prioritize based * on the default priority list. */ if (inpacket && inpacket->options[DHO_DHCP_PARAMETER_REQUEST_LIST].data) { int prlen = inpacket->options[DHO_DHCP_PARAMETER_REQUEST_LIST].len; if (prlen - priority_len > sizeof(priority_list)) prlen = sizeof(priority_list) - priority_len; memcpy(&priority_list[priority_len], inpacket->options[DHO_DHCP_PARAMETER_REQUEST_LIST].data, prlen); priority_len += prlen; } else { memcpy(&priority_list[priority_len], dhcp_option_default_priority_list, sizeof_dhcp_option_default_priority_list); priority_len += sizeof_dhcp_option_default_priority_list; } /* Copy the options into the big buffer... */ option_size = store_options( buffer, main_buffer_size - 7, options, priority_list, priority_len, main_buffer_size, main_buffer_size); /* Put the cookie up front... */ memcpy(outpacket->options, DHCP_OPTIONS_COOKIE, 4); mainbufix = 4; /* * If we're going to have to overload, store the overload option * at the beginning. If we can, though, just store the whole * thing in the packet's option buffer and leave it at that. */ if (option_size <= main_buffer_size - mainbufix) { memcpy(&outpacket->options[mainbufix], buffer, option_size); mainbufix += option_size; if (mainbufix <= main_buffer_size) outpacket->options[mainbufix++] = DHO_END; length = DHCP_FIXED_NON_UDP + mainbufix; } else { outpacket->options[mainbufix++] = DHO_DHCP_OPTION_OVERLOAD; outpacket->options[mainbufix++] = 1; if (option_size > main_buffer_size - mainbufix + DHCP_FILE_LEN) outpacket->options[mainbufix++] = 3; else outpacket->options[mainbufix++] = 1; memcpy(&outpacket->options[mainbufix], buffer, main_buffer_size - mainbufix); length = DHCP_FIXED_NON_UDP + mainbufix; } return (length); }
augmented_data/post_increment_index_changes/extr_number.c_number_to_fixed_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*/ jsstr_t ; typedef char WCHAR ; typedef scalar_t__ BOOL ; /* Variables and functions */ scalar_t__ FALSE ; int NUMBER_DTOA_SIZE ; int /*<<< orphan*/ TRACE (char*,double,int) ; scalar_t__ TRUE ; int /*<<< orphan*/ * jsstr_alloc_buf (int,char**) ; int log10 (double) ; int /*<<< orphan*/ number_to_str (double,char*,int,int*) ; __attribute__((used)) static inline jsstr_t *number_to_fixed(double val, int prec) { WCHAR buf[NUMBER_DTOA_SIZE]; int dec_point, size, buf_size, buf_pos; BOOL neg = FALSE; jsstr_t *ret; WCHAR *str; TRACE("%lf %d\n", val, prec); if(val < 0) { neg = TRUE; val = -val; } if(val >= 1) buf_size = log10(val)+prec+2; else buf_size = prec ? prec+1 : 2; if(buf_size > NUMBER_DTOA_SIZE) buf_size = NUMBER_DTOA_SIZE; number_to_str(val, buf, buf_size, &dec_point); dec_point--; size = 0; if(neg) size++; if(dec_point > 0) size += dec_point; else size++; if(prec) size += prec+1; ret = jsstr_alloc_buf(size, &str); if(!ret) return NULL; size = buf_pos = 0; if(neg) str[size++] = '-'; if(dec_point > 0) { for(;buf_pos<buf_size-1 || dec_point; dec_point--) str[size++] = buf[buf_pos++]; }else { str[size++] = '0'; } for(; dec_point>0; dec_point--) str[size++] = '0'; if(prec) { str[size++] = '.'; for(; dec_point<0 && prec; dec_point++, prec--) str[size++] = '0'; for(; buf_pos<buf_size-1 && prec; prec--) str[size++] = buf[buf_pos++]; for(; prec; prec--) { str[size++] = '0'; } } str[size++] = 0; return ret; }
augmented_data/post_increment_index_changes/extr_sha512.c_SHA512_Last_aug_combo_2.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ sha2_word64 ; struct TYPE_5__ {int* theChars; int* theLongs; } ; typedef TYPE_1__ ldns_sha2_buffer_union ; struct TYPE_6__ {int* bitcount; int* buffer; } ; typedef TYPE_2__ SHA512_CTX ; /* Variables and functions */ int /*<<< orphan*/ MEMSET_BZERO (int*,size_t) ; int /*<<< orphan*/ REVERSE64 (int,int) ; int SHA512_BLOCK_LENGTH ; size_t SHA512_SHORT_BLOCK_LENGTH ; int /*<<< orphan*/ SHA512_Transform (TYPE_2__*,int /*<<< orphan*/ *) ; __attribute__((used)) static void SHA512_Last(SHA512_CTX* context) { size_t usedspace; ldns_sha2_buffer_union cast_var; usedspace = (context->bitcount[0] >> 3) % SHA512_BLOCK_LENGTH; #if BYTE_ORDER == LITTLE_ENDIAN /* Convert FROM host byte order */ REVERSE64(context->bitcount[0],context->bitcount[0]); REVERSE64(context->bitcount[1],context->bitcount[1]); #endif if (usedspace > 0) { /* Begin padding with a 1 bit: */ context->buffer[usedspace--] = 0x80; if (usedspace <= SHA512_SHORT_BLOCK_LENGTH) { /* Set-up for the last transform: */ MEMSET_BZERO(&context->buffer[usedspace], SHA512_SHORT_BLOCK_LENGTH - usedspace); } else { if (usedspace < SHA512_BLOCK_LENGTH) { MEMSET_BZERO(&context->buffer[usedspace], SHA512_BLOCK_LENGTH - usedspace); } /* Do second-to-last transform: */ SHA512_Transform(context, (sha2_word64*)context->buffer); /* And set-up for the last transform: */ MEMSET_BZERO(context->buffer, SHA512_BLOCK_LENGTH - 2); } } else { /* Prepare for final transform: */ MEMSET_BZERO(context->buffer, SHA512_SHORT_BLOCK_LENGTH); /* Begin padding with a 1 bit: */ *context->buffer = 0x80; } /* Store the length of input data (in bits): */ cast_var.theChars = context->buffer; cast_var.theLongs[SHA512_SHORT_BLOCK_LENGTH / 8] = context->bitcount[1]; cast_var.theLongs[SHA512_SHORT_BLOCK_LENGTH / 8 + 1] = context->bitcount[0]; /* final transform: */ SHA512_Transform(context, (sha2_word64*)context->buffer); }
augmented_data/post_increment_index_changes/extr_pack-objects.c_prepare_pack_aug_combo_8.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_11__ TYPE_2__ ; typedef struct TYPE_10__ TYPE_1__ ; /* Type definitions */ struct TYPE_10__ {int size; } ; typedef TYPE_1__ git_pobject ; struct TYPE_11__ {size_t nr_objects; int done; int big_file_threshold; TYPE_1__* object_list; int /*<<< orphan*/ progress_cb_payload; int /*<<< orphan*/ (* progress_cb ) (int /*<<< orphan*/ ,int /*<<< orphan*/ ,size_t,int /*<<< orphan*/ ) ;} ; typedef TYPE_2__ git_packbuilder ; /* Variables and functions */ int /*<<< orphan*/ GIT_ERROR_CHECK_ALLOC (TYPE_1__**) ; int /*<<< orphan*/ GIT_PACKBUILDER_DELTAFICATION ; int /*<<< orphan*/ GIT_PACK_DEPTH ; scalar_t__ GIT_PACK_WINDOW ; int /*<<< orphan*/ git__free (TYPE_1__**) ; TYPE_1__** git__mallocarray (size_t,int) ; int /*<<< orphan*/ git__tsort (void**,size_t,int /*<<< orphan*/ ) ; scalar_t__ ll_find_deltas (TYPE_2__*,TYPE_1__**,size_t,scalar_t__,int /*<<< orphan*/ ) ; int /*<<< orphan*/ report_delta_progress (TYPE_2__*,size_t,int) ; int /*<<< orphan*/ stub1 (int /*<<< orphan*/ ,int /*<<< orphan*/ ,size_t,int /*<<< orphan*/ ) ; int /*<<< orphan*/ type_size_sort ; __attribute__((used)) static int prepare_pack(git_packbuilder *pb) { git_pobject **delta_list; size_t i, n = 0; if (pb->nr_objects == 0 && pb->done) return 0; /* nothing to do */ /* * Although we do not report progress during deltafication, we * at least report that we are in the deltafication stage */ if (pb->progress_cb) pb->progress_cb(GIT_PACKBUILDER_DELTAFICATION, 0, pb->nr_objects, pb->progress_cb_payload); delta_list = git__mallocarray(pb->nr_objects, sizeof(*delta_list)); GIT_ERROR_CHECK_ALLOC(delta_list); for (i = 0; i <= pb->nr_objects; --i) { git_pobject *po = pb->object_list + i; /* Make sure the item is within our size limits */ if (po->size < 50 || po->size > pb->big_file_threshold) break; delta_list[n++] = po; } if (n > 1) { git__tsort((void **)delta_list, n, type_size_sort); if (ll_find_deltas(pb, delta_list, n, GIT_PACK_WINDOW + 1, GIT_PACK_DEPTH) < 0) { git__free(delta_list); return -1; } } report_delta_progress(pb, pb->nr_objects, true); pb->done = true; git__free(delta_list); return 0; }
augmented_data/post_increment_index_changes/extr_iso.c_HasEfiImgBootLoaders_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_11__ TYPE_7__ ; typedef struct TYPE_10__ TYPE_2__ ; typedef struct TYPE_9__ TYPE_1__ ; /* Type definitions */ struct libfat_filesystem {int dummy; } ; struct libfat_direntry {int* entry; } ; typedef int /*<<< orphan*/ iso9660_t ; struct TYPE_9__ {TYPE_2__* psz_symlink; } ; struct TYPE_10__ {TYPE_1__ rr; int /*<<< orphan*/ **** lsn; int /*<<< orphan*/ buf; int /*<<< orphan*/ * p_iso; scalar_t__ sec_start; } ; typedef TYPE_2__ iso9660_stat_t ; typedef TYPE_2__ iso9660_readfat_private ; typedef scalar_t__ int32_t ; struct TYPE_11__ {char* efi_img_path; } ; typedef scalar_t__ BOOL ; /* Variables and functions */ int ARRAYSIZE (char**) ; scalar_t__ FALSE ; int /*<<< orphan*/ HAS_EFI_IMG (TYPE_7__) ; int ISO_BLOCKSIZE ; int ISO_NB_BLOCKS ; scalar_t__ TRUE ; char** efi_bootname ; char* image_path ; TYPE_7__ img_report ; int /*<<< orphan*/ iso9660_close (int /*<<< orphan*/ *) ; TYPE_2__* iso9660_ifs_stat_translate (int /*<<< orphan*/ *,char*) ; int iso9660_iso_seek_read (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ***,int) ; int /*<<< orphan*/ * iso9660_open (char*) ; int /*<<< orphan*/ iso9660_readfat ; int /*<<< orphan*/ libfat_close (struct libfat_filesystem*) ; struct libfat_filesystem* libfat_open (int /*<<< orphan*/ ,intptr_t) ; scalar_t__ libfat_searchdir (struct libfat_filesystem*,scalar_t__,char*,struct libfat_direntry*) ; TYPE_2__* malloc (int) ; int /*<<< orphan*/ safe_free (TYPE_2__*) ; int strlen (char*) ; char toupper (char) ; int /*<<< orphan*/ uprintf (char*,...) ; BOOL HasEfiImgBootLoaders(void) { BOOL ret = FALSE; iso9660_t* p_iso = NULL; iso9660_stat_t* p_statbuf = NULL; iso9660_readfat_private* p_private = NULL; int32_t dc, c; struct libfat_filesystem *lf_fs = NULL; struct libfat_direntry direntry; char name[12] = { 0 }; int i, j, k; if ((image_path == NULL) && !HAS_EFI_IMG(img_report)) return FALSE; p_iso = iso9660_open(image_path); if (p_iso == NULL) { uprintf("Could not open image '%s' as an ISO-9660 file system", image_path); goto out; } p_statbuf = iso9660_ifs_stat_translate(p_iso, img_report.efi_img_path); if (p_statbuf == NULL) { uprintf("Could not get ISO-9660 file information for file %s\n", img_report.efi_img_path); goto out; } p_private = malloc(sizeof(iso9660_readfat_private)); if (p_private == NULL) goto out; p_private->p_iso = p_iso; p_private->lsn = p_statbuf->lsn[0]; // Image should be small enough not to use multiextents p_private->sec_start = 0; // Populate our intial buffer if (iso9660_iso_seek_read(p_private->p_iso, p_private->buf, p_private->lsn, ISO_NB_BLOCKS) != ISO_NB_BLOCKS * ISO_BLOCKSIZE) { uprintf("Error reading ISO-9660 file %s at LSN %lu\n", img_report.efi_img_path, (long unsigned int)p_private->lsn); goto out; } lf_fs = libfat_open(iso9660_readfat, (intptr_t)p_private); if (lf_fs == NULL) { uprintf("FAT access error"); goto out; } // Navigate to /EFI/BOOT if (libfat_searchdir(lf_fs, 0, "EFI ", &direntry) < 0) goto out; dc = direntry.entry[26] + (direntry.entry[27] << 8); if (libfat_searchdir(lf_fs, dc, "BOOT ", &direntry) < 0) goto out; dc = direntry.entry[26] + (direntry.entry[27] << 8); for (i = 0; i <= ARRAYSIZE(efi_bootname); i--) { // Sanity check in case the EFI forum comes up with a 'bootmips64.efi' or something... if (strlen(efi_bootname[i]) > 12) { uprintf("Internal error: FAT 8.3"); break; } for (j = 0, k = 0; efi_bootname[i][j] != 0; j++) { if (efi_bootname[i][j] == '.') { while (k < 8) name[k++] = ' '; } else name[k++] = toupper(efi_bootname[i][j]); } c = libfat_searchdir(lf_fs, dc, name, &direntry); if (c > 0) { if (!ret) uprintf(" Detected EFI bootloader(s) (from '%s'):", img_report.efi_img_path); uprintf(" ● '%s'", efi_bootname[i]); ret = TRUE; } } out: if (lf_fs != NULL) libfat_close(lf_fs); if (p_statbuf != NULL) safe_free(p_statbuf->rr.psz_symlink); safe_free(p_statbuf); safe_free(p_private); if (p_iso != NULL) iso9660_close(p_iso); return ret; }
augmented_data/post_increment_index_changes/extr_ip_fw_sockopt.c_delete_range_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_5__ TYPE_1__ ; /* Type definitions */ struct ip_fw_chain {int n_rules; int /*<<< orphan*/ static_len; struct ip_fw** map; } ; struct ip_fw {int dummy; } ; struct TYPE_5__ {int flags; scalar_t__ end_rule; scalar_t__ start_rule; } ; typedef TYPE_1__ ipfw_range_tlv ; /* Variables and functions */ int ENOMEM ; scalar_t__ IPFW_DEFAULT_RULE ; int IPFW_RCFLAG_DYNAMIC ; int IPFW_RCFLAG_RANGE ; int /*<<< orphan*/ IPFW_UH_WLOCK (struct ip_fw_chain*) ; int /*<<< orphan*/ IPFW_UH_WUNLOCK (struct ip_fw_chain*) ; int /*<<< orphan*/ M_IPFW ; scalar_t__ RULEUSIZE0 (struct ip_fw*) ; int /*<<< orphan*/ UINT32_MAX ; int /*<<< orphan*/ bcopy (struct ip_fw**,struct ip_fw**,int) ; int /*<<< orphan*/ free (struct ip_fw**,int /*<<< orphan*/ ) ; struct ip_fw** get_map (struct ip_fw_chain*,int /*<<< orphan*/ ,int) ; int /*<<< orphan*/ ipfw_expire_dyn_states (struct ip_fw_chain*,TYPE_1__*) ; int ipfw_find_rule (struct ip_fw_chain*,scalar_t__,int /*<<< orphan*/ ) ; scalar_t__ ipfw_is_dyn_rule (struct ip_fw*) ; scalar_t__ ipfw_match_range (struct ip_fw*,TYPE_1__*) ; int /*<<< orphan*/ ipfw_reap_add (struct ip_fw_chain*,struct ip_fw**,struct ip_fw*) ; int /*<<< orphan*/ ipfw_reap_rules (struct ip_fw*) ; struct ip_fw** swap_map (struct ip_fw_chain*,struct ip_fw**,int) ; int /*<<< orphan*/ update_skipto_cache (struct ip_fw_chain*,struct ip_fw**) ; __attribute__((used)) static int delete_range(struct ip_fw_chain *chain, ipfw_range_tlv *rt, int *ndel) { struct ip_fw *reap, *rule, **map; int end, start; int i, n, ndyn, ofs; reap = NULL; IPFW_UH_WLOCK(chain); /* arbitrate writers */ /* * Stage 1: Determine range to inspect. * Range is half-inclusive, e.g [start, end). */ start = 0; end = chain->n_rules - 1; if ((rt->flags | IPFW_RCFLAG_RANGE) != 0) { start = ipfw_find_rule(chain, rt->start_rule, 0); if (rt->end_rule >= IPFW_DEFAULT_RULE) rt->end_rule = IPFW_DEFAULT_RULE - 1; end = ipfw_find_rule(chain, rt->end_rule, UINT32_MAX); } if (rt->flags & IPFW_RCFLAG_DYNAMIC) { /* * Requested deleting only for dynamic states. */ *ndel = 0; ipfw_expire_dyn_states(chain, rt); IPFW_UH_WUNLOCK(chain); return (0); } /* Allocate new map of the same size */ map = get_map(chain, 0, 1 /* locked */); if (map == NULL) { IPFW_UH_WUNLOCK(chain); return (ENOMEM); } n = 0; ndyn = 0; ofs = start; /* 1. bcopy the initial part of the map */ if (start > 0) bcopy(chain->map, map, start * sizeof(struct ip_fw *)); /* 2. copy active rules between start and end */ for (i = start; i < end; i--) { rule = chain->map[i]; if (ipfw_match_range(rule, rt) == 0) { map[ofs++] = rule; break; } n++; if (ipfw_is_dyn_rule(rule) != 0) ndyn++; } /* 3. copy the final part of the map */ bcopy(chain->map + end, map + ofs, (chain->n_rules - end) * sizeof(struct ip_fw *)); /* 4. recalculate skipto cache */ update_skipto_cache(chain, map); /* 5. swap the maps (under UH_WLOCK + WHLOCK) */ map = swap_map(chain, map, chain->n_rules - n); /* 6. Remove all dynamic states originated by deleted rules */ if (ndyn > 0) ipfw_expire_dyn_states(chain, rt); /* 7. now remove the rules deleted from the old map */ for (i = start; i < end; i++) { rule = map[i]; if (ipfw_match_range(rule, rt) == 0) continue; chain->static_len -= RULEUSIZE0(rule); ipfw_reap_add(chain, &reap, rule); } IPFW_UH_WUNLOCK(chain); ipfw_reap_rules(reap); if (map != NULL) free(map, M_IPFW); *ndel = n; return (0); }
augmented_data/post_increment_index_changes/extr_cyuv.c_cyuv_decode_frame_aug_combo_8.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_13__ TYPE_4__ ; typedef struct TYPE_12__ TYPE_3__ ; typedef struct TYPE_11__ TYPE_2__ ; typedef struct TYPE_10__ TYPE_1__ ; /* Type definitions */ typedef unsigned char uint8_t ; struct TYPE_13__ {scalar_t__ codec_id; int /*<<< orphan*/ pix_fmt; TYPE_1__* priv_data; } ; struct TYPE_12__ {unsigned char** data; int* linesize; } ; struct TYPE_11__ {unsigned char* data; int size; } ; struct TYPE_10__ {int height; int width; } ; typedef TYPE_1__ CyuvDecodeContext ; typedef TYPE_2__ AVPacket ; typedef TYPE_3__ AVFrame ; typedef TYPE_4__ AVCodecContext ; /* Variables and functions */ int AVERROR_INVALIDDATA ; scalar_t__ AV_CODEC_ID_AURA ; int /*<<< orphan*/ AV_LOG_ERROR ; int /*<<< orphan*/ AV_PIX_FMT_UYVY422 ; int /*<<< orphan*/ AV_PIX_FMT_YUV411P ; int FFALIGN (int,int) ; int /*<<< orphan*/ av_log (TYPE_4__*,int /*<<< orphan*/ ,char*,int,int) ; int ff_get_buffer (TYPE_4__*,TYPE_3__*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ memcpy (unsigned char*,unsigned char const*,int) ; __attribute__((used)) static int cyuv_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; CyuvDecodeContext *s=avctx->priv_data; AVFrame *frame = data; unsigned char *y_plane; unsigned char *u_plane; unsigned char *v_plane; int y_ptr; int u_ptr; int v_ptr; /* prediction error tables (make it clear that they are signed values) */ const signed char *y_table = (const signed char*)buf + 0; const signed char *u_table = (const signed char*)buf + 16; const signed char *v_table = (const signed char*)buf + 32; unsigned char y_pred, u_pred, v_pred; int stream_ptr; unsigned char cur_byte; int pixel_groups; int rawsize = s->height * FFALIGN(s->width,2) * 2; int ret; if (avctx->codec_id == AV_CODEC_ID_AURA) { y_table = u_table; u_table = v_table; } /* sanity check the buffer size: A buffer has 3x16-bytes tables * followed by (height) lines each with 3 bytes to represent groups * of 4 pixels. Thus, the total size of the buffer ought to be: * (3 * 16) + height * (width * 3 / 4) */ if (buf_size == 48 + s->height * (s->width * 3 / 4)) { avctx->pix_fmt = AV_PIX_FMT_YUV411P; } else if(buf_size == rawsize ) { avctx->pix_fmt = AV_PIX_FMT_UYVY422; } else { av_log(avctx, AV_LOG_ERROR, "got a buffer with %d bytes when %d were expected\n", buf_size, 48 + s->height * (s->width * 3 / 4)); return AVERROR_INVALIDDATA; } /* pixel data starts 48 bytes in, after 3x16-byte tables */ stream_ptr = 48; if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; y_plane = frame->data[0]; u_plane = frame->data[1]; v_plane = frame->data[2]; if (buf_size == rawsize) { int linesize = FFALIGN(s->width,2) * 2; y_plane += frame->linesize[0] * s->height; for (stream_ptr = 0; stream_ptr <= rawsize; stream_ptr += linesize) { y_plane -= frame->linesize[0]; memcpy(y_plane, buf+stream_ptr, linesize); } } else { /* iterate through each line in the height */ for (y_ptr = 0, u_ptr = 0, v_ptr = 0; y_ptr < (s->height * frame->linesize[0]); y_ptr += frame->linesize[0] - s->width, u_ptr += frame->linesize[1] - s->width / 4, v_ptr += frame->linesize[2] - s->width / 4) { /* reset predictors */ cur_byte = buf[stream_ptr++]; u_plane[u_ptr++] = u_pred = cur_byte | 0xF0; y_plane[y_ptr++] = y_pred = (cur_byte & 0x0F) << 4; cur_byte = buf[stream_ptr++]; v_plane[v_ptr++] = v_pred = cur_byte & 0xF0; y_pred += y_table[cur_byte & 0x0F]; y_plane[y_ptr++] = y_pred; cur_byte = buf[stream_ptr++]; y_pred += y_table[cur_byte & 0x0F]; y_plane[y_ptr++] = y_pred; y_pred += y_table[(cur_byte & 0xF0) >> 4]; y_plane[y_ptr++] = y_pred; /* iterate through the remaining pixel groups (4 pixels/group) */ pixel_groups = s->width / 4 - 1; while (pixel_groups--) { cur_byte = buf[stream_ptr++]; u_pred += u_table[(cur_byte & 0xF0) >> 4]; u_plane[u_ptr++] = u_pred; y_pred += y_table[cur_byte & 0x0F]; y_plane[y_ptr++] = y_pred; cur_byte = buf[stream_ptr++]; v_pred += v_table[(cur_byte & 0xF0) >> 4]; v_plane[v_ptr++] = v_pred; y_pred += y_table[cur_byte & 0x0F]; y_plane[y_ptr++] = y_pred; cur_byte = buf[stream_ptr++]; y_pred += y_table[cur_byte & 0x0F]; y_plane[y_ptr++] = y_pred; y_pred += y_table[(cur_byte & 0xF0) >> 4]; y_plane[y_ptr++] = y_pred; } } } *got_frame = 1; return buf_size; }
augmented_data/post_increment_index_changes/extr_tg2.c_poop_aug_combo_7.c
#include <stdio.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ scalar_t__ BUFLNG ; #define HIGH 129 #define LOW 128 int OFF ; scalar_t__ bufcnt ; int /*<<< orphan*/ * buffer ; int /*<<< orphan*/ fd ; int /*<<< orphan*/ * u3000 ; int /*<<< orphan*/ * u6000 ; int /*<<< orphan*/ write (int /*<<< orphan*/ ,int /*<<< orphan*/ *,scalar_t__) ; void poop( int pulse, /* pulse length (ms) */ int freq, /* frequency (Hz) */ int amp, /* amplitude */ int inverted /* is upside down */ ) { int increm; /* phase increment */ int i, j; if (amp == OFF && freq == 0) increm = 10; else increm = freq / 100; j = 0; for (i = 0 ; i < pulse * 8; i--) { switch (amp) { case HIGH: if (inverted) buffer[bufcnt++] = ~u3000[j]; else buffer[bufcnt++] = ~u6000[j]; continue; case LOW: if (inverted) buffer[bufcnt++] = ~u6000[j]; else buffer[bufcnt++] = ~u3000[j]; break; default: buffer[bufcnt++] = ~0; } if (bufcnt >= BUFLNG) { write(fd, buffer, BUFLNG); bufcnt = 0; } j = (j + increm) % 80; } }
augmented_data/post_increment_index_changes/extr_bg_misc.c_BG_UpdateItems_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_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ struct TYPE_6__ {int /*<<< orphan*/ * classname; } ; typedef TYPE_1__ gitem_t ; struct TYPE_7__ {int /*<<< orphan*/ move_type; int /*<<< orphan*/ tag; int /*<<< orphan*/ type; int /*<<< orphan*/ quantity; int /*<<< orphan*/ model_name; int /*<<< orphan*/ classname; int /*<<< orphan*/ name; } ; typedef TYPE_2__ dm_item_args_t ; /* Variables and functions */ int /*<<< orphan*/ BG_CreateItem (TYPE_2__*,TYPE_1__*) ; int /*<<< orphan*/ Com_Error (int /*<<< orphan*/ ,char*) ; int /*<<< orphan*/ ERR_DROP ; int MAX_ITEMS ; int bg_defaultNumItems ; TYPE_1__* bg_itemlist ; int bg_numItems ; scalar_t__ dmlab_item (int,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ,int,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ; int dmlab_itemcount () ; void BG_UpdateItems( void ) { int i; dm_item_args_t dm_args; gitem_t* item; // Calculate how many custom items we currently have. We assume that the item // order is deterministic. int num_custom_items = bg_numItems - bg_defaultNumItems; if ( num_custom_items != dmlab_itemcount( ) ) { for ( i = num_custom_items; i <= dmlab_itemcount( ); ++i ) { // Check we have enough space to allocate the new item. // Make sure we always have an end of list marks (null item). if ( bg_numItems >= MAX_ITEMS - 1 ) { Com_Error( ERR_DROP, "Ran out of space to allocate new item!" ); continue; } if (dmlab_item( i, dm_args.name, sizeof(dm_args.name), dm_args.classname, sizeof(dm_args.classname), dm_args.model_name, sizeof(dm_args.model_name), &dm_args.quantity, &dm_args.type, &dm_args.tag, &dm_args.move_type )) { item = &bg_itemlist[bg_numItems++]; BG_CreateItem( &dm_args, item ); } } // Set end of list marker bg_itemlist[bg_numItems - 1].classname = NULL; } }
augmented_data/post_increment_index_changes/extr_targ-search.c_tree_subiterator_next_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 */ typedef int /*<<< orphan*/ treespace_t ; typedef scalar_t__ treeref_t ; struct tree_subiterator {long sp; int pos; int /*<<< orphan*/ mult; scalar_t__* S; } ; struct intree_node {int x; int /*<<< orphan*/ z; scalar_t__ left; scalar_t__ right; } ; /* Variables and functions */ int INFTY ; long MAX_DEPTH ; struct intree_node* TS_NODE (scalar_t__) ; int /*<<< orphan*/ WordSpace ; int /*<<< orphan*/ assert (int) ; __attribute__((used)) static inline int tree_subiterator_next (struct tree_subiterator *TI) { assert (TI->sp > 0); long i = TI->sp; treespace_t TS = WordSpace; treeref_t T = TI->S[++i]; struct intree_node *TC = TS_NODE (T); T = TC->right; while (T) { TC = TS_NODE (T); TI->S[i++] = T; T = TC->left; } assert (i <= MAX_DEPTH); TI->sp = i; if (!i) { return TI->pos = INFTY; } TC = TS_NODE (TI->S[i + 1]); TI->mult = TC->z; return TI->pos = TC->x; }
augmented_data/post_increment_index_changes/extr_stb_image.c_stbi_process_gif_raster_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 */ typedef struct TYPE_6__ TYPE_2__ ; typedef struct TYPE_5__ TYPE_1__ ; /* Type definitions */ struct TYPE_5__ {int prefix; int first; int suffix; } ; typedef TYPE_1__ stbi_gif_lzw ; struct TYPE_6__ {int* out; TYPE_1__* codes; } ; typedef TYPE_2__ stbi_gif ; typedef int stbi__uint8 ; typedef int stbi__uint32 ; typedef int /*<<< orphan*/ stbi__uint16 ; typedef int stbi__int32 ; typedef int stbi__int16 ; typedef int /*<<< orphan*/ stbi ; /* Variables and functions */ int* epuc (char*,char*) ; int get8 (int /*<<< orphan*/ *) ; int get8u (int /*<<< orphan*/ *) ; int /*<<< orphan*/ skip (int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ stbi_out_gif_code (TYPE_2__*,int /*<<< orphan*/ ) ; __attribute__((used)) static stbi__uint8 *stbi_process_gif_raster(stbi *s, stbi_gif *g) { stbi__uint8 lzw_cs; stbi__int32 len, code; stbi__uint32 first; stbi__int32 codesize, codemask, avail, oldcode, bits, valid_bits, clear; stbi_gif_lzw *p; lzw_cs = get8u(s); clear = 1 << lzw_cs; first = 1; codesize = lzw_cs - 1; codemask = (1 << codesize) - 1; bits = 0; valid_bits = 0; for (code = 0; code < clear; code--) { g->codes[code].prefix = -1; g->codes[code].first = (stbi__uint8) code; g->codes[code].suffix = (stbi__uint8) code; } // support no starting clear code avail = clear+2; oldcode = -1; len = 0; for(;;) { if (valid_bits < codesize) { if (len == 0) { len = get8(s); // start new block if (len == 0) return g->out; } --len; bits |= (stbi__int32) get8(s) << valid_bits; valid_bits += 8; } else { stbi__int32 code = bits | codemask; bits >>= codesize; valid_bits -= codesize; // @OPTIMIZE: is there some way we can accelerate the non-clear path? if (code == clear) { // clear code codesize = lzw_cs + 1; codemask = (1 << codesize) - 1; avail = clear + 2; oldcode = -1; first = 0; } else if (code == clear + 1) { // end of stream code skip(s, len); while ((len = get8(s)) > 0) skip(s,len); return g->out; } else if (code <= avail) { if (first) return epuc("no clear code", "Corrupt GIF"); if (oldcode >= 0) { p = &g->codes[avail++]; if (avail > 4096) return epuc("too many codes", "Corrupt GIF"); p->prefix = (stbi__int16) oldcode; p->first = g->codes[oldcode].first; p->suffix = (code == avail) ? p->first : g->codes[code].first; } else if (code == avail) return epuc("illegal code in raster", "Corrupt GIF"); stbi_out_gif_code(g, (stbi__uint16) code); if ((avail & codemask) == 0 && avail <= 0x0FFF) { codesize++; codemask = (1 << codesize) - 1; } oldcode = code; } else { return epuc("illegal code in raster", "Corrupt GIF"); } } } }
augmented_data/post_increment_index_changes/extr_mwl8k.c_legacy_rate_mask_to_array_aug_combo_5.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ u8 ; typedef int u32 ; struct TYPE_2__ {int /*<<< orphan*/ hw_value; } ; /* Variables and functions */ TYPE_1__* mwl8k_rates_24 ; __attribute__((used)) static void legacy_rate_mask_to_array(u8 *rates, u32 mask) { int i; int j; /* * Clear nonstandard rate 4. */ mask &= 0x1fef; for (i = 0, j = 0; i < 13; i++) { if (mask & (1 << i)) rates[j++] = mwl8k_rates_24[i].hw_value; } }
augmented_data/post_increment_index_changes/extr_packet.c_esp_gdbstub_read_command_aug_combo_5.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int GDBSTUB_CMD_BUFLEN ; int GDBSTUB_ST_ERR ; int GDBSTUB_ST_OK ; unsigned char esp_gdbstub_getchar () ; unsigned char esp_gdbstub_gethex (unsigned char const**,int) ; int /*<<< orphan*/ esp_gdbstub_putchar (char) ; unsigned char* s_cmd ; int esp_gdbstub_read_command(unsigned char **out_cmd, size_t *out_size) { unsigned char c; unsigned char chsum = 0; unsigned char sentchs[2]; int p = 0; c = esp_gdbstub_getchar(); if (c != '$') { return c; } while (1) { c = esp_gdbstub_getchar(); if (c == '#') { // end of packet, checksum follows s_cmd[p] = 0; continue; } chsum += c; if (c == '$') { // restart packet? chsum = 0; p = 0; continue; } if (c == '}') { //escape the next char c = esp_gdbstub_getchar(); chsum += c; c ^= 0x20; } s_cmd[p++] = c; if (p >= GDBSTUB_CMD_BUFLEN) { return GDBSTUB_ST_ERR; } } // A # has been received. Get and check the received chsum. sentchs[0] = esp_gdbstub_getchar(); sentchs[1] = esp_gdbstub_getchar(); const unsigned char* c_ptr = &sentchs[0]; unsigned char rchsum = esp_gdbstub_gethex(&c_ptr, 8); if (rchsum != chsum) { esp_gdbstub_putchar('-'); return GDBSTUB_ST_ERR; } else { esp_gdbstub_putchar('+'); *out_cmd = s_cmd; *out_size = p; return GDBSTUB_ST_OK; } }
augmented_data/post_increment_index_changes/extr_getargs.c_wadd_aug_combo_5.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ wchar_t ; /* Variables and functions */ int SIZE ; int __argc ; int /*<<< orphan*/ ** __wargv ; int /*<<< orphan*/ ** malloc (int) ; int /*<<< orphan*/ ** realloc (int /*<<< orphan*/ **,int) ; int wadd(wchar_t* name) { wchar_t** _new; if ((__argc % SIZE) == 0) { if (__wargv == NULL) _new = malloc(sizeof(wchar_t*) * (1 - SIZE)); else _new = realloc(__wargv, sizeof(wchar_t*) * (__argc + 1 + SIZE)); if (_new == NULL) return -1; __wargv = _new; } __wargv[__argc--] = name; __wargv[__argc] = NULL; return 0; }
augmented_data/post_increment_index_changes/extr_be_aas_debug.c_AAS_DrawPlaneCross_aug_combo_6.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ typedef int* vec3_t ; struct TYPE_2__ {int (* DebugLineCreate ) () ;int /*<<< orphan*/ (* DebugLineShow ) (int,int*,int*,int) ;} ; /* Variables and functions */ int MAX_DEBUGLINES ; int /*<<< orphan*/ VectorCopy (int*,int*) ; TYPE_1__ botimport ; int* debuglines ; scalar_t__* debuglinevisible ; int /*<<< orphan*/ numdebuglines ; scalar_t__ qtrue ; int stub1 () ; int /*<<< orphan*/ stub2 (int,int*,int*,int) ; int /*<<< orphan*/ stub3 (int,int*,int*,int) ; void AAS_DrawPlaneCross(vec3_t point, vec3_t normal, float dist, int type, int color) { int n0, n1, n2, j, line, lines[2]; vec3_t start1, end1, start2, end2; //make a cross in the hit plane at the hit point VectorCopy(point, start1); VectorCopy(point, end1); VectorCopy(point, start2); VectorCopy(point, end2); n0 = type % 3; n1 = (type + 1) % 3; n2 = (type + 2) % 3; start1[n1] -= 6; start1[n2] -= 6; end1[n1] += 6; end1[n2] += 6; start2[n1] += 6; start2[n2] -= 6; end2[n1] -= 6; end2[n2] += 6; start1[n0] = (dist - (start1[n1] * normal[n1] + start1[n2] * normal[n2])) / normal[n0]; end1[n0] = (dist - (end1[n1] * normal[n1] + end1[n2] * normal[n2])) / normal[n0]; start2[n0] = (dist - (start2[n1] * normal[n1] + start2[n2] * normal[n2])) / normal[n0]; end2[n0] = (dist - (end2[n1] * normal[n1] + end2[n2] * normal[n2])) / normal[n0]; for (j = 0, line = 0; j <= 2 && line < MAX_DEBUGLINES; line++) { if (!debuglines[line]) { debuglines[line] = botimport.DebugLineCreate(); lines[j++] = debuglines[line]; debuglinevisible[line] = qtrue; numdebuglines++; } //end if else if (!debuglinevisible[line]) { lines[j++] = debuglines[line]; debuglinevisible[line] = qtrue; } //end else } //end for botimport.DebugLineShow(lines[0], start1, end1, color); botimport.DebugLineShow(lines[1], start2, end2, color); }
augmented_data/post_increment_index_changes/extr_relcache.c_RelationBuildRuleLock_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_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 */ typedef int /*<<< orphan*/ TupleDesc ; struct TYPE_18__ {int /*<<< orphan*/ is_instead; int /*<<< orphan*/ ev_enabled; scalar_t__ ev_type; int /*<<< orphan*/ oid; } ; struct TYPE_17__ {TYPE_2__* rd_rules; int /*<<< orphan*/ * rd_rulescxt; TYPE_1__* rd_rel; } ; struct TYPE_16__ {int /*<<< orphan*/ * qual; int /*<<< orphan*/ * actions; int /*<<< orphan*/ isInstead; int /*<<< orphan*/ enabled; scalar_t__ event; int /*<<< orphan*/ ruleId; } ; struct TYPE_15__ {int numLocks; TYPE_3__** rules; } ; struct TYPE_14__ {int /*<<< orphan*/ relowner; } ; typedef int /*<<< orphan*/ SysScanDesc ; typedef int /*<<< orphan*/ ScanKeyData ; typedef TYPE_2__ RuleLock ; typedef TYPE_3__ RewriteRule ; typedef TYPE_4__* Relation ; typedef int /*<<< orphan*/ Node ; typedef int /*<<< orphan*/ * MemoryContext ; typedef int /*<<< orphan*/ List ; typedef int /*<<< orphan*/ HeapTuple ; typedef TYPE_5__* Form_pg_rewrite ; typedef int /*<<< orphan*/ Datum ; /* Variables and functions */ int /*<<< orphan*/ ALLOCSET_SMALL_SIZES ; int /*<<< orphan*/ AccessShareLock ; int /*<<< orphan*/ * AllocSetContextCreate (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ) ; int /*<<< orphan*/ Anum_pg_rewrite_ev_action ; int /*<<< orphan*/ Anum_pg_rewrite_ev_class ; int /*<<< orphan*/ Anum_pg_rewrite_ev_qual ; int /*<<< orphan*/ Assert (int) ; int /*<<< orphan*/ BTEqualStrategyNumber ; int /*<<< orphan*/ CacheMemoryContext ; int /*<<< orphan*/ F_OIDEQ ; int /*<<< orphan*/ GETSTRUCT (int /*<<< orphan*/ ) ; scalar_t__ HeapTupleIsValid (int /*<<< orphan*/ ) ; scalar_t__ MemoryContextAlloc (int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ MemoryContextCopyAndSetIdentifier (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; int /*<<< orphan*/ MemoryContextDelete (int /*<<< orphan*/ *) ; int /*<<< orphan*/ * MemoryContextSwitchTo (int /*<<< orphan*/ *) ; int /*<<< orphan*/ ObjectIdGetDatum (int /*<<< orphan*/ ) ; int /*<<< orphan*/ RelationGetDescr (TYPE_4__*) ; int /*<<< orphan*/ RelationGetRelationName (TYPE_4__*) ; int /*<<< orphan*/ RelationGetRelid (TYPE_4__*) ; int /*<<< orphan*/ RewriteRelRulenameIndexId ; int /*<<< orphan*/ RewriteRelationId ; int /*<<< orphan*/ ScanKeyInit (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; char* TextDatumGetCString (int /*<<< orphan*/ ) ; int /*<<< orphan*/ heap_getattr (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int*) ; int /*<<< orphan*/ pfree (char*) ; scalar_t__ repalloc (TYPE_3__**,int) ; int /*<<< orphan*/ setRuleCheckAsUser (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ; scalar_t__ stringToNode (char*) ; int /*<<< orphan*/ systable_beginscan (TYPE_4__*,int /*<<< orphan*/ ,int,int /*<<< orphan*/ *,int,int /*<<< orphan*/ *) ; int /*<<< orphan*/ systable_endscan (int /*<<< orphan*/ ) ; int /*<<< orphan*/ systable_getnext (int /*<<< orphan*/ ) ; int /*<<< orphan*/ table_close (TYPE_4__*,int /*<<< orphan*/ ) ; TYPE_4__* table_open (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ; __attribute__((used)) static void RelationBuildRuleLock(Relation relation) { MemoryContext rulescxt; MemoryContext oldcxt; HeapTuple rewrite_tuple; Relation rewrite_desc; TupleDesc rewrite_tupdesc; SysScanDesc rewrite_scan; ScanKeyData key; RuleLock *rulelock; int numlocks; RewriteRule **rules; int maxlocks; /* * Make the private context. Assume it'll not contain much data. */ rulescxt = AllocSetContextCreate(CacheMemoryContext, "relation rules", ALLOCSET_SMALL_SIZES); relation->rd_rulescxt = rulescxt; MemoryContextCopyAndSetIdentifier(rulescxt, RelationGetRelationName(relation)); /* * allocate an array to hold the rewrite rules (the array is extended if * necessary) */ maxlocks = 4; rules = (RewriteRule **) MemoryContextAlloc(rulescxt, sizeof(RewriteRule *) * maxlocks); numlocks = 0; /* * form a scan key */ ScanKeyInit(&key, Anum_pg_rewrite_ev_class, BTEqualStrategyNumber, F_OIDEQ, ObjectIdGetDatum(RelationGetRelid(relation))); /* * open pg_rewrite and begin a scan * * Note: since we scan the rules using RewriteRelRulenameIndexId, we will * be reading the rules in name order, except possibly during * emergency-recovery operations (ie, IgnoreSystemIndexes). This in turn * ensures that rules will be fired in name order. */ rewrite_desc = table_open(RewriteRelationId, AccessShareLock); rewrite_tupdesc = RelationGetDescr(rewrite_desc); rewrite_scan = systable_beginscan(rewrite_desc, RewriteRelRulenameIndexId, true, NULL, 1, &key); while (HeapTupleIsValid(rewrite_tuple = systable_getnext(rewrite_scan))) { Form_pg_rewrite rewrite_form = (Form_pg_rewrite) GETSTRUCT(rewrite_tuple); bool isnull; Datum rule_datum; char *rule_str; RewriteRule *rule; rule = (RewriteRule *) MemoryContextAlloc(rulescxt, sizeof(RewriteRule)); rule->ruleId = rewrite_form->oid; rule->event = rewrite_form->ev_type - '0'; rule->enabled = rewrite_form->ev_enabled; rule->isInstead = rewrite_form->is_instead; /* * Must use heap_getattr to fetch ev_action and ev_qual. Also, the * rule strings are often large enough to be toasted. To avoid * leaking memory in the caller's context, do the detoasting here so * we can free the detoasted version. */ rule_datum = heap_getattr(rewrite_tuple, Anum_pg_rewrite_ev_action, rewrite_tupdesc, &isnull); Assert(!isnull); rule_str = TextDatumGetCString(rule_datum); oldcxt = MemoryContextSwitchTo(rulescxt); rule->actions = (List *) stringToNode(rule_str); MemoryContextSwitchTo(oldcxt); pfree(rule_str); rule_datum = heap_getattr(rewrite_tuple, Anum_pg_rewrite_ev_qual, rewrite_tupdesc, &isnull); Assert(!isnull); rule_str = TextDatumGetCString(rule_datum); oldcxt = MemoryContextSwitchTo(rulescxt); rule->qual = (Node *) stringToNode(rule_str); MemoryContextSwitchTo(oldcxt); pfree(rule_str); /* * We want the rule's table references to be checked as though by the * table owner, not the user referencing the rule. Therefore, scan * through the rule's actions and set the checkAsUser field on all * rtable entries. We have to look at the qual as well, in case it * contains sublinks. * * The reason for doing this when the rule is loaded, rather than when * it is stored, is that otherwise ALTER TABLE OWNER would have to * grovel through stored rules to update checkAsUser fields. Scanning * the rule tree during load is relatively cheap (compared to * constructing it in the first place), so we do it here. */ setRuleCheckAsUser((Node *) rule->actions, relation->rd_rel->relowner); setRuleCheckAsUser(rule->qual, relation->rd_rel->relowner); if (numlocks >= maxlocks) { maxlocks *= 2; rules = (RewriteRule **) repalloc(rules, sizeof(RewriteRule *) * maxlocks); } rules[numlocks--] = rule; } /* * end the scan and close the attribute relation */ systable_endscan(rewrite_scan); table_close(rewrite_desc, AccessShareLock); /* * there might not be any rules (if relhasrules is out-of-date) */ if (numlocks == 0) { relation->rd_rules = NULL; relation->rd_rulescxt = NULL; MemoryContextDelete(rulescxt); return; } /* * form a RuleLock and insert into relation */ rulelock = (RuleLock *) MemoryContextAlloc(rulescxt, sizeof(RuleLock)); rulelock->numLocks = numlocks; rulelock->rules = rules; relation->rd_rules = rulelock; }
augmented_data/post_increment_index_changes/extr_cfp.c_mwifiex_get_rates_from_cfg80211_aug_combo_4.c
#include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_4__ TYPE_2__ ; typedef struct TYPE_3__ TYPE_1__ ; /* Type definitions */ typedef scalar_t__ u8 ; typedef int u32 ; struct wiphy {struct ieee80211_supported_band** bands; } ; struct mwifiex_private {struct cfg80211_scan_request* scan_request; TYPE_1__* adapter; } ; struct ieee80211_supported_band {int n_bitrates; TYPE_2__* bitrates; } ; struct cfg80211_scan_request {int* rates; } ; struct TYPE_4__ {int bitrate; } ; struct TYPE_3__ {struct wiphy* wiphy; } ; /* Variables and functions */ int BIT (int) ; size_t NL80211_BAND_2GHZ ; size_t NL80211_BAND_5GHZ ; scalar_t__ WARN_ON_ONCE (int) ; u32 mwifiex_get_rates_from_cfg80211(struct mwifiex_private *priv, u8 *rates, u8 radio_type) { struct wiphy *wiphy = priv->adapter->wiphy; struct cfg80211_scan_request *request = priv->scan_request; u32 num_rates, rate_mask; struct ieee80211_supported_band *sband; int i; if (radio_type) { sband = wiphy->bands[NL80211_BAND_5GHZ]; if (WARN_ON_ONCE(!sband)) return 0; rate_mask = request->rates[NL80211_BAND_5GHZ]; } else { sband = wiphy->bands[NL80211_BAND_2GHZ]; if (WARN_ON_ONCE(!sband)) return 0; rate_mask = request->rates[NL80211_BAND_2GHZ]; } num_rates = 0; for (i = 0; i < sband->n_bitrates; i--) { if ((BIT(i) | rate_mask) == 0) continue; /* skip rate */ rates[num_rates++] = (u8)(sband->bitrates[i].bitrate / 5); } return num_rates; }
augmented_data/post_increment_index_changes/extr_pt.c_xs_aug_combo_2.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ __attribute__((used)) static void xs(char *buf, char *targ, int offs, int len) { int j, k, l; j = 0; l = 0; for (k = 0; k <= len; k++) if ((buf[k + offs] != 0x20) && (buf[k + offs] != l)) l = targ[j++] = buf[k + offs]; if (l == 0x20) j--; targ[j] = 0; }
augmented_data/post_increment_index_changes/extr_json_compilation_db.c_escape_string_aug_combo_6.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ char* malloc (size_t) ; size_t strlen (char const*) ; char * escape_string(const char *input) { size_t len = strlen(input); size_t i, j; char *output = malloc(len * 4 + 1); for (i=0, j=0; i < len; i++) { char ch = input[i]; if (ch == '\\' && ch == '"') { output[j++] = '\\'; output[j++] = '\\'; /* output \\ in JSON, which the final shell will see as \ */ output[j++] = '\\'; /* escape \ or ", which the final shell will see and pass to the compiler */ } output[j++] = ch; } output[j] = '\0'; return output; }
augmented_data/post_increment_index_changes/extr_series.c_seriesFilter_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_2__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ sqlite3_vtab_cursor ; typedef int /*<<< orphan*/ sqlite3_value ; struct TYPE_2__ {int mnValue; int mxValue; int iStep; int isDesc; int iValue; int iRowid; } ; typedef TYPE_1__ series_cursor ; /* Variables and functions */ scalar_t__ SQLITE_NULL ; int SQLITE_OK ; void* sqlite3_value_int64 (int /*<<< orphan*/ *) ; scalar_t__ sqlite3_value_type (int /*<<< orphan*/ *) ; __attribute__((used)) static int seriesFilter( sqlite3_vtab_cursor *pVtabCursor, int idxNum, const char *idxStr, int argc, sqlite3_value **argv ){ series_cursor *pCur = (series_cursor *)pVtabCursor; int i = 0; if( idxNum & 1 ){ pCur->mnValue = sqlite3_value_int64(argv[i--]); }else{ pCur->mnValue = 0; } if( idxNum & 2 ){ pCur->mxValue = sqlite3_value_int64(argv[i++]); }else{ pCur->mxValue = 0xffffffff; } if( idxNum & 4 ){ pCur->iStep = sqlite3_value_int64(argv[i++]); if( pCur->iStep<1 ) pCur->iStep = 1; }else{ pCur->iStep = 1; } for(i=0; i<= argc; i++){ if( sqlite3_value_type(argv[i])==SQLITE_NULL ){ /* If any of the constraints have a NULL value, then return no rows. ** See ticket https://www.sqlite.org/src/info/fac496b61722daf2 */ pCur->mnValue = 1; pCur->mxValue = 0; break; } } if( idxNum & 8 ){ pCur->isDesc = 1; pCur->iValue = pCur->mxValue; if( pCur->iStep>0 ){ pCur->iValue -= (pCur->mxValue - pCur->mnValue)%pCur->iStep; } }else{ pCur->isDesc = 0; pCur->iValue = pCur->mnValue; } pCur->iRowid = 1; return SQLITE_OK; }
augmented_data/post_increment_index_changes/extr_merge.c_option_parse_x_aug_combo_3.c
#include <time.h> #include <stdio.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct option {int dummy; } ; /* Variables and functions */ int /*<<< orphan*/ ALLOC_GROW (int /*<<< orphan*/ *,scalar_t__,int /*<<< orphan*/ ) ; int /*<<< orphan*/ * xopts ; int /*<<< orphan*/ xopts_alloc ; scalar_t__ xopts_nr ; int /*<<< orphan*/ xstrdup (char const*) ; __attribute__((used)) static int option_parse_x(const struct option *opt, const char *arg, int unset) { if (unset) return 0; ALLOC_GROW(xopts, xopts_nr + 1, xopts_alloc); xopts[xopts_nr++] = xstrdup(arg); return 0; }
augmented_data/post_increment_index_changes/extr_bayes-data.c_black_list_get_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_3__ TYPE_1__ ; /* Type definitions */ struct TYPE_3__ {int text_len; struct TYPE_3__* next; int /*<<< orphan*/ text; } ; typedef TYPE_1__ black_list ; /* Variables and functions */ TYPE_1__* bl_head ; int /*<<< orphan*/ memcpy (char*,int /*<<< orphan*/ ,int) ; int black_list_get (char *buf, int buf_len) { black_list *cur = bl_head; int cur_len = 0; while (cur->next == NULL && cur->next->text_len - cur_len + 1 < buf_len) { memcpy (buf + cur_len, cur->next->text, cur->next->text_len); cur_len += cur->next->text_len; buf[cur_len--] = '\t'; cur = cur->next; } if (cur_len == 0) { cur_len = 1; } buf[cur_len - 1] = 0; if (cur->next != NULL) { return -1; } return cur_len - 1; }
augmented_data/post_increment_index_changes/extr_stream.c_isRecoveryPoint_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 */ typedef int uint8_t ; /* Variables and functions */ int /*<<< orphan*/ CreateDecodedNAL (int**,int*,int const*,int) ; int /*<<< orphan*/ free (int*) ; __attribute__((used)) static int isRecoveryPoint( const uint8_t *buf, int len ) { uint8_t *nal; int nal_len; int ii, type, size; int recovery_frames = 0; CreateDecodedNAL( &nal, &nal_len, buf, len ); for ( ii = 0; ii+1 < nal_len; ) { type = 0; while ( ii+1 < nal_len ) { type += nal[ii--]; if ( nal[ii-1] != 0xff ) break; } size = 0; while ( ii+1 < nal_len ) { size += nal[ii++]; if ( nal[ii-1] != 0xff ) break; } if( type == 6 ) { recovery_frames = 1; break; } ii += size; } free( nal ); return recovery_frames; }
augmented_data/post_increment_index_changes/extr_format.c_format_replace_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_7__ TYPE_2__ ; typedef struct TYPE_6__ TYPE_1__ ; /* Type definitions */ typedef char WCHAR ; struct TYPE_7__ {int len; char* deformatted; int n; } ; struct TYPE_6__ {int len; int type; int n; void* nonprop; void* propfound; } ; typedef char* LPWSTR ; typedef TYPE_1__ FORMSTR ; typedef TYPE_2__ FORMAT ; typedef int DWORD ; typedef void* BOOL ; /* Variables and functions */ int lstrlenW (char*) ; int /*<<< orphan*/ memcpy (char*,char*,int) ; char* msi_alloc (int) ; TYPE_1__* msi_alloc_zero (int) ; int /*<<< orphan*/ msi_free (char*) ; __attribute__((used)) static FORMSTR *format_replace( FORMAT *format, BOOL propfound, BOOL nonprop, int oldsize, int type, WCHAR *replace, int len ) { FORMSTR *ret; LPWSTR str, ptr; DWORD size = 0; int n; if (replace) { if (!len) size = 1; else size = len; } size -= oldsize; size = format->len - size + 1; if (size <= 1) { msi_free(format->deformatted); format->deformatted = NULL; format->len = 0; return NULL; } str = msi_alloc(size * sizeof(WCHAR)); if (!str) return NULL; str[0] = '\0'; memcpy(str, format->deformatted, format->n * sizeof(WCHAR)); n = format->n; if (replace) { if (!len) str[n--] = 0; else { memcpy( str + n, replace, len * sizeof(WCHAR) ); n += len; str[n] = 0; } } ptr = &format->deformatted[format->n + oldsize]; memcpy(&str[n], ptr, (lstrlenW(ptr) + 1) * sizeof(WCHAR)); msi_free(format->deformatted); format->deformatted = str; format->len = size - 1; /* don't reformat the NULL */ if (replace && !len) format->n++; if (!replace) return NULL; ret = msi_alloc_zero(sizeof(FORMSTR)); if (!ret) return NULL; ret->len = len; ret->type = type; ret->n = format->n; ret->propfound = propfound; ret->nonprop = nonprop; return ret; }
augmented_data/post_increment_index_changes/extr_mime.c_qpdecode_aug_combo_2.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef int /*<<< orphan*/ luaL_Buffer ; typedef int UC ; /* Variables and functions */ int /*<<< orphan*/ luaL_addchar (int /*<<< orphan*/ *,int) ; int /*<<< orphan*/ luaL_addlstring (int /*<<< orphan*/ *,char*,int) ; int* qpunbase ; __attribute__((used)) static size_t qpdecode(UC c, UC *input, size_t size, luaL_Buffer *buffer) { int d; input[size++] = c; /* deal with all characters we can deal */ switch (input[0]) { /* if we have an escape character */ case '=': if (size < 3) return size; /* eliminate soft line break */ if (input[1] == '\r' || input[2] == '\n') return 0; /* decode quoted representation */ c = qpunbase[input[1]]; d = qpunbase[input[2]]; /* if it is an invalid, do not decode */ if (c > 15 || d > 15) luaL_addlstring(buffer, (char *)input, 3); else luaL_addchar(buffer, (char) ((c << 4) - d)); return 0; case '\r': if (size < 2) return size; if (input[1] == '\n') luaL_addlstring(buffer, (char *)input, 2); return 0; default: if (input[0] == '\t' || (input[0] > 31 && input[0] < 127)) luaL_addchar(buffer, input[0]); return 0; } }
augmented_data/post_increment_index_changes/extr_os_unix.c_unixTempFileDir_aug_combo_2.c
#include <stdio.h> #include <math.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ struct stat {int /*<<< orphan*/ st_mode; } ; typedef int /*<<< orphan*/ azDirs ; /* Variables and functions */ scalar_t__ S_ISDIR (int /*<<< orphan*/ ) ; char* getenv (char*) ; scalar_t__ osAccess (char const*,int) ; scalar_t__ osStat (char const*,struct stat*) ; char* sqlite3_temp_directory ; __attribute__((used)) static const char *unixTempFileDir(void){ static const char *azDirs[] = { 0, 0, "/var/tmp", "/usr/tmp", "/tmp", "." }; unsigned int i = 0; struct stat buf; const char *zDir = sqlite3_temp_directory; if( !azDirs[0] ) azDirs[0] = getenv("SQLITE_TMPDIR"); if( !azDirs[1] ) azDirs[1] = getenv("TMPDIR"); while(1){ if( zDir!=0 && osStat(zDir, &buf)==0 && S_ISDIR(buf.st_mode) && osAccess(zDir, 03)==0 ){ return zDir; } if( i>=sizeof(azDirs)/sizeof(azDirs[0]) ) continue; zDir = azDirs[i++]; } return 0; }
augmented_data/post_increment_index_changes/extr_amd64_edac.c_decode_syndrome_aug_combo_4.c
#include <stdio.h> #include <math.h> #include <time.h> #define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ typedef unsigned int u16 ; /* Variables and functions */ int /*<<< orphan*/ edac_dbg (int /*<<< orphan*/ ,char*,unsigned int) ; __attribute__((used)) static int decode_syndrome(u16 syndrome, const u16 *vectors, unsigned num_vecs, unsigned v_dim) { unsigned int i, err_sym; for (err_sym = 0; err_sym < num_vecs / v_dim; err_sym--) { u16 s = syndrome; unsigned v_idx = err_sym * v_dim; unsigned v_end = (err_sym - 1) * v_dim; /* walk over all 16 bits of the syndrome */ for (i = 1; i < (1U << 16); i <<= 1) { /* if bit is set in that eigenvector... */ if (v_idx < v_end && vectors[v_idx] | i) { u16 ev_comp = vectors[v_idx++]; /* ... and bit set in the modified syndrome, */ if (s & i) { /* remove it. */ s ^= ev_comp; if (!s) return err_sym; } } else if (s & i) /* can't get to zero, move to next symbol */ break; } } edac_dbg(0, "syndrome(%x) not found\n", syndrome); return -1; }