Instruction stringlengths 14 778 | input_code stringlengths 0 4.24k | output_code stringlengths 1 5.44k |
|---|---|---|
Add basic test for integer constans |
/*
name: TEST022
description: Basic test for int constants
comments: This test is done for z80 data types
output:
F1
G1 F1 main
{
-
A2 I i
A3 N u
A2 #I1 :I
A2 #IFFFF :I
A2 #IFFFF :I
A2 #IFFFF :I
A2 #IFFFF :I
A2 #I3 :I
A2 #I1 :I
A2 #I0 :I
A3 #N1 :N
A3 #NFFFF :N
A3 #NFFFF :N
A3 #NFFFF :N
A3 #NFFFF :N
A3 #N... | |
Fix a typo pointed about by gabor. | //===--- MacroBuilder.h - CPP Macro building utilitiy -----------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===-------------------------------------------------------... | //===--- MacroBuilder.h - CPP Macro building utility ------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===-------------------------------------------------------... |
Fix __BITS_PER_LONG value for x32 builds | #ifndef __ASM_X86_BITSPERLONG_H
#define __ASM_X86_BITSPERLONG_H
#ifdef __x86_64__
# define __BITS_PER_LONG 64
#else
# define __BITS_PER_LONG 32
#endif
#include <asm-generic/bitsperlong.h>
#endif /* __ASM_X86_BITSPERLONG_H */
| #ifndef __ASM_X86_BITSPERLONG_H
#define __ASM_X86_BITSPERLONG_H
#if defined(__x86_64__) && !defined(__ILP32__)
# define __BITS_PER_LONG 64
#else
# define __BITS_PER_LONG 32
#endif
#include <asm-generic/bitsperlong.h>
#endif /* __ASM_X86_BITSPERLONG_H */
|
ADD ui and text comps to menustate | #ifndef SSPAPPLICATION_GAMESTATES_MENUSTATE_H
#define SSPAPPLICATION_GAMESTATES_MENUSTATE_H
#include "GameState.h"
class MenuState :
public GameState
{
private:
public:
MenuState();
~MenuState();
int ShutDown();
int Initialize(GameStateHandler* gsh, ComponentHandler* cHandler);
int Update(float dt, InputHandler ... | #ifndef SSPAPPLICATION_GAMESTATES_MENUSTATE_H
#define SSPAPPLICATION_GAMESTATES_MENUSTATE_H
#include "GameState.h"
#include "../GraphicsDLL/GraphicsComponent.h"
class MenuState :
public GameState
{
private:
const static int m_NR_OF_MENU_ITEMS = 2;
UIComponent* m_uiComps[NR_OF_MENU_ITEMS];
TextComponent* m_textComps... |
Fix compilation error when disabling zlib support | #ifndef DSMCC_COMPRESS_H
#define DSMCC_COMPRESS_H
#include <stdbool.h>
#include "dsmcc-config.h"
#include "dsmcc-debug.h"
#ifdef HAVE_ZLIB
bool dsmcc_inflate_file(const char *filename);
#else
static inline bool dsmcc_inflate_file(const char *filename)
{
DSMCC_ERROR("Compression support is disabled in this build");
... | #ifndef DSMCC_COMPRESS_H
#define DSMCC_COMPRESS_H
#include <stdbool.h>
#include "dsmcc-config.h"
#include "dsmcc-debug.h"
#ifdef HAVE_ZLIB
bool dsmcc_inflate_file(const char *filename);
#else
static inline bool dsmcc_inflate_file(const char *filename)
{
(void) filename;
DSMCC_ERROR("Compression support is disabled... |
Test inability to inline certain functions | // RUN: %check -e %s
#define always_inline __attribute((always_inline))
always_inline hidden(int);
void always_inline __attribute((noinline)) noinline(void)
{
}
always_inline void print(const char *fmt, ...)
{
}
always_inline void old(a, b)
int a, b;
{
}
always_inline void addr(int x)
{
int *p = &x;
*p = 3;
}
... | |
Load balance & foreign message queue refactored. | #include "./p7r_api.h"
#include "./p7r_root_alloc.h"
static
struct p7r_poolized_meta {
int startup_channel[2];
} meta_singleton;
static
void p7r_poolized_main_entrance(void *argument) {
struct p7r_poolized_meta *meta = argument;
struct p7r_delegation channel_hint;
for (;;) {
channel_hi... | #include "./p7r_api.h"
#include "./p7r_root_alloc.h"
static
struct p7r_poolized_meta {
int startup_channel[2];
} meta_singleton;
static
void p7r_poolized_main_entrance(void *argument) {
struct p7r_poolized_meta *meta = argument;
struct p7r_delegation channel_hint;
for (;;) {
channel_hi... |
Change safety guard to PATH_MAX because Solaris doesn't know NAME_MAX | /* ISC license. */
#include <limits.h>
#include <string.h>
#include <sys/stat.h>
#include <errno.h>
#include <s6-rc/s6rc-utils.h>
int s6rc_livedir_prefixsize (char const *live, size_t *n)
{
struct stat st ;
size_t llen = strlen(live) ;
char sfn[llen + 8] ;
memcpy(sfn, live, llen) ;
memcpy(sfn + llen, "/pref... | /* ISC license. */
#include <limits.h>
#include <string.h>
#include <sys/stat.h>
#include <errno.h>
#include <s6-rc/s6rc-utils.h>
int s6rc_livedir_prefixsize (char const *live, size_t *n)
{
struct stat st ;
size_t llen = strlen(live) ;
char sfn[llen + 8] ;
memcpy(sfn, live, llen) ;
memcpy(sfn + llen, "/pref... |
Fix overflow in test case | struct test {
int a[3];
char b[2];
long c;
};
int sum(struct test *t) {
int sum = 0;
sum += t->a[0] + t->a[1] + t->a[2];
sum += t->b[0] + t->b[1] + t->b[2];
sum += t->c;
return sum;
}
int main() {
struct test t1 = { .a = { 1, 2, 3 }, .b = { 'a', 'c' }, .c = -1 };
struct test t2 = t1;
t2.b[0] = ... | struct test {
int a[3];
char b[2];
long c;
};
int sum(struct test *t) {
int sum = 0;
sum += t->a[0] + t->a[1] + t->a[2];
sum += t->b[0] + t->b[1];
sum += t->c;
return sum;
}
int main() {
struct test t1 = { .a = { 1, 2, 3 }, .b = { 'a', 'c' }, .c = -1 };
struct test t2 = t1;
t2.b[0] = 32;
t2.a... |
Add Error handring to removePointsByRange() | #ifndef POINTS_DOWNSAMPLER_H
#define POINTS_DOWNSAMPLER_H
static pcl::PointCloud<pcl::PointXYZI> removePointsByRange(pcl::PointCloud<pcl::PointXYZI> scan, double min_range, double max_range)
{
pcl::PointCloud<pcl::PointXYZI> narrowed_scan;
narrowed_scan.header = scan.header;
double square_min_range = min_range *... | #ifndef POINTS_DOWNSAMPLER_H
#define POINTS_DOWNSAMPLER_H
static pcl::PointCloud<pcl::PointXYZI> removePointsByRange(pcl::PointCloud<pcl::PointXYZI> scan, double min_range, double max_range)
{
pcl::PointCloud<pcl::PointXYZI> narrowed_scan;
narrowed_scan.header = scan.header;
#if 1 // This error handling shou... |
Allow specifyign hackc compiler id with C define | /**
* Copyright (c) 2014, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the "hack" directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*/
#define CAML_N... | /**
* Copyright (c) 2014, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the "hack" directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*/
#define CAML_N... |
Move the structure definition on a better place | /** Author : Paul TREHIOU & Victor SENE
* Date : November 2014
**/
/**
* Declaration Point structure
* x - real wich is the abscisse of the point
* y - real wich is the ordinate of the point
*/
typedef struct
{
float x;
float y;
}Point;
/**
* Function wich create a point with a specified abscisse and ordin... | /** Author : Paul TREHIOU & Victor SENE
* Date : November 2014
**/
/**
* Declaration Point structure
* x - real wich is the abscisse of the point
* y - real wich is the ordinate of the point
*/
typedef struct
{
float x;
float y;
}Point;
/**
* Declaration of the Element structure
* value - value of the poi... |
Fix for GCC 4.6 compatibility | #ifndef OPTIONFIELDPAIRS_H
#define OPTIONFIELDPAIRS_H
#include "optioni.h"
typedef std::pair<std::string, std::string> FieldPair;
typedef std::vector<FieldPair> FieldPairs;
class OptionFieldPairs : public OptionI<std::vector<std::pair<std::string, std::string> > >
{
public:
OptionFieldPairs(std::string name);
vir... | #ifndef OPTIONFIELDPAIRS_H
#define OPTIONFIELDPAIRS_H
#include "optioni.h"
#include "common.h"
typedef std::pair<std::string, std::string> FieldPair;
typedef std::vector<FieldPair> FieldPairs;
class OptionFieldPairs : public OptionI<std::vector<std::pair<std::string, std::string> > >
{
public:
OptionFieldPairs(std:... |
Change some function prototypes around | #include "opt.h"
CorkOpt *
corkopt_init(int argc, char *argv[])
{
CorkOpt *co;
if ((co = malloc(sizeof(CorkOpt))) == NULL)
return NULL;
co->argc = argc;
co->argv = argv;
return co;
}
static void
corkopt_fini(CorkOpt *co)
{ }
void
corkopt_add(CorkOpt *co,
int shortopt,
... | #include "opt.h"
CorkOpt *
corkopt_init(void)
{
CorkOpt *co;
if ((co = malloc(sizeof(CorkOpt))) == NULL)
return NULL;
co->args = corklist_create();
return co;
}
void
corkopt_fini(CorkOpt *co)
{ }
void
corkopt_add(CorkOpt *co,
int shortopt,
const char *longopt,
... |
Use the option "+" to force the new style Streamer for all classes in bench. | #ifdef __CINT__
#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;
#pragma link C++ class THit!+;
#pragma link C++ class TObjHit+;
#pragma link C++ class TSTLhit;
#pragma link C++ class TSTLhitList;
#pragma link C++ class TSTLhitDeque;
#pragma link C++ class TSTLhitSet;
#pragm... | #ifdef __CINT__
#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;
#pragma link C++ class THit!+;
#pragma link C++ class TObjHit+;
#pragma link C++ class TSTLhit+;
#pragma link C++ class TSTLhitList+;
#pragma link C++ class TSTLhitDeque+;
#pragma link C++ class TSTLhitSet+;
#p... |
Make Job::cancel and Job::pause public slots | // vim:cindent:cino=\:0:et:fenc=utf-8:ff=unix:sw=4:ts=4:
#ifndef CONVEYOR_JOB_H
#define CONVEYOR_JOB_H (1)
#include <QList>
#include <QObject>
#include <QScopedPointer>
#include <QString>
#include <conveyor/fwd.h>
#include <conveyor/jobstatus.h>
namespace conveyor
{
class Job : public QObject
{
Q_OB... | // vim:cindent:cino=\:0:et:fenc=utf-8:ff=unix:sw=4:ts=4:
#ifndef CONVEYOR_JOB_H
#define CONVEYOR_JOB_H (1)
#include <QList>
#include <QObject>
#include <QScopedPointer>
#include <QString>
#include <conveyor/fwd.h>
#include <conveyor/jobstatus.h>
namespace conveyor
{
class Job : public QObject
{
Q_OB... |
Add more rationale as to how this exception is different from others. | //--------------------------------------------------------------------*- C++ -*-
// CLING - the C++ LLVM-based InterpreterG :)
// author: Axel Naumann <axel@cern.ch>
//------------------------------------------------------------------------------
#ifndef CLING_COMPILATIONEXCEPTION_H
#define CLING_COMPILATIONEXCEPTION... | //--------------------------------------------------------------------*- C++ -*-
// CLING - the C++ LLVM-based InterpreterG :)
// author: Axel Naumann <axel@cern.ch>
//------------------------------------------------------------------------------
#ifndef CLING_COMPILATIONEXCEPTION_H
#define CLING_COMPILATIONEXCEPTION... |
Mark this test as requiring and x86 registered target. | // RUN: %clang_cc1 %s -triple=x86_64-linux-gnu -S -o -
#define __MM_MALLOC_H
#include <x86intrin.h>
// No warnings.
extern __m256i a;
int __attribute__((target("avx"))) bar(__m256i a) {
return _mm256_extract_epi32(a, 3);
}
int baz() {
return bar(a);
}
int __attribute__((target("avx"))) qq_avx(__m256i a) {
ret... | // REQUIRES: x86-registered-target
// RUN: %clang_cc1 %s -triple=x86_64-linux-gnu -S -o -
#define __MM_MALLOC_H
#include <x86intrin.h>
// No warnings.
extern __m256i a;
int __attribute__((target("avx"))) bar(__m256i a) {
return _mm256_extract_epi32(a, 3);
}
int baz() {
return bar(a);
}
int __attribute__((target... |
Enable 64 bit atomics on ARM64. | /*-------------------------------------------------------------------------
*
* arch-arm.h
* Atomic operations considerations specific to ARM
*
* Portions Copyright (c) 2013-2017, PostgreSQL Global Development Group
*
* NOTES:
*
* src/include/port/atomics/arch-arm.h
*
*-------------------------------------... | /*-------------------------------------------------------------------------
*
* arch-arm.h
* Atomic operations considerations specific to ARM
*
* Portions Copyright (c) 2013-2017, PostgreSQL Global Development Group
*
* NOTES:
*
* src/include/port/atomics/arch-arm.h
*
*-------------------------------------... |
Rename and don't spit out all the sanity output when running on the CI server. | #include "unity.h"
#include "unity_fixture.h"
#include "Utils/IO/ArrayIO.h"
#include "Utils/IO/BlockMapIO.h"
#include "Utils/IO/ImageIO.h"
#include "Utils/IO/HistogramIO.h"
#include <stdio.h>
#include <stdlib.h>
bool IsUnderCI = false ;
TEST_GROUP(DataStructures);
TEST_SETUP(DataStructures)
{
IsUnderCI = (geten... | |
Set correct name for boost IPC | #ifndef QTIPCSERVER_H
#define QTIPCSERVER_H
// Define Bitcoin-Qt message queue name
#define BITCOINURI_QUEUE_NAME "BitcoinURI"
void ipcScanRelay(int argc, char *argv[]);
void ipcInit(int argc, char *argv[]);
#endif // QTIPCSERVER_H
| #ifndef QTIPCSERVER_H
#define QTIPCSERVER_H
// Define Bitcoin-Qt message queue name
#define BITCOINURI_QUEUE_NAME "CrainCoinURI"
void ipcScanRelay(int argc, char *argv[]);
void ipcInit(int argc, char *argv[]);
#endif // QTIPCSERVER_H
|
Adjust for sigset_t to intrmask_t renaming. | /* libunwind - a platform-independent unwind library
Copyright (c) 2004-2005 Hewlett-Packard Development Company, L.P.
Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
This file is part of libunwind.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associate... | |
Add BST Pre/Post order walk function declaration | #include <stdlib.h>
#ifndef __BST_H__
#define __BST_H__
struct BSTNode;
struct BST;
typedef struct BSTNode BSTNode;
typedef struct BST BST;
BST* BST_Create(void);
BSTNode* BSTNode_Create(void* k);
void BST_Inorder_Tree_Walk(BST* T, void (f)(void*));
#endif | #include <stdlib.h>
#ifndef __BST_H__
#define __BST_H__
struct BSTNode;
struct BST;
typedef struct BSTNode BSTNode;
typedef struct BST BST;
BST* BST_Create(void);
BSTNode* BSTNode_Create(void* k);
void BST_Inorder_Tree_Walk(BST* T, void (f)(void*));
void BST_Preorder_Tree_Walk(BST* T, void (f)(void*));
void BST_Postor... |
Extend size of text in Message | // Copyright 2014-2016 the project authors as listed in the AUTHORS file.
// All rights reserved. Use of this source code is governed by the
// license that can be found in the LICENSE file.
#ifndef _MESSAGE_QUEUE
#define _MESSAGE_QUEUE
// note that on the arduino we have to be careful of how much memory we
// use so... | // Copyright 2014-2016 the project authors as listed in the AUTHORS file.
// All rights reserved. Use of this source code is governed by the
// license that can be found in the LICENSE file.
#ifndef _MESSAGE_QUEUE
#define _MESSAGE_QUEUE
// note that on the arduino we have to be careful of how much memory we
// use so... |
Add line break in default error formatter | #ifndef BANDIT_DEFAULT_FAILURE_FORMATTER_H
#define BANDIT_DEFAULT_FAILURE_FORMATTER_H
namespace bandit { namespace detail {
struct default_failure_formatter : public failure_formatter
{
std::string format(const assertion_exception& err) const
{
std::stringstream ss;
if(err.file_name().size())
... | #ifndef BANDIT_DEFAULT_FAILURE_FORMATTER_H
#define BANDIT_DEFAULT_FAILURE_FORMATTER_H
namespace bandit { namespace detail {
struct default_failure_formatter : public failure_formatter
{
std::string format(const assertion_exception& err) const
{
std::stringstream ss;
if(err.file_name().size())
... |
Change defined(_HF_ARCH_LINUX) -> defined(__linux__) for public includes | #ifdef __cplusplus
extern "C" {
#endif
/*
* buf: input fuzzing data
* len: size of the 'buf' data
*
* Return value: should return 0
*/
int LLVMFuzzerTestOneInput(const uint8_t * buf, size_t len);
/*
* argc: ptr to main's argc
* argv: ptr to main's argv
*
* Return value: ignored
*/
int LLVMFuzzerInit... | #ifdef __cplusplus
extern "C" {
#endif
/*
* buf: input fuzzing data
* len: size of the 'buf' data
*
* Return value: should return 0
*/
int LLVMFuzzerTestOneInput(const uint8_t * buf, size_t len);
/*
* argc: ptr to main's argc
* argv: ptr to main's argv
*
* Return value: ignored
*/
int LLVMFuzzerInit... |
Remove extraneous string.h from listing 1 | # include <stdio.h>
# include <libmill.h>
# include <string.h>
coroutine void f(int index)
{
printf("Worker %d\n", index);
}
int main(int argc, char **argv)
{
for(int i=1;i<=10; i++) {
go(f(i));
}
return 0;
}
| # include <stdio.h>
# include <libmill.h>
coroutine void f(int index)
{
printf("Worker %d\n", index);
}
int main(int argc, char **argv)
{
for(int i=1;i<=10; i++) {
go(f(i));
}
return 0;
}
|
Use \177 instead of a special character inserted with a hex editor | #define L for(char*c=a[1],y;*c;)printf("%c%c%c%c",(y="w$]m.k{o"[*c++-48])&u/4?124:32,y&u?95:32,y&u/2?124:32,*c?32:10);u*=8;
main(int u,char**a){u=1;L;L;L} | #define L for(char*c=a[1],y;*c;)printf("%c%c%c%c",(y="w$]m.k{%\177o"[*c++-48])&u/4?124:32,y&u?95:32,y&u/2?124:32,*c?32:10);u*=8;
main(int u,char**a){u=1;L;L;L} |
Add space inside the regular expression. | // RUN: %clang_profgen -o %t -O3 %s
// RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t
// RUN: llvm-profdata merge -o %t.profdata %t.profraw
// RUN: %clang_profuse=%t.profdata -o - -S -emit-llvm %s | FileCheck %s
void __llvm_profile_reset_counters(void);
void foo(int);
int main(void) {
foo(0);
__llvm_profile_reset_c... | // RUN: %clang_profgen -o %t -O3 %s
// RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t
// RUN: llvm-profdata merge -o %t.profdata %t.profraw
// RUN: %clang_profuse=%t.profdata -o - -S -emit-llvm %s | FileCheck %s
void __llvm_profile_reset_counters(void);
void foo(int);
int main(void) {
foo(0);
__llvm_profile_reset_c... |
Add util status bar layer | #pragma once
#include <pebble.h>
#ifndef PBL_PLATFORM_BASALT
typedef struct StatusBarLayer StatusBarLayer;
struct StatusBarLayer;
static inline StatusBarLayer *status_bar_layer_create(void) {
return NULL;
}
static inline void status_bar_layer_destroy(StatusBarLayer *status_bar_layer) {
}
static inline Layer *st... | |
Use Is2Power instead of ctz | #ifndef IV_LV5_RADIO_BLOCK_SIZE_H_
#define IV_LV5_RADIO_BLOCK_SIZE_H_
#include <iv/static_assert.h>
#include <iv/arith.h>
namespace iv {
namespace lv5 {
namespace radio {
class Block;
static const std::size_t kBlockSize = core::Size::KB * 4;
static const uintptr_t kBlockMask = ~static_cast<uintptr_t>(kBlockSize - 1);... | #ifndef IV_LV5_RADIO_BLOCK_SIZE_H_
#define IV_LV5_RADIO_BLOCK_SIZE_H_
#include <iv/static_assert.h>
namespace iv {
namespace lv5 {
namespace radio {
namespace detail_block_size {
template<std::size_t x>
struct Is2Power {
static const bool value = x > 1 && (x & (x - 1)) == 0;
};
} // namespace detail_block_size
cl... |
Use lowercase underscore for variable name | #ifndef CPR_ERROR_H
#define CPR_ERROR_H
#include <string>
#include "cprtypes.h"
#include "defines.h"
namespace cpr {
enum class ErrorCode {
OK = 0,
CONNECTION_FAILURE,
EMPTY_RESPONSE,
HOST_RESOLUTION_FAILURE,
INTERNAL_ERROR,
INVALID_URL_FORMAT,
NETWORK_RECEIVE_ERROR,
NETWORK_SEND_FAI... | #ifndef CPR_ERROR_H
#define CPR_ERROR_H
#include <string>
#include "cprtypes.h"
#include "defines.h"
namespace cpr {
enum class ErrorCode {
OK = 0,
CONNECTION_FAILURE,
EMPTY_RESPONSE,
HOST_RESOLUTION_FAILURE,
INTERNAL_ERROR,
INVALID_URL_FORMAT,
NETWORK_RECEIVE_ERROR,
NETWORK_SEND_FAI... |
Change c files to header files. | #include <stddef.h>
#include <stdint.h>
#include "gdt.c"
#include "idt.c"
#include "isr.c"
#include "terminal.h"
/* Check if the compiler thinks if we are targeting the wrong operating system. */
#if defined(__linux__)
#error "You are not using a cross-compiler, you will most certainly run into trouble"
#endif
/* T... | #include <stddef.h>
#include <stdint.h>
#include "gdt.h"
#include "idt.h"
#include "isr.h"
#include "terminal.h"
/* Check if the compiler thinks if we are targeting the wrong operating system. */
#if defined(__linux__)
#error "You are not using a cross-compiler, you will most certainly run into trouble"
#endif
/* T... |
Isolate all PHP compatability stuff into its own file | #ifndef PHP_FE_END
# define PHP_FE_END { NULL, NULL, NULL }
#endif
#ifndef HASH_KEY_NON_EXISTENT
# define HASH_KEY_NON_EXISTENT HASH_KEY_NON_EXISTANT
#endif
| |
Fix fwd decl for windows. | //--------------------------------------------------------------------*- C++ -*-
// CLING - the C++ LLVM-based InterpreterG :)
// version: $Id$
// author: Timur Pocheptsov <Timur.Pocheptsov@cern.ch>
//------------------------------------------------------------------------------
#ifndef CLING_DISPLAY_H
#define CLING_... | //--------------------------------------------------------------------*- C++ -*-
// CLING - the C++ LLVM-based InterpreterG :)
// version: $Id$
// author: Timur Pocheptsov <Timur.Pocheptsov@cern.ch>
//------------------------------------------------------------------------------
#ifndef CLING_DISPLAY_H
#define CLING_... |
Increment version number since we forked for beta. | /**
* @file llversionviewer.h
* @brief
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as ... | /**
* @file llversionviewer.h
* @brief
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as ... |
Add ending null-byte to binaries | #include <binary.h>
#include <assert.h>
#include <crc32.h>
/* API ************************************************************************/
Binary *binary_new(Scope *scope, size_t size) {
Binary *binary = scope_alloc(scope, sizeof(Binary) + size);
binary->size = size;
binary->header = ref_header(TYPEID_BINA... | #include <binary.h>
#include <assert.h>
#include <crc32.h>
/* API ************************************************************************/
Binary *binary_new(Scope *scope, size_t size) {
Binary *binary = scope_alloc(scope, sizeof(Binary) + size + 1);
binary->size = size;
binary->header = ref_header(TYPEID_... |
Format previos commit with clang-formatter | #ifndef MAP_EVENT_LISTENER_H
#define MAP_EVENT_LISTENER_H
#include "cocos2d.h"
namespace tsg {
namespace map {
class IMapEventListener {
public:
virtual void onMapLoad(cocos2d::TMXTiledMap *) = 0;
virtual void onViewCoordinatesChanged(cocos2d::Vec2) =0;
virtual void onNightTime() =0;
virtual void onDayTime() ... | #ifndef MAP_EVENT_LISTENER_H
#define MAP_EVENT_LISTENER_H
#include "cocos2d.h"
namespace tsg {
namespace map {
class IMapEventListener {
public:
virtual void onMapLoad(cocos2d::TMXTiledMap *) = 0;
virtual void onViewCoordinatesChanged(cocos2d::Vec2) = 0;
virtual void onNightTime() = 0;
virtual void onDayTime... |
Remove public headers from umbrella header | #import <Foundation/Foundation.h>
//! Project version number for Quick.
FOUNDATION_EXPORT double QuickVersionNumber;
//! Project version string for Quick.
FOUNDATION_EXPORT const unsigned char QuickVersionString[];
// In this header, you should import all the public headers of your framework using statements like #i... | #import <Foundation/Foundation.h>
//! Project version number for Quick.
FOUNDATION_EXPORT double QuickVersionNumber;
//! Project version string for Quick.
FOUNDATION_EXPORT const unsigned char QuickVersionString[];
#import <Quick/QuickSpec.h> |
Put method declaration back into category header | //
// ORKCollectionResult+MORK.h
// MORK
//
// Created by Nolan Carroll on 4/23/15.
// Copyright (c) 2015 Medidata Solutions. All rights reserved.
//
#import "ORKResult.h"
@interface ORKTaskResult (MORK)
@property (readonly) NSArray *mork_fieldDataFromResults;
@end
| //
// ORKCollectionResult+MORK.h
// MORK
//
// Created by Nolan Carroll on 4/23/15.
// Copyright (c) 2015 Medidata Solutions. All rights reserved.
//
#import "ORKResult.h"
@interface ORKTaskResult (MORK)
- (NSArray *)mork_getFieldDataFromResults;
@end
|
Introduce |HasPartial()|, |HasPublic()|, and so on in |WithModifiers| class for ease of accessing modifiers. | // Copyright 2014-2015 Project Vogue. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef ELANG_COMPILER_AST_WITH_MODIFIERS_H_
#define ELANG_COMPILER_AST_WITH_MODIFIERS_H_
#include "elang/compiler/modifiers.h"
namespace elang {
namespac... | // Copyright 2014-2015 Project Vogue. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef ELANG_COMPILER_AST_WITH_MODIFIERS_H_
#define ELANG_COMPILER_AST_WITH_MODIFIERS_H_
#include "elang/compiler/modifiers.h"
namespace elang {
namespac... |
Change header to C style. | /**
* File: dump.h
* Author: Scott Bennett
*/
#ifndef DUMP_H
#define DUMP_H
void dumpMemory();
void dumpProgramRegisters();
void dumpProcessorRegisters();
#endif /* DUMP_H */
| /*
* File: dump.h
* Author: Scott Bennett
*/
#ifndef DUMP_H
#define DUMP_H
void dumpMemory();
void dumpProgramRegisters();
void dumpProcessorRegisters();
#endif /* DUMP_H */
|
Remove broken prototype, starting out clean | #include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <unistd.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <netinet/in.h>
#include <sys/uio.h>
#define SERVER "127.0.0.1"
#define BUFLEN 512 // max length of buffer
#define PORT 3000 // destination port
... | #include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <sys/socket.h>
#include <netinet/in.h>
__attribute__((noreturn))
void failed(const char* s) {
perror(s);
exit(1);
}
int main() {
int s = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
if (s == -1) {
failed("socket()");
}
}
|
Add basic cmd options handling | #include <config.h>
#include "utest.h"
int __attribute__((weak)) main (void)
{
return ut_run_all_tests() == 0;
}
| #include <config.h>
#include "utest.h"
#include <unistd.h>
#include <getopt.h>
#include <stdio.h>
static struct option options[] = {
{ "help", no_argument, NULL, 'h' },
{ "version", no_argument, NULL, 'V' },
{ NULL, 0, 0, 0 }
};
int __attribute__((weak)) main (int argc, char **argv)
{
int c;
wh... |
Fix path seperator for Windows. | // Test ld invocation on Solaris targets.
// Check sparc-sun-solaris2.1
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN: --target=sparc-sun-solaris2.11 \
// RUN: --gcc-toolchain="" \
// RUN: --sysroot=%S/Inputs/sparc-sun-solaris2.11 \
// RUN: | FileCheck %s
// CHECK: "-cc1" "-triple" ... | // Test ld invocation on Solaris targets.
// Check sparc-sun-solaris2.1
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN: --target=sparc-sun-solaris2.11 \
// RUN: --gcc-toolchain="" \
// RUN: --sysroot=%S/Inputs/sparc-sun-solaris2.11 \
// RUN: | FileCheck %s
// CHECK: "-cc1" "-triple" ... |
Use socketcan data structures and defines | #include <stdint.h>
typedef uint8_t __u8;
typedef uint32_t __u32;
/* special address description flags for the CAN_ID */
#define CAN_EFF_FLAG 0x80000000U /* EFF/SFF is set in the MSB */
#define CAN_RTR_FLAG 0x40000000U /* remote transmission request */
#define CAN_ERR_FLAG 0x20000000U /* error message frame */
/* va... | |
Add a test for line continuation. | // Copyright 2012 Rui Ueyama <rui314@gmail.com>
// This program is free software licensed under the MIT license.
#include "test.h"
#define stringify(x) #x
void digraph(void) {
expect_string("[", stringify(<:));
expect_string("]", stringify(:>));
expect_string("{", stringify(<%));
expect_string("}", s... | // Copyright 2012 Rui Ueyama <rui314@gmail.com>
// This program is free software licensed under the MIT license.
#include "test.h"
#define stringify(x) #x
void digraph(void) {
expect_string("[", stringify(<:));
expect_string("]", stringify(:>));
expect_string("{", stringify(<%));
expect_string("}", s... |
Put comment right next to class def | #ifndef TRIANGLESTRIPGLWIDGET_H
#define TRIANGLESTRIPGLWIDGET_H
#include "GLWidget.h"
#include <cmath>
/**
* Draws a trapezoid on screen using a triangle strip. Strips can be thought of
* lists of vertices, where each triangle in the list is composed of some
* adjacent group of three vertices. The vertices are col... | #ifndef TRIANGLESTRIPGLWIDGET_H
#define TRIANGLESTRIPGLWIDGET_H
#include "GLWidget.h"
#include <cmath>
/**
* Draws a trapezoid on screen using a triangle strip. Strips can be thought of
* lists of vertices, where each triangle in the list is composed of some
* adjacent group of three vertices. The vertices are col... |
Add prototypes for randr_changed_get and randr_changes_apply functions. | #ifdef E_TYPEDEFS
#else
# ifndef E_SMART_RANDR_H
# define E_SMART_RANDR_H
Evas_Object *e_smart_randr_add(Evas *evas);
void e_smart_randr_current_size_set(Evas_Object *obj, Evas_Coord w, Evas_Coord h);
void e_smart_randr_monitors_create(Evas_Object *obj);
void e_smart_randr_monitor_add(Evas_Object *obj, Evas_Object *m... | #ifdef E_TYPEDEFS
#else
# ifndef E_SMART_RANDR_H
# define E_SMART_RANDR_H
Evas_Object *e_smart_randr_add(Evas *evas);
void e_smart_randr_current_size_set(Evas_Object *obj, Evas_Coord w, Evas_Coord h);
void e_smart_randr_monitors_create(Evas_Object *obj);
void e_smart_randr_monitor_add(Evas_Object *obj, Evas_Object *m... |
Add start of messaging interface. | // Messages are the scrolling messages within the UI.
// This file contains update and retrieval functions.
#include "7drltypes.h"
#define MAX_MSG_SIZE ( 80 )
static int oldest_message = ( MAX_MESSAGES - 1 );
char messages[ MAX_MESSAGES ][ MAX_MSG_SIZE ];
void init_messages( void )
{
bzero( messages, ( size_t... | |
Update the version after tagging | #ifndef PHP_SHMT_H
#define PHP_SHMT_H
#define PHP_SHMT_EXTNAME "SHMT"
#define PHP_SHMT_EXTVER "1.0.1"
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif /* HAVE_CONFIG_H */
extern zend_module_entry shmt_module_entry;
#define phpext_shmt_ptr &shmt_module_entry;
#endif /* PHP_SHMT_H */
| #ifndef PHP_SHMT_H
#define PHP_SHMT_H
#define PHP_SHMT_EXTNAME "SHMT"
#define PHP_SHMT_EXTVER "1.0.2dev"
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif /* HAVE_CONFIG_H */
extern zend_module_entry shmt_module_entry;
#define phpext_shmt_ptr &shmt_module_entry;
#endif /* PHP_SHMT_H */
|
Make it harder to accidentally steal ownership of a RAIIHelper resource | #pragma once
#include <utility>
namespace shk {
template<
typename T,
typename Return,
Return (Free)(T),
T EmptyValue = nullptr>
class RAIIHelper {
public:
RAIIHelper(T obj)
: _obj(obj) {}
RAIIHelper(const RAIIHelper &) = delete;
RAIIHelper &operator=(const RAIIHelper &) = delete;
RA... | #pragma once
#include <utility>
namespace shk {
template<
typename T,
typename Return,
Return (Free)(T),
T EmptyValue = nullptr>
class RAIIHelper {
public:
explicit RAIIHelper(T obj)
: _obj(obj) {}
RAIIHelper(const RAIIHelper &) = delete;
RAIIHelper &operator=(const RAIIHelper &) = dele... |
Add note about how protocol conformance checking works. | //
// VOKMappableModel.h
// VOKCoreData
//
#import "VOKCoreDataManager.h"
/**
* Any models that conform to this protocol will be automatically registered for mapping with the shared instance
* of VOKCoreDataManager.
*/
@protocol VOKMappableModel <NSObject>
///@return an array of VOKManagedObjectMap objects m... | //
// VOKMappableModel.h
// VOKCoreData
//
#import "VOKCoreDataManager.h"
/**
* Any models that conform to this protocol will be automatically registered for mapping with the shared instance
* of VOKCoreDataManager.
*
* Note that runtime protocol-conformance is based on declared conformance (the angle-brack... |
Add file for reading/writing settings. Oops. | #include <stdio.h>
#include <stdlib.h>
#include "therm.h"
/* Loads settings from persistent storage, returning the number of
items read, or -1 on error. */
int persistent_load() {
FILE *f = fopen(SAVEPATH, "r");
float pid[6];
int ret = 0;
if(!f) {
return -1;
}
ret += fread(&wanted_temperature, sizeof(want... | |
Fix an incomplete copy and paste in my previous patch. | // RUN: not %clang_cc1 %s -cake-is-lie -%0 -%d 2> %t.log
// RUN: FileCheck %s -input-file=%t.log
// CHECK: unknown argument
// CHECK: unknown argument
// CHECK: unknown argument
// RUN: %clang -S %s -o %t.s -funknown-to-clang-option -Wunknown-to-clang-option -munknown-to-clang-optio
// IGNORED: warning: argument un... | // RUN: not %clang_cc1 %s -cake-is-lie -%0 -%d 2> %t.log
// RUN: FileCheck %s -input-file=%t.log
// CHECK: unknown argument
// CHECK: unknown argument
// CHECK: unknown argument
// RUN: %clang -S %s -o %t.s -funknown-to-clang-option -Wunknown-to-clang-option -munknown-to-clang-option 2>&1 | FileCheck --check-prefix=... |
Fix build with clang on non-Mac | // Unwinding stuff missing on some architectures (Mac OS X).
#ifndef RUST_UNWIND_H
#define RUST_UNWIND_H
#ifdef __APPLE__
#include <libunwind.h>
typedef int _Unwind_Action;
typedef void _Unwind_Context;
typedef void _Unwind_Exception;
typedef int _Unwind_Reason_Code;
#else
#include <unwind.h>
#endif
#endif
| // Unwinding stuff missing on some architectures (Mac OS X).
#ifndef RUST_UNWIND_H
#define RUST_UNWIND_H
#ifdef __APPLE__
#include <libunwind.h>
typedef void _Unwind_Context;
typedef int _Unwind_Reason_Code;
#else
#include <unwind.h>
#endif
#if (defined __APPLE__) || (defined __clang__)
typedef int _Unwind_Acti... |
Add test for the C API for selections | #include "chemfiles.h"
// Force NDEBUG to be undefined
#undef NDEBUG
#include <assert.h>
#include <stdlib.h>
int main() {
CHFL_TOPOLOGY* topology = chfl_topology();
CHFL_ATOM* O = chfl_atom("O");
CHFL_ATOM* H = chfl_atom("H");
assert(topology != NULL);
assert(H != NULL);
assert(O != NULL);
... | |
Create a utility to properly parse obj files. | #include <stdlib.h>
#include <stdio.h>
#include <string.h>
typedef struct vector3f
{
float x, y, z;
}VECTOR3F;
typedef struct triangle
{
int32_t v1, v2, v3;
}TRIANGLE;
typedef struct trianglemesh
{
int32_t id;
TRIANGLE t; // vertices number
VECTOR3F v[3]; // vertices coordinates
}TRIANGLEMESH;
... | |
Add global initializer SV-COMP test | extern void __VERIFIER_error() __attribute__ ((__noreturn__));
void __VERIFIER_assert(int cond) {
if (!(cond)) {
ERROR: __VERIFIER_error();
}
return;
}
int g = 1;
int main()
{
__VERIFIER_assert(g == 1);
return 0;
} | |
Add verb to touch all clones of a given clonable | /*
* This file is part of Kotaka, a mud library for DGD
* http://github.com/shentino/kotaka
*
* Copyright (C) 2012 Raymond Jennings
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundati... | |
Add endAllBackgroundTasks to the Public API | //
// BackgroundTaskManager.h
//
// Created by Puru Shukla on 20/02/13.
// Copyright (c) 2013 Puru Shukla. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface BackgroundTaskManager : NSObject
+(instancetype)sharedBackgroundTaskManager;
-(UIBackgroundTaskIdentifier)beginNewBackgroundTask;
@end
| //
// BackgroundTaskManager.h
//
// Created by Puru Shukla on 20/02/13.
// Copyright (c) 2013 Puru Shukla. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface BackgroundTaskManager : NSObject
+(instancetype)sharedBackgroundTaskManager;
-(UIBackgroundTaskIdentifier)beginNewBackgroundTask;
-(void)... |
Add class comment for BmNodeStatsReporter. | // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include <vespa/vespalib/util/threadstackexecutor.h>
#include <chrono>
#include <mutex>
#include <condition_variable>
namespace search::bmcluster {
class BmCluster;
class BmNodeStatsReporter {
... | // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include <vespa/vespalib/util/threadstackexecutor.h>
#include <chrono>
#include <mutex>
#include <condition_variable>
namespace search::bmcluster {
class BmCluster;
/*
* Class handling background ... |
Fix DirBrowserFormAction build on FreeBSD | #ifndef NEWSBOAT_DIRBROWSERFORMACTION_H
#define NEWSBOAT_DIRBROWSERFORMACTION_H
#include <grp.h>
#include "configcontainer.h"
#include "formaction.h"
namespace newsboat {
class DirBrowserFormAction : public FormAction {
public:
DirBrowserFormAction(View*, std::string formstr, ConfigContainer* cfg);
~DirBrowse... | #ifndef NEWSBOAT_DIRBROWSERFORMACTION_H
#define NEWSBOAT_DIRBROWSERFORMACTION_H
#include <sys/stat.h>
#include <grp.h>
#include "configcontainer.h"
#include "formaction.h"
namespace newsboat {
class DirBrowserFormAction : public FormAction {
public:
DirBrowserFormAction(View*, std::string formstr, ConfigContain... |
Remove redundant commended out code | #ifndef _TILESET_H_
#define _TILESET_H_
#include <SDL.h>
//#define TILESET_ROW_LENGTH 8
typedef struct tileset
{
SDL_Surface *image;
SDL_Rect *clip;
int length;
} tileset;
int tilesetLoad(tileset *tSet, char *fileName, int width, int height, int rowLen, int length);
void tilesetUnload(tileset *tSet);
#endif /* ... | #ifndef _TILESET_H_
#define _TILESET_H_
#include <SDL.h>
typedef struct tileset
{
SDL_Surface *image;
SDL_Rect *clip;
int length;
} tileset;
int tilesetLoad(tileset *tSet, char *fileName, int width, int height, int rowLen, int length);
void tilesetUnload(tileset *tSet);
#endif /* _TILESET_H_ */
|
Load match configs into each local proc. | /* Preprocessor defines added by opencl compiler
* #define CONFIGS_PER_PROC
*/
__kernel void start_trampoline(__global char *match_configs,
__global char *output)
{
__private unsigned int i;
for (i = 0; i < 256; i++) {
output[i] = CONFIGS_PER_PROC;
}
write_mem_fence(CLK_GLOBAL_MEM_FENCE);
return;
}
| /* Preprocessor defines added by opencl compiler
* #define CONFIGS_PER_PROC
*/
__kernel void start_trampoline(__global char *match_configs,
__global char *output)
{
__private unsigned int i, startloc;
// Per worker match configs.
__private char local_match_configs[CONFIGS_PER_PROC * sizeof(char) * 4];
// Re... |
Add note about using yield(). | // Calculates the 45th Fibonacci number with a visual indicator.
#include <stdio.h>
#include <assert.h>
#include <libdill.h>
// Calculates Fibonacci of x.
static int fib(int x)
{
// Need to yield or spinner will not have any time to spin.
int rc = yield();
assert(rc == 0);
if (x < 2) return x;
return fib(x - 1) ... | // Calculates the 45th Fibonacci number with a visual indicator.
// Note: using yield() in fib() may allow the spinner to actually spin, but
// fib() takes a lot longer to complete. E.g. Over 2 minutes with yield()
// vs. 10 seconds without it.
#include <stdio.h>
#include <assert.h>
#include <libdill.h>
// Calculates ... |
Refactor the space tokenizer to be its own function; parse() no longer exists. | #include <stdlib.h>
#include <stdio.h>
#include types.c
#include <string.h>
/* We can:
Set something equal to something
Function calls
Function definitions
Returning things -- delimiter '<'
Printing things
Iffing */
struct call parseCall(char* statement);
struct function parseFunction(char* statemen... | #include <stdlib.h>
#include <stdio.h>
#include types.c
#include <string.h>
/* We can:
Set something equal to something
Function calls
Function definitions
Returning things -- delimiter '<'
Printing things
Iffing */
struct call parseCall(char* statement);
struct function parseFunction(char* statemen... |
Solve Fire Flowers in c | #include <math.h>
#include <stdio.h>
int main() {
double r1, x1, y1, r2, x2, y2;
double distance;
while (scanf("%lf %lf %lf %lf %lf %lf", &r1, &x1, &y1, &r2, &x2, &y2) != EOF) {
distance = sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
if (r1 >= distance + r2) {
puts("RI... | |
Make all bus events to be signals | #include <gst/gst.h>
#include "kms-core.h"
static GstElement *pipe = NULL;
static G_LOCK_DEFINE(mutex);
static gboolean init = FALSE;
static gboolean
bus_watch(GstBus *bus, GstMessage *message, gpointer data) {
KMS_LOG_DEBUG("TODO: implement bus watcher\n");
return TRUE;
}
void
kms_init(gint *argc, gchar **argv[])... | #include <gst/gst.h>
#include "kms-core.h"
static GstElement *pipe = NULL;
static G_LOCK_DEFINE(mutex);
static gboolean init = FALSE;
static gpointer
gstreamer_thread(gpointer data) {
GMainLoop *loop;
loop = g_main_loop_new(NULL, TRUE);
g_main_loop_run(loop);
return NULL;
}
void
kms_init(gint *argc, gchar **argv... |
Fix `_CHOOSE` to use the copies instead of double execution of side-effects (issue reported by tromp at bitcointalk.org) | #ifndef _EFFECTLESS
#define EFFECTLESS
/*
Macros without multiple execution of side-effects.
*/
/*
Generic min and max without double execution of side-effects:
http://stackoverflow.com/questions/3437404/min-and-max-in-c
*/
#define _CHOOSE(boolop, a, b, uid) \
({ \
decltype(a) _... | #ifndef _EFFECTLESS
#define EFFECTLESS
/*
Macros without multiple execution of side-effects.
*/
/*
Generic min and max without double execution of side-effects:
http://stackoverflow.com/questions/3437404/min-and-max-in-c
*/
#define _CHOOSE(boolop, a, b, uid) \
({ ... |
Make gutted help subsystem shut itself down on next upgrade | /*
* This file is part of Kotaka, a mud library for DGD
* http://github.com/shentino/kotaka
*
* Copyright (C) 2009, 2012, 2013, 2014 Raymond Jennings
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free... | /*
* This file is part of Kotaka, a mud library for DGD
* http://github.com/shentino/kotaka
*
* Copyright (C) 2009, 2012, 2013, 2014 Raymond Jennings
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free... |
Add the MemChunks screen [for kmalloc heavy stats] | /* SPDX-License-Identifier: BSD-2-Clause */
#include <tilck/common/basic_defs.h>
#include <tilck/common/string_util.h>
#include <tilck/kernel/kmalloc.h>
#include <tilck/kernel/cmdline.h>
#include "termutil.h"
#include "dp_int.h"
static debug_kmalloc_chunk_stat chunks_arr[1024];
static void dp_show_chunks(void)
{
... | |
Adjust for the fact that MacOS X and Solaris report maxrss in different units. | #include "../sccs.h"
#ifdef WIN32
#include <psapi.h>
u64
maxrss(void)
{
PROCESS_MEMORY_COUNTERS cnt;
if (GetProcessMemoryInfo(GetCurrentProcess(), &cnt, sizeof(cnt))) {
return (cnt.PeakWorkingSetSize);
}
return (0);
}
#else
#include <sys/resource.h>
u64
maxrss(void)
{
struct rusage ru;
if (!getrusage(RU... | #include "../sccs.h"
#ifdef WIN32
#include <psapi.h>
u64
maxrss(void)
{
PROCESS_MEMORY_COUNTERS cnt;
if (GetProcessMemoryInfo(GetCurrentProcess(), &cnt, sizeof(cnt))) {
return (cnt.PeakWorkingSetSize);
}
return (0);
}
#else
#include <sys/resource.h>
u64
maxrss(void)
{
struct rusage ru;
#if defined(sun)
i... |
Make zero a user field | #ifndef __ZERO_FIELD_H__
#define __ZERO_FIELD_H__
#include "Field.h"
namespace cigma {
class ZeroField;
}
class cigma::ZeroField : public cigma::Field
{
public:
ZeroField();
~ZeroField();
void set_shape(int dim, int rank);
public:
int n_dim() { return dim; }
int n_rank() { return rank; }
... | #ifndef __ZERO_FIELD_H__
#define __ZERO_FIELD_H__
#include "UserField.h"
namespace cigma {
class ZeroField;
}
class cigma::ZeroField : public cigma::UserField
{
public:
ZeroField();
~ZeroField();
void set_shape(int dim, int rank);
public:
int n_dim() { return dim; }
int n_rank() { return ran... |
Add 'LONG_TO_PTR' and 'PTR_TO_LONG' macros | #ifndef PSTOREJNI_H
#define PSTOREJNI_H
#include <inttypes.h>
#ifdef __i386__
#define LONG_TO_PTR(ptr) (void *) (uint32_t) ptr
#elif __X86_64__
#define LONG_TO_PTR(ptr) (void *) ptr
#endif
#define PTR_TO_LONG(ptr) (long) ptr
#endif
| |
Update import in main header file | //
// MORK.h
// MORK
//
// Created by Nolan Carroll on 4/23/15.
// Copyright (c) 2015 Medidata Solutions. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "ORKTaskResult+MORK.h"
#import "ORKQuestionResult+MORK.h"
//! Project version number for MORK.
FOUNDATION_EXPORT double MORKVersionNumber;
//! Project ... | //
// MORK.h
// MORK
//
// Created by Nolan Carroll on 4/23/15.
// Copyright (c) 2015 Medidata Solutions. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "ORKCollectionResult+MORK.h"
#import "ORKQuestionResult+MORK.h"
//! Project version number for MORK.
FOUNDATION_EXPORT double MORKVersionNumber;
//! Pr... |
Clean up versioning commit hash. | /* @(#)root/meta:$Id: 4660ec009138a70261265c65fc5a10398706fbd1 $ */
/*************************************************************************
* Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
* All rights reserved. *
* ... | /* @(#)root/meta:$Id$ */
/*************************************************************************
* Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
* All rights reserved. *
* ... |
Fix test submitted with r275115 (failed on ppc64 buildbots). | // RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
// Check that no empty blocks are generated for nested ifs.
extern void func();
int f0(int val) {
if (val == 0) {
func();
} else if (val == 1) {
func();
}
return 0;
}
// CHECK-LABEL: define i32 @f0
// CHECK: call void {{.*}} @func
// CHECK: call vo... | // RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
// Check that no empty blocks are generated for nested ifs.
extern void func();
int f0(int val) {
if (val == 0) {
func();
} else if (val == 1) {
func();
}
return 0;
}
// CHECK-LABEL: define {{.*}} i32 @f0
// CHECK: call void {{.*}} @func
// CHECK: ... |
Add a program to test Kiss FFT. | // Taken from: http://stackoverflow.com/a/14537855
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#ifndef M_PI
#define M_PI 3.14159265358979324
#endif
#define N 16
#define kiss_fft_scalar double
#include "kiss_fftr.h"
void TestFftReal(const char *title, const kiss_fft_scalar in[N],
kiss_... | |
Use ! instead of |, looks nicer also saves two bytes | #define L for(char*c=a[1],y;*c;)printf("%c%c%c%c",(y="w$]m.k{%\177o"[*c++-48])&u/4?124:32,y&u?95:32,y&u/2?124:32,*c?32:10);u*=8;
main(int u,char**a){u=1;L;L;L} | #define L for(char*c=a[1],y;*c;)printf("%c%c%c%c",(y="w$]m.k{%\177o"[*c++-48])&u/4?33:32,y&u?95:32,y&u/2?33:32,*c?32:10);u*=8;
main(int u,char**a){u=1;L;L;L} |
Enable raw mode in terminal | #include <unistd.h>
int main() {
char c;
while (read(STDIN_FILENO, &c, 1) == 1 && c!= 'q');
return 0;
}
| #include <termios.h>
#include <unistd.h>
void enableRawMode() {
struct termios raw;
tcgetattr(STDIN_FILENO, &raw);
raw.c_lflag &= ~(ECHO);
tcsetattr(STDIN_FILENO, TCSAFLUSH, &raw);
}
int main() {
enableRawMode();
char c;
while (read(STDIN_FILENO, &c, 1) == 1 && c!= 'q');
return 0;
}
|
Clear errno, just to be sure. | /* This is not a proper strtod() implementation, but sufficient for Python.
Python won't detect floating point constant overflow, though. */
extern int strlen();
extern double atof();
double
strtod(p, pp)
char *p;
char **pp;
{
if (pp)
*pp = p + strlen(p);
return atof(p);
}
| /* This is not a proper strtod() implementation, but sufficient for Python.
Python won't detect floating point constant overflow, though. */
extern int errno;
extern int strlen();
extern double atof();
double
strtod(p, pp)
char *p;
char **pp;
{
double res;
if (pp)
*pp = p + strlen(p);
res = atof(p);
errn... |
Fix documentation parameter name warnings | @class NSString;
/**
* Returns a string appropriate for displaying in test output
* from the provided value.
*
* @param value A value that will show up in a test's output.
*
* @return The string that is returned can be
* customized per type by conforming a type to the `TestOutputStringConvertible`
* pr... | @class NSString;
/**
* Returns a string appropriate for displaying in test output
* from the provided value.
*
* @param anyObject A value that will show up in a test's output.
*
* @return The string that is returned can be
* customized per type by conforming a type to the `TestOutputStringConvertible`
* ... |
Add member variables for storing disk info | #pragma once
#include <Windows.h>
#include <string>
class DiskInfo {
public:
DiskInfo(wchar_t driveLetter);
static std::wstring DriveFileName(wchar_t &driveLetter);
static std::wstring DriveFileName(std::wstring &driveLetter);
private:
HANDLE _devHandle;
}; | #pragma once
#include <Windows.h>
#include <string>
class DiskInfo {
public:
DiskInfo(wchar_t driveLetter);
static std::wstring DriveFileName(wchar_t &driveLetter);
static std::wstring DriveFileName(std::wstring &driveLetter);
private:
HANDLE _devHandle;
std::wstring _productId;
std::wstrin... |
Add Bad Request error code | //
// BBAAPIErrors.h
// BBAAPI
//
// Created by Owen Worley on 11/08/2014.
// Copyright (c) 2014 Blinkbox Books. All rights reserved.
//
NS_ENUM(NSInteger, BBAAPIError) {
/**
* Used when needed parameter is not supplied to the method
* or when object is supplied but it has wrong type or
* fo... | //
// BBAAPIErrors.h
// BBAAPI
//
// Created by Owen Worley on 11/08/2014.
// Copyright (c) 2014 Blinkbox Books. All rights reserved.
//
NS_ENUM(NSInteger, BBAAPIError) {
/**
* Used when needed parameter is not supplied to the method
* or when object is supplied but it has wrong type or
* fo... |
Remove 'using' directive from header, explicitly qualify std namespace. |
#ifndef SQREDIR_BLOCKLIST_H
#define SQREDIR_BLOCKLIST_H
#include <cstdio>
#include <string>
using namespace std;
// reads the given configuration file
// returns: true/false for success/failure
bool read_config(string filename);
// tries to match the Squid request & writes the response to the output stream
// inpu... |
#ifndef SQREDIR_BLOCKLIST_H
#define SQREDIR_BLOCKLIST_H
#include <cstdio>
#include <string>
// reads the given configuration file
// returns: true/false for success/failure
bool read_config(std::string filename);
// tries to match the Squid request & writes the response to the output stream
// input: a request line... |
Change header guard name to do not colide with JPetMCHit | /**
* @copyright Copyright 2018 The J-PET Framework Authors. 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 find a copy of the License in the LICENCE file.
*
* Unless required by applicable la... | /**
* @copyright Copyright 2018 The J-PET Framework Authors. 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 find a copy of the License in the LICENCE file.
*
* Unless required by applicable la... |
Delete TickComponent ( because of tick manager ) | #pragma once
#include "MileObject.h"
namespace Mile
{
/**
* ActorComponent Actor ߰ ִ ϴ Component ⺻ ŬԴϴ.
*/
class Actor;
class MILE_API ActorComponent : public MileObject
{
friend Actor;
public:
ActorComponent( const MString& NewName ) :
bIsTick( false ),
... | #pragma once
#include "MileObject.h"
namespace Mile
{
/**
* ActorComponent Actor ߰ ִ ϴ Component ⺻ ŬԴϴ.
*/
class Actor;
class MILE_API ActorComponent : public MileObject
{
friend Actor;
public:
ActorComponent( const MString& NewName ) :
bIsTick( false ),
... |
Improve compatibility with older ESP32 Arduino core versions | #pragma once
#include "esp32-hal.h"
#ifndef ESP32
#define ESP32
#endif
#define FASTLED_ESP32
#if CONFIG_IDF_TARGET_ARCH_RISCV
#define FASTLED_RISCV
#endif
#if CONFIG_IDF_TARGET_ARCH_XTENSA || CONFIG_XTENSA_IMPL
#define FASTLED_XTENSA
#endif
// Use system millis timer
#define FASTLED_HAS_MILLIS
typedef volatile uin... | #pragma once
#include "esp32-hal.h"
#ifndef ESP32
#define ESP32
#endif
#define FASTLED_ESP32
#if CONFIG_IDF_TARGET_ARCH_RISCV
#define FASTLED_RISCV
#else
#define FASTLED_XTENSA
#endif
// Handling for older versions of ESP32 Arduino core
#if !defined(ESP_IDF_VERSION)
// Older versions of ESP_IDF only supported ESP32
... |
Add another debug check to bigstructs | /*
* This file is part of Kotaka, a mud library for DGD
* http://github.com/shentino/kotaka
*
* Copyright (C) 2012 Raymond Jennings
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundati... | /*
* This file is part of Kotaka, a mud library for DGD
* http://github.com/shentino/kotaka
*
* Copyright (C) 2012 Raymond Jennings
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundati... |
Use other format specifers on Windows. | #if defined(WIN32) || defined(_WIN32) || \
defined(__WIN32) && !defined(__CYGWIN__)
#include <BaseTsd.h>
#include <windows.h>
typedef SSIZE_T ssize_t;
#endif
#ifndef _WIN32
#include <unistd.h>
#endif
#include <inttypes.h>
typedef char *String;
typedef char *Pattern;
typedef int64_t Long;
#if defined NDEBUG
#defin... | #if defined(WIN32) || defined(_WIN32) || \
defined(__WIN32) && !defined(__CYGWIN__)
#include <BaseTsd.h>
#include <windows.h>
typedef SSIZE_T ssize_t;
#define SIZE_T_FORMAT_SPECIFIER "%ld"
#endif
#ifndef _WIN32
#include <unistd.h>
#define SIZE_T_FORMAT_SPECIFIER "%zd"
#endif
#include <inttypes.h>
typedef char *Str... |
Add an Allocator interface that indicates if memory is zero init | /*
* Copyright 2015 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "SkBitmap.h"
#include "SkCodec.h"
/**
* Abstract subclass of SkBitmap's allocator.
* Allows the allocator to indicate if the memory it allocates
* is zero init... | |
Use compiler_rt version of clz and ctz | /* Copyright 2014 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.
*/
#ifndef __CROS_EC_CONFIG_CORE_H
#define __CROS_EC_CONFIG_CORE_H
/* Linker binary architecture and format */
#define BFD_ARCH arm
#define BFD_FORMA... | /* Copyright 2014 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.
*/
#ifndef __CROS_EC_CONFIG_CORE_H
#define __CROS_EC_CONFIG_CORE_H
/* Linker binary architecture and format */
#define BFD_ARCH arm
#define BFD_FORMA... |
Fix for compiler error in r4154 | /*
* 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 SkStippleMaskFilter_DEFINED
#define SkStippleMaskFilter_DEFINED
#include "SkMaskFilter.h"
/**
* Simple MaskFilter that creates a screen door stipple pattern
*/
cla... | /*
* 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 SkStippleMaskFilter_DEFINED
#define SkStippleMaskFilter_DEFINED
#include "SkMaskFilter.h"
/**
* Simple MaskFilter that creates a screen door stipple pattern
*/
cla... |
Fix stratified sampler to use minstd_rand | #ifndef STRATIFIED_SAMPLER_H
#define STRATIFIED_SAMPLER_H
#include <random>
#include <memory>
#include <array>
#include <vector>
#include "sampler.h"
/*
* A stratified sampler, generates multipled jittered
* samples per pixel in its sample region
*/
class StratifiedSampler : public Sampler {
const int spp;
std::... | #ifndef STRATIFIED_SAMPLER_H
#define STRATIFIED_SAMPLER_H
#include <random>
#include <memory>
#include <array>
#include <vector>
#include "sampler.h"
/*
* A stratified sampler, generates multipled jittered
* samples per pixel in its sample region
*/
class StratifiedSampler : public Sampler {
const int spp;
std::... |
Fix crash when dragging a thread state track | // Copyright (c) 2020 The Orbit 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 ORBIT_GL_THREAD_STATE_TRACK_H_
#define ORBIT_GL_THREAD_STATE_TRACK_H_
#include "Track.h"
// This is a track dedicated to displaying thread stat... | // Copyright (c) 2020 The Orbit 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 ORBIT_GL_THREAD_STATE_TRACK_H_
#define ORBIT_GL_THREAD_STATE_TRACK_H_
#include "Track.h"
// This is a track dedicated to displaying thread stat... |
Fix return value for logging channel write | /*
* Copyright 2019 The Project Oak Authors
*
* 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 o... | /*
* Copyright 2019 The Project Oak Authors
*
* 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 o... |
Fix the spdlog issue on 32bit systems: Failed getting file size from fd | #pragma once
#ifdef _WIN32
#include <SDKDDKVer.h>
//#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
// Windows Header Files:
#include <windows.h>
#define tstring std::wstring
#define WidenHelper(x) L##x
#define LITERAL(x) WidenHelper(x)
#else // ifdef _WIN32
#define tstri... | #pragma once
#ifdef _WIN32
#include <SDKDDKVer.h>
//#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
// Windows Header Files:
#include <windows.h>
#define tstring std::wstring
#define WidenHelper(x) L##x
#define LITERAL(x) WidenHelper(x)
#else // ifdef _WIN32
#define tstri... |
Adjust this to the wonky syntax that GCC expects. | // RUN: %llvmgcc %s -S -emit-llvm -o - | llvm-as | llvm-dis | grep llvm.used | grep foo | grep X
int X __attribute__((used));
int Y;
void foo() __attribute__((used));
void foo() {}
| // RUN: %llvmgcc %s -S -emit-llvm -o - | llvm-as | llvm-dis | grep llvm.used | grep foo | grep X
int X __attribute__((used));
int Y;
__attribute__((used)) void foo() {}
|
Fix grammatical error in comment. | /*-------------------------------------------------------------------------
*
* nodes.c
* support code for nodes (now that we get rid of the home-brew
* inheritance system, our support code for nodes get much simpler)
*
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyri... | /*-------------------------------------------------------------------------
*
* nodes.c
* support code for nodes (now that we have removed the home-brew
* inheritance system, our support code for nodes is much simpler)
*
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyr... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.