Instruction stringlengths 14 778 | input_code stringlengths 0 4.24k | output_code stringlengths 1 5.44k |
|---|---|---|
Use the size of the array passed in | #include <stdio.h>
#include <stdlib.h>
#define MARK_SIZE 8
int read_marks(float marks[])
{
char mark[MARK_SIZE];
int c = 0;
for (int i = 0; i < 4; i++) {
c += 1;
printf("mark[%d]: ", i+1);
fgets(mark, sizeof(mark), stdin);
marks[i] = strtol(mark, NULL, 0);
}
retur... | #include <stdio.h>
#include <stdlib.h>
#define MARK_SIZE 8
int read_marks(float marks[])
{
char mark[MARK_SIZE];
int c = 0;
for (int i = 0; i < 4; i++) {
c += 1;
printf("mark[%d]: ", i+1);
fgets(mark, sizeof(mark), stdin);
marks[i] = strtol(mark, NULL, 0);
}
retur... |
Fix warning ('struct gl_context' declared inside parameter list). | /*
* Mesa 3-D graphics library
* Version: 3.5
*
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, in... | /*
* Mesa 3-D graphics library
* Version: 3.5
*
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, in... |
Fix test so it works on systems where wchar_t != int. | // RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null
typedef int __darwin_wchar_t;
typedef __darwin_wchar_t wchar_t;
typedef signed short SQLSMALLINT;
typedef SQLSMALLINT SQLRETURN;
typedef enum
{
en_sqlstat_total
}
sqlerrmsg_t;
SQLRETURN _iodbcdm_sqlerror( )
{
wchar_t _sqlState[6] = { L"\0" };
}
| // RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null
#include <stddef.h>
signed short _iodbcdm_sqlerror( )
{
wchar_t _sqlState[6] = { L"\0" };
}
|
Add token counter and cursor array to connections. | /**
* @author Adam Grandquist
*/
#include "ReQL-ast.h"
#ifndef _REQL_H
#define _REQL_H
struct _ReQL_Conn_s {
int socket;
int error;
char *buf;
};
typedef struct _ReQL_Conn_s _ReQL_Conn_t;
struct _ReQL_Cur_s {
};
typedef struct _ReQL_Cur_s _ReQL_Cur_t;
int _reql_connect(_ReQL_Conn_t *conn, unsigned char hos... | /**
* @author Adam Grandquist
*/
#include "ReQL-ast.h"
#ifndef _REQL_H
#define _REQL_H
struct _ReQL_Conn_s {
int socket;
int error;
char *buf;
unsigned int max_token;
struct _ReQL_Cur_s **cursor;
};
typedef struct _ReQL_Conn_s _ReQL_Conn_t;
struct _ReQL_Cur_s {
};
typedef struct _ReQL_Cur_s _ReQL_Cur_t;... |
Put constructor for FourierTransformFFTW in cc file. | #ifndef BART_SRC_CALCULATOR_FOURIER_FOURIER_TRANSFORM_FFTW_H_
#define BART_SRC_CALCULATOR_FOURIER_FOURIER_TRANSFORM_FFTW_H_
#include "calculator/fourier/fourier_transform_i.h"
namespace bart {
namespace calculator {
namespace fourier {
class FourierTransformFFTW : public FourierTransformI {
public:
FourierTrans... | #ifndef BART_SRC_CALCULATOR_FOURIER_FOURIER_TRANSFORM_FFTW_H_
#define BART_SRC_CALCULATOR_FOURIER_FOURIER_TRANSFORM_FFTW_H_
#include "calculator/fourier/fourier_transform_i.h"
namespace bart {
namespace calculator {
namespace fourier {
class FourierTransformFFTW : public FourierTransformI {
public:
FourierTrans... |
Make abs_time() use GetTickCount() on Windows | #ifndef __libcpu_timings_h
#define __libcpu_timings_h
#ifdef __MACH__
#include <mach/mach_time.h>
#define abs_time() mach_absolute_time()
#endif
#ifdef sun
#include <sys/time.h>
#define abs_time() gethrtime()
#endif
#ifdef linux
#warning High precission timing currently n/a on Linux
// HACK
#define abs_time() 0
#... | #ifndef __libcpu_timings_h
#define __libcpu_timings_h
#ifdef __MACH__
#include <mach/mach_time.h>
#define abs_time() mach_absolute_time()
#endif
#ifdef sun
#include <sys/time.h>
#define abs_time() gethrtime()
#endif
#ifdef linux
#warning High precission timing currently n/a on Linux
// HACK
#define abs_time() 0
#... |
Increment the run configuration's reference counter. | /**
* Touhou Community Reliant Automatic Patcher
* Main DLL
*
* ----
*
* Globals, compile-time constants and runconfig abstractions.
*/
#include "thcrap.h"
CRITICAL_SECTION cs_file_access;
json_t* run_cfg = NULL;
const char* PROJECT_NAME(void)
{
return "Touhou Community Reliant Automatic Patcher";
}
c... | /**
* Touhou Community Reliant Automatic Patcher
* Main DLL
*
* ----
*
* Globals, compile-time constants and runconfig abstractions.
*/
#include "thcrap.h"
CRITICAL_SECTION cs_file_access;
json_t* run_cfg = NULL;
const char* PROJECT_NAME(void)
{
return "Touhou Community Reliant Automatic Patcher";
}
c... |
Fix up the spooldir/lockfile changes that caused a segfault. | /*
* (C) 2001 by Matthias Andree
*/
/*
* This file (leafnode-version.c) is public domain. It comes without and
* express or implied warranties. Do with this file whatever you wish, but
* don't remove the disclaimer.
*/
#include <stdio.h>
#include "leafnode.h"
#ifdef WITH_DMALLOC
#include <dmalloc.h>
#endif
#i... | /*
* (C) 2001 by Matthias Andree
*/
/*
* This file (leafnode-version.c) is public domain. It comes without and
* express or implied warranties. Do with this file whatever you wish, but
* don't remove the disclaimer.
*/
#include <stdio.h>
#include "leafnode.h"
#ifdef WITH_DMALLOC
#include <dmalloc.h>
#endif
#i... |
Fix bug when compiling minizip with C++ [Vollant]. | /*
Additional tools for Minizip
Code: Xavier Roche '2004
License: Same as ZLIB (www.gzip.org)
*/
#ifndef _zip_tools_H
#define _zip_tools_H
#ifdef __cplusplus
extern "C" {
#endif
#ifndef _ZLIB_H
#include "zlib.h"
#endif
#include "unzip.h"
/* Repair a ZIP file (missing central directory)
file: file to recov... | /*
Additional tools for Minizip
Code: Xavier Roche '2004
License: Same as ZLIB (www.gzip.org)
*/
#ifndef _zip_tools_H
#define _zip_tools_H
#ifdef __cplusplus
extern "C" {
#endif
#ifndef _ZLIB_H
#include "zlib.h"
#endif
#include "unzip.h"
/* Repair a ZIP file (missing central directory)
file: file to recov... |
Fix a typo in remark | /**
* \file
* \remark This file is part of VITA.
*
* \copyright Copyright (C) 2018 EOS di Manlio Morini.
*
* \license
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.o... | /**
* \file
* \remark This file is part of VITA.
*
* \copyright Copyright (C) 2018 EOS di Manlio Morini.
*
* \license
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.o... |
Make the gcc/clang asm keyword available, even when running in standard C mode. | /* Unix sqConfig.h -- platform identification and configuration */
/* This file has been superseded by autoconf for Unix variants. */
#include "config.h"
#ifndef UNIX
# define UNIX
#endif
#if !defined(LSB_FIRST)
#error "LSB_FIRST is undefined. Used for setting platform endianesness!"
#endif
#if LSB_FIRST
# defin... | /* Unix sqConfig.h -- platform identification and configuration */
/* This file has been superseded by autoconf for Unix variants. */
#include "config.h"
#ifndef UNIX
# define UNIX
#endif
#if !defined(LSB_FIRST)
#error "LSB_FIRST is undefined. Used for setting platform endianesness!"
#endif
#if LSB_FIRST
# defin... |
Fix to compile on Debian | #ifndef _SERHEX_H_
#define _SERHEX_H_
#include <termios.h> // POSIX terminal control definitions
int configure_port(int fd, speed_t st);
int open_port(char *port);
int send_cmd(char *, uint8_t *, int, uint8_t *);
int send_cmd_with_delay(char *, uint8_t *, int, uint8_t *, int);
#endif /* _SERHEX_H_ */ | #ifndef _SERHEX_H_
#define _SERHEX_H_
#include <termios.h> // POSIX terminal control definitions
#include <stdint.h>
int configure_port(int fd, speed_t st);
int open_port(char *port);
int send_cmd(char *, uint8_t *, int, uint8_t *);
int send_cmd_with_delay(char *, uint8_t *, int, uint8_t *, int);
#endif /* _SERHEX_H... |
Disable test in a way that keeps lit happy. | // R UN: %llvmgcc %s -S -O0 -o - | FileCheck %s
// Radar 9156771
typedef struct RGBColor {
unsigned short red;
unsigned short green;
unsigned short blue;
} RGBColor;
RGBColor func();
RGBColor X;
void foo() {
//CHECK: store i48
X = func();
}
| // RUN: %llvmgcc %s -S -O0 -o - | FileCheck %s
// REQUIRES: disabled
// Radar 9156771
typedef struct RGBColor {
unsigned short red;
unsigned short green;
unsigned short blue;
} RGBColor;
RGBColor func();
RGBColor X;
void foo() {
//CHECK: store i48
X = func();
}
|
Add support for computing currently used size in resource caches | /*
* Copyright (c) 2017 Lech Kulina
*
* This file is part of the Realms Of Steel.
* For conditions of distribution and use, see copyright details in the LICENSE file.
*/
#ifndef ROS_RESOURCE_CACHE_H
#define ROS_RESOURCE_CACHE_H
#include <core/Common.h>
#include <core/Environment.h>
#include <resources/ArchiveFile... | /*
* Copyright (c) 2017 Lech Kulina
*
* This file is part of the Realms Of Steel.
* For conditions of distribution and use, see copyright details in the LICENSE file.
*/
#ifndef ROS_RESOURCE_CACHE_H
#define ROS_RESOURCE_CACHE_H
#include <core/Common.h>
#include <core/Environment.h>
#include <resources/ArchiveFile... |
Add missing namespace closing comment | #pragma once
#include <util/raii_helper.h>
namespace shk {
namespace detail {
void closeFd(int fd);
}
using FileDescriptor = RAIIHelper<int, void, detail::closeFd, -1>;
} // namespace shk
| #pragma once
#include <util/raii_helper.h>
namespace shk {
namespace detail {
void closeFd(int fd);
} // namespace detail
using FileDescriptor = RAIIHelper<int, void, detail::closeFd, -1>;
} // namespace shk
|
Add SDK IF_ELSE and USAGE macros | #pragma once
#include "util/none.h"
#ifdef PBL_SDK_3
#define SDK_SELECT(sdk3, sdk2) sdk3
#elif PBL_SDK_2
#define SDK_SELECT(sdk3, sdk2) sdk2
#endif
| #pragma once
#include "util/none.h"
#ifdef PBL_SDK_3
#define SDK_SELECT(sdk3, sdk2) sdk3
#define IF_SDK_3_ELSE(sdk3, other) sdk3
#define IF_SDK_2_ELSE(sdk2, other) other
#define SDK_3_USAGE
#define SDK_2_USAGE __attribute__((unused))
#elif PBL_SDK_2
#define SDK_SELECT(sdk3, sdk2) sdk2
#define IF_SDK_3_ELSE(sdk3, othe... |
Add bugfix version to match package version parity | #ifndef PHP_FAST_ASSERT_H
#define PHP_FAST_ASSERT_H
#define PHP_FAST_ASSERT_VERSION "0.1"
#define PHP_FAST_ASSERT_EXTNAME "fast_assert"
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
extern "C" {
#include "php.h"
}
typedef struct _fast_assert_globals {
// global object handles pointing to the 3 commonly used asse... | #ifndef PHP_FAST_ASSERT_H
#define PHP_FAST_ASSERT_H
#define PHP_FAST_ASSERT_VERSION "0.1.1"
#define PHP_FAST_ASSERT_EXTNAME "fast_assert"
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
extern "C" {
#include "php.h"
}
typedef struct _fast_assert_globals {
// global object handles pointing to the 3 commonly used as... |
Remove now needless debug spam | #include <kotaka/paths.h>
#include <kotaka/privilege.h>
#include <kotaka/bigstruct.h>
#include <kotaka/log.h>
inherit LIB_INITD;
inherit UTILITY_COMPILE;
static void create()
{
load_dir("obj", 1);
load_dir("sys", 1);
}
void full_reset()
{
object turkeylist;
object cursor;
object first;
object this;
ACCESS_CH... | #include <kotaka/paths.h>
#include <kotaka/privilege.h>
#include <kotaka/bigstruct.h>
#include <kotaka/log.h>
inherit LIB_INITD;
inherit UTILITY_COMPILE;
static void create()
{
load_dir("obj", 1);
load_dir("sys", 1);
}
void full_reset()
{
object turkeylist;
object cursor;
object first;
object this;
ACCESS_CH... |
Adjust Speed min/max Adjust Gas min/max Use other Pins for gear forwards/backwards | #define PIN_GAS_PEDAL A0
#define PIN_BATTERY_VOLTAGE A1
#define PIN_CW 5
#define PIN_CCW 6
#define PIN_SWITCH_FORWARDS 12
#define PIN_SWITCH_BACKWARDS 13
#define GAS_VALUE_MIN 442
#define GAS_VALUE_MAX 520
#define BATTERY_READING_12V 670
#define BATTERY_READING_6V 331
#define BATTERY_VOLTAGE_MIN 11
#define SPEED_... | #define PIN_GAS_PEDAL A0
#define PIN_BATTERY_VOLTAGE A1
#define PIN_CW 5
#define PIN_CCW 6
#define PIN_SWITCH_FORWARDS 10
#define PIN_SWITCH_BACKWARDS 11
#define GAS_VALUE_MIN 446
#define GAS_VALUE_MAX 510
#define BATTERY_READING_12V 670
#define BATTERY_READING_6V 331
#define BATTERY_VOLTAGE_MIN 11
#define SPEED_... |
Test to see whether or not there are memory leaks. | #include <stdio.h>
#include "sass_interface.h"
int main(int argc, char** argv)
{
if (argc < 2) {
printf("Hey, I need an input file!\n");
return 0;
}
while (1) {
struct sass_file_context* ctx = sass_new_file_context();
ctx->options.include_paths = "::/blah/bloo/fuzz:/slub/flub/chub::/Users/Aaron/dev/... | |
Change the reported openssh release string to indicate the barrelfish port. | /* $OpenBSD: version.h,v 1.64 2012/02/09 20:00:18 markus Exp $ */
#define SSH_VERSION "OpenSSH_6.0"
#define SSH_PORTABLE "p1"
#define SSH_RELEASE SSH_VERSION SSH_PORTABLE
| /* $OpenBSD: version.h,v 1.64 2012/02/09 20:00:18 markus Exp $ */
#define SSH_VERSION "OpenSSH_6.0"
#define SSH_PORTABLE "p1"
#define SSH_PORT_NOTE "Barrelfish port"
#define SSH_RELEASE SSH_VERSION SSH_PORTABLE SSH_PORT_NOTE
|
Convert demo project to ARC. | //
// SVProgressHUDAppDelegate.h
// SVProgressHUD
//
// Created by Sam Vermette on 27.03.11.
// Copyright 2011 Sam Vermette. All rights reserved.
//
#import <UIKit/UIKit.h>
@class ViewController;
@interface AppDelegate : NSObject <UIApplicationDelegate> {
UIWindow *window;
ViewController *viewController;... | //
// SVProgressHUDAppDelegate.h
// SVProgressHUD
//
// Created by Sam Vermette on 27.03.11.
// Copyright 2011 Sam Vermette. All rights reserved.
//
#import <UIKit/UIKit.h>
@class ViewController;
@interface AppDelegate : NSObject <UIApplicationDelegate> {
UIWindow *__weak window;
ViewController *__weak v... |
Test for presence of new sodium_runtime_has_*() functions |
#define TEST_NAME "sodium_core"
#include "cmptest.h"
int main(void)
{
printf("%d\n", sodium_init());
(void)sodium_runtime_has_neon();
(void)sodium_runtime_has_sse2();
(void)sodium_runtime_has_sse3();
return 0;
}
|
#define TEST_NAME "sodium_core"
#include "cmptest.h"
int main(void)
{
printf("%d\n", sodium_init());
(void)sodium_runtime_has_neon();
(void)sodium_runtime_has_sse2();
(void)sodium_runtime_has_sse3();
(void)sodium_runtime_has_pclmul();
(void)sodium_runtime_has_aesni();
return 0;
}
|
Fix example build under clang | #include <assert.h>
#include <inform/dist.h>
#include <math.h>
int main()
{
inform_dist *dist = inform_dist_create((uint32_t[4]){3, 0, 1, 2}, 4);
assert(abs(inform_dist_prob(dist, 0) - 0.5) < 1e-6);
assert(abs(inform_dist_prob(dist, 1) - 0.0) < 1e-6);
assert(abs(inform_dist_prob(dist, 2) - 0.1666... | #include <assert.h>
#include <inform/dist.h>
#include <math.h>
int main()
{
inform_dist *dist = inform_dist_create((uint32_t[4]){3, 0, 1, 2}, 4);
assert(fabs(inform_dist_prob(dist, 0) - 0.5) < 1e-6);
assert(fabs(inform_dist_prob(dist, 1) - 0.0) < 1e-6);
assert(fabs(inform_dist_prob(dist, 2) - 0.1... |
Add a test for fq_pth_root. | /*=============================================================================
This file is part of FLINT.
FLINT is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, ... | |
Add a header file for users to include. | /*
Copyright (c) 2015 ThreadScan authors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribu... | |
Add declaration header file for token space. | /** @file
GUID for PcAtChipsetPkg PCD Token Space
Copyright (c) 2009, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license ... | |
Add NULL dereferenced top value test | #include <assert.h>
#include <stddef.h>
int main() {
int r; // rand
int i = 0;
int *p;
if (r)
p = &i;
else
p = NULL;
if (*p == 2) // WARN
assert(1); // reachable (via UB)
return 0;
}
| |
Split up C++ program into separate files and put its components into proper places. | //
// mysociety_error.cpp:
// Some helpers.
//
// Copyright (c) 2009 UK Citizens Online Democracy. All rights reserved.
// Email: francis@mysociety.org; WWW: http://www.mysociety.org/
//
// $Id: mysociety_error.h,v 1.1 2009-03-23 09:30:06 francis Exp $
//
#include <string>
#if defined(OUTPUT_ROUTE_DETAILS) or defined... | |
Use CLOCK_REALTIME if CLOCK_MONOTONIC is not available. | #ifndef COMPAT_H
#define COMPAT_H
#ifndef HAVE_PLEDGE
#include "pledge.h"
#endif
#ifndef HAVE_STRTONUM
#include "strtonum.h"
#endif
#ifndef timespecsub
#define timespecsub(tsp, usp, vsp) \
do { \
(vsp)->tv_sec = (tsp)->tv_sec - (usp)->tv_sec; \
(vsp)->tv_nsec = (tsp)->tv_nsec - (usp)->tv_nsec; \
i... | #ifndef COMPAT_H
#define COMPAT_H
#ifndef HAVE_PLEDGE
#include "pledge.h"
#endif
#ifndef HAVE_STRTONUM
#include "strtonum.h"
#endif
/* Use CLOCK_REALTIME if CLOCK_MONOTONIC is not available */
#ifndef CLOCK_MONOTONIC
#define CLOCK_MONOTONIC CLOCK_REALTIME
#endif
#ifndef timespecsub
#define timespecsub(tsp, usp, vsp... |
Add solution to Exercise 2-2. | /* A solution to Exercise 2-2 in The C Programming Language (Second Edition).
*/
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
uint32_t i = 0;
uint32_t lim = 100;
char c = 0;
char s[lim];
while (i < (lim - 1)) {
c = getchar();
if (c != '\n') {
if (c != EOF) {
... | |
Disable this test on win32. My "sleep 2" trick didn't seem to work | // RUN: mkdir -p %t.dir
// RUN: echo '#include "header2.h"' > %t.dir/header1.h
// RUN: echo > %t.dir/header2.h
// RUN: cp %s %t.dir/t.c
// RUN: %clang_cc1 -x c-header %t.dir/header1.h -emit-pch -o %t.pch
// RUN: sleep 2
// RUN: echo >> %t.dir/header2.h
// RUN: %clang_cc1 %t.dir/t.c -include-pch %t.pch -fsyntax-only 2>&... | // RUN: mkdir -p %t.dir
// RUN: echo '#include "header2.h"' > %t.dir/header1.h
// RUN: echo > %t.dir/header2.h
// RUN: cp %s %t.dir/t.c
// RUN: %clang_cc1 -x c-header %t.dir/header1.h -emit-pch -o %t.pch
// RUN: echo >> %t.dir/header2.h
// RUN: %clang_cc1 %t.dir/t.c -include-pch %t.pch -fsyntax-only 2>&1 | FileCheck %s... |
Test int64_t -> long double | #include "src/math/reinterpret.h"
#include <stdint.h>
#include <assert.h>
int64_t __fixtfdi(long double);
static _Bool run(int64_t a)
{
return a == __fixtfdi(a);
}
int main(void)
{
const int64_t delta = 0x0000002BA87B5A22;
assert(run(INT64_MAX));
assert(run(INT64_MIN));
for (int64_t i = 0x3FFFF... | |
Set currentStatus public and add default value | //
// ofxSocketIO.h
//
// Created by hugohil on 05/02/16.
//
//
#pragma once
#include "ofMain.h"
#include "ofEvents.h"
#if defined(_MSC_VER) || defined(_WIN32) || defined(WIN32) || defined(__MINGW32__)
// Windows stuff
#else
// Linux and OSX here
#include <sio_client.h>
#endif
#include "ofxSocketIOData.h"
cla... | //
// ofxSocketIO.h
//
// Created by hugohil on 05/02/16.
//
//
#pragma once
#include "ofMain.h"
#include "ofEvents.h"
#if defined(_MSC_VER) || defined(_WIN32) || defined(WIN32) || defined(__MINGW32__)
// Windows stuff
#else
// Linux and OSX here
#include <sio_client.h>
#endif
#include "ofxSocketIOData.h"
cla... |
Add traits for befriendable concepts. | #ifndef VAST_ACCESS_H
#define VAST_ACCESS_H
namespace vast {
/// Wrapper to encapsulate the implementation of concepts requiring access to
/// private state.
struct access
{
template <typename, typename = void>
struct state;
template <typename, typename = void>
struct parsable;
template <typename, typenam... | #ifndef VAST_ACCESS_H
#define VAST_ACCESS_H
namespace vast {
/// Wrapper to encapsulate the implementation of concepts requiring access to
/// private state.
struct access
{
template <typename, typename = void>
struct state;
template <typename, typename = void>
struct parser;
template <typename, typename ... |
Fix name of C function | #include "erl_nif.h"
#include <sodium.h>
#include "hash.h"
ERL_NIF_TERM enacl_crypto_hash_nif(ErlNifEnv *env, int argc,
ERL_NIF_TERM const argv[]) {
ErlNifBinary input;
ErlNifBinary result;
ERL_NIF_TERM ret;
if ((argc != 1) || (!enif_inspect_iolist_as_binary(env, argv[0], ... | #include "erl_nif.h"
#include <sodium.h>
#include "hash.h"
ERL_NIF_TERM enacl_crypto_hash(ErlNifEnv *env, int argc,
ERL_NIF_TERM const argv[]) {
ErlNifBinary input;
ErlNifBinary result;
ERL_NIF_TERM ret;
if ((argc != 1) || (!enif_inspect_iolist_as_binary(env, argv[0], &input))... |
Add test for bug parsing typenames in structs | /*
name: TEST040
description: Test for bug parsing typenames in struct definition
output:
*/
typedef struct List List;
struct List {
int len;
struct List *head;
};
| |
Fix debugging printouts when running tests. | #include "log.h"
#include <stdio.h>
void debug(const char* format, ...) {
#ifdef __DEBUG__
vprintf(format, args);
#endif // __DEBUG__
}
void initializeLogging() { }
| #include "log.h"
#include <stdio.h>
#include <stdarg.h>
void debug(const char* format, ...) {
#ifdef __DEBUG__
va_list args;
va_start(args, format);
vprintf(format, args);
va_end(args);
#endif // __DEBUG__
}
void initializeLogging() { }
|
Make the remove*OnSignal functions deal with Paths not strings | //===- llvm/System/Signals.h - Signal Handling support ----------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file was developed by the LLVM research group and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
//
//===--------... | //===- llvm/System/Signals.h - Signal Handling support ----------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file was developed by the LLVM research group and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
//
//===--------... |
Add new future syntax for 'new' in Future folder | /*
* Copyright (C) 2016 Bastien Penavayre
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, ... | |
Revert "players number changed, for some tests" | #include "builder.h"
#include "entity/board.h"
/**
* A small board has 4 cells, and its layout is a square.
* 1 ----- 2
* | |
* | |
* | |
* 4 ----- 3
*/
int builder_create_small_board(s_board *b)
{
int c;
uint8_t nb_max_players;
nb_max_players = 4;
init_board(b, SMALL_BOARD_NB_CELLS, nb_m... | #include "builder.h"
#include "entity/board.h"
/**
* A small board has 4 cells, and its layout is a square.
* 1 ----- 2
* | |
* | |
* | |
* 4 ----- 3
*/
int builder_create_small_board(s_board *b)
{
int c;
uint8_t nb_max_players;
nb_max_players = 2;
init_board(b, SMALL_BOARD_NB_CELLS, nb_m... |
Add helper function to map from bitrate values to zephyr cfg | /*
* Copyright (c) 2017 Linaro Limited
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef _I2C_PRIV_H_
#define _I2C_PRIV_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <i2c.h>
#include <dt-bindings/i2c/i2c.h>
#ifndef SYS_LOG_LEVEL
#define SYS_LOG_LEVEL CONFIG_SYS_LOG_I2C_LEVEL
#endif
#include <logging/sys_l... | |
Add missing event reporting code. | /*
* Copyright (c) 2005 David Xu
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions ... | |
Add a todo for more useful Python exception output | /*ckwg +5
* Copyright 2012 by Kitware, Inc. All Rights Reserved. Please refer to
* KITWARE_LICENSE.TXT for licensing information, or contact General Counsel,
* Kitware, Inc., 28 Corporate Drive, Clifton Park, NY 12065.
*/
#ifndef VISTK_PYTHON_HELPERS_EXCEPTIONS_H
#define VISTK_PYTHON_HELPERS_EXCEPTIONS_H
#define ... | /*ckwg +5
* Copyright 2012 by Kitware, Inc. All Rights Reserved. Please refer to
* KITWARE_LICENSE.TXT for licensing information, or contact General Counsel,
* Kitware, Inc., 28 Corporate Drive, Clifton Park, NY 12065.
*/
#ifndef VISTK_PYTHON_HELPERS_EXCEPTIONS_H
#define VISTK_PYTHON_HELPERS_EXCEPTIONS_H
/// \tod... |
Change the return type to bool. | #ifndef SCC_SEMANTIC_HEADER
#define SCC_SEMANTIC_HEADER
#include <stdio.h>
#include "syntax.h"
#include "symboltable.h"
int semantic_analysis(Syntax * top_level);
#endif
| #ifndef SCC_SEMANTIC_HEADER
#define SCC_SEMANTIC_HEADER
#include <stdio.h>
#include <stdbool.h>
#include "syntax.h"
#include "symboltable.h"
bool semantic_analysis(Syntax * top_level);
#endif
|
Add declaration of lift function | #ifndef RSTORE_UITLS_H
#define RSTORE_UITLS_H
#include <RStore.h>
#include <ParsedRStore.h>
RS_RStore RS_lowerRStore(PRS_RStore store);
#endif
| #ifndef RSTORE_UITLS_H
#define RSTORE_UITLS_H
#include <RStore.h>
#include <ParsedRStore.h>
RS_RStore RS_lowerRStore(PRS_RStore store);
PRS_RStore RS_liftRStore(RS_RStore store);
#endif
|
Allow external contributions on src/main/native | // Copyright 2014 Google Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable ... | // Copyright 2014 Google Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable ... |
Include http_parser.h from the right spot (public header copied to framework headers) | //
// SwiftyHTTP.h
// SwiftyHTTP
//
// Created by Helge Hess on 6/25/14.
// Copyright (c) 2014 Always Right Institute. All rights reserved.
//
#import <Cocoa/Cocoa.h>
//! Project version number for SwiftyHTTP.
FOUNDATION_EXPORT double SwiftyHTTPVersionNumber;
//! Project version string for SwiftyHTTP.
FOUNDATION... | //
// SwiftyHTTP.h
// SwiftyHTTP
//
// Created by Helge Hess on 6/25/14.
// Copyright (c) 2014 Always Right Institute. All rights reserved.
//
#import <Cocoa/Cocoa.h>
//! Project version number for SwiftyHTTP.
FOUNDATION_EXPORT double SwiftyHTTPVersionNumber;
//! Project version string for SwiftyHTTP.
FOUNDATION... |
Synchronize the mailbox after expunging messages to actually get them expunged. | /* Copyright (c) 2002-2008 Dovecot authors, see the included COPYING file */
#include "common.h"
#include "commands.h"
#include "imap-expunge.h"
bool cmd_close(struct client_command_context *cmd)
{
struct client *client = cmd->client;
struct mailbox *mailbox = client->mailbox;
struct mail_storage *storage;
if (!... | /* Copyright (c) 2002-2008 Dovecot authors, see the included COPYING file */
#include "common.h"
#include "commands.h"
#include "imap-expunge.h"
bool cmd_close(struct client_command_context *cmd)
{
struct client *client = cmd->client;
struct mailbox *mailbox = client->mailbox;
struct mail_storage *storage;
if (!... |
Add useless bootlader header needed to merge with google code. | #ifndef BOARD_H
#define BOARD_H
// USARTs
#if xplain == TARGET
#define BL_PORT PORTF
#define BL_DIR BL_PORT.DIR
#define BL_IN BL_PORT.IN
#define BL_OUT BL_PORT.OUT
#define BL_0_PIN 0
#define BL_1_PIN 1
#define BL_2_PIN 2
#define APP_PIN 3
... | |
Fix build for boost 1.66 | --- src/txmempool.h.orig 2018-01-11 20:38:04 UTC
+++ src/txmempool.h
@@ -241,7 +241,7 @@ public:
class CompareTxMemPoolEntryByScore
{
public:
- bool operator()(const CTxMemPoolEntry& a, const CTxMemPoolEntry& b)
+ bool operator()(const CTxMemPoolEntry& a, const CTxMemPoolEntry& b) const
{
double ... | --- src/txmempool.h.orig 2018-01-11 20:38:04 UTC
+++ src/txmempool.h
@@ -204,7 +204,7 @@ struct mempoolentry_txid
class CompareTxMemPoolEntryByDescendantScore
{
public:
- bool operator()(const CTxMemPoolEntry& a, const CTxMemPoolEntry& b)
+ bool operator()(const CTxMemPoolEntry& a, const CTxMemPoolEntry& b) co... |
Check if options is nullptr in DatasetBase | #pragma once
#include "common/definitions.h"
#include "data/batch.h"
#include "data/rng_engine.h"
#include "data/vocab.h"
#include "training/training_state.h"
namespace marian {
namespace data {
template <class Sample, class Iterator, class Batch>
class DatasetBase {
protected:
// Data processing may differ in tra... | #pragma once
#include "common/definitions.h"
#include "data/batch.h"
#include "data/rng_engine.h"
#include "data/vocab.h"
#include "training/training_state.h"
namespace marian {
namespace data {
template <class Sample, class Iterator, class Batch>
class DatasetBase {
protected:
// Data processing may differ in tra... |
Check handling of arrays of variable sized components. | // RUN: %llvmgcc -S %s -O2 -o - | grep {ret i8 0}
static char c(int n) {
char x[2][n];
x[1][0]=0;
return *(n+(char *)x);
}
char d(void) {
return c(2);
}
| |
Add one call to yaz_mutex_destroy in test | /* This file is part of the YAZ toolkit.
* Copyright (C) 1995-2010 Index Data
* See the file LICENSE for details.
*/
#include <stdlib.h>
#include <stdio.h>
#include <yaz/mutex.h>
#include <yaz/test.h>
#include <yaz/log.h>
static void tst(void)
{
YAZ_MUTEX p = 0;
yaz_mutex_create(&p);
YAZ_CHECK(p);
... | /* This file is part of the YAZ toolkit.
* Copyright (C) 1995-2010 Index Data
* See the file LICENSE for details.
*/
#include <stdlib.h>
#include <stdio.h>
#include <yaz/mutex.h>
#include <yaz/test.h>
#include <yaz/log.h>
static void tst(void)
{
YAZ_MUTEX p = 0;
yaz_mutex_create(&p);
YAZ_CHECK(p);
... |
Add solution to Exercise 1-10. | /* Exercise 1-10: Write a program to copy its input to its output, replacing
* each tab by \t, each backspace by \b, and each backslash by \\. This makes
* tabs and backspaces visible in an unambiguous way. */
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char **argv)
{
int16_t cha... | |
Add FS defines, move includes, add member functions | #ifndef _GEN_H
#define _GEN_H
#define MAKEFILE "Makefile"
#include <fstream>
#include <sys/param.h>
class Generate
{
public:
char cwd[MAXPATHLEN];
const char *defaultMakefile;
FILE *Makefile;
FILE *newConfig;
Generate();
~Generate();
char *DefineBaseDir();
void WriteMake();
void GenBlankConfig();
void Chec... | #ifndef _GEN_H
#define _GEN_H
#define MAKEFILE "Makefile"
#define FS_NONE 0
#define FS_RECURSIVE (1 << 0)
#define FS_DEFAULT FS_RECURSIVE
#define FS_FOLLOWLINK (1 << 1)
#define FS_DOTFILES (1 << 2)
#define FS_MATCHDIRS (1 << 3)
#include <regex.h>
#include <unistd.h>
#include <sys/param.h>
#include <fstream>
class Ge... |
Fix sprite clipping by using signed rect width | #ifndef INCLUDE_GRAPHICS_H
#define INCLUDE_GRAPHICS_H
namespace WalrusRPG
{
namespace Graphics
{
typedef struct Rect Rect_t;
struct Rect
{
int x, y;
unsigned w, h;
};
/*
* Buffer management
*/
void buffer_allocate();
void buf... | #ifndef INCLUDE_GRAPHICS_H
#define INCLUDE_GRAPHICS_H
namespace WalrusRPG
{
namespace Graphics
{
typedef struct Rect Rect_t;
struct Rect
{
int x, y;
int w, h;
};
/*
* Buffer management
*/
void buffer_allocate();
void buffer_f... |
Add override keywork to CDSNotificationInterface::NotifyChainLock | // Copyright (c) 2015 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef BITCOIN_DSNOTIFICATIONINTERFACE_H
#define BITCOIN_DSNOTIFICATIONINTERFACE_H
#include "validationinterface.h"
class CDSNo... | // Copyright (c) 2015 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef BITCOIN_DSNOTIFICATIONINTERFACE_H
#define BITCOIN_DSNOTIFICATIONINTERFACE_H
#include "validationinterface.h"
class CDSNo... |
Make the hostname probe for real | #include <sys/utsname.h>
#include <libopticonf/var.h>
#include "probes.h"
/** List of built-in probe functions */
builtinfunc BUILTINS[] = {
{"probe_pcpu", runprobe_pcpu},
{"probe_hostname", runprobe_hostname},
{"probe_uname", runprobe_uname},
{NULL, NULL}
};
var *runprobe_pcpu (probe *self) {
var... | #include <sys/utsname.h>
#include <unistd.h>
#include <libopticonf/var.h>
#include "probes.h"
/** List of built-in probe functions */
builtinfunc BUILTINS[] = {
{"probe_pcpu", runprobe_pcpu},
{"probe_hostname", runprobe_hostname},
{"probe_uname", runprobe_uname},
{NULL, NULL}
};
var *runprobe_pcpu (pr... |
Use the imperfect snprintf(3) instead of sprintf(3). |
/*
* m_name.c -- return a message number as a string
*
* This code is Copyright (c) 2002, by the authors of nmh. See the
* COPYRIGHT file in the root directory of the nmh distribution for
* complete copyright information.
*/
#include <limits.h>
#include <h/mh.h>
#define STR(s) #s
#define SIZE(n) (sizeof STR(n... |
/*
* m_name.c -- return a message number as a string
*
* This code is Copyright (c) 2002, by the authors of nmh. See the
* COPYRIGHT file in the root directory of the nmh distribution for
* complete copyright information.
*/
#include <limits.h>
#include <h/mh.h>
#define STR(s) #s
#define SIZE(n) (sizeof STR(n... |
Move OptionsDialog::queryViewTypes into public bool method | #pragma once
#include <QtWidgets/QComboBox>
#include <QtWidgets/QDialog>
#include <QtWidgets/QLabel>
#include <QtCore/QObject>
#include <QtCore/QString>
#include <QtWidgets/QTabWidget>
#include <QtWidgets/QWidget>
#include "binaryninjaapi.h"
#include "viewtype.h"
#include "filecontext.h"
#include <string>
#include <t... | #pragma once
#include <QtWidgets/QComboBox>
#include <QtWidgets/QDialog>
#include <QtWidgets/QLabel>
#include <QtCore/QObject>
#include <QtCore/QString>
#include <QtWidgets/QTabWidget>
#include <QtWidgets/QWidget>
#include "binaryninjaapi.h"
#include "viewtype.h"
#include "filecontext.h"
#include <string>
#include <t... |
Change object to string input | #include "mruby.h"
#include "mruby/irep.h"
#include "mruby/string.h"
#include "simple_module_mrb.h"
static mrb_value foo_bar(mrb_state* mrb, mrb_value obj)
{
mrb_value message;
mrb_get_args(mrb, "o", &message);
if (!mrb_nil_p(message))
{
fprintf(stderr, "bar: %s\n", mrb_str_ptr(message)->ptr);
}
ret... | #include "mruby.h"
#include "mruby/irep.h"
#include "mruby/string.h"
#include "simple_module_mrb.h"
static mrb_value foo_bar(mrb_state* mrb, mrb_value obj)
{
mrb_value message;
mrb_get_args(mrb, "S", &message);
if (!mrb_nil_p(message))
{
fprintf(stderr, "bar: %s\n", mrb_str_ptr(message)->ptr);
}
ret... |
Enable more time on aspiration failure | #ifndef _CONFIG_H
#define _CONFIG_H
#define ENABLE_FUTILITY_DEPTH 4
#define ENABLE_HISTORY 1
#define ENABLE_KILLERS 1
#define ENABLE_LMR 1
#define ENABLE_NNUE 0
#define ENABLE_NNUE_SIMD 0
#define ENABLE_NULL_MOVE_PRUNING 1
#define ENABLE_REVERSE_FUTILITY_DEPTH 4
#define ENABLE_SEE_Q_PRUNE_LOSING_CAPTURES 1
#define ENA... | #ifndef _CONFIG_H
#define _CONFIG_H
#define ENABLE_FUTILITY_DEPTH 4
#define ENABLE_HISTORY 1
#define ENABLE_KILLERS 1
#define ENABLE_LMR 1
#define ENABLE_NNUE 0
#define ENABLE_NNUE_SIMD 0
#define ENABLE_NULL_MOVE_PRUNING 1
#define ENABLE_REVERSE_FUTILITY_DEPTH 4
#define ENABLE_SEE_Q_PRUNE_LOSING_CAPTURES 1
#define ENA... |
Add "name" property for convenience. | //
// C3DObject.h
// Cocoa3D
//
// Created by Brent Gulanowski on 2014-07-11.
// Copyright (c) 2014 Lichen Labs. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <Cocoa3D/C3DCamera.h>
@class C3DIndexBuffer, C3DNode, C3DProgram, C3DVertexBuffer;
@interface C3DObject : NSObject<C3DVisible>
@prop... | //
// C3DObject.h
// Cocoa3D
//
// Created by Brent Gulanowski on 2014-07-11.
// Copyright (c) 2014 Lichen Labs. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <Cocoa3D/C3DCamera.h>
@class C3DIndexBuffer, C3DNode, C3DProgram, C3DVertexBuffer;
@interface C3DObject : NSObject<C3DVisible>
@prop... |
Include DmiDevice as part of global includes | /*
* This file is part of linux-driver-management.
*
* Copyright © 2016-2017 Ikey Doherty
*
* linux-driver-management is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1
* of the ... | /*
* This file is part of linux-driver-management.
*
* Copyright © 2016-2017 Ikey Doherty
*
* linux-driver-management is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1
* of the ... |
Change from plend1 to plend to generate errors for devices that have trouble for that case. | /* $Id$
plend and plend1 testing demo.
*/
#include "plcdemos.h"
/*--------------------------------------------------------------------------*\
* main
*
* Demonstrates absolute positioning of graphs on a page.
\*--------------------------------------------------------------------------*/
int
main(int argc, const... | /* $Id$
plend and plend1 testing demo.
*/
#include "plcdemos.h"
/*--------------------------------------------------------------------------*\
* main
*
* Demonstrates absolute positioning of graphs on a page.
\*--------------------------------------------------------------------------*/
int
main(int argc, const... |
Stop using __strtonum_fallback on Android. | // -*- C++ -*-
//===------------------- support/android/locale_bionic.h ------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===-------------------------... | // -*- C++ -*-
//===------------------- support/android/locale_bionic.h ------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===-------------------------... |
Fix bug: Parser<Success>::operator() was not public | // DESCRIPTION
//
#ifndef HITTOP_PARSER_SUCCESS_H
#define HITTOP_PARSER_SUCCESS_H
#include <iterator>
#include "hittop/parser/parser.h"
namespace hittop {
namespace parser {
struct Success {};
// Always succeed, consuming no input.
template <> class Parser<Success> {
template <typename Range>
auto operator()(c... | // DESCRIPTION
//
#ifndef HITTOP_PARSER_SUCCESS_H
#define HITTOP_PARSER_SUCCESS_H
#include <iterator>
#include "hittop/parser/parser.h"
namespace hittop {
namespace parser {
struct Success {};
// Always succeed, consuming no input.
template <> class Parser<Success> {
public:
template <typename Range>
auto oper... |
Fix build failure from r265600 | //===- ScriptParser.h -------------------------------------------*- C++ -*-===//
//
// The LLVM Linker
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------... | //===- ScriptParser.h -------------------------------------------*- C++ -*-===//
//
// The LLVM Linker
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------... |
Check readstat_calloc for 0-sized input | #include <stdlib.h>
#define MAX_MALLOC_SIZE (1<<20) /* One megabyte ought to be enough for anyone */
void *readstat_malloc(size_t len) {
if (len > MAX_MALLOC_SIZE || len == 0) {
return NULL;
}
return malloc(len);
}
void *readstat_calloc(size_t count, size_t size) {
if (count > MAX_MALLOC_SIZE... | #include <stdlib.h>
#define MAX_MALLOC_SIZE (1<<20) /* One megabyte ought to be enough for anyone */
void *readstat_malloc(size_t len) {
if (len > MAX_MALLOC_SIZE || len == 0) {
return NULL;
}
return malloc(len);
}
void *readstat_calloc(size_t count, size_t size) {
if (count > MAX_MALLOC_SIZE... |
Remove stray word 'runtime' from comment | // The Tree-sitter runtime library can be built by compiling this
// one source file.
//
// The following directories must be added to the include path:
// - src
// - include
// - externals/utf8proc
#include "./get_changed_ranges.c"
#include "./language.c"
#include "./lexer.c"
#include "./node.c"
#include "./par... | // The Tree-sitter library can be built by compiling this one source file.
//
// The following directories must be added to the include path:
// - src
// - include
// - externals/utf8proc
#include "./get_changed_ranges.c"
#include "./language.c"
#include "./lexer.c"
#include "./node.c"
#include "./parser.c"
#inc... |
Change indent and comments to a more readable style | #include "gc.h"
#include "tree.h"
#include "dict.h"
#include "match.h"
#include "optimize.h"
/* We recursively iterate through all
* rules on all the children of the tree
* until the expression is irreducible,
* i.e. stops changing.
*
* Also, we (try to) apply the optimization
* routine.
*/
int apply_rules... | #include "gc.h"
#include "tree.h"
#include "dict.h"
#include "match.h"
#include "optimize.h"
/*
* We recursively iterate through all
* rules on all the children of the tree
* until the expression is irreducible,
* i.e. stops changing.
*
* Also, we (try to) apply the optimization
* routine.
*/
int apply_rules... |
Make class more C++11 compliant | #include <atomic>
namespace ROOT {
/// A spin mutex class which respects the STL interface.
class TSpinMutex {
public:
TSpinMutex() noexcept {}
TSpinMutex(const TSpinMutex&) = delete;
TSpinMutex( TSpinMutex && ) = delete;
~TSpinMutex(){}
void lock(){while (fAFlag.test_and_set(std... | #ifndef ROOT_TSpinMutex
#define ROOT_TSpinMutex
#include <atomic>
namespace ROOT {
/// A spin mutex class which respects the STL interface.
class TSpinMutex {
public:
TSpinMutex() = default;
TSpinMutex(const TSpinMutex&) = delete;
~TSpinMutex(){}
TSpinMutex& operator=(const TSpinMutex... |
Remove logging definition from config | #ifndef _R2BOT_CONFIG
#define _R2BOT_CONFIG
#define _WINSOCK_DEPRECATED_NO_WARNINGS
// Logging
#ifndef LOGGING
# define LOGGING 0
#endif
// Define / undefine these for your own use
#define USE_KINECT1
#define USE_KINECT2
#define USE_MOTORS
#define USE_ULTRASONIC
#define USE_R2SERVER
#endif | #ifndef _R2BOT_CONFIG
#define _R2BOT_CONFIG
#define _WINSOCK_DEPRECATED_NO_WARNINGS
// Define / undefine these for your own use
#define USE_KINECT1
#define USE_KINECT2
#define USE_MOTORS
#define USE_ULTRASONIC
#define USE_R2SERVER
#endif |
Test program for playing around with (p)select. | #include <stdio.h>
#include <sys/select.h>
/* pselect loop test */
int main(int argc, char *argv[])
{
struct timespec timeout;
fd_set readfds;
int fdcount;
while(1){
FD_ZERO(&readfds);
FD_SET(0, &readfds);
timeout.tv_sec = 1;
timeout.tv_nsec = 0;
fdcount = pselect(1, &readfds, NULL, NULL, &timeout, NUL... | |
Load and configure core map. | #include "ensemble.h"
void c_main( void ) {
// Set the system up
address_t address = system_load_sram();
data_system ( region_start( 1, address ) );
data_get_bias ( region_start( 2, address ), g_ensemble.n_neurons );
data_get_encoders ( region_start( 3, address ), g_ensemble.n_neurons, g_n_input_di... | #include "ensemble.h"
void c_main( void ) {
// Set the system up
address_t address = system_load_sram();
data_system ( region_start( 1, address ) );
data_get_bias ( region_start( 2, address ), g_ensemble.n_neurons );
data_get_encoders ( region_start( 3, address ), g_ensemble.n_neurons, g_n_input_di... |
Add font change notifications to reflection view. | #pragma once
#include <QtGui/QMouseEvent>
#include <QtGui/QPaintEvent>
#include <QtWidgets/QWidget>
#include "binaryninjaapi.h"
#include "dockhandler.h"
#include "uitypes.h"
class ContextMenuManager;
class DisassemblyContainer;
class FlowGraphWidget;
class Menu;
class ViewFrame;
class BINARYNINJAUIAPI ReflectionVie... | #pragma once
#include <QtGui/QMouseEvent>
#include <QtGui/QPaintEvent>
#include <QtWidgets/QWidget>
#include "binaryninjaapi.h"
#include "dockhandler.h"
#include "uitypes.h"
class ContextMenuManager;
class DisassemblyContainer;
class FlowGraphWidget;
class Menu;
class ViewFrame;
class BINARYNINJAUIAPI ReflectionVie... |
Add hpc padding approach using omp | #include <stdio.h>
#include <omp.h>
static long num_steps = 1000000000;
double step;
#define NUM_THREADS 2
#define PAD 8
int main()
{
int i, nThreads;
double pi, sum[NUM_THREADS][PAD];
step = 1.0/(double) num_steps;
omp_set_num_threads(NUM_THREADS);
#pragma omp parallel
... | |
Fix for eps8266 and athers non avr mcu :) | /*
* File: Curve.h
* Author: cameron
*
* Created on October 22, 2013, 1:07 AM
*/
#ifndef CURVE_H
#define CURVE_H
#include <avr/pgmspace.h>
class Curve {
static const uint8_t etable[] PROGMEM;
public:
static uint8_t exponential(uint8_t);
static uint8_t linear(uint8_t);
static uint8_t reverse(uint8_t);
};
... | /*
* File: Curve.h
* Author: cameron
*
* Created on October 22, 2013, 1:07 AM
*/
#ifndef CURVE_H
#define CURVE_H
#if (defined(__AVR__))
#include <avr\pgmspace.h>
#else
#include <pgmspace.h>
#endif
class Curve {
static const uint8_t etable[] PROGMEM;
public:
static uint8_t exponential(uint8_t);
static uint... |
Make chrome use the static square vb when drawing rects. | #ifndef GrGLConfig_chrome_DEFINED
#define GrGLConfig_chrome_DEFINED
#define GR_SUPPORT_GLES2 1
// gl2ext.h will define these extensions macros but Chrome doesn't provide
// prototypes.
#define GL_OES_mapbuffer 0
#define GL_IMG_multisampled_render_to_texture 0
#include <GLES2/gl2.h>
#include <... | #ifndef GrGLConfig_chrome_DEFINED
#define GrGLConfig_chrome_DEFINED
#define GR_SUPPORT_GLES2 1
// gl2ext.h will define these extensions macros but Chrome doesn't provide
// prototypes.
#define GL_OES_mapbuffer 0
#define GL_IMG_multisampled_render_to_texture 0
#include <GLES2/gl2.h>
#include <... |
Implement the equivalent of chmod a+rX. | /* chmod_arx.c - the equivalent of chmod a+rX on the command line.
*
* The chmod(1) utility uses the chmod(2) system call to perform a series of
* changes on file permissions. Particularly, if you invoke it as in:
*
* $ chmod a+rX <files>
*
* it will give read permission for every type of user, and will give ... | |
Add inline annotation for base::MakeCriticalClosure() in platform other than ios. | // Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef BASE_CRITICAL_CLOSURE_H_
#define BASE_CRITICAL_CLOSURE_H_
#include "base/callback.h"
namespace base {
// Returns a closure that will contin... | // Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef BASE_CRITICAL_CLOSURE_H_
#define BASE_CRITICAL_CLOSURE_H_
#include "base/callback.h"
namespace base {
// Returns a closure that will contin... |
Use scoped_ptr for Panel in PanelBrowserWindowGTK. | // Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_UI_PANELS_PANEL_BROWSER_WINDOW_GTK_H_
#define CHROME_BROWSER_UI_PANELS_PANEL_BROWSER_WINDOW_GTK_H_
#include "chrome/browser/ui... | // Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_UI_PANELS_PANEL_BROWSER_WINDOW_GTK_H_
#define CHROME_BROWSER_UI_PANELS_PANEL_BROWSER_WINDOW_GTK_H_
#include "chrome/browser/ui... |
Add SK_API to null canvas create method | /*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SkNullCanvas_DEFINED
#define SkNullCanvas_DEFINED
#include "SkBitmap.h"
class SkCanvas;
/**
* Creates a canvas that draws nothing. This is useful for performance t... | /*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SkNullCanvas_DEFINED
#define SkNullCanvas_DEFINED
#include "SkBitmap.h"
class SkCanvas;
/**
* Creates a canvas that draws nothing. This is useful for performance t... |
Fix build after MacOS merge | /*
Copyright 2014 OpenMarket Ltd
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | /*
Copyright 2014 OpenMarket Ltd
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... |
Add problematic example due to widening :'( | // SKIP PARAM: --set ana.activated[+] apron --set ana.path_sens[+] threadflag --sets exp.apron.privatization mutex-meet-tid --set ana.activated[-] threadJoins
// Fig 5a from Miné 2014
#include <pthread.h>
#include <stdio.h>
int x;
pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
void *t_fun(void *arg) {
int top;
... | |
Add basic ScannerContext create / destroy functions | #include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "scanner.h"
/**
* Opens a file in read-only mode and creates a scanner context for it.
*/
ScannerContext* scanner_open(char* filename)
{
// open the given file
FILE* stream = fopen(filename, "r");
if (stream == NULL) ... | |
Write failing assert for count | #include<stdio.h>
#include<stdlib.h>
struct node {
int data;
struct node* next;
};
int Length(struct node* head) {
int count = 0;
struct node* current = head;
while (current != NULL) {
count++;
current=current->next;
}
return(count);
}
// Given a reference (pointer to pointer) to the head
// of ... | #include<stdio.h>
#include<stdlib.h>
#include<assert.h>
struct node {
int data;
struct node* next;
};
int Length(struct node* head) {
int count = 0;
struct node* current = head;
while (current != NULL) {
count++;
current=current->next;
}
return(count);
}
// Given a reference (pointer to pointer)... |
Fix Social framework headers to be self-contained. | //******************************************************************************
//
// Copyright (c) 2016 Microsoft Corporation. All rights reserved.
//
// This code is licensed under the MIT License (MIT).
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LI... | //******************************************************************************
//
// Copyright (c) 2016 Microsoft Corporation. All rights reserved.
//
// This code is licensed under the MIT License (MIT).
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LI... |
Add prefix file for ProjectBuilder samples | /*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2001-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of sou... | |
Increase UART transmit buffer size | /* Copyright 2018 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
/* Bip board configuration */
#ifndef __CROS_EC_BOARD_H
#define __CROS_EC_BOARD_H
/* Select Baseboard features */
#define VARIANT_OCTOPUS_EC_ITE8... | /* Copyright 2018 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
/* Bip board configuration */
#ifndef __CROS_EC_BOARD_H
#define __CROS_EC_BOARD_H
/* Select Baseboard features */
#define VARIANT_OCTOPUS_EC_ITE8... |
Add portable file to handle headless asserts etc. on Windows | #ifndef PCRT_H
#define PCRT_H
#ifdef __cplusplus
extern "C" {
#endif
/*
* Assertions and pointer violations in debug mode may trigger a dialog
* on Windows. When running headless this is not helpful, but
* unfortunately it cannot be disabled with a compiler option so code
* must be injected into the runtime earl... | |
Add enum for compaction table. | //===-- llvm/Bytecode/Format.h - VM bytecode file format info ---*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file was developed by the LLVM research group and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
//
//===--------... | //===-- llvm/Bytecode/Format.h - VM bytecode file format info ---*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file was developed by the LLVM research group and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
//
//===--------... |
Use stdbool.h for bool definition. | #ifndef _CGMINER_MINER_H
#define _CGMINER_MINER_H
#include <stdint.h>
struct work {
uint8_t *midstate;
uint8_t *data;
};
#ifndef MAX
#define MAX(a,b) ((a) < (b) ? (b) : (a))
#endif
#ifndef MIN
#define MIN(a,b) ((a) > (b) ? (b) : (a))
#endif
typedef enum {
false = 0,
true = 1
} bool;
#endif
| #ifndef _CGMINER_MINER_H
#define _CGMINER_MINER_H
#include <stdint.h>
#include <stdbool.h>
struct work {
uint8_t *midstate;
uint8_t *data;
};
#ifndef MAX
#define MAX(a,b) ((a) < (b) ? (b) : (a))
#endif
#ifndef MIN
#define MIN(a,b) ((a) > (b) ? (b) : (a))
#endif
#endif
|
Move things around the rxt_node struct and clean up comments. Breaks ABI. | #ifndef RADIXTREE
#define RADIXTREE
typedef struct rxt_node {
int color;
char *key; // only stores pos and beyond
int level; // tree level; for debug only
int parent_id; //for debug only
int pos;
void *value;
struct rxt_node *parent;
struct rxt_node *left;
struct rxt_node *right;
}r... | #ifndef RADIXTREE
#define RADIXTREE
typedef struct rxt_node {
int color;
char *key;
void *value;
int pos; // bit index of the key to compare at (critical position)
int level; // tree level; for debug only
int parent_id; //for debug only
struct rxt_node *parent;
struct rxt_node *left;
... |
Add a function to stringify boards. | #include <stdlib.h>
/**
* @author: Hendrik Werner
*/
#define BOARD_HEIGHT 50
#define BOARD_WIDTH 50
typedef struct Position {
int row;
int col;
} Position;
typedef enum Cell {
EMPTY
,SNAKE
,FOOD
} Cell;
typedef Cell Board[BOARD_HEIGHT][BOARD_WIDTH];
typedef enum Direction {LEFT, UP, RIGHT, DOWN} Direction;... | #include <stdlib.h>
/**
* @author: Hendrik Werner
*/
#define BOARD_HEIGHT 50
#define BOARD_WIDTH 50
typedef struct Position {
int row;
int col;
} Position;
typedef enum Cell {
EMPTY
,SNAKE
,FOOD
} Cell;
typedef Cell Board[BOARD_HEIGHT][BOARD_WIDTH];
typedef enum Direction {LEFT, UP, RIGHT, DOWN} Direction;... |
Fix missing ; in struct implementation | #include "stack.h"
struct Stack
{
size_t size;
size_t top;
void** e;
}
Stack* Stack_Create(size_t n)
{
Stack* s = (Stack *)malloc(sizeof(Stack));
s->size = n;
s->top = 0;
s->e = (void**)malloc(sizeof(void*) * (n + 1));
return s;
}
int Stack_Empty(Stack* s)
{
if (s->top == 0)
{
return 1;
} else {
retur... | #include "stack.h"
struct Stack
{
size_t size;
size_t top;
void** e;
};
Stack* Stack_Create(size_t n)
{
Stack* s = (Stack *)malloc(sizeof(Stack));
s->size = n;
s->top = 0;
s->e = (void**)malloc(sizeof(void*) * (n + 1));
return s;
}
int Stack_Empty(Stack* s)
{
if (s->top == 0)
{
return 1;
} else {
retu... |
Use new stack inspection function. Enable JIT compilation. | /*
* alpha/netbsd/jit-md.h
* NetBSD Alpha JIT configuration information.
*
* Copyright (c) 2001
* Edouard G. Parmelan. All rights reserved.
*
* Copyright (c) 2001
* Transvirtual Technologies, Inc. All rights reserved.
*
* See the file "license.terms" for information on usage and redistribution
* of this fi... | |
Use an assert() for the REQ() macro instead of making up our own assertion. |
/* Parse tree node interface */
#ifndef Py_NODE_H
#define Py_NODE_H
#ifdef __cplusplus
extern "C" {
#endif
typedef struct _node {
short n_type;
char *n_str;
int n_lineno;
int n_nchildren;
struct _node *n_child;
} node;
extern DL_IMPORT(node *) PyNode_New(int type);
extern DL_IMPORT(int) Py... |
/* Parse tree node interface */
#ifndef Py_NODE_H
#define Py_NODE_H
#ifdef __cplusplus
extern "C" {
#endif
typedef struct _node {
short n_type;
char *n_str;
int n_lineno;
int n_nchildren;
struct _node *n_child;
} node;
extern DL_IMPORT(node *) PyNode_New(int type);
extern DL_IMPORT(int) Py... |
Include glx as a gl-header | #ifndef GL_HEADERS_H
#define GL_HEADERS_H
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#else
#define WINGDIAPI KHRONOS_APICALL
#define APIENTRY KHRONOS_APIENTRY
#endif
#include <codegen/input/egl.h>
#include <codegen/input/eglext.h>
#include <codegen/input/GL.h>
#include <codegen/input... | #ifndef GL_HEADERS_H
#define GL_HEADERS_H
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#else
#define WINGDIAPI KHRONOS_APICALL
#define APIENTRY KHRONOS_APIENTRY
#endif
#include <codegen/input/egl.h>
#include <codegen/input/eglext.h>
#include <codegen/input/GL.h>
#include <codegen/input... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.