Projectname large_stringclasses 15
values | Filepath large_stringlengths 4 106 ⌀ | Function large_stringlengths 11 3.45k | Label list |
|---|---|---|---|
Chromium | base/allocator/allocator_shim_override_cpp_symbols.h |
SHIM_ALWAYS_EXPORT void *operator new(size_t size) { return ShimCppNew(size); } | [
0,
0
] |
Chromium | base/allocator/allocator_shim_override_cpp_symbols.h |
SHIM_ALWAYS_EXPORT void operator delete(void *p) __THROW { ShimCppDelete(p); } | [
0,
0
] |
Chromium | base/allocator/partition_allocator/partition_page.h |
ALWAYS_INLINE QuarantineBitmap *
QuarantineBitmapFromPointer(QuarantineBitmapType type, size_t pcscan_epoch,
void *ptr) {
PA_DCHECK(!IsManagedByPartitionAllocDirectMap(ptr));
auto *super_page_base = reinterpret_cast<char *>(
reinterpret_cast<uintptr_t>(ptr) & kSuperPageBaseMask);
... | [
0,
0
] |
Chromium | base/android/jni_int_wrapper.h | inline jint as_jint(const JniIntWrapper &wrapper) { return wrapper.as_jint(); }
#endif
#endif // BASE_ANDROID_JNI_INT_WRAPPER_H_ | [
0,
0
] |
Chromium | base/bits.h |
ALWAYS_INLINE uint32_t CountLeadingZeroBits32(uint32_t x) {
return CountLeadingZeroBits(x);
} | [
0,
0
] |
Chromium | base/bits.h |
ALWAYS_INLINE size_t CountTrailingZeroBitsSizeT(size_t x) {
return CountTrailingZeroBits(x);
} | [
0,
0
] |
Chromium | base/bits.h | template <typename T> constexpr T LeftmostBit() {
static_assert(std::is_integral<T>::value,
"This function can only be used with integral types.");
T one(1u);
return one << ((CHAR_BIT * sizeof(T) - 1));
} | [
1,
0
] |
Chromium | base/compiler_specific.h | inline constexpr bool AnalyzerAssumeTrue(bool arg) {
// false.
return arg || AnalyzerNoReturn();
}
#define ANALYZER_ASSUME_TRUE(arg) ::AnalyzerAssumeTrue(!!(arg))
#define ANALYZER_SKIP_THIS_PATH() static_cast<void>(::AnalyzerNoReturn())
#define ANALYZER_ALLOW_UNUSED(var) static_cast<void>(var);
#else // !defined... | [
0,
0
] |
Chromium | base/containers/circular_deque.h |
value_type &front() {
DCHECK(!empty());
return buffer_[begin_];
} | [
0,
0
] |
Chromium | base/containers/circular_deque.h |
iterator end() { return iterator(this, end_); } | [
0,
0
] |
Chromium | base/containers/circular_deque.h |
reverse_iterator rbegin() { return reverse_iterator(end()); } | [
0,
0
] |
Chromium | base/containers/circular_deque.h | void reserve(size_type new_capacity) {
if (new_capacity > capacity())
SetCapacityTo(new_capacity);
} | [
0,
0
] |
Chromium | base/containers/circular_deque.h | static void MoveBuffer(VectorBuffer &from_buf, size_t from_begin,
size_t from_end, VectorBuffer *to_buf, size_t *to_begin,
size_t *to_end) {
size_t from_capacity = from_buf.capacity();
*to_begin = 0;
if (from_begin < from_end) {
from_buf.MoveRange(&from_buf[from... | [
0,
0
] |
Chromium | base/containers/circular_deque.h | void ShrinkCapacityIfNecessary() {
if (capacity() <= internal::kCircularBufferInitialCapacity)
return;
// Shrink when 100% of the size() is wasted.
size_t sz = size();
size_t empty_spaces = capacity() - sz;
if (empty_spaces < sz)
return;
// Leave 1/4 the size as free capacity, not going below the... | [
0,
0
] |
Chromium | base/containers/circular_deque.h | void MakeRoomFor(size_t count, iterator *insert_begin, iterator *insert_end) {
if (count == 0) {
*insert_end = *insert_begin;
return;
}
size_t begin_offset = insert_begin->OffsetFromBegin();
ExpandCapacityIfNecessary(count);
insert_begin->index_ = (begin_ + begin_offset) % buffer_.capacity();
*ins... | [
0,
0
] |
Chromium | base/containers/circular_deque.h |
template <class T, class Predicate>
size_t EraseIf(circular_deque<T> &container, Predicate pred) {
auto it = ranges::remove_if(container, pred);
size_t removed = std::distance(it, container.end());
container.erase(it, container.end());
return removed;
} | [
0,
0
] |
Chromium | base/containers/small_map.h |
iterator find(const key_type &key) {
key_equal compare;
if (UsingFullMap()) {
return iterator(map()->find(key));
}
for (size_t i = 0; i < size_; ++i) {
if (compare(array_[i].first, key)) {
return iterator(array_ + i);
}
}
return iterator(array_ + size_);
} | [
0,
0
] |
Chromium | base/containers/small_map.h | data_type &operator[](const key_type &key) {
key_equal compare;
if (UsingFullMap()) {
return map_[key];
}
for (size_t i = size_; i > 0; --i) {
const size_t index = i - 1;
if (compare(array_[index].first, key)) {
return array_[index].second;
}
}
if (size_ == kArraySize) {
Convert... | [
0,
0
] |
Chromium | base/containers/small_map.h | iterator erase(const iterator &position) {
if (UsingFullMap()) {
return iterator(map_.erase(position.map_iter_));
}
size_t i = position.array_iter_ - array_;
// TODO(crbug.com/817982): When we have a checked iterator, this CHECK might
CHECK_LE(i, size_);
array_[i].~value_type();
--size_;
if (i != ... | [
0,
1
] |
Chromium | base/functional/invoke.h | Reference: https:wg21.link/func.require#1.5
template <typename F,
typename T1,
EnableIf<IsMemObjPtr<F> && IsRefWrapper<T1>> = true>
constexpr decltype(auto) InvokeImpl(F&& f, T1&& t1 | [
0,
0
] |
Chromium | base/macros.h | std::unique_ptr<MyType> my_var = ...;
if (TakeOwnership(my_var.get()) == SUCCESS)
ignore_result(my_var.release());
template <typename T> inline void ignore_result(const T &) {}
#endif BASE_MACROS_H_ | [
0,
0
] |
Chromium | base/memory/scoped_refptr.h |
void swap(scoped_refptr &r) noexcept { std::swap(ptr_, r.ptr_); } | [
0,
0
] |
Chromium | base/memory/scoped_refptr.h |
template <typename T>
void swap(scoped_refptr<T> &lhs, scoped_refptr<T> &rhs) noexcept {
lhs.swap(rhs);
} | [
0,
0
] |
Chromium | base/memory/weak_ptr.h | EXAMPLE : class Base : public base::SupportsWeakPtr<Producer> {};
class Derived : public Base {};
Derived derived;
base::WeakPtr<Derived> ptr = base::AsWeakPtr(&derived);
Note that the following
doesn't work (invalid type conversion) since Derived::AsWeakPtr()
is WeakPtr<Base> SupportsWeakPtr<Base>::AsWea... | [
0,
0
] |
Chromium | base/numerics/checked_math_impl.h | template <typename T> constexpr bool CheckedSubImpl(T x, T y, T *result) {
static_assert(std::is_integral<T>::value, "Type must be integral");
// it using the unsigned type of the same size.
using UnsignedDst = typename std::make_unsigned<T>::type;
using SignedDst = typename std::make_signed<T>::type;
Unsign... | [
1,
0
] |
Chromium | base/ranges/algorithm.h | Let `N` be `last - first`.
Preconditions: `result` is not in the range `(first, last]`.
Effects: Moves elements in the range `[first, last)` into the range
`[result - N, result)` starting from `last - 1` and proceeding to `first`.
For each positive integer `n ≤ N`, performs `*(result - n) = E(n)`.
Returns: `re... | [
0,
0
] |
Chromium | base/ranges/algorithm.h | Mandates: The expression `value` is writable to the output iterator.
Effects: Assigns `value` through all the iterators in the range
`[first, last)`.
Returns: `last`.
Complexity: Exactly `N` assignments.
# : ~ : text = ranges::fill(O
template <typename OutputIterator,
typename T,
typename =... | [
0,
0
] |
Chromium | base/ranges/algorithm.h | Preconditions: `[first, middle)` and `[middle, last)` are valid ranges. The
ranges `[first, last)` and `[result, result + N)` do not overlap.
Effects: Copies the range `[first, last)` to the range `[result, result + N)`
such that for each non-negative integer `i < N` the following assignment
takes place: `*(resul... | [
0,
0
] |
Chromium | base/stl_util.h | template <typename Container, typename Value,
std::enable_if_t<
!internal::HasFindWithNpos<Container, Value>::value &&
!internal::HasFindWithEnd<Container, Value>::value &&
!internal::HasContains<Container, Value>::value> * = nullptr>
bool Contains(const Container &co... | [
1,
0
] |
Chromium | base/stl_util.h | template <typename Container, typename Value,
std::enable_if_t<internal::HasContains<Container, Value>::value> * =
nullptr>
bool Contains(const Container &container, const Value &value) {
return container.contains(value);
} | [
0,
0
] |
Chromium | base/strings/string_util.h | inline int snprintf(char *buffer, size_t size, const char *format, ...) {
va_list arguments;
va_start(arguments, format);
int result = vsnprintf(buffer, size, format, arguments);
va_end(arguments);
return result;
} | [
1,
0
] |
Chromium | base/strings/string_util.h | template <typename CharT,
typename = std::enable_if_t<std::is_integral<CharT>::value>>
CharT ToLowerASCII(CharT c) {
return (c >= 'A' && c <= 'Z') ? (c + ('a' - 'A')) : c;
} | [
1,
0
] |
Chromium | base/strings/string_util.h | template <typename Char> inline bool IsAsciiWhitespace(Char c) {
return c == ' ' || c == '\r' || c == '\n' || c == '\t' || c == '\f';
} | [
1,
0
] |
Chromium | base/strings/string_util.h | template <typename Char> inline bool IsAsciiDigit(Char c) {
return c >= '0' && c <= '9';
} | [
0,
0
] |
Chromium | base/strings/string_util.h | template <typename Char> inline bool IsAsciiPrintable(Char c) {
return c >= ' ' && c <= '~';
} | [
0,
0
] |
Chromium | base/test/data/mac/print_arch.c |
int main(int argc, char *argv[]) {
#if defined(__i386__)
static const char kArchitecture[] = "x86";
#elif defined(__x86_64__)
static const char kArchitecture[] = "x86_64";
#elif defined(__arm64__) || defined(__aarch64__)
static const char kArchitecture[] = "arm64";
#endif
printf("%s\n", kArchitecture);
ret... | [
0,
0
] |
Chromium | base/third_party/double_conversion/double-conversion/ieee.h |
static double Infinity() { return Double(kInfinity).value(); } | [
0,
0
] |
Chromium | base/third_party/double_conversion/double-conversion/ieee.h |
static double NaN() { return Double(kNaN).value(); } | [
0,
0
] |
Chromium | base/third_party/double_conversion/double-conversion/ieee.h |
static float NaN() { return Single(kNaN).value(); } | [
0,
0
] |
Chromium | base/third_party/dynamic_annotations/dynamic_annotations.c | void DYNAMIC_ANNOTATIONS_NAME(AnnotateRWLockCreate)(const char *file, int line,
const volatile void *lock) {
DYNAMIC_ANNOTATIONS_IMPL
} | [
0,
0
] |
Chromium | base/third_party/dynamic_annotations/dynamic_annotations.c |
void DYNAMIC_ANNOTATIONS_NAME(AnnotateRWLockDestroy)(
const char *file, int line, const volatile void *lock) {
DYNAMIC_ANNOTATIONS_IMPL
} | [
0,
0
] |
Chromium | base/third_party/dynamic_annotations/dynamic_annotations.c |
void DYNAMIC_ANNOTATIONS_NAME(AnnotateRWLockReleased)(const char *file,
int line,
const volatile void *lock,
long is_w) {
DYNAMIC_ANNOTATIONS_IMPL
} | [
0,
0
] |
Chromium | base/third_party/dynamic_annotations/dynamic_annotations.c |
void DYNAMIC_ANNOTATIONS_NAME(AnnotateBarrierInit)(
const char *file, int line, const volatile void *barrier, long count,
long reinitialization_allowed) {
DYNAMIC_ANNOTATIONS_IMPL
} | [
0,
0
] |
Chromium | base/third_party/dynamic_annotations/dynamic_annotations.c |
void DYNAMIC_ANNOTATIONS_NAME(AnnotateBarrierDestroy)(
const char *file, int line, const volatile void *barrier) {
DYNAMIC_ANNOTATIONS_IMPL
} | [
0,
0
] |
Chromium | base/third_party/dynamic_annotations/dynamic_annotations.c |
void DYNAMIC_ANNOTATIONS_NAME(AnnotatePublishMemoryRange)(
const char *file, int line, const volatile void *address, long size) {
DYNAMIC_ANNOTATIONS_IMPL
} | [
0,
0
] |
Chromium | base/third_party/dynamic_annotations/dynamic_annotations.c |
void DYNAMIC_ANNOTATIONS_NAME(AnnotateUnpublishMemoryRange)(
const char *file, int line, const volatile void *address, long size) {
DYNAMIC_ANNOTATIONS_IMPL
} | [
0,
0
] |
Chromium | base/third_party/dynamic_annotations/dynamic_annotations.c |
void DYNAMIC_ANNOTATIONS_NAME(AnnotatePCQGet)(const char *file, int line,
const volatile void *pcq) {
DYNAMIC_ANNOTATIONS_IMPL
} | [
0,
0
] |
Chromium | base/third_party/dynamic_annotations/dynamic_annotations.c |
void DYNAMIC_ANNOTATIONS_NAME(AnnotateNewMemory)(const char *file, int line,
const volatile void *mem,
long size) {
DYNAMIC_ANNOTATIONS_IMPL
} | [
0,
0
] |
Chromium | base/third_party/dynamic_annotations/dynamic_annotations.c |
void DYNAMIC_ANNOTATIONS_NAME(AnnotateExpectRace)(const char *file, int line,
const volatile void *mem,
const char *description) {
DYNAMIC_ANNOTATIONS_IMPL
} | [
0,
0
] |
Chromium | base/third_party/dynamic_annotations/dynamic_annotations.c |
void DYNAMIC_ANNOTATIONS_NAME(AnnotateTraceMemory)(const char *file, int line,
const volatile void *arg) {
DYNAMIC_ANNOTATIONS_IMPL
} | [
0,
0
] |
Chromium | base/third_party/dynamic_annotations/dynamic_annotations.c |
void DYNAMIC_ANNOTATIONS_NAME(AnnotateThreadName)(const char *file, int line,
const char *name) {
DYNAMIC_ANNOTATIONS_IMPL
} | [
0,
0
] |
Chromium | base/third_party/dynamic_annotations/dynamic_annotations.c |
void DYNAMIC_ANNOTATIONS_NAME(AnnotateIgnoreSyncEnd)(const char *file,
int line) {
DYNAMIC_ANNOTATIONS_IMPL
} | [
0,
0
] |
Chromium | base/third_party/dynamic_annotations/dynamic_annotations.c |
void DYNAMIC_ANNOTATIONS_NAME(AnnotateEnableRaceDetection)(const char *file,
int line,
int enable) {
DYNAMIC_ANNOTATIONS_IMPL
} | [
0,
0
] |
Chromium | base/third_party/libevent/buffer.c | void evbuffer_free(struct evbuffer *buffer) {
if (buffer->orig_buffer != NULL)
free(buffer->orig_buffer);
free(buffer);
}
#define SWAP(x, y) \
do { \
(x)->buffer = (y)->buff... | [
1,
0
] |
Chromium | base/third_party/libevent/devpoll.c | static int devpoll_queue(struct devpollop *devpollop, int fd, int events) {
struct pollfd *pfd;
if (devpollop->nchanges >= devpollop->nevents) {
if (devpoll_commit(devpollop) != 0)
return (-1);
}
pfd = &devpollop->changes[devpollop->nchanges++];
pfd->fd = fd;
pfd->events = events;
pfd->revent... | [
0,
0
] |
Chromium | base/third_party/libevent/epoll.c |
static int epoll_del(void *arg, struct event *ev) {
struct epollop *epollop = arg;
struct epoll_event epev = {0, {0}};
struct evepoll *evep;
int fd, events, op;
int needwritedelete = 1, needreaddelete = 1;
if (ev->ev_events & EV_SIGNAL)
return (evsignal_del(ev));
fd = ev->ev_fd;
if (fd >= epollop... | [
0,
0
] |
Chromium | base/third_party/libevent/epoll_sub.c |
int epoll_wait(int epfd, struct epoll_event *events, int maxevents,
int timeout) {
return (syscall(__NR_epoll_wait, epfd, events, maxevents, timeout));
} | [
0,
0
] |
Chromium | base/third_party/libevent/evbuffer.c |
static int bufferevent_add(struct event *ev, int timeout) {
struct timeval tv, *ptv = NULL;
if (timeout) {
evutil_timerclear(&tv);
tv.tv_sec = timeout;
ptv = &tv;
}
return (event_add(ev, ptv));
} | [
0,
0
] |
Chromium | base/third_party/libevent/evbuffer.c | struct bufferevent *bufferevent_new(int fd, evbuffercb readcb,
evbuffercb writecb, everrorcb errorcb,
void *cbarg) {
struct bufferevent *bufev;
if ((bufev = calloc(1, sizeof(struct bufferevent))) == NULL)
return (NULL);
if ((bufev->inpu... | [
1,
0
] |
Chromium | base/third_party/libevent/evbuffer.c | void bufferevent_free(struct bufferevent *bufev) {
event_del(&bufev->ev_read);
event_del(&bufev->ev_write);
evbuffer_free(bufev->input);
evbuffer_free(bufev->output);
free(bufev);
} | [
1,
0
] |
Chromium | base/third_party/libevent/evbuffer.c | size_t bufferevent_read(struct bufferevent *bufev, void *data, size_t size) {
struct evbuffer *buf = bufev->input;
if (buf->off < size)
size = buf->off;
memcpy(data, buf->buffer, size);
if (size)
evbuffer_drain(buf, size);
return (size);
} | [
1,
0
] |
Chromium | base/third_party/libevent/evbuffer.c |
int bufferevent_disable(struct bufferevent *bufev, short event) {
if (event & EV_READ) {
if (event_del(&bufev->ev_read) == -1)
return (-1);
}
if (event & EV_WRITE) {
if (event_del(&bufev->ev_write) == -1)
return (-1);
}
bufev->enabled &= ~event;
return (0);
} | [
0,
0
] |
Chromium | base/third_party/libevent/evdns.c |
void evdns_set_log_fn(evdns_debug_log_fn_type fn) { evdns_log_fn = fn; }
#ifdef __GNUC__
#define EVDNS_LOG_CHECK __attribute__((format(printf, 2, 3)))
#else
#define EVDNS_LOG_CHECK
#endif | [
0,
0
] |
Chromium | base/third_party/libevent/evdns.c | static void evdns_requests_pump_waiting_queue(void) {
while (global_requests_inflight < global_max_requests_inflight &&
global_requests_waiting) {
struct request *req;
assert(req_waiting_head);
if (req_waiting_head->next == req_waiting_head) {
/* only one item in the queue */
req = r... | [
0,
0
] |
Chromium | base/third_party/libevent/evdns.c |
static void reply_callback(struct request *const req, u32 ttl, u32 err,
struct reply *reply) {
switch (req->request_type) {
case TYPE_A:
if (reply)
req->user_callback(DNS_ERR_NONE, DNS_IPv4_A, reply->data.a.addrcount, ttl,
reply->data.a.addresses, req->... | [
1,
0
] |
Chromium | base/third_party/libevent/evdns.c |
void evdns_set_transaction_id_fn(ev_uint16_t (*fn)(void)) {
if (fn)
trans_id_function = fn;
else
trans_id_function = default_transaction_id_fn;
} | [
0,
0
] |
Chromium | base/third_party/libevent/evdns.c | static u16 transaction_id_pick(void) {
for (;;) {
u16 trans_id = trans_id_function();
if (trans_id == 0xffff)
continue;
if (request_find_from_trans_id(trans_id) == NULL)
return trans_id;
}
} | [
0,
0
] |
Chromium | base/third_party/libevent/evdns.c |
static int address_is_correct(struct nameserver *ns, struct sockaddr *sa,
socklen_t slen) {
struct sockaddr_in *sin = (struct sockaddr_in *)sa;
if (sa->sa_family != AF_INET || slen != sizeof(struct sockaddr_in))
return 0;
if (sin->sin_addr.s_addr != ns->address)
return 0;
... | [
1,
0
] |
Chromium | base/third_party/libevent/evdns.c | static void server_port_flush(struct evdns_server_port *port) {
while (port->pending_replies) {
struct server_request *req = port->pending_replies;
int r = sendto(port->socket, req->response, req->response_len, 0,
(struct sockaddr *)&req->addr, req->addrlen);
if (r < 0) {
int err ... | [
0,
0
] |
Chromium | base/third_party/libevent/evdns.c | static void nameserver_write_waiting(struct nameserver *ns, char waiting) {
if (ns->write_waiting == waiting)
return;
ns->write_waiting = waiting;
(void)event_del(&ns->event);
event_set(&ns->event, ns->socket,
EV_READ | (waiting ? EV_WRITE : 0) | EV_PERSIST,
nameserver_ready_callbac... | [
0,
0
] |
Chromium | base/third_party/libevent/evdns.c | static void nameserver_ready_callback(int fd, short events, void *arg) {
struct nameserver *ns = (struct nameserver *)arg;
(void)fd;
if (events & EV_WRITE) {
ns->choked = 0;
if (!evdns_transmit()) {
nameserver_write_waiting(ns, 0);
}
}
if (events & EV_READ) {
nameserver_read(ns);
}
} | [
0,
0
] |
Chromium | base/third_party/libevent/evdns.c | static int dnslabel_table_get_pos(const struct dnslabel_table *table,
const char *label) {
int i;
for (i = 0; i < table->n_labels; ++i) {
if (!strcmp(label, table->labels[i].v))
return table->labels[i].pos;
}
return -1;
} | [
0,
0
] |
Chromium | base/third_party/libevent/evdns.c | static int dnslabel_table_add(struct dnslabel_table *table, const char *label,
off_t pos) {
char *v;
int p;
if (table->n_labels == MAX_LABELS)
return (-1);
v = strdup(label);
if (v == NULL)
return (-1);
p = table->n_labels++;
table->labels[p].v = v;
table->labels[p]... | [
0,
0
] |
Chromium | base/third_party/libevent/evdns.c | static int evdns_request_len(const int name_len) {
return 96 + name_len + 2 + 4; /* space for the resource type */
} | [
0,
0
] |
Chromium | base/third_party/libevent/evdns.c | int evdns_server_request_add_a_reply(struct evdns_server_request *req,
const char *name, int n, void *addrs,
int ttl) {
return evdns_server_request_add_reply(req, EVDNS_ANSWER_SECTION, name, TYPE_A,
CLASS... | [
0,
0
] |
Chromium | base/third_party/libevent/evdns.c | int evdns_server_request_respond(struct evdns_server_request *_req, int err) {
struct server_request *req = TO_SERVER_REQUEST(_req);
struct evdns_server_port *port = req->port;
int r;
if (!req->response) {
if ((r = evdns_server_request_format_response(req, err)) < 0)
return r;
}
r = sendto(port->... | [
0,
0
] |
Chromium | base/third_party/libevent/evdns.c | static int evdns_transmit(void) {
char did_try_to_transmit = 0;
if (req_head) {
struct request *const started_at = req_head, *req = req_head;
do {
if (req->transmit_me) {
did_try_to_transmit = 1;
evdns_request_transmit(req);
}
req = req->next;
} while (req != started... | [
0,
0
] |
Chromium | base/third_party/libevent/evdns.c | int evdns_count_nameservers(void) {
const struct nameserver *server = server_head;
int n = 0;
if (!server)
return 0;
do {
++n;
server = server->next;
} while (server != server_head);
return n;
} | [
0,
0
] |
Chromium | base/third_party/libevent/evdns.c | int evdns_clear_nameservers_and_suspend(void) {
struct nameserver *server = server_head, *started_at = server_head;
struct request *req = req_head, *req_started_at = req_head;
if (!server)
return 0;
while (1) {
struct nameserver *next = server->next;
(void)event_del(&server->event);
if (evtimer... | [
1,
0
] |
Chromium | base/third_party/libevent/evdns.c | int evdns_nameserver_add(unsigned long int address) {
return _evdns_nameserver_add_impl(address, 53);
} | [
0,
0
] |
Chromium | base/third_party/libevent/evdns.c | int evdns_nameserver_ip_add(const char *ip_as_string) {
struct in_addr ina;
int port;
char buf[20];
const char *cp;
cp = strchr(ip_as_string, ':');
if (!cp) {
cp = ip_as_string;
port = 53;
} else {
port = strtoint(cp + 1);
if (port < 0 || port > 65535) {
return 4;
}
if ((cp -... | [
1,
0
] |
Chromium | base/third_party/libevent/evdns.c | static void evdns_request_insert(struct request *req, struct request **head) {
if (!*head) {
*head = req;
req->next = req->prev = req;
return;
}
req->prev = (*head)->prev;
req->prev->next = req;
req->next = *head;
(*head)->prev = req;
} | [
0,
0
] |
Chromium | base/third_party/libevent/evdns.c | static struct request *request_new(int type, const char *name, int flags,
evdns_callback_type callback,
void *user_ptr) {
const char issuing_now =
(global_requests_inflight < global_max_requests_inflight) ? 1 : 0;
const int name_len = strl... | [
1,
0
] |
Chromium | base/third_party/libevent/evdns.c | int evdns_resolve_ipv6(const char *name, int flags,
evdns_callback_type callback, void *ptr) {
log(EVDNS_LOG_DEBUG, "Resolve requested for %s", name);
if (flags & DNS_QUERY_NO_SEARCH) {
struct request *const req =
request_new(TYPE_AAAA, name, flags, callback, ptr);
if (req == ... | [
0,
0
] |
Chromium | base/third_party/libevent/evdns.c |
static struct search_state *search_state_new(void) {
struct search_state *state =
(struct search_state *)malloc(sizeof(struct search_state));
if (!state)
return NULL;
memset(state, 0, sizeof(struct search_state));
state->refcount = 1;
state->ndots = 1;
return state;
} | [
1,
0
] |
Chromium | base/third_party/libevent/evdns.c |
static void search_postfix_clear(void) {
search_state_decref(global_search_state);
global_search_state = search_state_new();
} | [
0,
0
] |
Chromium | base/third_party/libevent/evdns.c | static void search_reverse(void) {
struct search_domain *cur, *prev = NULL, *next;
cur = global_search_state->head;
while (cur) {
next = cur->next;
cur->next = prev;
prev = cur;
cur = next;
}
global_search_state->head = prev;
} | [
0,
0
] |
Chromium | base/third_party/libevent/evdns.c | void evdns_search_ndots_set(const int ndots) {
if (!global_search_state)
global_search_state = search_state_new();
if (!global_search_state)
return;
global_search_state->ndots = ndots;
} | [
1,
0
] |
Chromium | base/third_party/libevent/evdns.c | static char *search_make_new(const struct search_state *const state, int n,
const char *const base_name) {
const int base_len = strlen(base_name);
const char need_to_append_dot = base_name[base_len - 1] == '.' ? 0 : 1;
struct search_domain *dom;
for (dom = state->head; dom; dom = d... | [
1,
0
] |
Chromium | base/third_party/libevent/evdns.c | static int search_try_next(struct request *const req) {
if (req->search_state) {
char *new_name;
struct request *newreq;
req->search_index++;
if (req->search_index >= req->search_state->num_domains) {
/* no more postfixes to try, however we may need to try */
/* this name without a postfi... | [
1,
0
] |
Chromium | base/third_party/libevent/evdns.c | static int strtoint_clipped(const char *const str, int min, int max) {
int r = strtoint(str);
if (r == -1)
return r;
else if (r < min)
return min;
else if (r > max)
return max;
else
return r;
} | [
0,
0
] |
Chromium | base/third_party/libevent/evdns.c |
static int config_nameserver_from_reg_key(HKEY key, const char *subkey) {
char *buf;
DWORD bufsz = 0, type = 0;
int status = 0;
if (RegQueryValueExA(key, subkey, 0, &type, NULL, &bufsz) != ERROR_MORE_DATA)
return -1;
if (!(buf = malloc(bufsz)))
return -1;
if (RegQueryValueExA(key, subkey, 0, &typ... | [
1,
0
] |
Chromium | base/third_party/libevent/evdns.c |
int evdns_config_windows_nameservers(void) {
if (load_nameservers_with_getnetworkparams() == 0)
return 0;
return load_nameservers_from_registry();
}
#endif | [
0,
0
] |
Chromium | base/third_party/libevent/evdns.c |
const char *evdns_err_to_string(int err) {
switch (err) {
case DNS_ERR_NONE:
return "no error";
case DNS_ERR_FORMAT:
return "misformatted query";
case DNS_ERR_SERVERFAILED:
return "server failed";
case DNS_ERR_NOTEXIST:
return "name does not exist";
case DNS_ERR_NOTIMPL:
return "query n... | [
0,
0
] |
Chromium | base/third_party/libevent/evdns.c |
void evdns_shutdown(int fail_requests) {
struct nameserver *server, *server_next;
struct search_domain *dom, *dom_next;
while (req_head) {
if (fail_requests)
reply_callback(req_head, 0, DNS_ERR_SHUTDOWN, NULL);
request_finished(req_head, &req_head);
}
while (req_waiting_head) {
if (fail_re... | [
1,
0
] |
Chromium | base/third_party/libevent/event.c |
static int gettime(struct event_base *base, struct timeval *tp) {
if (base->tv_cache.tv_sec) {
*tp = base->tv_cache;
return (0);
}
#if defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC)
struct timespec ts;
if (use_monotonic && clock_gettime(CLOCK_MONOTONIC, &ts) == 0) {
tp->tv_sec = ts.tv_se... | [
0,
0
] |
Chromium | base/third_party/libevent/event.c | struct event_base *event_base_new(void) {
int i;
struct event_base *base;
if ((base = calloc(1, sizeof(struct event_base))) == NULL)
event_err(1, "%s: calloc", __func__);
gettime(base, &base->event_tv);
min_heap_ctor(&base->timeheap);
TAILQ_INIT(&base->eventqueue);
base->sig.ev_signal_pair[0] = -1;... | [
1,
0
] |
Chromium | base/third_party/libevent/event.c | void event_base_free(struct event_base *base) {
int i, n_deleted = 0;
struct event *ev;
if (base == NULL && current_base)
base = current_base;
if (base == current_base)
current_base = NULL;
assert(base);
/* Delete all non-internal events. */
for (ev = TAILQ_FIRST(&base->eventqueue); ev;) {
s... | [
1,
0
] |
Chromium | base/third_party/libevent/event.c | static void event_process_active(struct event_base *base) {
struct event *ev;
struct event_list *activeq = NULL;
int i;
short ncalls;
for (i = 0; i < base->nactivequeues; ++i) {
if (TAILQ_FIRST(base->activequeues[i]) != NULL) {
activeq = base->activequeues[i];
break;
}
}
assert(activ... | [
0,
0
] |
Chromium | base/third_party/libevent/event.c | int event_dispatch(void) { return (event_loop(0)); } | [
0,
0
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.