idx
int64
func
string
target
int64
294,638
d_lite_to_s(VALUE self) { return strftimev("%Y-%m-%d", self, set_tmx); }
0
450,354
static int protocol_client_init(VncState *vs, uint8_t *data, size_t len) { char buf[1024]; VncShareMode mode; int size; mode = data[0] ? VNC_SHARE_MODE_SHARED : VNC_SHARE_MODE_EXCLUSIVE; switch (vs->vd->share_policy) { case VNC_SHARE_POLICY_IGNORE: /* * Ignore the shared flag. Nothing to do here. * * Doesn't conform to the rfb spec but is traditional qemu * behavior, thus left here as option for compatibility * reasons. */ break; case VNC_SHARE_POLICY_ALLOW_EXCLUSIVE: /* * Policy: Allow clients ask for exclusive access. * * Implementation: When a client asks for exclusive access, * disconnect all others. Shared connects are allowed as long * as no exclusive connection exists. * * This is how the rfb spec suggests to handle the shared flag. */ if (mode == VNC_SHARE_MODE_EXCLUSIVE) { VncState *client; QTAILQ_FOREACH(client, &vs->vd->clients, next) { if (vs == client) { continue; } if (client->share_mode != VNC_SHARE_MODE_EXCLUSIVE && client->share_mode != VNC_SHARE_MODE_SHARED) { continue; } vnc_disconnect_start(client); } } if (mode == VNC_SHARE_MODE_SHARED) { if (vs->vd->num_exclusive > 0) { vnc_disconnect_start(vs); return 0; } } break; case VNC_SHARE_POLICY_FORCE_SHARED: /* * Policy: Shared connects only. * Implementation: Disallow clients asking for exclusive access. * * Useful for shared desktop sessions where you don't want * someone forgetting to say -shared when running the vnc * client disconnect everybody else. */ if (mode == VNC_SHARE_MODE_EXCLUSIVE) { vnc_disconnect_start(vs); return 0; } break; } vnc_set_share_mode(vs, mode); if (vs->vd->num_shared > vs->vd->connections_limit) { vnc_disconnect_start(vs); return 0; } assert(pixman_image_get_width(vs->vd->server) < 65536 && pixman_image_get_width(vs->vd->server) >= 0); assert(pixman_image_get_height(vs->vd->server) < 65536 && pixman_image_get_height(vs->vd->server) >= 0); vs->client_width = pixman_image_get_width(vs->vd->server); vs->client_height = pixman_image_get_height(vs->vd->server); vnc_write_u16(vs, vs->client_width); vnc_write_u16(vs, vs->client_height); pixel_format_message(vs); if (qemu_name) { size = snprintf(buf, sizeof(buf), "QEMU (%s)", qemu_name); if (size > sizeof(buf)) { size = sizeof(buf); } } else { size = snprintf(buf, sizeof(buf), "QEMU"); } vnc_write_u32(vs, size); vnc_write(vs, buf, size); vnc_flush(vs); vnc_client_cache_auth(vs); vnc_qmp_event(vs, QAPI_EVENT_VNC_INITIALIZED); vnc_read_when(vs, protocol_client_msg, 1); return 0; }
0
455,285
bash_backward_shellword (count, key) int count, key; { size_t slen; int c, p, prev_p; DECLARE_MBSTATE; if (count < 0) return (bash_forward_shellword (-count, key)); p = rl_point; slen = rl_end; while (count) { if (p == 0) { rl_point = 0; return 0; } /* Move backward until we hit a non-metacharacter. We want to deal with the characters before point, so we move off a word if we're at its first character. */ BACKUP_CHAR (rl_line_buffer, slen, p); while (p > 0) { c = rl_line_buffer[p]; if (WORDDELIM (c) == 0 || char_is_quoted (rl_line_buffer, p)) break; BACKUP_CHAR (rl_line_buffer, slen, p); } if (p == 0) { rl_point = 0; return 0; } /* Now move backward until we hit a metacharacter or BOL. Leave point at the start of the shellword or at BOL. */ prev_p = p; while (p > 0) { c = rl_line_buffer[p]; if (WORDDELIM (c) && char_is_quoted (rl_line_buffer, p) == 0) { p = prev_p; break; } prev_p = p; BACKUP_CHAR (rl_line_buffer, slen, p); } count--; } rl_point = p; return 0; }
0
389,672
check_for_list_or_blob_arg(typval_T *args, int idx) { if (args[idx].v_type != VAR_LIST && args[idx].v_type != VAR_BLOB) { semsg(_(e_list_or_blob_required_for_argument_nr), idx + 1); return FAIL; } return OK; }
0
229,315
void EagerKernelExecuteAsync( EagerContext* ctx, const absl::InlinedVector<TensorHandle*, 4>& op_inputs, const absl::optional<EagerFunctionParams>& eager_func_params, const core::RefCountPtr<KernelAndDevice> kernel, GraphCollector* graph_collector, CancellationManager* cancellation_manager, TensorHandle** retvals, int num_outputs, StatusCallback done) { auto inputs = std::make_shared<ExecuteNodeArgs>(op_inputs.size()); auto outputs = std::make_shared<std::vector<EagerKernelRet>>(1); Status s = inputs->Init(ctx, op_inputs, kernel); if (!s.ok()) { done(s); return; } CoordinationServiceAgent* coord_agent = nullptr; #if !defined(IS_MOBILE_PLATFORM) if (ctx->GetDistributedManager() != nullptr) coord_agent = ctx->GetDistributedManager()->GetCoordinationServiceAgent(); #endif // !IS_MOBILE_PLATFORM kernel->Ref(); // Ownership of reference is transferred to the callback kernel->RunAsync( ctx->StepContainer(), *inputs, outputs.get(), cancellation_manager, eager_func_params, coord_agent, [retvals, inputs, outputs, num_outputs, ctx, graph_collector, eager_func_params, kernel_raw = kernel.get(), done = std::move(done)](const Status& s) { auto wrapped_done = [&](const Status& s) { kernel_raw->Unref(); done(s); }; if (!s.ok()) { wrapped_done(s); return; } if (graph_collector != nullptr) { CollectGraphs(ctx); } DCHECK_EQ(num_outputs, outputs->size()); wrapped_done(GetKernelOutputs(outputs.get(), num_outputs, retvals, ctx, kernel_raw, eager_func_params)); }); }
0
508,363
open_system_tables_for_read(THD *thd, TABLE_LIST *table_list, Open_tables_backup *backup) { Query_tables_list query_tables_list_backup; LEX *lex= thd->lex; DBUG_ENTER("open_system_tables_for_read"); /* Besides using new Open_tables_state for opening system tables, we also have to backup and reset/and then restore part of LEX which is accessed by open_tables() in order to determine if prelocking is needed and what tables should be added for it. close_system_tables() doesn't require such treatment. */ lex->reset_n_backup_query_tables_list(&query_tables_list_backup); thd->reset_n_backup_open_tables_state(backup); thd->lex->sql_command= SQLCOM_SELECT; if (open_and_lock_tables(thd, table_list, FALSE, MYSQL_OPEN_IGNORE_FLUSH | MYSQL_LOCK_IGNORE_TIMEOUT)) { lex->restore_backup_query_tables_list(&query_tables_list_backup); thd->restore_backup_open_tables_state(backup); DBUG_RETURN(TRUE); } for (TABLE_LIST *tables= table_list; tables; tables= tables->next_global) { DBUG_ASSERT(tables->table->s->table_category == TABLE_CATEGORY_SYSTEM); tables->table->use_all_columns(); } lex->restore_backup_query_tables_list(&query_tables_list_backup); DBUG_RETURN(FALSE); }
0
292,212
find_session_from_nick (char *nick, server *serv) { session *sess; GSList *list = sess_list; sess = find_dialog (serv, nick); if (sess) return sess; if (serv->front_session) { if (userlist_find (serv->front_session, nick)) return serv->front_session; } if (current_sess && current_sess->server == serv) { if (userlist_find (current_sess, nick)) return current_sess; } while (list) { sess = list->data; if (sess->server == serv) { if (userlist_find (sess, nick)) return sess; } list = list->next; } return NULL; }
0
450,340
static void png_flush_data(png_structp png_ptr) { }
0
301,015
pcx_write_page(gx_device_printer * pdev, gp_file * file, pcx_header * phdr, bool planar) { int raster = gdev_prn_raster(pdev); uint rsize = ROUND_UP((pdev->width * phdr->bpp + 7) >> 3, 2); /* PCX format requires even */ int height = pdev->height; int depth = pdev->color_info.depth; uint lsize = raster + rsize; byte *line = gs_alloc_bytes(pdev->memory, lsize, "pcx file buffer"); byte *plane = line + raster; int y; int code = 0; /* return code */ if (line == 0) /* can't allocate line buffer */ return_error(gs_error_VMerror); /* Fill in the other variable entries in the header struct. */ assign_ushort(phdr->x2, pdev->width - 1); assign_ushort(phdr->y2, height - 1); assign_ushort(phdr->hres, (int)pdev->x_pixels_per_inch); assign_ushort(phdr->vres, (int)pdev->y_pixels_per_inch); assign_ushort(phdr->bpl, (planar || depth == 1 ? rsize : raster + (raster & 1))); /* Write the header. */ if (gp_fwrite((const char *)phdr, 1, 128, file) < 128) { code = gs_error_ioerror; goto pcx_done; } /* Write the contents of the image. */ for (y = 0; y < height; y++) { byte *row; byte *end; code = gdev_prn_get_bits(pdev, y, line, &row); if (code < 0) break; end = row + raster; if (!planar) { /* Just write the bits. */ if (raster & 1) { /* Round to even, with predictable padding. */ *end = end[-1]; ++end; } pcx_write_rle(row, end, 1, file); } else switch (depth) { case 4: { byte *pend = plane + rsize; int shift; for (shift = 0; shift < 4; shift++) { register byte *from, *to; register int bright = 1 << shift; register int bleft = bright << 4; for (from = row, to = plane; from < end; from += 4 ) { *to++ = (from[0] & bleft ? 0x80 : 0) | (from[0] & bright ? 0x40 : 0) | (from[1] & bleft ? 0x20 : 0) | (from[1] & bright ? 0x10 : 0) | (from[2] & bleft ? 0x08 : 0) | (from[2] & bright ? 0x04 : 0) | (from[3] & bleft ? 0x02 : 0) | (from[3] & bright ? 0x01 : 0); } /* We might be one byte short of rsize. */ if (to < pend) *to = to[-1]; pcx_write_rle(plane, pend, 1, file); } } break; case 24: { int pnum; for (pnum = 0; pnum < 3; ++pnum) { pcx_write_rle(row + pnum, row + raster, 3, file); if (pdev->width & 1) gp_fputc(0, file); /* pad to even */ } } break; default: code = gs_note_error(gs_error_rangecheck); goto pcx_done; } } pcx_done: gs_free_object(pdev->memory, line, "pcx file buffer"); return code; }
0
248,251
DLLIMPORT int cfg_opt_setmulti(cfg_t *cfg, cfg_opt_t *opt, unsigned int nvalues, char **values) { cfg_opt_t old; unsigned int i; if (!opt || !nvalues) { errno = EINVAL; return CFG_FAIL; } old = *opt; opt->nvalues = 0; opt->values = NULL; for (i = 0; i < nvalues; i++) { if (cfg_setopt(cfg, opt, values[i])) continue; /* ouch, revert */ cfg_free_value(opt); opt->nvalues = old.nvalues; opt->values = old.values; opt->flags &= ~(CFGF_RESET | CFGF_MODIFIED); opt->flags |= old.flags & (CFGF_RESET | CFGF_MODIFIED); return CFG_FAIL; } cfg_free_value(&old); opt->flags |= CFGF_MODIFIED; return CFG_SUCCESS; }
0
90,142
virtual std::string GetHtmlInfo(int refresh) { std::string output; output.append("<html><head><title>About Network</title>"); if (refresh > 0) output.append("<meta http-equiv=\"refresh\" content=\"" + base::IntToString(refresh) + "\"/>"); output.append("</head><body>"); if (refresh > 0) { output.append("(Auto-refreshing page every " + base::IntToString(refresh) + "s)"); } else { output.append("(To auto-refresh this page: about:network/&lt;secs&gt;)"); } output.append("<h3>Ethernet:</h3><table border=1>"); if (ethernet_ && ethernet_enabled()) { output.append("<tr>" + ToHtmlTableHeader(ethernet_) + "</tr>"); output.append("<tr>" + ToHtmlTableRow(ethernet_) + "</tr>"); } output.append("</table><h3>Wifi:</h3><table border=1>"); for (size_t i = 0; i < wifi_networks_.size(); ++i) { if (i == 0) output.append("<tr>" + ToHtmlTableHeader(wifi_networks_[i]) + "</tr>"); output.append("<tr>" + ToHtmlTableRow(wifi_networks_[i]) + "</tr>"); } output.append("</table><h3>Cellular:</h3><table border=1>"); for (size_t i = 0; i < cellular_networks_.size(); ++i) { if (i == 0) output.append("<tr>" + ToHtmlTableHeader(cellular_networks_[i]) + "</tr>"); output.append("<tr>" + ToHtmlTableRow(cellular_networks_[i]) + "</tr>"); } output.append("</table><h3>Remembered Wifi:</h3><table border=1>"); for (size_t i = 0; i < remembered_wifi_networks_.size(); ++i) { if (i == 0) output.append( "<tr>" + ToHtmlTableHeader(remembered_wifi_networks_[i]) + "</tr>"); output.append("<tr>" + ToHtmlTableRow(remembered_wifi_networks_[i]) + "</tr>"); } output.append("</table></body></html>"); return output; }
0
476,119
static void __composite_unbind(struct usb_gadget *gadget, bool unbind_driver) { struct usb_composite_dev *cdev = get_gadget_data(gadget); struct usb_gadget_strings *gstr = cdev->driver->strings[0]; struct usb_string *dev_str = gstr->strings; /* composite_disconnect() must already have been called * by the underlying peripheral controller driver! * so there's no i/o concurrency that could affect the * state protected by cdev->lock. */ WARN_ON(cdev->config); while (!list_empty(&cdev->configs)) { struct usb_configuration *c; c = list_first_entry(&cdev->configs, struct usb_configuration, list); remove_config(cdev, c); } if (cdev->driver->unbind && unbind_driver) cdev->driver->unbind(cdev); composite_dev_cleanup(cdev); if (dev_str[USB_GADGET_MANUFACTURER_IDX].s == cdev->def_manufacturer) dev_str[USB_GADGET_MANUFACTURER_IDX].s = ""; kfree(cdev->def_manufacturer); kfree(cdev); set_gadget_data(gadget, NULL); }
0
224,589
Status ReductionShape(InferenceContext* c) { ShapeHandle input = c->input(0); ShapeHandle indices; // Older versions of TensorFlow accidentally allowed higher rank tensors like // [[1,2]] or [[1],[2]] to represent axis=[1,2]. if (c->graph_def_version() < 21) { indices = c->input(1); } else { TF_RETURN_IF_ERROR(c->WithRankAtMost(c->input(1), 1, &indices)); } bool keep_dims; TF_RETURN_IF_ERROR(c->GetAttr("keep_dims", &keep_dims)); const Tensor* reduction_indices_t = c->input_tensor(1); if (reduction_indices_t == nullptr || !c->RankKnown(input)) { // If we do not have the reduction values at runtime, or the // rank of the input, we don't know the output shape. if (keep_dims && c->RankKnown(input)) { // output rank matches input input if <keep_dims>. c->set_output(0, c->UnknownShapeOfRank(c->Rank(input))); return Status::OK(); } else { return shape_inference::UnknownShape(c); } } const int32_t input_rank = c->Rank(input); std::set<int64_t> true_indices; if (reduction_indices_t->dtype() == DataType::DT_INT32) { TF_RETURN_IF_ERROR(ReductionShapeHelper<int32>(reduction_indices_t, input_rank, &true_indices)); } else if (reduction_indices_t->dtype() == DataType::DT_INT64) { TF_RETURN_IF_ERROR(ReductionShapeHelper<int64_t>( reduction_indices_t, input_rank, &true_indices)); } else { return errors::InvalidArgument( "reduction_indices can only be int32 or int64"); } std::vector<DimensionHandle> dims; for (int i = 0; i < input_rank; ++i) { if (true_indices.count(i) > 0) { if (keep_dims) { dims.emplace_back(c->MakeDim(1)); } } else { dims.emplace_back(c->Dim(input, i)); } } c->set_output(0, c->MakeShape(dims)); return Status::OK(); }
0
436,158
static inline bool io_run_task_work(void) { if (current->task_works) { __set_current_state(TASK_RUNNING); task_work_run(); return true; } return false; }
0
508,790
void st_select_lex::remap_tables(TABLE_LIST *derived, table_map map, uint tablenr, SELECT_LEX *parent_lex) { bool first_table= TRUE; TABLE_LIST *tl; table_map first_map; uint first_tablenr; if (derived && derived->table) { first_map= derived->table->map; first_tablenr= derived->table->tablenr; } else { first_map= map; map<<= 1; first_tablenr= tablenr++; } /* Assign table bit/table number. To the first table of the subselect the table bit/tablenr of the derived table is assigned. The rest of tables are getting bits sequentially, starting from the provided table map/tablenr. */ List_iterator<TABLE_LIST> ti(leaf_tables); while ((tl= ti++)) { if (first_table) { first_table= FALSE; tl->table->set_table_map(first_map, first_tablenr); } else { tl->table->set_table_map(map, tablenr); tablenr++; map<<= 1; } SELECT_LEX *old_sl= tl->select_lex; tl->select_lex= parent_lex; for(TABLE_LIST *emb= tl->embedding; emb && emb->select_lex == old_sl; emb= emb->embedding) emb->select_lex= parent_lex; } }
0
369,219
static int io_sendmsg(struct io_kiocb *req, unsigned int issue_flags) { struct io_async_msghdr iomsg, *kmsg; struct socket *sock; unsigned flags; int min_ret = 0; int ret; sock = sock_from_file(req->file); if (unlikely(!sock)) return -ENOTSOCK; if (req_has_async_data(req)) { kmsg = req->async_data; } else { ret = io_sendmsg_copy_hdr(req, &iomsg); if (ret) return ret; kmsg = &iomsg; } flags = req->sr_msg.msg_flags; if (issue_flags & IO_URING_F_NONBLOCK) flags |= MSG_DONTWAIT; if (flags & MSG_WAITALL) min_ret = iov_iter_count(&kmsg->msg.msg_iter); ret = __sys_sendmsg_sock(sock, &kmsg->msg, flags); if (ret < min_ret) { if (ret == -EAGAIN && (issue_flags & IO_URING_F_NONBLOCK)) return io_setup_async_msg(req, kmsg); if (ret == -ERESTARTSYS) ret = -EINTR; req_set_fail(req); } /* fast path, check for non-NULL to avoid function call */ if (kmsg->free_iov) kfree(kmsg->free_iov); req->flags &= ~REQ_F_NEED_CLEANUP; __io_req_complete(req, issue_flags, ret, 0); return 0; }
0
508,913
void st_select_lex::print_limit(THD *thd, String *str, enum_query_type query_type) { SELECT_LEX_UNIT *unit= master_unit(); Item_subselect *item= unit->item; if (item && unit->global_parameters() == this) { Item_subselect::subs_type subs_type= item->substype(); if (subs_type == Item_subselect::IN_SUBS || subs_type == Item_subselect::ALL_SUBS) { return; } } if (explicit_limit && select_limit) { str->append(STRING_WITH_LEN(" limit ")); if (offset_limit) { offset_limit->print(str, query_type); str->append(','); } select_limit->print(str, query_type); } }
0
329,940
_fill_a8_lerp_opaque_spans (void *abstract_renderer, int y, int h, const cairo_half_open_span_t *spans, unsigned num_spans) { cairo_image_span_renderer_t *r = abstract_renderer; if (num_spans == 0) return CAIRO_STATUS_SUCCESS; if (likely(h == 1)) { uint8_t *d = r->u.fill.data + r->u.fill.stride*y; do { uint8_t a = spans[0].coverage; if (a) { int len = spans[1].x - spans[0].x; if (a == 0xff) { memset(d + spans[0].x, r->u.fill.pixel, len); } else { uint8_t s = mul8_8(a, r->u.fill.pixel); uint8_t *dst = d + spans[0].x; a = ~a; while (len-- > 0) { uint8_t t = mul8_8(*dst, a); *dst++ = t + s; } } } spans++; } while (--num_spans > 1); } else { do { uint8_t a = spans[0].coverage; if (a) { int yy = y, hh = h; if (a == 0xff) { do { int len = spans[1].x - spans[0].x; uint8_t *d = r->u.fill.data + r->u.fill.stride*yy + spans[0].x; memset(d, r->u.fill.pixel, len); yy++; } while (--hh); } else { uint8_t s = mul8_8(a, r->u.fill.pixel); a = ~a; do { int len = spans[1].x - spans[0].x; uint8_t *d = r->u.fill.data + r->u.fill.stride*yy + spans[0].x; while (len-- > 0) { uint8_t t = mul8_8(*d, a); *d++ = t + s; } yy++; } while (--hh); } } spans++; } while (--num_spans > 1); } return CAIRO_STATUS_SUCCESS; }
0
241,067
static int do_command(cmd_request_t cmd) { struct booth_site *site; struct boothc_ticket_msg reply; struct booth_transport const *tpt; uint32_t leader_id; int rv; int reply_cnt = 0, msg_logged = 0; const char *op_str = ""; if (cmd == CMD_GRANT) op_str = "grant"; else if (cmd == CMD_REVOKE) op_str = "revoke"; rv = 0; site = NULL; /* Always use TCP for client - at least for now. */ tpt = booth_transport + TCP; if (!*cl.site) site = local; else { if (!find_site_by_name(cl.site, &site, 1)) { log_error("Site \"%s\" not configured.", cl.site); goto out_close; } } if (site->type == ARBITRATOR) { if (site == local) { log_error("We're just an arbitrator, cannot grant/revoke tickets here."); } else { log_error("%s is just an arbitrator, cannot grant/revoke tickets there.", cl.site); } goto out_close; } assert(site->type == SITE); /* We don't check for existence of ticket, so that asking can be * done without local configuration, too. * Although, that means that the UDP port has to be specified, too. */ if (!cl.msg.ticket.id[0]) { /* If the loaded configuration has only a single ticket defined, use that. */ if (booth_conf->ticket_count == 1) { strncpy(cl.msg.ticket.id, booth_conf->ticket[0].name, sizeof(cl.msg.ticket.id)); } else { log_error("No ticket given."); goto out_close; } } redirect: init_header(&cl.msg.header, cmd, 0, cl.options, 0, 0, sizeof(cl.msg)); rv = tpt->open(site); if (rv < 0) goto out_close; rv = tpt->send(site, &cl.msg, sendmsglen(&cl.msg)); if (rv < 0) goto out_close; read_more: rv = tpt->recv_auth(site, &reply, sizeof(reply)); if (rv < 0) { /* print any errors depending on the code sent by the * server */ (void)test_reply(ntohl(reply.header.result), cmd); goto out_close; } rv = test_reply(ntohl(reply.header.result), cmd); if (rv == 1) { tpt->close(site); leader_id = ntohl(reply.ticket.leader); if (!find_site_by_id(leader_id, &site)) { log_error("Message with unknown redirect site %x received", leader_id); rv = -1; goto out_close; } goto redirect; } else if (rv == 2 || rv == 3) { /* the server has more to say */ /* don't wait too long */ if (reply_cnt > 1 && !(cl.options & OPT_WAIT)) { rv = 0; log_info("Giving up on waiting for the definite result. " "Please use \"booth list\" later to " "see the outcome."); goto out_close; } if (reply_cnt == 0) { log_info("%s request sent, " "waiting for the result ...", op_str); msg_logged++; } else if (rv == 3 && msg_logged < 2) { log_info("waiting for the CIB commit ..."); msg_logged++; } reply_cnt++; goto read_more; } out_close: if (site) tpt->close(site); return rv; }
0
222,871
bool MaybeTensorProtoToShape(InferenceContext* ic, const TensorProto& tensor_proto, ShapeHandle* tensors_as_shapes) { // Skip if dtype is not integer. if (tensor_proto.dtype() != DT_INT32 && tensor_proto.dtype() != DT_INT64) { return false; } // Skip if the const tensor is too large. if (NumElementsFromTensorProto(tensor_proto) > kThresholdToSkipConstTensorInstantiation) { return false; } // Skip if shape is neither scalar nor vector. if (tensor_proto.tensor_shape().unknown_rank() || tensor_proto.tensor_shape().dim_size() > 1) { return false; } Tensor tensor; if (!tensor.FromProto(tensor_proto)) { return false; } return MaybeTensorValueToShape(ic, tensor, tensors_as_shapes); }
0
234,141
fetch_indexed_value (dwarf_vma idx, enum dwarf_section_display_enum sec_enum, dwarf_vma base_address) { struct dwarf_section *section = &debug_displays [sec_enum].section; if (section->start == NULL) { warn (_("Unable to locate %s section\n"), section->uncompressed_name); return 0; } uint32_t pointer_size, bias; if (byte_get (section->start, 4) == 0xffffffff) { pointer_size = 8; bias = 20; } else { pointer_size = 4; bias = 12; } dwarf_vma offset = idx * pointer_size; /* Offsets are biased by the size of the section header or base address. */ if (sec_enum == loclists) offset += base_address; else offset += bias; if (offset + pointer_size > section->size) { warn (_("Offset into section %s too big: 0x%s\n"), section->name, dwarf_vmatoa ("x", offset)); return 0; } return byte_get (section->start + offset, pointer_size); }
0
512,767
bool set_value(THD *thd, const Type_all_attributes *attr, const st_value *val, const Type_handler *h) { value.set_handler(h); // See comments in set_param_func() return h->Item_param_set_from_value(thd, this, attr, val); }
0
336,645
static gboolean reds_use_client_monitors_config(RedsState *reds) { if (reds->qxl_instances.empty()) { return FALSE; } FOREACH_QXL_INSTANCE(reds, qxl) { if (!red_qxl_client_monitors_config(qxl, NULL)) return FALSE; } return TRUE; }
0
386,494
void DL_Dxf::addPoint(DL_CreationInterface* creationInterface) { DL_PointData d(getRealValue(10, 0.0), getRealValue(20, 0.0), getRealValue(30, 0.0)); creationInterface->addPoint(d); }
0
513,002
Item *get_copy(THD *thd) { return get_item_copy<Item_hex_string>(thd, this); }
0
261,757
void RtmpProtocol::send_complex_S0S1S2(int schemeType,const string &digest){ //S1S2计算参考自:https://github.com/hitYangfei/golang/blob/master/rtmpserver.go //发送S0 char handshake_head = HANDSHAKE_PLAINTEXT; onSendRawData(obtainBuffer(&handshake_head, 1)); //S1 RtmpHandshake s1(0); memcpy(s1.zero, "\x04\x05\x00\x01", 4); char *digestPos; if (schemeType == 0) { /* c1s1 schema0 time: 4bytes version: 4bytes key: 764bytes digest: 764bytes */ get_C1_digest(s1.random + C1_SCHEMA_SIZE, &digestPos); } else { /* c1s1 schema1 time: 4bytes version: 4bytes digest: 764bytes key: 764bytes */ get_C1_digest(s1.random, &digestPos); } char *s1_start = (char *) &s1; string s1_joined(s1_start, sizeof(s1)); s1_joined.erase(digestPos - s1_start, C1_DIGEST_SIZE); string s1_digest = openssl_HMACsha256(FMSKey, S1_FMS_KEY_SIZE, s1_joined.data(), s1_joined.size()); memcpy(digestPos, s1_digest.data(), s1_digest.size()); onSendRawData(obtainBuffer((char *) &s1, sizeof(s1))); //S2 string s2_key = openssl_HMACsha256(FMSKey, S2_FMS_KEY_SIZE, digest.data(), digest.size()); RtmpHandshake s2(0); s2.random_generate((char *) &s2, 8); string s2_digest = openssl_HMACsha256(s2_key.data(), s2_key.size(), &s2, sizeof(s2) - C1_DIGEST_SIZE); memcpy((char *) &s2 + C1_HANDSHARK_SIZE - C1_DIGEST_SIZE, s2_digest.data(), C1_DIGEST_SIZE); onSendRawData(obtainBuffer((char *) &s2, sizeof(s2))); //等待C2 _next_step_func = [this](const char *data, size_t len) { return handle_C2(data, len); }; }
0
455,346
execute_env_file (env_file) char *env_file; { char *fn; if (env_file && *env_file) { fn = expand_string_unsplit_to_string (env_file, Q_DOUBLE_QUOTES); if (fn && *fn) maybe_execute_file (fn, 1); FREE (fn); } }
0
225,889
GF_Err chnl_box_size(GF_Box *s) { GF_ChannelLayoutBox *ptr = (GF_ChannelLayoutBox *) s; s->size += 1; if (ptr->layout.stream_structure & 1) { s->size += 1; if (ptr->layout.definedLayout==0) { u32 i; for (i=0; i<ptr->layout.channels_count; i++) { s->size+=1; if (ptr->layout.layouts[i].position==126) s->size+=3; } } else { s->size += 8; } } if (ptr->layout.stream_structure & 2) { s->size += 1; } return GF_OK;
0
233,886
*/ int php_wddx_deserialize_ex(const char *value, size_t vallen, zval *return_value) { wddx_stack stack; XML_Parser parser; st_entry *ent; int retval; wddx_stack_init(&stack); parser = XML_ParserCreate((XML_Char *) "UTF-8"); XML_SetUserData(parser, &stack); XML_SetElementHandler(parser, php_wddx_push_element, php_wddx_pop_element); XML_SetCharacterDataHandler(parser, php_wddx_process_data); /* XXX value should be parsed in the loop to exhaust size_t */ XML_Parse(parser, (const XML_Char *) value, (int)vallen, 1); XML_ParserFree(parser); if (stack.top == 1) { wddx_stack_top(&stack, (void**)&ent); ZVAL_COPY(return_value, &ent->data); retval = SUCCESS; } else { retval = FAILURE; } wddx_stack_destroy(&stack); return retval;
0
338,206
static bool isIdChar(char ch) { return (ch >= '0' && ch <= '9') || (ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z') || ch == '!' || ch == '#' || ch == '$' || ch == '%' || ch == '&' || ch == '\'' || ch == '*' || ch == '+' || ch == '-' || ch == '.' || ch == '/' || ch == ':' || ch == '<' || ch == '=' || ch == '>' || ch == '?' || ch == '@' || ch == '^' || ch == '_' || ch == '`' || ch == '|' || ch == '~'; }
0
259,307
static void mov_parse_stsd_video(MOVContext *c, AVIOContext *pb, AVStream *st, MOVStreamContext *sc) { uint8_t codec_name[32] = { 0 }; int64_t stsd_start; unsigned int len; uint32_t id = 0; /* The first 16 bytes of the video sample description are already * read in ff_mov_read_stsd_entries() */ stsd_start = avio_tell(pb) - 16; avio_rb16(pb); /* version */ avio_rb16(pb); /* revision level */ id = avio_rl32(pb); /* vendor */ av_dict_set(&st->metadata, "vendor_id", av_fourcc2str(id), 0); avio_rb32(pb); /* temporal quality */ avio_rb32(pb); /* spatial quality */ st->codecpar->width = avio_rb16(pb); /* width */ st->codecpar->height = avio_rb16(pb); /* height */ avio_rb32(pb); /* horiz resolution */ avio_rb32(pb); /* vert resolution */ avio_rb32(pb); /* data size, always 0 */ avio_rb16(pb); /* frames per samples */ len = avio_r8(pb); /* codec name, pascal string */ if (len > 31) len = 31; mov_read_mac_string(c, pb, len, codec_name, sizeof(codec_name)); if (len < 31) avio_skip(pb, 31 - len); if (codec_name[0]) av_dict_set(&st->metadata, "encoder", codec_name, 0); /* codec_tag YV12 triggers an UV swap in rawdec.c */ if (!strncmp(codec_name, "Planar Y'CbCr 8-bit 4:2:0", 25)) { st->codecpar->codec_tag = MKTAG('I', '4', '2', '0'); st->codecpar->width &= ~1; st->codecpar->height &= ~1; } /* Flash Media Server uses tag H.263 with Sorenson Spark */ if (st->codecpar->codec_tag == MKTAG('H','2','6','3') && !strncmp(codec_name, "Sorenson H263", 13)) st->codecpar->codec_id = AV_CODEC_ID_FLV1; st->codecpar->bits_per_coded_sample = avio_rb16(pb); /* depth */ avio_seek(pb, stsd_start, SEEK_SET); if (ff_get_qtpalette(st->codecpar->codec_id, pb, sc->palette)) { st->codecpar->bits_per_coded_sample &= 0x1F; sc->has_palette = 1; } }
0
332,363
get_op_char(int optype) { return opchars[optype][0]; }
0
409,479
may_req_termresponse(void) { if (crv_status.tr_progress == STATUS_GET && can_get_termresponse() && starting == 0 && *T_CRV != NUL) { MAY_WANT_TO_LOG_THIS; LOG_TR(("Sending CRV request")); out_str(T_CRV); termrequest_sent(&crv_status); // check for the characters now, otherwise they might be eaten by // get_keystroke() out_flush(); (void)vpeekc_nomap(); } }
0
226,357
GF_Box *csgp_box_new() { ISOM_DECL_BOX_ALLOC(GF_CompactSampleGroupBox, GF_ISOM_BOX_TYPE_CSGP); return (GF_Box *)tmp;
0
243,998
GF_Err gitn_box_write(GF_Box *s, GF_BitStream *bs) { GF_Err e; u32 i; GroupIdToNameBox *ptr = (GroupIdToNameBox *) s; if (!s) return GF_BAD_PARAM; e = gf_isom_full_box_write(s, bs); if (e) return e; gf_bs_write_u16(bs, ptr->nb_entries); for (i=0; i<ptr->nb_entries; i++) { gf_bs_write_u32(bs, ptr->entries[i].group_id); if (ptr->entries[i].name) gf_bs_write_data(bs, ptr->entries[i].name, (u32)strlen(ptr->entries[i].name) ); gf_bs_write_u8(bs, 0); } return GF_OK; }
0
359,393
DEFUN (clear_ip_bgp_as_ipv4_soft_in, clear_ip_bgp_as_ipv4_soft_in_cmd, "clear ip bgp <1-65535> ipv4 (unicast|multicast) soft in", CLEAR_STR IP_STR BGP_STR "Clear peers with the AS number\n" "Address family\n" "Address Family modifier\n" "Address Family modifier\n" "Soft reconfig\n" "Soft reconfig inbound update\n") { if (strncmp (argv[1], "m", 1) == 0) return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, BGP_CLEAR_SOFT_IN, argv[0]); return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, BGP_CLEAR_SOFT_IN, argv[0]); }
0
445,951
fr_window_set_password (FrWindow *window, const char *password) { g_return_if_fail (window != NULL); if (window->priv->password == password) return; if (window->priv->password != NULL) { g_free (window->priv->password); window->priv->password = NULL; } if ((password != NULL) && (password[0] != '\0')) window->priv->password = g_strdup (password); }
0
379,704
R_API R_BORROW RPVector *r_anal_function_get_vars_used_at(RAnalFunction *fcn, ut64 op_addr) { r_return_val_if_fail (fcn, NULL); return ht_up_find (fcn->inst_vars, op_addr - fcn->addr, NULL); }
0
310,259
list_single_server_status(routerinfo_t *desc, int is_live) { char buf[MAX_NICKNAME_LEN+HEX_DIGEST_LEN+4]; /* !nickname=$hexdigest\0 */ char *cp; tor_assert(desc); cp = buf; if (!is_live) { *cp++ = '!'; } if (desc->is_valid) { strlcpy(cp, desc->nickname, sizeof(buf)-(cp-buf)); cp += strlen(cp); *cp++ = '='; } *cp++ = '$'; base16_encode(cp, HEX_DIGEST_LEN+1, desc->cache_info.identity_digest, DIGEST_LEN); return tor_strdup(buf); }
0
139,214
void OverlayWindowViews::CreateCustomControl( std::unique_ptr<views::ControlImageButton>& control_button, const blink::PictureInPictureControlInfo& info, ControlPosition position) { control_button = std::make_unique<views::ControlImageButton>(this); controls_parent_view_->AddChildView(control_button.get()); control_button->set_id(info.id); control_button->set_owned_by_client(); control_button->SetImageAlignment(views::ImageButton::ALIGN_CENTER, views::ImageButton::ALIGN_MIDDLE); UpdateCustomControlsSize(control_button.get()); UpdateControlsBounds(); base::string16 custom_button_label = base::UTF8ToUTF16(info.label); control_button->SetAccessibleName(custom_button_label); control_button->SetTooltipText(custom_button_label); control_button->SetInstallFocusRingOnFocus(true); control_button->SetFocusForPlatform(); }
0
316,982
static int selinux_inode_getsecurity(struct user_namespace *mnt_userns, struct inode *inode, const char *name, void **buffer, bool alloc) { u32 size; int error; char *context = NULL; struct inode_security_struct *isec; /* * If we're not initialized yet, then we can't validate contexts, so * just let vfs_getxattr fall back to using the on-disk xattr. */ if (!selinux_initialized(&selinux_state) || strcmp(name, XATTR_SELINUX_SUFFIX)) return -EOPNOTSUPP; /* * If the caller has CAP_MAC_ADMIN, then get the raw context * value even if it is not defined by current policy; otherwise, * use the in-core value under current policy. * Use the non-auditing forms of the permission checks since * getxattr may be called by unprivileged processes commonly * and lack of permission just means that we fall back to the * in-core context value, not a denial. */ isec = inode_security(inode); if (has_cap_mac_admin(false)) error = security_sid_to_context_force(&selinux_state, isec->sid, &context, &size); else error = security_sid_to_context(&selinux_state, isec->sid, &context, &size); if (error) return error; error = size; if (alloc) { *buffer = context; goto out_nofree; } kfree(context); out_nofree: return error; }
0
512,529
Item *get_copy(THD *thd) { return get_item_copy<Item_cache_date>(thd, this); }
0
462,304
pcl_inquire_readback_entity(pcl_args_t * pargs, pcl_state_t * pcs) { uint i = uint_arg(pargs); int unit = pcs->location_unit; stream st; static const char *entity_types[] = { "FONTS", "MACROS", "PATTERNS", "SYMBOLSETS", "FONTS EXTENDED" }; pcl_data_storage_t storage; int code = 0; long pos; if (i > 4) return e_Range; status_begin(&st, pcs); stprintf(&st, "INFO %s\r\n", entity_types[i]); switch (pcs->location_type) { case 0: /* invalid location */ code = -1; break; case 1: /* currently selected */ storage = (pcl_data_storage_t) 0; /* indicates currently selected */ break; case 2: /* all locations */ storage = (pcl_data_storage_t) ~ 0; break; case 3: /* internal */ if (unit != 0) { code = -1; break; } storage = pcds_internal; break; case 4: /* downloaded */ if (unit > 2) code = -1; else { static const pcl_data_storage_t dl_masks[] = { pcds_downloaded, pcds_temporary, pcds_permanent }; storage = dl_masks[unit]; } break; case 5: /* cartridges */ if (unit == 0) storage = (pcl_data_storage_t) pcds_all_cartridges; else if (unit <= pcds_cartridge_max) storage = (pcl_data_storage_t) (1 << (pcds_cartridge_shift + unit - 1)); else code = -1; break; case 6: /* SIMMs */ if (unit == 0) storage = (pcl_data_storage_t) pcds_all_simms; else if (unit <= pcds_simm_max) storage = (pcl_data_storage_t) (1 << (pcds_simm_shift + unit - 1)); else code = -1; break; default: code = -1; stputs(&st, "ERROR=INVALID ENTITY\r\n"); break; } if (code >= 0) { pos = stell(&st); code = (*status_write[i]) (&st, pcs, storage); if (code >= 0) { if (stell(&st) == pos) stputs(&st, "ERROR=NONE\r\n"); else if (storage == 0) /* currently selected */ stprintf(&st, "LOCTYPE=%d\r\nLOCUNIT=%d\r\n", pcs->location_type, unit); } } if (code < 0) { if (code == e_Memory) stputs(&st, "ERROR=INTERNAL ERROR\r\n"); else stputs(&st, "ERROR=INVALID LOCATION\r\n"); } status_end(&st, pcs); return 0; }
0
413,846
static void trace_method_resolution(const char* prefix, Klass* klass, Klass* resolved_klass, Method* method, bool logitables, int index = -1) { #ifndef PRODUCT ResourceMark rm; Log(itables) logi; LogStream lsi(logi.trace()); Log(vtables) logv; LogStream lsv(logv.trace()); outputStream* st; if (logitables) { st = &lsi; } else { st = &lsv; } st->print("%s%s, compile-time-class:%s, method:%s, method_holder:%s, access_flags: ", prefix, (klass == NULL ? "<NULL>" : klass->internal_name()), (resolved_klass == NULL ? "<NULL>" : resolved_klass->internal_name()), Method::name_and_sig_as_C_string(resolved_klass, method->name(), method->signature()), method->method_holder()->internal_name()); method->print_linkage_flags(st); if (index != -1) { st->print("vtable_index:%d", index); } st->cr(); #endif // PRODUCT }
0
500,696
unsigned int sftp_extensions_get_count(sftp_session sftp) { if (sftp == NULL || sftp->ext == NULL) { return 0; } return sftp->ext->count; }
0
338,066
void WasmBinaryBuilder::visitSwitch(Switch* curr) { BYN_TRACE("zz node: Switch\n"); curr->condition = popNonVoidExpression(); auto numTargets = getU32LEB(); BYN_TRACE("targets: " << numTargets << std::endl); for (size_t i = 0; i < numTargets; i++) { curr->targets.push_back(getBreakTarget(getU32LEB()).name); } auto defaultTarget = getBreakTarget(getU32LEB()); curr->default_ = defaultTarget.name; BYN_TRACE("default: " << curr->default_ << "\n"); if (defaultTarget.type.isConcrete()) { curr->value = popTypedExpression(defaultTarget.type); } curr->finalize(); }
0
274,758
int ntfs_attr_map_runlist(ntfs_attr *na, VCN vcn) { LCN lcn; ntfs_attr_search_ctx *ctx; ntfs_log_trace("Entering for inode 0x%llx, attr 0x%x, vcn 0x%llx.\n", (unsigned long long)na->ni->mft_no, le32_to_cpu(na->type), (long long)vcn); lcn = ntfs_rl_vcn_to_lcn(na->rl, vcn); if (lcn >= 0 || lcn == LCN_HOLE || lcn == LCN_ENOENT) return 0; ctx = ntfs_attr_get_search_ctx(na->ni, NULL); if (!ctx) return -1; /* Find the attribute in the mft record. */ if (!ntfs_attr_lookup(na->type, na->name, na->name_len, CASE_SENSITIVE, vcn, NULL, 0, ctx)) { runlist_element *rl; /* Decode the runlist. */ rl = ntfs_mapping_pairs_decompress(na->ni->vol, ctx->attr, na->rl); if (rl) { na->rl = rl; ntfs_attr_put_search_ctx(ctx); return 0; } } ntfs_attr_put_search_ctx(ctx); return -1; }
0
385,858
struct file *do_file_open_root(struct dentry *dentry, struct vfsmount *mnt, const char *name, const struct open_flags *op) { struct nameidata nd; struct file *file; struct filename filename = { .name = name }; int flags = op->lookup_flags | LOOKUP_ROOT; nd.root.mnt = mnt; nd.root.dentry = dentry; if (dentry->d_inode->i_op->follow_link && op->intent & LOOKUP_OPEN) return ERR_PTR(-ELOOP); file = path_openat(-1, &filename, &nd, op, flags | LOOKUP_RCU); if (unlikely(file == ERR_PTR(-ECHILD))) file = path_openat(-1, &filename, &nd, op, flags); if (unlikely(file == ERR_PTR(-ESTALE))) file = path_openat(-1, &filename, &nd, op, flags | LOOKUP_REVAL); return file; }
0
453,107
XML_ParserCreateNS(const XML_Char *encodingName, XML_Char nsSep) { XML_Char tmp[2] = {nsSep, 0}; return XML_ParserCreate_MM(encodingName, NULL, tmp); }
0
226,378
void jp2h_box_del(GF_Box *s) { gf_free(s);
0
195,331
Status ConcatShapeHelper(InferenceContext* c, int start_value_index, int end_value_index, int dim_index) { ShapeHandle unused; TF_RETURN_IF_ERROR(c->WithRank(c->input(dim_index), 0, &unused)); const Tensor* concat_dim_t = c->input_tensor(dim_index); if (concat_dim_t == nullptr) { // Return an unknown shape with same rank as inputs, or an unknown rank // if no input's rank is known. // Find rank. int32_t rank = InferenceContext::kUnknownRank; for (int i = start_value_index; i < end_value_index; ++i) { if (rank == InferenceContext::kUnknownRank) rank = c->Rank(c->input(i)); if (rank != InferenceContext::kUnknownRank) { break; } } if (rank == InferenceContext::kUnknownRank) { c->set_output(0, c->UnknownShape()); return Status::OK(); } else if (rank == 0) { return errors::InvalidArgument( "Can't concatenate scalars (use tf.stack instead)"); } else { for (int i = start_value_index; i < end_value_index; ++i) { // Check that all the inputs are of the correct rank. TF_RETURN_IF_ERROR(c->WithRank(c->input(i), rank, &unused)); } } // Build result of <rank> different unknown dims. std::vector<DimensionHandle> dims; dims.reserve(rank); for (int i = 0; i < rank; ++i) dims.push_back(c->UnknownDim()); c->set_output(0, c->MakeShape(dims)); return Status::OK(); } // Merge all the non-concat dims, and sum the concat dim to make an output // shape. int64_t concat_dim; if (concat_dim_t->dtype() == DT_INT32) { concat_dim = static_cast<int64_t>(concat_dim_t->flat<int32>()(0)); } else { concat_dim = concat_dim_t->flat<int64_t>()(0); } // Minimum required number of dimensions. const int min_rank = concat_dim < 0 ? -concat_dim : concat_dim + 1; ShapeHandle output_before; ShapeHandle output_after; ShapeHandle input = c->input(end_value_index - 1); TF_RETURN_IF_ERROR(c->WithRankAtLeast(input, min_rank, &input)); TF_RETURN_IF_ERROR(c->Subshape(input, 0, concat_dim, &output_before)); DimensionHandle output_middle = c->Dim(input, concat_dim); if (concat_dim == -1) { output_after = c->Scalar(); // no dimensions. } else { TF_RETURN_IF_ERROR(c->Subshape(input, concat_dim + 1, &output_after)); } for (int i = end_value_index - 2; i >= start_value_index; --i) { ShapeHandle before; ShapeHandle after; input = c->input(i); TF_RETURN_IF_ERROR(c->WithRankAtLeast(input, min_rank, &input)); TF_RETURN_IF_ERROR(c->Subshape(input, 0, concat_dim, &before)); DimensionHandle middle = c->Dim(input, concat_dim); if (concat_dim == -1) { after = c->Scalar(); } else { TF_RETURN_IF_ERROR(c->Subshape(input, concat_dim + 1, &after)); } TF_RETURN_IF_ERROR(c->Merge(before, output_before, &output_before)); TF_RETURN_IF_ERROR(c->Add(output_middle, middle, &output_middle)); TF_RETURN_IF_ERROR(c->Merge(after, output_after, &output_after)); } ShapeHandle s; TF_RETURN_IF_ERROR( c->Concatenate(output_before, c->Vector(output_middle), &s)); TF_RETURN_IF_ERROR(c->Concatenate(s, output_after, &s)); c->set_output(0, s); return Status::OK(); }
1
313,819
do_nv_ident(int c1, int c2) { oparg_T oa; cmdarg_T ca; clear_oparg(&oa); CLEAR_FIELD(ca); ca.oap = &oa; ca.cmdchar = c1; ca.nchar = c2; nv_ident(&ca); }
0
488,326
static int unmap_mapping_range_vma(struct vm_area_struct *vma, unsigned long start_addr, unsigned long end_addr, struct zap_details *details) { unsigned long restart_addr; int need_break; /* * files that support invalidating or truncating portions of the * file from under mmaped areas must have their ->fault function * return a locked page (and set VM_FAULT_LOCKED in the return). * This provides synchronisation against concurrent unmapping here. */ again: restart_addr = vma->vm_truncate_count; if (is_restart_addr(restart_addr) && start_addr < restart_addr) { start_addr = restart_addr; if (start_addr >= end_addr) { /* Top of vma has been split off since last time */ vma->vm_truncate_count = details->truncate_count; return 0; } } restart_addr = zap_page_range(vma, start_addr, end_addr - start_addr, details); need_break = need_resched() || spin_needbreak(details->i_mmap_lock); if (restart_addr >= end_addr) { /* We have now completed this vma: mark it so */ vma->vm_truncate_count = details->truncate_count; if (!need_break) return 0; } else { /* Note restart_addr in vma's truncate_count field */ vma->vm_truncate_count = restart_addr; if (!need_break) goto again; } spin_unlock(details->i_mmap_lock); cond_resched(); spin_lock(details->i_mmap_lock); return -EINTR; }
0
335,429
replace_makeprg(exarg_T *eap, char_u *p, char_u **cmdlinep) { char_u *new_cmdline; char_u *program; char_u *pos; char_u *ptr; int len; int i; /* * Don't do it when ":vimgrep" is used for ":grep". */ if ((eap->cmdidx == CMD_make || eap->cmdidx == CMD_lmake || eap->cmdidx == CMD_grep || eap->cmdidx == CMD_lgrep || eap->cmdidx == CMD_grepadd || eap->cmdidx == CMD_lgrepadd) && !grep_internal(eap->cmdidx)) { if (eap->cmdidx == CMD_grep || eap->cmdidx == CMD_lgrep || eap->cmdidx == CMD_grepadd || eap->cmdidx == CMD_lgrepadd) { if (*curbuf->b_p_gp == NUL) program = p_gp; else program = curbuf->b_p_gp; } else { if (*curbuf->b_p_mp == NUL) program = p_mp; else program = curbuf->b_p_mp; } p = skipwhite(p); if ((pos = (char_u *)strstr((char *)program, "$*")) != NULL) { // replace $* by given arguments i = 1; while ((pos = (char_u *)strstr((char *)pos + 2, "$*")) != NULL) ++i; len = (int)STRLEN(p); new_cmdline = alloc(STRLEN(program) + (size_t)i * (len - 2) + 1); if (new_cmdline == NULL) return NULL; // out of memory ptr = new_cmdline; while ((pos = (char_u *)strstr((char *)program, "$*")) != NULL) { i = (int)(pos - program); STRNCPY(ptr, program, i); STRCPY(ptr += i, p); ptr += len; program = pos + 2; } STRCPY(ptr, program); } else { new_cmdline = alloc(STRLEN(program) + STRLEN(p) + 2); if (new_cmdline == NULL) return NULL; // out of memory STRCPY(new_cmdline, program); STRCAT(new_cmdline, " "); STRCAT(new_cmdline, p); } msg_make(p); // 'eap->cmd' is not set here, because it is not used at CMD_make vim_free(*cmdlinep); *cmdlinep = new_cmdline; p = new_cmdline; } return p; }
0
395,072
after_updating_screen(int may_resize_shell UNUSED) { updating_screen = FALSE; #ifdef FEAT_GUI if (may_resize_shell) gui_may_resize_shell(); #endif #ifdef FEAT_TERMINAL term_check_channel_closed_recently(); #endif #ifdef HAVE_DROP_FILE // If handle_drop() was called while updating_screen was TRUE need to // handle the drop now. handle_any_postponed_drop(); #endif }
0
343,207
static int doport3(const int protocol) { struct sockaddr_storage dataconn; /* his endpoint */ # ifndef NON_ROOT_FTP static const in_port_t portlist[] = FTP_ACTIVE_SOURCE_PORTS; const in_port_t *portlistpnt = portlist; # else static const in_port_t portlist[] = { 0U }; const in_port_t *portlistpnt = portlist; # endif int on; # ifndef NON_ROOT_FTP disablesignals(); seteuid((uid_t) 0); # endif if ((datafd = socket(protocol, SOCK_STREAM, IPPROTO_TCP)) == -1) { data_socket_error: # ifndef NON_ROOT_FTP if (seteuid(authresult.uid) != 0) { _EXIT(EXIT_FAILURE); } enablesignals(); # endif (void) close(datafd); datafd = -1; error(425, MSG_CANT_CREATE_DATA_SOCKET); return -1; } on = 1; # ifdef SO_REUSEPORT (void) setsockopt(datafd, SOL_SOCKET, SO_REUSEPORT, (char *) &on, sizeof on); # else (void) setsockopt(datafd, SOL_SOCKET, SO_REUSEADDR, (char *) &on, sizeof on); # endif memcpy(&dataconn, &ctrlconn, sizeof dataconn); for (;;) { if (STORAGE_FAMILY(dataconn) == AF_INET6) { STORAGE_PORT6(dataconn) = htons(*portlistpnt); } else { STORAGE_PORT(dataconn) = htons(*portlistpnt); } if (bind(datafd, (struct sockaddr *) &dataconn, STORAGE_LEN(dataconn)) == 0) { break; } # ifdef USE_ONLY_FIXED_DATA_PORT (void) sleep(1U); # else if (*portlistpnt == (in_port_t) 0U) { goto data_socket_error; } portlistpnt++; # endif } # ifndef NON_ROOT_FTP if (seteuid(authresult.uid) != 0) { _EXIT(EXIT_FAILURE); } enablesignals(); # endif return 0; }
0
430,377
int seq_path_root(struct seq_file *m, const struct path *path, const struct path *root, const char *esc) { char *buf; size_t size = seq_get_buf(m, &buf); int res = -ENAMETOOLONG; if (size) { char *p; p = __d_path(path, root, buf, size); if (!p) return SEQ_SKIP; res = PTR_ERR(p); if (!IS_ERR(p)) { char *end = mangle_path(buf, p, esc); if (end) res = end - buf; else res = -ENAMETOOLONG; } } seq_commit(m, res); return res < 0 && res != -ENAMETOOLONG ? res : 0; }
0
276,444
void Compute(OpKernelContext* context) override { core::RefCountPtr<BoostedTreesEnsembleResource> tree_ensemble_resource; OP_REQUIRES_OK(context, LookupResource(context, HandleFromInput(context, 0), &tree_ensemble_resource)); tf_shared_lock l(*tree_ensemble_resource->get_mutex()); Tensor* output_stamp_token_t = nullptr; OP_REQUIRES_OK(context, context->allocate_output(0, TensorShape(), &output_stamp_token_t)); output_stamp_token_t->scalar<int64>()() = tree_ensemble_resource->stamp(); Tensor* output_proto_t = nullptr; OP_REQUIRES_OK(context, context->allocate_output(1, TensorShape(), &output_proto_t)); output_proto_t->scalar<tstring>()() = tree_ensemble_resource->SerializeAsString(); }
0
448,531
static void bgp_refresh_stalepath_timer_expire(struct thread *thread) { struct peer_af *paf; paf = THREAD_ARG(thread); afi_t afi = paf->afi; safi_t safi = paf->safi; struct peer *peer = paf->peer; peer->t_refresh_stalepath = NULL; if (peer->nsf[afi][safi]) bgp_clear_stale_route(peer, afi, safi); if (bgp_debug_neighbor_events(peer)) zlog_debug( "%pBP route-refresh (BoRR) timer expired for afi/safi: %d/%d", peer, afi, safi); bgp_timer_set(peer); }
0
512,838
Item** Arg_comparator::cache_converted_constant(THD *thd_arg, Item **value, Item **cache_item, const Type_handler *handler) { /* Don't need cache if doing context analysis only. */ if (!thd_arg->lex->is_ps_or_view_context_analysis() && (*value)->const_item() && handler->type_handler_for_comparison() != (*value)->type_handler_for_comparison()) { Item_cache *cache= handler->Item_get_cache(thd_arg, *value); cache->setup(thd_arg, *value); *cache_item= cache; return cache_item; } return value; }
0
226,166
GF_Err paen_box_read(GF_Box *s, GF_BitStream *bs) { return gf_isom_box_array_read(s, bs);
0
312,491
vgr_get_auname(cmdidx_T cmdidx) { switch (cmdidx) { case CMD_vimgrep: return (char_u *)"vimgrep"; case CMD_lvimgrep: return (char_u *)"lvimgrep"; case CMD_vimgrepadd: return (char_u *)"vimgrepadd"; case CMD_lvimgrepadd: return (char_u *)"lvimgrepadd"; case CMD_grep: return (char_u *)"grep"; case CMD_lgrep: return (char_u *)"lgrep"; case CMD_grepadd: return (char_u *)"grepadd"; case CMD_lgrepadd: return (char_u *)"lgrepadd"; default: return NULL; } }
0
244,070
static GF_Err ctrn_box_read(GF_Box *s, GF_BitStream *bs) { u32 i, count, flags, first_idx=0; Bool inherit_dur, inherit_size, inherit_flags, inherit_ctso; GF_TrunEntry *ent; GF_TrackFragmentRunBox *ptr = (GF_TrackFragmentRunBox *)s; flags = ptr->flags; ptr->ctrn_flags = flags; ptr->flags = 0; ptr->sample_count = gf_bs_read_u16(bs); ISOM_DECREASE_SIZE(ptr, 2); if (flags & GF_ISOM_TRUN_DATA_OFFSET) { if (flags & GF_ISOM_CTRN_DATAOFFSET_16) { ptr->data_offset = gf_bs_read_u16(bs); ISOM_DECREASE_SIZE(ptr, 2); } else { ptr->data_offset = gf_bs_read_u32(bs); ISOM_DECREASE_SIZE(ptr, 4); } ptr->flags |= GF_ISOM_TRUN_DATA_OFFSET; } if (flags & GF_ISOM_CTRN_CTSO_MULTIPLIER) { ptr->ctso_multiplier = gf_bs_read_u16(bs); ISOM_DECREASE_SIZE(ptr, 2); } /*no sample dur/sample_flag/size/ctso for first or following, create a pack sample */ if (! (flags & 0x00FFFF00)) { GF_SAFEALLOC(ent, GF_TrunEntry); if (!ent) return GF_OUT_OF_MEM; ent->nb_pack = ptr->sample_count; gf_list_add(ptr->entries, ent); return GF_OK; } /*allocate all entries*/ for (i=0; i<ptr->sample_count; i++) { GF_SAFEALLOC(ent, GF_TrunEntry); if (!ent) return GF_OUT_OF_MEM; gf_list_add(ptr->entries, ent); } //unpack flags ptr->ctrn_first_dur = (flags>>22) & 0x3; ptr->ctrn_first_size = (flags>>20) & 0x3; ptr->ctrn_first_sample_flags = (flags>>18) & 0x3; ptr->ctrn_first_ctts = (flags>>16) & 0x3; ptr->ctrn_dur = (flags>>14) & 0x3; ptr->ctrn_size = (flags>>12) & 0x3; ptr->ctrn_sample_flags = (flags>>10) & 0x3; ptr->ctrn_ctts = (flags>>8) & 0x3; inherit_dur = flags & GF_ISOM_CTRN_INHERIT_DUR; inherit_size = flags & GF_ISOM_CTRN_INHERIT_SIZE; inherit_flags = flags & GF_ISOM_CTRN_INHERIT_FLAGS; inherit_ctso = flags & GF_ISOM_CTRN_INHERIT_CTSO; if (flags & GF_ISOM_CTRN_FIRST_SAMPLE) { ent = gf_list_get(ptr->entries, 0); first_idx = 1; if (!inherit_dur && ptr->ctrn_first_dur) { ent->Duration = gf_bs_read_int(bs, gf_isom_ctrn_field_size_bits(ptr->ctrn_first_dur) ); ISOM_DECREASE_SIZE(ptr, ctrn_field_size(ptr->ctrn_first_dur) ); } if (!inherit_size && ptr->ctrn_first_size) { ent->size = gf_bs_read_int(bs, gf_isom_ctrn_field_size_bits(ptr->ctrn_first_size) ); ISOM_DECREASE_SIZE(ptr, ctrn_field_size(ptr->ctrn_first_size) ); } if (!inherit_flags && ptr->ctrn_first_sample_flags) { ent->flags = ctrn_read_flags(bs, gf_isom_ctrn_field_size_bits(ptr->ctrn_first_sample_flags) ); ISOM_DECREASE_SIZE(ptr, ctrn_field_size(ptr->ctrn_first_sample_flags) ); } if (!inherit_ctso && ptr->ctrn_first_ctts) { ent->CTS_Offset = gf_bs_read_int(bs, gf_isom_ctrn_field_size_bits(ptr->ctrn_first_ctts) ); ISOM_DECREASE_SIZE(ptr, ctrn_field_size(ptr->ctrn_first_ctts) ); if (ptr->ctso_multiplier) ent->CTS_Offset *= (s32) ptr->ctso_multiplier; } } count = ptr->sample_count - first_idx; if (!inherit_dur && ptr->ctrn_dur) { u32 nbbits = gf_isom_ctrn_field_size_bits(ptr->ctrn_dur); ISOM_DECREASE_SIZE(ptr, count * nbbits / 8); for (i=first_idx; i<ptr->sample_count; i++) { ent = gf_list_get(ptr->entries, i); ent->Duration = gf_bs_read_int(bs, nbbits); } } if (!inherit_size && ptr->ctrn_size) { u32 nbbits = gf_isom_ctrn_field_size_bits(ptr->ctrn_size); ISOM_DECREASE_SIZE(ptr, count * nbbits / 8); for (i=first_idx; i<ptr->sample_count; i++) { ent = gf_list_get(ptr->entries, i); ent->size = gf_bs_read_int(bs, nbbits); } } if (!inherit_flags && ptr->ctrn_sample_flags) { u32 nbbits = gf_isom_ctrn_field_size_bits(ptr->ctrn_sample_flags); ISOM_DECREASE_SIZE(ptr, count * nbbits / 8); for (i=first_idx; i<ptr->sample_count; i++) { ent = gf_list_get(ptr->entries, i); ent->flags = ctrn_read_flags(bs, nbbits); } } if (!inherit_ctso && ptr->ctrn_ctts) { u32 nbbits = gf_isom_ctrn_field_size_bits(ptr->ctrn_ctts); ISOM_DECREASE_SIZE(ptr, count * nbbits / 8); for (i=first_idx; i<ptr->sample_count; i++) { ent = gf_list_get(ptr->entries, i); ent->CTS_Offset = gf_bs_read_int(bs, nbbits); if (ptr->ctso_multiplier) ent->CTS_Offset *= (s32) ptr->ctso_multiplier; } } return GF_OK; }
0
328,828
R_API void r_bin_java_print_code_exceptions_attr_summary(RBinJavaExceptionEntry *exc_entry) { if (exc_entry == NULL) { eprintf ("Attempting to print an invalid RBinJavaExceptionEntry *.\n"); return; } printf (" Exception Table Entry Information\n"); printf (" offset: 0x%08"PFMT64x"\n", exc_entry->file_offset); printf (" catch_type: %d\n", exc_entry->catch_type); printf (" start_pc: 0x%04x\n", exc_entry->start_pc); printf (" end_pc: 0x%04x\n", exc_entry->end_pc); printf (" handler_pc: 0x%04x\n", exc_entry->handler_pc); }
0
509,541
int ha_maria::rnd_next(uchar *buf) { register_handler(file); return maria_scan(file, buf); }
0
275,488
njs_async_context_free(njs_vm_t *vm, njs_async_ctx_t *ctx) { njs_mp_free(vm->mem_pool, ctx->capability); njs_mp_free(vm->mem_pool, ctx); }
0
309,879
vid_puts(attr_t newmode, NCURSES_PAIRS_T pair_arg, void *opts GCC_UNUSED, NCURSES_OUTC outc) { SetSafeOutcWrapper(outc); return NCURSES_SP_NAME(vid_puts) (CURRENT_SCREEN, newmode, pair_arg, opts, _nc_outc_wrapper); }
0
236,189
GF_Err twrp_box_size(GF_Box *s) { s->size += 1; return GF_OK; }
0
233,859
static int do_iff_chunk_sequence(deark *c, struct de_iffctx *ictx, i64 pos1, i64 len, int level) { i64 pos; i64 endpos; i64 chunk_len; struct de_fourcc saved_container_fmt4cc; struct de_fourcc saved_container_contentstype4cc; int ret; if(level >= 16) { // An arbitrary recursion limit. return 0; } endpos = pos1+len; saved_container_fmt4cc = ictx->curr_container_fmt4cc; saved_container_contentstype4cc = ictx->curr_container_contentstype4cc; pos = pos1; while(pos < endpos) { ictx->curr_container_fmt4cc = saved_container_fmt4cc; ictx->curr_container_contentstype4cc = saved_container_contentstype4cc; if(ictx->handle_nonchunk_data_fn) { i64 skip_len = 0; ret = ictx->handle_nonchunk_data_fn(c, ictx, pos, &skip_len); if(ret && skip_len>0) { pos += de_pad_to_n(skip_len, ictx->alignment); continue; } } ret = do_iff_chunk(c, ictx, pos, endpos-pos, level, &chunk_len); if(!ret) return 0; pos += chunk_len; } ictx->curr_container_fmt4cc = saved_container_fmt4cc; ictx->curr_container_contentstype4cc = saved_container_contentstype4cc; return 1; }
0
336,620
static void reds_adjust_agent_capabilities(RedsState *reds, VDAgentMessage *message) { VDAgentAnnounceCapabilities *capabilities; if (message->type != VD_AGENT_ANNOUNCE_CAPABILITIES) { return; } capabilities = (VDAgentAnnounceCapabilities *) message->data; if (!reds->config->agent_copypaste) { VD_AGENT_CLEAR_CAPABILITY(capabilities->caps, VD_AGENT_CAP_CLIPBOARD); VD_AGENT_CLEAR_CAPABILITY(capabilities->caps, VD_AGENT_CAP_CLIPBOARD_BY_DEMAND); VD_AGENT_CLEAR_CAPABILITY(capabilities->caps, VD_AGENT_CAP_CLIPBOARD_SELECTION); } if (!reds->config->agent_file_xfer) { VD_AGENT_SET_CAPABILITY(capabilities->caps, VD_AGENT_CAP_FILE_XFER_DISABLED); } size_t caps_size = VD_AGENT_CAPS_SIZE_FROM_MSG_SIZE(message->size); reds->agent_dev->priv->agent_supports_graphics_device_info = VD_AGENT_HAS_CAPABILITY(capabilities->caps, caps_size, VD_AGENT_CAP_GRAPHICS_DEVICE_INFO); reds_send_device_display_info(reds); }
0
379,689
static void r_anal_var_proto_free(RAnalVarProt *vp) { if (vp) { free (vp->name); free (vp->type); free (vp); } }
0
317,126
static int selinux_skb_peerlbl_sid(struct sk_buff *skb, u16 family, u32 *sid) { int err; u32 xfrm_sid; u32 nlbl_sid; u32 nlbl_type; err = selinux_xfrm_skb_sid(skb, &xfrm_sid); if (unlikely(err)) return -EACCES; err = selinux_netlbl_skbuff_getsid(skb, family, &nlbl_type, &nlbl_sid); if (unlikely(err)) return -EACCES; err = security_net_peersid_resolve(&selinux_state, nlbl_sid, nlbl_type, xfrm_sid, sid); if (unlikely(err)) { pr_warn( "SELinux: failure in selinux_skb_peerlbl_sid()," " unable to determine packet's peer label\n"); return -EACCES; } return 0; }
0
220,403
ary_shrink_capa(mrb_state *mrb, struct RArray *a) { mrb_int capa; if (ARY_EMBED_P(a)) return; capa = a->as.heap.aux.capa; if (capa < ARY_DEFAULT_LEN * 2) return; if (capa <= a->as.heap.len * ARY_SHRINK_RATIO) return; do { capa /= 2; if (capa < ARY_DEFAULT_LEN) { capa = ARY_DEFAULT_LEN; break; } } while (capa > a->as.heap.len * ARY_SHRINK_RATIO); if (capa > a->as.heap.len && capa < a->as.heap.aux.capa) { a->as.heap.aux.capa = capa; a->as.heap.ptr = (mrb_value *)mrb_realloc(mrb, a->as.heap.ptr, sizeof(mrb_value)*capa); } }
0
446,058
LZWDecodeCompat(TIFF* tif, uint8* op0, tmsize_t occ0, uint16 s) { static const char module[] = "LZWDecodeCompat"; LZWCodecState *sp = DecoderState(tif); char *op = (char*) op0; long occ = (long) occ0; char *tp; unsigned char *bp; int code, nbits; int len; long nextbits, nextdata, nbitsmask; code_t *codep, *free_entp, *maxcodep, *oldcodep; (void) s; assert(sp != NULL); /* Fail if value does not fit in long. */ if ((tmsize_t) occ != occ0) return (0); /* * Restart interrupted output operation. */ if (sp->dec_restart) { long residue; codep = sp->dec_codep; residue = codep->length - sp->dec_restart; if (residue > occ) { /* * Residue from previous decode is sufficient * to satisfy decode request. Skip to the * start of the decoded string, place decoded * values in the output buffer, and return. */ sp->dec_restart += occ; do { codep = codep->next; } while (--residue > occ); tp = op + occ; do { *--tp = codep->value; codep = codep->next; } while (--occ); return (1); } /* * Residue satisfies only part of the decode request. */ op += residue; occ -= residue; tp = op; do { *--tp = codep->value; codep = codep->next; } while (--residue); sp->dec_restart = 0; } bp = (unsigned char *)tif->tif_rawcp; #ifdef LZW_CHECKEOS sp->dec_bitsleft = (((uint64)tif->tif_rawcc) << 3); #endif nbits = sp->lzw_nbits; nextdata = sp->lzw_nextdata; nextbits = sp->lzw_nextbits; nbitsmask = sp->dec_nbitsmask; oldcodep = sp->dec_oldcodep; free_entp = sp->dec_free_entp; maxcodep = sp->dec_maxcodep; while (occ > 0) { NextCode(tif, sp, bp, code, GetNextCodeCompat); if (code == CODE_EOI) break; if (code == CODE_CLEAR) { do { free_entp = sp->dec_codetab + CODE_FIRST; _TIFFmemset(free_entp, 0, (CSIZE - CODE_FIRST) * sizeof (code_t)); nbits = BITS_MIN; nbitsmask = MAXCODE(BITS_MIN); maxcodep = sp->dec_codetab + nbitsmask; NextCode(tif, sp, bp, code, GetNextCodeCompat); } while (code == CODE_CLEAR); /* consecutive CODE_CLEAR codes */ if (code == CODE_EOI) break; if (code > CODE_CLEAR) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "LZWDecode: Corrupted LZW table at scanline %d", tif->tif_row); return (0); } *op++ = (char)code; occ--; oldcodep = sp->dec_codetab + code; continue; } codep = sp->dec_codetab + code; /* * Add the new entry to the code table. */ if (free_entp < &sp->dec_codetab[0] || free_entp >= &sp->dec_codetab[CSIZE]) { TIFFErrorExt(tif->tif_clientdata, module, "Corrupted LZW table at scanline %d", tif->tif_row); return (0); } free_entp->next = oldcodep; if (free_entp->next < &sp->dec_codetab[0] || free_entp->next >= &sp->dec_codetab[CSIZE]) { TIFFErrorExt(tif->tif_clientdata, module, "Corrupted LZW table at scanline %d", tif->tif_row); return (0); } free_entp->firstchar = free_entp->next->firstchar; free_entp->length = free_entp->next->length+1; free_entp->value = (codep < free_entp) ? codep->firstchar : free_entp->firstchar; if (++free_entp > maxcodep) { if (++nbits > BITS_MAX) /* should not happen */ nbits = BITS_MAX; nbitsmask = MAXCODE(nbits); maxcodep = sp->dec_codetab + nbitsmask; } oldcodep = codep; if (code >= 256) { /* * Code maps to a string, copy string * value to output (written in reverse). */ if(codep->length == 0) { TIFFErrorExt(tif->tif_clientdata, module, "Wrong length of decoded " "string: data probably corrupted at scanline %d", tif->tif_row); return (0); } if (codep->length > occ) { /* * String is too long for decode buffer, * locate portion that will fit, copy to * the decode buffer, and setup restart * logic for the next decoding call. */ sp->dec_codep = codep; do { codep = codep->next; } while (codep->length > occ); sp->dec_restart = occ; tp = op + occ; do { *--tp = codep->value; codep = codep->next; } while (--occ); break; } len = codep->length; tp = op + len; do { int t; --tp; t = codep->value; codep = codep->next; *tp = (char)t; } while (codep && tp > op); assert(occ >= len); op += len; occ -= len; } else { *op++ = (char)code; occ--; } } tif->tif_rawcc -= (tmsize_t)( (uint8*) bp - tif->tif_rawcp ); tif->tif_rawcp = (uint8*) bp; sp->lzw_nbits = (unsigned short)nbits; sp->lzw_nextdata = nextdata; sp->lzw_nextbits = nextbits; sp->dec_nbitsmask = nbitsmask; sp->dec_oldcodep = oldcodep; sp->dec_free_entp = free_entp; sp->dec_maxcodep = maxcodep; if (occ > 0) { #if defined(__WIN32__) && (defined(_MSC_VER) || defined(__MINGW32__)) TIFFErrorExt(tif->tif_clientdata, module, "Not enough data at scanline %d (short %I64d bytes)", tif->tif_row, (unsigned __int64) occ); #else TIFFErrorExt(tif->tif_clientdata, module, "Not enough data at scanline %d (short %llu bytes)", tif->tif_row, (unsigned long long) occ); #endif return (0); } return (1); }
0
487,668
static void groups_sort(struct group_info *group_info) { int base, max, stride; int gidsetsize = group_info->ngroups; for (stride = 1; stride < gidsetsize; stride = 3 * stride + 1) ; /* nothing */ stride /= 3; while (stride) { max = gidsetsize - stride; for (base = 0; base < max; base++) { int left = base; int right = left + stride; gid_t tmp = GROUP_AT(group_info, right); while (left >= 0 && GROUP_AT(group_info, left) > tmp) { GROUP_AT(group_info, right) = GROUP_AT(group_info, left); right = left; left -= stride; } GROUP_AT(group_info, right) = tmp; } stride /= 3; } }
0
317,320
static int smk_copy_rules(struct list_head *nhead, struct list_head *ohead, gfp_t gfp) { struct smack_rule *nrp; struct smack_rule *orp; int rc = 0; list_for_each_entry_rcu(orp, ohead, list) { nrp = kmem_cache_zalloc(smack_rule_cache, gfp); if (nrp == NULL) { rc = -ENOMEM; break; } *nrp = *orp; list_add_rcu(&nrp->list, nhead); } return rc; }
0
473,980
expand_case_fold_string(Node* node, regex_t* reg) { #define THRESHOLD_CASE_FOLD_ALT_FOR_EXPANSION 8 int r, n, len, alt_num; UChar *start, *end, *p; Node *top_root, *root, *snode, *prev_node; OnigCaseFoldCodeItem items[ONIGENC_GET_CASE_FOLD_CODES_MAX_NUM]; StrNode* sn = NSTR(node); if (NSTRING_IS_AMBIG(node)) return 0; start = sn->s; end = sn->end; if (start >= end) return 0; r = 0; top_root = root = prev_node = snode = NULL_NODE; alt_num = 1; p = start; while (p < end) { n = ONIGENC_GET_CASE_FOLD_CODES_BY_STR(reg->enc, reg->case_fold_flag, p, end, items); if (n < 0) { r = n; goto err; } len = enclen(reg->enc, p, end); if (n == 0) { if (IS_NULL(snode)) { if (IS_NULL(root) && IS_NOT_NULL(prev_node)) { top_root = root = onig_node_list_add(NULL_NODE, prev_node); if (IS_NULL(root)) { onig_node_free(prev_node); goto mem_err; } } prev_node = snode = onig_node_new_str(NULL, NULL); if (IS_NULL(snode)) goto mem_err; if (IS_NOT_NULL(root)) { if (IS_NULL(onig_node_list_add(root, snode))) { onig_node_free(snode); goto mem_err; } } } r = onig_node_str_cat(snode, p, p + len); if (r != 0) goto err; } else { alt_num *= (n + 1); if (alt_num > THRESHOLD_CASE_FOLD_ALT_FOR_EXPANSION) break; if (IS_NULL(root) && IS_NOT_NULL(prev_node)) { top_root = root = onig_node_list_add(NULL_NODE, prev_node); if (IS_NULL(root)) { onig_node_free(prev_node); goto mem_err; } } r = expand_case_fold_string_alt(n, items, p, len, end, reg, &prev_node); if (r < 0) goto mem_err; if (r == 1) { if (IS_NULL(root)) { top_root = prev_node; } else { if (IS_NULL(onig_node_list_add(root, prev_node))) { onig_node_free(prev_node); goto mem_err; } } root = NCAR(prev_node); } else { /* r == 0 */ if (IS_NOT_NULL(root)) { if (IS_NULL(onig_node_list_add(root, prev_node))) { onig_node_free(prev_node); goto mem_err; } } } snode = NULL_NODE; } p += len; } if (p < end) { Node *srem; r = expand_case_fold_make_rem_string(&srem, p, end, reg); if (r != 0) goto mem_err; if (IS_NOT_NULL(prev_node) && IS_NULL(root)) { top_root = root = onig_node_list_add(NULL_NODE, prev_node); if (IS_NULL(root)) { onig_node_free(srem); onig_node_free(prev_node); goto mem_err; } } if (IS_NULL(root)) { prev_node = srem; } else { if (IS_NULL(onig_node_list_add(root, srem))) { onig_node_free(srem); goto mem_err; } } } /* ending */ top_root = (IS_NOT_NULL(top_root) ? top_root : prev_node); swap_node(node, top_root); onig_node_free(top_root); return 0; mem_err: r = ONIGERR_MEMORY; err: onig_node_free(top_root); return r; }
0
443,302
eval_vars( char_u *src, // pointer into commandline char_u *srcstart, // beginning of valid memory for src int *usedlen, // characters after src that are used linenr_T *lnump, // line number for :e command, or NULL char **errormsg, // pointer to error message int *escaped, // return value has escaped white space (can // be NULL) int empty_is_error) // empty result is considered an error { int i; char_u *s; char_u *result; char_u *resultbuf = NULL; int resultlen; buf_T *buf; int valid = VALID_HEAD + VALID_PATH; // assume valid result int spec_idx; int tilde_file = FALSE; int skip_mod = FALSE; char_u strbuf[30]; *errormsg = NULL; if (escaped != NULL) *escaped = FALSE; /* * Check if there is something to do. */ spec_idx = find_cmdline_var(src, usedlen); if (spec_idx < 0) // no match { *usedlen = 1; return NULL; } /* * Skip when preceded with a backslash "\%" and "\#". * Note: In "\\%" the % is also not recognized! */ if (src > srcstart && src[-1] == '\\') { *usedlen = 0; STRMOVE(src - 1, src); // remove backslash return NULL; } /* * word or WORD under cursor */ if (spec_idx == SPEC_CWORD || spec_idx == SPEC_CCWORD || spec_idx == SPEC_CEXPR) { resultlen = find_ident_under_cursor(&result, spec_idx == SPEC_CWORD ? (FIND_IDENT | FIND_STRING) : spec_idx == SPEC_CEXPR ? (FIND_IDENT | FIND_STRING | FIND_EVAL) : FIND_STRING); if (resultlen == 0) { *errormsg = ""; return NULL; } } /* * '#': Alternate file name * '%': Current file name * File name under the cursor * File name for autocommand * and following modifiers */ else { int off = 0; switch (spec_idx) { case SPEC_PERC: #ifdef FEAT_EVAL if (!in_vim9script() || src[1] != '%') #endif { // '%': current file if (curbuf->b_fname == NULL) { result = (char_u *)""; valid = 0; // Must have ":p:h" to be valid } else { result = curbuf->b_fname; tilde_file = STRCMP(result, "~") == 0; } break; } #ifdef FEAT_EVAL // "%%" alternate file off = 1; #endif // FALLTHROUGH case SPEC_HASH: // '#' or "#99": alternate file if (off == 0 ? src[1] == '#' : src[2] == '%') { // "##" or "%%%": the argument list result = arg_all(); resultbuf = result; *usedlen = off + 2; if (escaped != NULL) *escaped = TRUE; skip_mod = TRUE; break; } s = src + off + 1; if (*s == '<') // "#<99" uses v:oldfiles ++s; i = (int)getdigits(&s); if (s == src + off + 2 && src[off + 1] == '-') // just a minus sign, don't skip over it s--; *usedlen = (int)(s - src); // length of what we expand if (src[off + 1] == '<' && i != 0) { if (*usedlen < off + 2) { // Should we give an error message for #<text? *usedlen = off + 1; return NULL; } #ifdef FEAT_EVAL result = list_find_str(get_vim_var_list(VV_OLDFILES), (long)i); if (result == NULL) { *errormsg = ""; return NULL; } #else *errormsg = _(e_hashsmall_is_not_available_without_the_eval_feature); return NULL; #endif } else { if (i == 0 && src[off + 1] == '<' && *usedlen > off + 1) *usedlen = off + 1; buf = buflist_findnr(i); if (buf == NULL) { *errormsg = _(e_no_alternate_file_name_to_substitute_for_hash); return NULL; } if (lnump != NULL) *lnump = ECMD_LAST; if (buf->b_fname == NULL) { result = (char_u *)""; valid = 0; // Must have ":p:h" to be valid } else { result = buf->b_fname; tilde_file = STRCMP(result, "~") == 0; } } break; case SPEC_CFILE: // file name under cursor result = file_name_at_cursor(FNAME_MESS|FNAME_HYP, 1L, NULL); if (result == NULL) { *errormsg = ""; return NULL; } resultbuf = result; // remember allocated string break; case SPEC_AFILE: // file name for autocommand result = autocmd_fname; if (result != NULL && !autocmd_fname_full) { // Still need to turn the fname into a full path. It is // postponed to avoid a delay when <afile> is not used. autocmd_fname_full = TRUE; result = FullName_save(autocmd_fname, FALSE); vim_free(autocmd_fname); autocmd_fname = result; } if (result == NULL) { *errormsg = _(e_no_autocommand_file_name_to_substitute_for_afile); return NULL; } result = shorten_fname1(result); break; case SPEC_ABUF: // buffer number for autocommand if (autocmd_bufnr <= 0) { *errormsg = _(e_no_autocommand_buffer_name_to_substitute_for_abuf); return NULL; } sprintf((char *)strbuf, "%d", autocmd_bufnr); result = strbuf; break; case SPEC_AMATCH: // match name for autocommand result = autocmd_match; if (result == NULL) { *errormsg = _(e_no_autocommand_match_name_to_substitute_for_amatch); return NULL; } break; case SPEC_SFILE: // file name for ":so" command result = estack_sfile(ESTACK_SFILE); if (result == NULL) { *errormsg = _(e_no_source_file_name_to_substitute_for_sfile); return NULL; } resultbuf = result; // remember allocated string break; case SPEC_STACK: // call stack result = estack_sfile(ESTACK_STACK); if (result == NULL) { *errormsg = _(e_no_call_stack_to_substitute_for_stack); return NULL; } resultbuf = result; // remember allocated string break; case SPEC_SCRIPT: // script file name result = estack_sfile(ESTACK_SCRIPT); if (result == NULL) { *errormsg = _(e_no_script_file_name_to_substitute_for_script); return NULL; } resultbuf = result; // remember allocated string break; case SPEC_SLNUM: // line in file for ":so" command if (SOURCING_NAME == NULL || SOURCING_LNUM == 0) { *errormsg = _(e_no_line_number_to_use_for_slnum); return NULL; } sprintf((char *)strbuf, "%ld", SOURCING_LNUM); result = strbuf; break; #ifdef FEAT_EVAL case SPEC_SFLNUM: // line in script file if (current_sctx.sc_lnum + SOURCING_LNUM == 0) { *errormsg = _(e_no_line_number_to_use_for_sflnum); return NULL; } sprintf((char *)strbuf, "%ld", (long)(current_sctx.sc_lnum + SOURCING_LNUM)); result = strbuf; break; case SPEC_SID: if (current_sctx.sc_sid <= 0) { *errormsg = _(e_using_sid_not_in_script_context); return NULL; } sprintf((char *)strbuf, "<SNR>%d_", current_sctx.sc_sid); result = strbuf; break; #endif #ifdef FEAT_CLIENTSERVER case SPEC_CLIENT: // Source of last submitted input sprintf((char *)strbuf, PRINTF_HEX_LONG_U, (long_u)clientWindow); result = strbuf; break; #endif default: result = (char_u *)""; // avoid gcc warning break; } resultlen = (int)STRLEN(result); // length of new string if (src[*usedlen] == '<') // remove the file name extension { ++*usedlen; if ((s = vim_strrchr(result, '.')) != NULL && s >= gettail(result)) resultlen = (int)(s - result); } else if (!skip_mod) { valid |= modify_fname(src, tilde_file, usedlen, &result, &resultbuf, &resultlen); if (result == NULL) { *errormsg = ""; return NULL; } } } if (resultlen == 0 || valid != VALID_HEAD + VALID_PATH) { if (empty_is_error) { if (valid != VALID_HEAD + VALID_PATH) *errormsg = _(e_empty_file_name_for_percent_or_hash_only_works_with_ph); else *errormsg = _(e_evaluates_to_an_empty_string); } result = NULL; } else result = vim_strnsave(result, resultlen); vim_free(resultbuf); return result; }
0
317,306
static int smack_inode_setattr(struct dentry *dentry, struct iattr *iattr) { struct smk_audit_info ad; int rc; /* * Need to allow for clearing the setuid bit. */ if (iattr->ia_valid & ATTR_FORCE) return 0; smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_DENTRY); smk_ad_setfield_u_fs_path_dentry(&ad, dentry); rc = smk_curacc(smk_of_inode(d_backing_inode(dentry)), MAY_WRITE, &ad); rc = smk_bu_inode(d_backing_inode(dentry), MAY_WRITE, rc); return rc; }
0
413,576
static bool isValidAddress(RCore *core, ut64 addr) { // check if address is mapped RIOMap* map = r_io_map_get_at (core->io, addr); if (!map) { return false; } st64 fdsz = (st64)r_io_fd_size (core->io, map->fd); if (fdsz > 0 && map->delta > fdsz) { return false; } // check if associated file is opened RIODesc *desc = r_io_desc_get (core->io, map->fd); if (!desc) { return false; } // check if current map->fd is null:// if (!strncmp (desc->name, "null://", 7)) { return false; } return true; }
0
299,888
readconf_rewrites(void) { rewrite_rule **chain = &global_rewrite_rules; uschar *p; while ((p = get_config_line()) != NULL) { rewrite_rule *next = readconf_one_rewrite(p, &rewrite_existflags, TRUE); *chain = next; chain = &(next->next); } }
0
331,766
QVectorPath::~QVectorPath() { if (m_hints & ShouldUseCacheHint) { CacheEntry *e = m_cache; while (e) { if (e->data) e->cleanup(e->engine, e->data); CacheEntry *n = e->next; delete e; e = n; } } }
0
436,137
static void io_queue_deferred(struct io_ring_ctx *ctx) { while (!list_empty(&ctx->defer_list)) { struct io_defer_entry *de = list_first_entry(&ctx->defer_list, struct io_defer_entry, list); if (req_need_defer(de->req, de->seq)) break; list_del_init(&de->list); io_req_task_queue(de->req); kfree(de); } }
0
369,341
static void io_destroy_buffers(struct io_ring_ctx *ctx) { int i; for (i = 0; i < (1U << IO_BUFFERS_HASH_BITS); i++) { struct list_head *list = &ctx->io_buffers[i]; while (!list_empty(list)) { struct io_buffer_list *bl; bl = list_first_entry(list, struct io_buffer_list, list); __io_remove_buffers(ctx, bl, -1U); list_del(&bl->list); kfree(bl); } } while (!list_empty(&ctx->io_buffers_pages)) { struct page *page; page = list_first_entry(&ctx->io_buffers_pages, struct page, lru); list_del_init(&page->lru); __free_page(page); }
0
329,917
_fill_xrgb32_lerp_opaque_spans (void *abstract_renderer, int y, int h, const cairo_half_open_span_t *spans, unsigned num_spans) { cairo_image_span_renderer_t *r = abstract_renderer; if (num_spans == 0) return CAIRO_STATUS_SUCCESS; if (likely(h == 1)) { do { uint8_t a = spans[0].coverage; if (a) { int len = spans[1].x - spans[0].x; uint32_t *d = (uint32_t*)(r->u.fill.data + r->u.fill.stride*y + spans[0].x*4); if (a == 0xff) { if (len > 31) { pixman_fill ((uint32_t *)r->u.fill.data, r->u.fill.stride / sizeof(uint32_t), 32, spans[0].x, y, len, 1, r->u.fill.pixel); } else { uint32_t *d = (uint32_t*)(r->u.fill.data + r->u.fill.stride*y + spans[0].x*4); while (len-- > 0) *d++ = r->u.fill.pixel; } } else while (len-- > 0) { *d = lerp8x4 (r->u.fill.pixel, a, *d); d++; } } spans++; } while (--num_spans > 1); } else { do { uint8_t a = spans[0].coverage; if (a) { if (a == 0xff) { if (spans[1].x - spans[0].x > 16) { pixman_fill ((uint32_t *)r->u.fill.data, r->u.fill.stride / sizeof(uint32_t), 32, spans[0].x, y, spans[1].x - spans[0].x, h, r->u.fill.pixel); } else { int yy = y, hh = h; do { int len = spans[1].x - spans[0].x; uint32_t *d = (uint32_t*)(r->u.fill.data + r->u.fill.stride*yy + spans[0].x*4); while (len-- > 0) *d++ = r->u.fill.pixel; yy++; } while (--hh); } } else { int yy = y, hh = h; do { int len = spans[1].x - spans[0].x; uint32_t *d = (uint32_t *)(r->u.fill.data + r->u.fill.stride*yy + spans[0].x*4); while (len-- > 0) { *d = lerp8x4 (r->u.fill.pixel, a, *d); d++; } yy++; } while (--hh); } } spans++; } while (--num_spans > 1); } return CAIRO_STATUS_SUCCESS; }
0
424,956
static int iwl_pcie_load_cpu_sections(struct iwl_trans *trans, const struct fw_img *image, int cpu, int *first_ucode_section) { int i, ret = 0; u32 last_read_idx = 0; if (cpu == 1) *first_ucode_section = 0; else (*first_ucode_section)++; for (i = *first_ucode_section; i < image->num_sec; i++) { last_read_idx = i; /* * CPU1_CPU2_SEPARATOR_SECTION delimiter - separate between * CPU1 to CPU2. * PAGING_SEPARATOR_SECTION delimiter - separate between * CPU2 non paged to CPU2 paging sec. */ if (!image->sec[i].data || image->sec[i].offset == CPU1_CPU2_SEPARATOR_SECTION || image->sec[i].offset == PAGING_SEPARATOR_SECTION) { IWL_DEBUG_FW(trans, "Break since Data not valid or Empty section, sec = %d\n", i); break; } ret = iwl_pcie_load_section(trans, i, &image->sec[i]); if (ret) return ret; } *first_ucode_section = last_read_idx; return 0; }
0
328,980
R_API char *r_bin_java_print_interfacemethodref_cp_stringify(RBinJavaCPTypeObj *obj) { return r_str_newf ("%d.0x%04"PFMT64x ".%s.%d.%d", obj->metas->ord, obj->file_offset + obj->loadaddr, ((RBinJavaCPTypeMetas *) obj->metas->type_info)->name, obj->info.cp_interface.class_idx, obj->info.cp_interface.name_and_type_idx); }
0
369,336
static bool io_resubmit_prep(struct io_kiocb *req) { struct io_async_rw *rw = req->async_data; if (!req_has_async_data(req)) return !io_req_prep_async(req); iov_iter_restore(&rw->s.iter, &rw->s.iter_state); return true; }
0
238,603
static void mark_verifier_state_clean(struct bpf_verifier_env *env) { env->scratched_regs = 0U; env->scratched_stack_slots = 0ULL; }
0
225,733
#ifndef GPAC_DISABLE_ISOM_WRITE GF_Err prft_box_write(GF_Box *s, GF_BitStream *bs) { GF_Err e; GF_ProducerReferenceTimeBox *ptr = (GF_ProducerReferenceTimeBox *) s; if (!s) return GF_BAD_PARAM; e = gf_isom_full_box_write(s, bs); if (e) return e; gf_bs_write_u32(bs, ptr->refTrackID); gf_bs_write_u64(bs, ptr->ntp); if (ptr->version==0) { gf_bs_write_u32(bs, (u32) ptr->timestamp); } else { gf_bs_write_u64(bs, ptr->timestamp); } return GF_OK;
0
293,531
PJ_DEF(void) pj_scan_init( pj_scanner *scanner, char *bufstart, pj_size_t buflen, unsigned options, pj_syn_err_func_ptr callback ) { PJ_CHECK_STACK(); scanner->begin = scanner->curptr = bufstart; scanner->end = bufstart + buflen; scanner->line = 1; scanner->start_line = scanner->begin; scanner->callback = callback; scanner->skip_ws = options; if (scanner->skip_ws) pj_scan_skip_whitespace(scanner); }
0
498,093
static char *convert_query_hexchar(char *txt) { int d1, d2, n; n = strlen(txt); if (n < 3) { *txt = '\0'; return txt-1; } d1 = hextoint(*(txt + 1)); d2 = hextoint(*(txt + 2)); if (d1 < 0 || d2 < 0) { memmove(txt, txt + 3, n - 2); return txt-1; } else { *txt = d1 * 16 + d2; memmove(txt + 1, txt + 3, n - 2); return txt; } }
0
459,173
int tcf_block_get(struct tcf_block **p_block, struct tcf_proto __rcu **p_filter_chain, struct Qdisc *q, struct netlink_ext_ack *extack) { struct tcf_block_ext_info ei = { .chain_head_change = tcf_chain_head_change_dflt, .chain_head_change_priv = p_filter_chain, }; WARN_ON(!p_filter_chain); return tcf_block_get_ext(p_block, q, &ei, extack); }
0
249,515
int processing_data(png_structp png_ptr, png_infop info_ptr, unsigned char* p, unsigned int size) { if (!png_ptr || !info_ptr) return 1; if (setjmp(png_jmpbuf(png_ptr))) { png_destroy_read_struct(&png_ptr, &info_ptr, 0); return 1; } png_process_data(png_ptr, info_ptr, p, size); return 0; }
0
220,929
const GF_FilterRegister *mpgviddmx_register(GF_FilterSession *session) { return NULL; }
0
229,340
string EscapeOrigName(const string& orig_name) { // Replace _ with __ in the original name to avoid name conflicts. return absl::StrReplaceAll(orig_name, {{"_", "__"}}); }
0
227,038
IRC_PROTOCOL_CALLBACK(mode) { char *pos_modes, *pos_modes_args, *modes_args; int smart_filter, local_mode; struct t_irc_channel *ptr_channel; struct t_irc_nick *ptr_nick; struct t_gui_buffer *ptr_buffer; IRC_PROTOCOL_MIN_ARGS(4); IRC_PROTOCOL_CHECK_HOST; pos_modes = (argv[3][0] == ':') ? argv[3] + 1 : argv[3]; pos_modes_args = (argc > 4) ? ((argv_eol[4][0] == ':') ? argv_eol[4] + 1 : argv_eol[4]) : NULL; if (irc_channel_is_channel (server, argv[2])) { smart_filter = 0; ptr_channel = irc_channel_search (server, argv[2]); if (ptr_channel) { smart_filter = irc_mode_channel_set (server, ptr_channel, host, pos_modes, pos_modes_args); } local_mode = (irc_server_strcasecmp (server, nick, server->nick) == 0); ptr_nick = irc_nick_search (server, ptr_channel, nick); ptr_buffer = (ptr_channel) ? ptr_channel->buffer : server->buffer; modes_args = irc_mode_get_arguments (pos_modes_args); weechat_printf_date_tags ( irc_msgbuffer_get_target_buffer (server, NULL, command, NULL, ptr_buffer), date, irc_protocol_tags (command, (smart_filter && !local_mode) ? "irc_smart_filter" : NULL, NULL, address), _("%sMode %s%s %s[%s%s%s%s%s]%s by %s%s"), weechat_prefix ("network"), IRC_COLOR_CHAT_CHANNEL, (ptr_channel) ? ptr_channel->name : argv[2], IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_RESET, pos_modes, (modes_args && modes_args[0]) ? " " : "", (modes_args && modes_args[0]) ? modes_args : "", IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_RESET, irc_nick_color_for_msg (server, 1, ptr_nick, nick), nick); if (modes_args) free (modes_args); } else { weechat_printf_date_tags ( irc_msgbuffer_get_target_buffer (server, NULL, command, NULL, NULL), date, irc_protocol_tags (command, NULL, NULL, address), _("%sUser mode %s[%s%s%s]%s by %s%s"), weechat_prefix ("network"), IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_RESET, pos_modes, IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_RESET, irc_nick_color_for_msg (server, 1, NULL, nick), nick); irc_mode_user_set (server, pos_modes, 0); } return WEECHAT_RC_OK; }
0
359,585
DEFUN (no_neighbor_distribute_list, no_neighbor_distribute_list_cmd, NO_NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Filter updates to/from this neighbor\n" "IP access-list number\n" "IP access-list number (expanded range)\n" "IP Access-list name\n" "Filter incoming updates\n" "Filter outgoing updates\n") { return peer_distribute_unset_vty (vty, argv[0], bgp_node_afi (vty), bgp_node_safi (vty), argv[2]); }
0
343,214
void dositetime(void) { char tmp[64]; const struct tm *tm; time_t now; if ((now = time(NULL)) == (time_t) -1 || (tm = localtime(&now)) == NULL) { addreply_noformat(451, "time()"); return; } strftime(tmp, sizeof tmp, "%Y-%m-%d %H:%M:%S", tm); addreply_noformat(211, tmp); }
0
248,281
DLLIMPORT cfg_validate_callback2_t cfg_set_validate_func2(cfg_t *cfg, const char *name, cfg_validate_callback2_t vf) { cfg_opt_t *opt; cfg_validate_callback2_t oldvf; opt = cfg_getopt_array(cfg->opts, cfg->flags, name); if (!opt) return NULL; oldvf = opt->validcb2; opt->validcb2 = vf; return oldvf; }
0