Instruction stringlengths 14 778 | input_code stringlengths 0 4.24k | output_code stringlengths 1 5.44k |
|---|---|---|
Change buffer sizes to ease stk5. | #include "../../include/mid.h"
#include <SDL/SDL_error.h>
#include <stdarg.h>
#include <errno.h>
#include <string.h>
enum { Bufsz = 1024 };
static char curerr[Bufsz + 1];
void seterrstr(const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
vsnprintf(curerr, Bufsz + 1, fmt, ap);
va_end(ap);
}
const char *miderr... | #include "../../include/mid.h"
#include <SDL/SDL_error.h>
#include <stdarg.h>
#include <errno.h>
#include <string.h>
enum { Bufsz = 1024 };
static char curerr[Bufsz];
void seterrstr(const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
vsnprintf(curerr, Bufsz, fmt, ap);
va_end(ap);
}
const char *miderrstr(void... |
Add an explanation for graphics_*_draw prototype | #ifndef __GRAPHICS_TB_H__
#define __GRAPHICS_TB_H__
#include <termbox.h>
#include "models.h"
#include "graphics.h"
typedef struct {} graphics_tb_t;
// graphics_tb initialize the graphic module.
graphics_tb_t *graphics_tb_init();
// graphics_tb_draw draws the given state on the screen.
void graphics_tb_draw(void ... | #ifndef __GRAPHICS_TB_H__
#define __GRAPHICS_TB_H__
#include <termbox.h>
#include "models.h"
#include "graphics.h"
typedef struct {} graphics_tb_t;
// graphics_tb initializes the graphic module.
graphics_tb_t *graphics_tb_init();
// graphics_tb_draw draws the given state on the screen.
//
// We do not use `graph... |
Include configured padding in offset calculation. | // Copyright 2017, Jeffrey E. Bedard
#include "text_widget.h"
#include "XSTextWidget.h"
#include "font.h"
#include "xdata.h"
short xstatus_draw_text_widget(struct XSTextWidget * widget)
{
xcb_connection_t * xc = widget->connection;
struct JBDim font_size = xstatus_get_font_size();
xcb_image_text_8(xc, widget->buffer... | // Copyright 2017, Jeffrey E. Bedard
#include "text_widget.h"
#include "XSTextWidget.h"
#include "config.h"
#include "font.h"
#include "xdata.h"
short xstatus_draw_text_widget(struct XSTextWidget * widget)
{
xcb_connection_t * xc = widget->connection;
struct JBDim font_size = xstatus_get_font_size();
xcb_image_text_... |
Revert "Handle MSVC's definition of __cplusplus" | /*
* Copyright 2018 NVIDIA Corporation
*
* 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 ... | /*
* Copyright 2018 NVIDIA Corporation
*
* 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 ... |
Change TDCHits array size from 100 to 50 | #ifndef TDCChannel_h
#define TDCChannel_h
#include <fstream>
#include <TObject.h>
#include <TClonesArray.h>
#include <iostream>
#define MAX_FULL_HITS 100
class TDCChannel : public TObject {
protected:
Int_t channel;
double leadTime1;
double trailTime1;
double tot1;
double referenceDiff1;
double leadTimes[M... | #ifndef TDCChannel_h
#define TDCChannel_h
#include <fstream>
#include <TObject.h>
#include <TClonesArray.h>
#include <iostream>
#define MAX_FULL_HITS 50
class TDCChannel : public TObject {
protected:
Int_t channel;
double leadTime1;
double trailTime1;
double tot1;
double referenceDiff1;
double leadTimes[MA... |
Remove prototypes for no longer existing functions | /*
* $Id$
*/
#include "common.h"
#include "miniobj.h"
extern struct evbase *mgt_evb;
/* mgt_child.c */
void mgt_run(int dflag);
void mgt_start_child(void);
void mgt_stop_child(void);
extern pid_t mgt_pid, child_pid;
/* mgt_cli.c */
void mgt_cli_init(void);
void mgt_cli_setup(int fdi, int fdo, int verbose);
int m... | /*
* $Id$
*/
#include "common.h"
#include "miniobj.h"
extern struct evbase *mgt_evb;
/* mgt_child.c */
void mgt_run(int dflag);
extern pid_t mgt_pid, child_pid;
/* mgt_cli.c */
void mgt_cli_init(void);
void mgt_cli_setup(int fdi, int fdo, int verbose);
int mgt_cli_askchild(int *status, char **resp, const char *f... |
Switch version numbers to 0.8.1.99 | #ifndef CLIENTVERSION_H
#define CLIENTVERSION_H
//
// client versioning
//
// These need to be macros, as version.cpp's and bitcoin-qt.rc's voodoo requires it
#define CLIENT_VERSION_MAJOR 0
#define CLIENT_VERSION_MINOR 8
#define CLIENT_VERSION_REVISION 0
#define CLIENT_VERSION_BUILD 0
// Set to ... | #ifndef CLIENTVERSION_H
#define CLIENTVERSION_H
//
// client versioning
//
// These need to be macros, as version.cpp's and bitcoin-qt.rc's voodoo requires it
#define CLIENT_VERSION_MAJOR 0
#define CLIENT_VERSION_MINOR 8
#define CLIENT_VERSION_REVISION 1
#define CLIENT_VERSION_BUILD 99
// Set to... |
Fix conditional compilation mechanism for ios | #import "CoreDataAdditions/NSManagedObject+TDTAdditions.h"
#import "CoreDataAdditions/NSManagedObjectContext+TDTAdditions.h"
#import "CoreDataAdditions/TDTCoreDataUtilityMacros.h"
#ifdef TARGET_IPHONE_OS
#import "CoreDataAdditions/NSFetchedResultsController+TDTAdditions.h"
#endif
| #import "CoreDataAdditions/NSManagedObject+TDTAdditions.h"
#import "CoreDataAdditions/NSManagedObjectContext+TDTAdditions.h"
#import "CoreDataAdditions/TDTCoreDataUtilityMacros.h"
#import "TargetConditionals.h"
#if TARGET_OS_IPHONE
#import "CoreDataAdditions/NSFetchedResultsController+TDTAdditions.h"
#endif
|
Add stubs for fp 16.16 handling rountines. | #ifndef __STD_FP16_H__
#define __STD_FP16_H__
typedef struct {
int16_t integer;
uint16_t fraction;
} Q16T;
void CastFloatQ16(Q16T *result asm("a0"), float value asm("fp0"));
void CastIntQ16(Q16T *result asm("a0"), int value asm("d0"));
void IAddQ16(Q16T *result asm("a0"), Q16T value asm("d0"));
#endif
| |
Move unknown enum entry to top. | #import <WebKit/WebKit.h>
typedef NS_ENUM (NSInteger, WMFWKScriptMessageType) {
WMFWKScriptMessagePeek,
WMFWKScriptMessageConsoleMessage,
WMFWKScriptMessageClickLink,
WMFWKScriptMessageClickImage,
WMFWKScriptMessageClickReference,
WMFWKScriptMessageClickEdit,
WMFWKScriptMessageNonAnchorTouc... | #import <WebKit/WebKit.h>
typedef NS_ENUM (NSInteger, WMFWKScriptMessageType) {
WMFWKScriptMessageUnknown,
WMFWKScriptMessagePeek,
WMFWKScriptMessageConsoleMessage,
WMFWKScriptMessageClickLink,
WMFWKScriptMessageClickImage,
WMFWKScriptMessageClickReference,
WMFWKScriptMessageClickEdit,
... |
Add a (broken) test for consume-style things where we compare the pointer. | #define REQUIRE_EXPLICIT_ATOMICS 1
#include "rmc.h"
int foo;
// LLVM will want to propagate the knowledge that p == &foo into the
// conditional, breaking our chain. We need to make sure that doesn't
// happen. The optimization is performed by -gvn.
int test(_Rmc(int *)* pp) {
XEDGE(a, b);
int *p = L(a, rmc_l... | |
Remove usage of non standard identity struct | /**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2017 Ben Vanik. All rights reserved. ... | /**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2017 Ben Vanik. All rights reserved. ... |
Set LC_ALL to UTF-8 so that SSH is clean. | #include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <pwd.h>
int main(int argc, char** argv) {
struct passwd *passwd = getpwuid(getuid());
int errno = setreuid(geteuid(), geteuid());
// errno = execle("/usr/bin/id", (char *) 0, envp);
if (errno == 0 && passwd != 0) {
// CHECK... | #include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <pwd.h>
int main(int argc, char** argv) {
struct passwd *passwd = getpwuid(getuid());
int errno = setreuid(geteuid(), geteuid());
// errno = execle("/usr/bin/id", (char *) 0, envp);
if (errno == 0 && passwd != 0) {
// CHECK... |
Refactor Matrix3x3 to internally use Vector3's | #ifndef COMMON_MATRIX_H
#define COMMON_MATRIX_H
/*
* Printipi/common/matrix.h
* (c) 2014 Colin Wallace
*
* This file exposes classes and templates used to construct 3x3 matrices.
* Matrices are useful in applying linear transformations. Notably, they can be used to adjust coordinates to a different coordinate-sp... | #ifndef COMMON_MATRIX_H
#define COMMON_MATRIX_H
#include "common/vector3.h"
/*
* Matrices are useful in applying linear transformations.
* Notably, they can be used to adjust coordinates to a different coordinate-space in order to account for an unlevel bed.
*/
class Matrix3x3 {
//r0, r1, r2 each represent o... |
Add a structure that defines ARP headers | #ifndef ARP_H_
#define ARP_H_
/*
* Address Resolution Protocol.
* See RFC 826 for protocol description.
* - https://tools.ietf.org/html/rfc826
*/
struct arphdr {
uint16_t ar_hrd; /* hardware type, one of: */
#define ARPHRD_ETHER 1 /* ethernet */
#define ARPHRD_FRELAY 15 /* frame relay */
uint16_t ar_pro; /* pr... | |
Add test case that shows a leak we don't catch. | // RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-experimental-checks -analyzer-store=region -verify %s
#include <stdlib.h>
void f1() {
int *p = malloc(10);
return; // expected-warning{{Allocated memory never released. Potential memory leak.}}
}
void f2() {
int *p = mallo... | // RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-experimental-checks -analyzer-store=region -verify %s
#include <stdlib.h>
void f1() {
int *p = malloc(10);
return; // expected-warning{{Allocated memory never released. Potential memory leak.}}
}
// THIS TEST CURRENTLY FAILS... |
Add some more test function stubs | #include <CUnit/CUnit.h>
#include <CUnit/Basic.h>
#include <utils/hashmap.h>
void test_hashmap_create(void) {
return;
}
int main(int argc, char **argv) {
CU_pSuite suite = NULL;
if(CU_initialize_registry() != CUE_SUCCESS) {
return CU_get_error();
}
// Init suite
suite = CU_add_suite(... | #include <CUnit/CUnit.h>
#include <CUnit/Basic.h>
#include <utils/hashmap.h>
void test_hashmap_create(void) {
return;
}
void test_hashmap_free(void) {
return;
}
void test_hashmap_delete(void) {
return;
}
void test_hashmap_insert(void) {
return;
}
void test_hashmap_get(void) {
return;
}
void te... |
Add empty definitions for __VERIFIER_atomic_begin and end | void __VERIFIER_error() { abort(); }
// Some files define __VERIFIER_assume, some declare as extern. What happens when redefined?
void __VERIFIER_assume(int expression) { if (!expression) { LOOP: goto LOOP; }; return; }
// #define __VERIFIER_nondet(X) X __VERIFIER_nondet_##X() { X val; return val; }
#define __VERIFIE... | void __VERIFIER_error() { abort(); }
// Some files define __VERIFIER_assume, some declare as extern. What happens when redefined?
void __VERIFIER_assume(int expression) { if (!expression) { LOOP: goto LOOP; }; return; }
// #define __VERIFIER_nondet(X) X __VERIFIER_nondet_##X() { X val; return val; }
#define __VERIFIE... |
Add finite field operations in c | #include <stdio.h>
#include <stdlib.h>
// Chunk of a finite field element.
typedef unsigned char chunk;
// Number of chunks per element.
#define N 10
// A finite field element.
typedef struct { chunk v[N]; }* number;
// Helper macro.
#define FOR(i) for (int i = 0; i < N; i++)
number new_number() {
number n = mall... | |
Disable the DAL's radio IRQ handler so we can use our own. | /**
* MicroBitCustomConfig.h
*
* This file is automatically included by the microbit DAL compilation
* process. Use this to define any custom configration options needed
* for your build of the micro:bit runtime.
*
* See microbit-dal/inc/MicroBitConfig.h for a complete list of options.
* Any options you... | /**
* MicroBitCustomConfig.h
*
* This file is automatically included by the microbit DAL compilation
* process. Use this to define any custom configration options needed
* for your build of the micro:bit runtime.
*
* See microbit-dal/inc/MicroBitConfig.h for a complete list of options.
* Any options you... |
Update version number to 8.01.07-k1. | /*
* QLogic Fibre Channel HBA Driver
* Copyright (c) 2003-2005 QLogic Corporation
*
* See LICENSE.qla2xxx for copyright and licensing details.
*/
/*
* Driver version
*/
#define QLA2XXX_VERSION "8.01.05-k4"
#define QLA_DRIVER_MAJOR_VER 8
#define QLA_DRIVER_MINOR_VER 1
#define QLA_DRIVER_PATCH_VER 5
#define... | /*
* QLogic Fibre Channel HBA Driver
* Copyright (c) 2003-2005 QLogic Corporation
*
* See LICENSE.qla2xxx for copyright and licensing details.
*/
/*
* Driver version
*/
#define QLA2XXX_VERSION "8.01.07-k1"
#define QLA_DRIVER_MAJOR_VER 8
#define QLA_DRIVER_MINOR_VER 1
#define QLA_DRIVER_PATCH_VER 7
#define... |
Update formatting, remove CII vars | static char rcsid[] = "$Id: H:/drh/idioms/book/RCS/except.doc,v 1.10 1997/02/21 19:43:55 drh Exp $";
#include "assert.h"
const Except_T Assert_Failed = { "Assertion failed" };
void (assert)(int e) {
assert(e);
}
| /**
* assert.c
*
* Copyright (C) 2017 Nickolas Burr <nickolasburr@gmail.com>
*/
#include "assert.h"
const Except_T Assert_Failed = {
"Assertion failed"
};
void (assert)(int e) {
assert(e);
}
|
Use correct file io function for binary reads | #include <stdlib.h>
#include <stdio.h>
#include "diskio.h"
char* loadDataFromDiskFile(char* fileName) {
FILE* diskFile = fopen(fileName, "rb");
if(diskFile == NULL)
return NULL;
char* diskData = (char*)malloc(sizeof(char) * DISK_SIZE);
if(!fgets(diskData, DISK_SIZE, diskFile)) {
... | #include <stdlib.h>
#include <stdio.h>
#include "diskio.h"
char* loadDataFromDiskFile(char* fileName) {
FILE* diskFile = fopen(fileName, "rb");
if(diskFile == NULL)
return NULL;
char* diskData = (char*)malloc(sizeof(char) * DISK_SIZE);
/* TODO: Return null if bytes read is less than ... |
Fix wrong eth payload data type | #ifndef ETHERNET_H_
#define ETHERNET_H_
#include <linux/if_ether.h>
struct eth_hdr
{
unsigned char dst_mac[6];
unsigned char src_mac[6];
unsigned short ethertype;
unsigned char* payload;
};
struct eth_hdr* init_eth_hdr(char* buf);
void print_eth_hdr(struct eth_hdr *ehdr);
#endif
| #ifndef ETHERNET_H_
#define ETHERNET_H_
#include <linux/if_ether.h>
struct eth_hdr
{
unsigned char dst_mac[6];
unsigned char src_mac[6];
unsigned short ethertype;
unsigned char payload[];
};
struct eth_hdr* init_eth_hdr(char* buf);
void print_eth_hdr(struct eth_hdr *ehdr);
#endif
|
Send the "* BYE Logging out" before closing mailbox. | /* Copyright (C) 2002 Timo Sirainen */
#include "common.h"
#include "commands.h"
int cmd_logout(struct client *client)
{
client_send_line(client, "* BYE Logging out");
if (client->mailbox != NULL) {
/* this could be done at client_disconnect() as well,
but eg. mbox rewrite takes a while so the waiting is
... | /* Copyright (C) 2002 Timo Sirainen */
#include "common.h"
#include "commands.h"
int cmd_logout(struct client *client)
{
client_send_line(client, "* BYE Logging out");
o_stream_uncork(client->output);
if (client->mailbox != NULL) {
/* this could be done at client_disconnect() as well,
but eg. mbox rewrite ... |
Change the EFM32 reset type to a software reset | /* CMSIS-DAP Interface Firmware
* Copyright (c) 2009-2013 ARM Limited
*
* 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 re... | /* CMSIS-DAP Interface Firmware
* Copyright (c) 2009-2013 ARM Limited
*
* 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 re... |
Add a missing prototype (callGetLocaleInfoEx()) |
#include "link-includes.h"
// Already declared in link-includes.h
// const char * linkgrammar_get_dict_locale(Dictionary dict);
// const char * linkgrammar_get_version(void);
// const char * linkgrammar_get_dict_version(Dictionary dict);
void dictionary_setup_locale(Dictionary dict);
void dictionary_setup_defines(Di... |
#include "link-includes.h"
#include "utilities.h"
// Already declared in link-includes.h
// const char * linkgrammar_get_dict_locale(Dictionary dict);
// const char * linkgrammar_get_version(void);
// const char * linkgrammar_get_dict_version(Dictionary dict);
void dictionary_setup_locale(Dictionary dict);
void dict... |
Add missing initialization of time resolution | //
// This file is part of the Marble Virtual Globe.
//
// This program is free software licensed under the GNU LGPL. You can
// find a copy of this license in LICENSE.txt in the top directory of
// the source code.
//
// Copyright 2010 Harshit Jain <hjain.itbhu@gmail.com>
//
#ifndef GEODATATIMESTAMPPRIVATE_H
#de... | //
// This file is part of the Marble Virtual Globe.
//
// This program is free software licensed under the GNU LGPL. You can
// find a copy of this license in LICENSE.txt in the top directory of
// the source code.
//
// Copyright 2010 Harshit Jain <hjain.itbhu@gmail.com>
//
#ifndef GEODATATIMESTAMPPRIVATE_H
#de... |
Add newline to end of file | //
// AardvarkDefines.h
// Aardvark
//
// Created by Dan Federman on 10/4/14.
// Copyright (c) 2014 Square, Inc. All rights reserved.
//
/**
Provides the ability to verify key paths at compile time.
If "keyPath" does not exist, a compile-time error will be generated.
Example:
// Verifies "isFinished" exist... | //
// AardvarkDefines.h
// Aardvark
//
// Created by Dan Federman on 10/4/14.
// Copyright (c) 2014 Square, Inc. All rights reserved.
//
/**
Provides the ability to verify key paths at compile time.
If "keyPath" does not exist, a compile-time error will be generated.
Example:
// Verifies "isFinished" exist... |
Change bool to a macro instead of typedef | #ifndef _UCC_STDBOOL_H
#define _UCC_STDBOOL_H
#define __bool_true_false_are_defined 1
typedef _Bool bool;
#define bool bool
#define false 0
#define true 1
#endif
| #ifndef _UCC_STDBOOL_H
#define _UCC_STDBOOL_H
#define __bool_true_false_are_defined 1
#define bool _Bool
#define false 0
#define true 1
#endif
|
Fix up merge with the ARM tree | /*
* arch/arm/mach-shark/include/mach/io.h
*
* by Alexander Schulz
*
* derived from:
* arch/arm/mach-ebsa110/include/mach/io.h
* Copyright (C) 1997,1998 Russell King
*/
#ifndef __ASM_ARM_ARCH_IO_H
#define __ASM_ARM_ARCH_IO_H
#define PCIO_BASE 0xe0000000
#define IO_SPACE_LIMIT 0xffffffff
#define __io(a) __ty... | /*
* arch/arm/mach-shark/include/mach/io.h
*
* by Alexander Schulz
*
* derived from:
* arch/arm/mach-ebsa110/include/mach/io.h
* Copyright (C) 1997,1998 Russell King
*/
#ifndef __ASM_ARM_ARCH_IO_H
#define __ASM_ARM_ARCH_IO_H
#define PCIO_BASE 0xe0000000
#define IO_SPACE_LIMIT 0xffffffff
#define __io(a) __ty... |
Comment out the c for now | #include <ruby.h>
#include <stdint.h>
static VALUE rb_integer_to_bson(VALUE self)
{
const int32_t v = NUM2INT(self);
const char bytes[4] = { v & 255, (v >> 8) & 255, (v >> 16) & 255, (v >> 24) & 255 };
return rb_str_new(bytes, 4);
}
void Init_native()
{
VALUE bson = rb_const_get(rb_cObject, rb_intern("BSON"))... | #include <ruby.h>
#include <stdint.h>
static VALUE rb_integer_to_bson(VALUE self)
{
/* const int32_t v = NUM2INT(self); */
/* const char bytes[4] = { v & 255, (v >> 8) & 255, (v >> 16) & 255, (v >> 24) & 255 }; */
/* return rb_str_new(bytes, 4); */
}
void Init_native()
{
/* VALUE bson = rb_const_get(rb_cObjec... |
Return the result of debugged functions, and flush stderr on exit. | #include <string.h>
#include "iobuf/iobuf.h"
#include "msg/msg.h"
#include "str/str.h"
void NL(void) { obuf_putc(&outbuf, LF); }
void debugstr(const str* s)
{
obuf_puts(&outbuf, "len=");
obuf_putu(&outbuf, s->len);
obuf_puts(&outbuf, " size=");
obuf_putu(&outbuf, s->size);
if (s->s == 0)
obuf_puts(&out... | #include <string.h>
#include "iobuf/iobuf.h"
#include "msg/msg.h"
#include "str/str.h"
void NL(void) { obuf_putc(&outbuf, LF); }
void debugstr(const str* s)
{
obuf_puts(&outbuf, "len=");
obuf_putu(&outbuf, s->len);
obuf_puts(&outbuf, " size=");
obuf_putu(&outbuf, s->size);
if (s->s == 0)
obuf_puts(&out... |
Make sure plan and currency are not readonly | //
// PSTCKTransactionParams.h
// Paystack
//
#import <Foundation/Foundation.h>
#import "PSTCKFormEncodable.h"
/**
* Representation of the transaction to perform on a card
*/
@interface PSTCKTransactionParams : NSObject<PSTCKFormEncodable>
@property (nonatomic, copy, nonnull) NSString *email;
@property (nonatomi... | //
// PSTCKTransactionParams.h
// Paystack
//
#import <Foundation/Foundation.h>
#import "PSTCKFormEncodable.h"
/**
* Representation of the transaction to perform on a card
*/
@interface PSTCKTransactionParams : NSObject<PSTCKFormEncodable>
@property (nonatomic, copy, nonnull) NSString *email;
@property (nonatomi... |
Change type of DeclSpecs to uint16_t | #ifndef DECL_H
#define DECL_H
#include <stdlib.h>
typedef enum DeclSpec {
DECL_SPEC_NONE = 0x0,
DECL_SPEC_FLOAT = 0x1,
DECL_SPEC_INT = 0x2,
DECL_SPEC_SIGNED = 0x4,
DECL_SPEC_UNSIGNED = 0x8,
DECL_SPEC_VOID = 0x10,
} DeclSpec;
typedef size_t DeclSpecs;
#endif
| #ifndef DECL_H
#define DECL_H
#include <stdint.h>
typedef enum DeclSpec {
DECL_SPEC_NONE = 0x0,
DECL_SPEC_FLOAT = 0x1,
DECL_SPEC_INT = 0x2,
DECL_SPEC_SIGNED = 0x4,
DECL_SPEC_UNSIGNED = 0x8,
DECL_SPEC_VOID = 0x10,
} DeclSpec;
typedef uint16_t DeclSpecs;
#endif
|
Remove gard around of the prototype declaration of rb_get_kwargs for Ruby 2.1.x | #ifndef DLIB_MISSING_H
#define DLIB_MISSING_H
#include <ruby/ruby.h>
#if defined(__cplusplus)
extern "C" {
#if 0
} /* satisfy cc-mode */
#endif
#endif
#ifndef HAVE_RB_GET_KWARGS
int rb_get_kwargs(VALUE keyword_hash, const ID *table, int required, int optional, VALUE *values);
#endif
#if defined(__cplusplus)
#if 0... | #ifndef DLIB_MISSING_H
#define DLIB_MISSING_H
#include <ruby/ruby.h>
#if defined(__cplusplus)
extern "C" {
#if 0
} /* satisfy cc-mode */
#endif
#endif
int rb_get_kwargs(VALUE keyword_hash, const ID *table, int required, int optional, VALUE *values);
#if defined(__cplusplus)
#if 0
{ /* satisfy cc-mode */
#endif
} /... |
Enable a WebP AID to show its animation one time | /*
* Copyright 2017 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SkUserConfigManual_DEFINED
#define SkUserConfigManual_DEFINED
#define GR_TEST_UTILS 1
#define SK_BUILD_FOR_ANDROID_FRAMEWORK
#define SK_DEFAULT_FONT_CACHE_LIMIT ... | /*
* Copyright 2017 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SkUserConfigManual_DEFINED
#define SkUserConfigManual_DEFINED
#define GR_TEST_UTILS 1
#define SK_BUILD_FOR_ANDROID_FRAMEWORK
#define SK_DEFAULT_FONT_CACHE_LIMIT ... |
Reset EnvType and changed objdefs.h | #ifndef _RTUPDATE_H_
#define _RTUPDATE_H_ 1
#define MAXPUPARR 100
#define MAXPUPS 20
#define NOPUPDATE 78787878 // hopefully never a real p-value!
/* For rtperf */
/* DJT: modified to work with JG's objlib.h */
typedef enum {
NONE,
ATTACK,
DECAY,
SUSTAIN,
RELEASE,
END
} EnvType;
GLOBAL int curtag; ... | #ifndef _RTUPDATE_H_
#define _RTUPDATE_H_ 1
#define MAXPUPARR 100
#define MAXPUPS 20
#define NOPUPDATE 78787878 // hopefully never a real p-value!
/* For rtperf */
/* DJT: modified to work with JG's objlib.h */
typedef enum {
NONE,
RISE,
SUSTAIN,
DECAY
} EnvType;
#ifndef GLOBAL
#define GLOBAL extern
#endif... |
Reduce character size to 2 units | #pragma once
#include <cmath>
#include <tuple>
namespace Component {
struct Warpgate {
int16_t id;
float min_x;
float min_y;
float min_z;
float max_x;
float max_y;
float max_z;
static constexpr float character_size = 2000.f;
uint16_t dest_map;
static constexpr inline float s... | #pragma once
#include <cmath>
#include <tuple>
namespace Component {
struct Warpgate {
int16_t id;
float min_x;
float min_y;
float min_z;
float max_x;
float max_y;
float max_z;
static constexpr float character_size = 200.f;
uint16_t dest_map;
static constexpr inline float sq... |
FIX typo: 0.21-nextç -> 0.21.0-next | #ifndef SRC_APP_CONTEXTBROKER_VERSION_H_
#define SRC_APP_CONTEXTBROKER_VERSION_H_
/*
*
* Copyright 2013 Telefonica Investigacion y Desarrollo, S.A.U
*
* This file is part of Orion Context Broker.
*
* Orion Context Broker is free software: you can redistribute it and/or
* modify it under the terms of the GNU Affero Gen... | #ifndef SRC_APP_CONTEXTBROKER_VERSION_H_
#define SRC_APP_CONTEXTBROKER_VERSION_H_
/*
*
* Copyright 2013 Telefonica Investigacion y Desarrollo, S.A.U
*
* This file is part of Orion Context Broker.
*
* Orion Context Broker is free software: you can redistribute it and/or
* modify it under the terms of the GNU Affero Gen... |
Move SH4 definitions to header file | #ifndef __sh4_h__
#define __sh4_h__
enum {
SH4_BASE = 0x4000,
Rm,
Rn,
FRm,
FRn,
i8,
i20,
Pr15, // [R15++]
Dn, // [--Rn]
Pn, // [Rn++]
dn, // [Rn]
dn0, // [Rn+R0]
d4n, // [Rn+d4]
d12n, // [Rn+d12]
Dm, // [--Rm]
Pm, // [Rm++]
dm, // [Rm]
dm0, // [Rm+R0]
d4m, // [Rm... | |
Add centralized header which would include all other debug headers (memdeb, glitching at the moment). | /*
* Copyright (c) 2019 Sippy Software, Inc., http://www.sippysoft.com
* 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
... | |
Add test where address containing unknown should escape known | #include <pthread.h>
#include <assert.h>
int *p;
void *t_fun(void *arg) {
if (arg != NULL) {
*((int*)arg) = 42;
}
return NULL;
}
int main() {
pthread_t id, id2;
int *r; // unknown
int i = 5;
pthread_create(&id, NULL, t_fun, NULL); // enter multithreaded
p = r;
p = &i;
pthread_create(&id2, ... | |
Add new file that was forgotten. | #ifndef HALIDE_BUF_SIZE_H
#define HALIDE_BUF_SIZE_H
// TODO: in new buffer_t, add an inline method to do this and kill this file.
// Compute the total amount of memory we'd need to allocate on gpu to
// represent a given buffer (using the same strides as the host
// allocation).
WEAK size_t buf_size(const buffer_t *b... | |
Introduce |CodeBufferUser::code_buffer()| to use |CodeBuffer::EmitJump()| for 'br' instruction emitter. | // Copyright 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_LIR_EMITTERS_CODE_BUFFER_USER_H_
#define ELANG_LIR_EMITTERS_CODE_BUFFER_USER_H_
#include "base/basictypes.h"
namespace elang {
namespace lir {
c... | // Copyright 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_LIR_EMITTERS_CODE_BUFFER_USER_H_
#define ELANG_LIR_EMITTERS_CODE_BUFFER_USER_H_
#include "base/basictypes.h"
namespace elang {
namespace lir {
c... |
Add List Node destroy function declaration | #include <stdlib.h>
#ifndef __LIST_H__
#define __LIST_H__
struct ListNode;
struct List;
typedef struct ListNode ListNode;
typedef struct List List;
List* List_Create(void);
void List_Destroy(List* l);
ListNode* ListNode_Create(void *);
#endif | #include <stdlib.h>
#ifndef __LIST_H__
#define __LIST_H__
struct ListNode;
struct List;
typedef struct ListNode ListNode;
typedef struct List List;
List* List_Create(void);
void List_Destroy(List* l);
ListNode* ListNode_Create(void *);
void ListNode_Destroy(ListNode* n);
#endif |
Improve BOM test from r195877 | // RUN: %clang -E -frewrite-includes -I %S/Inputs %s -o - | %clang -fsyntax-only -Xclang -verify -x c -
// expected-no-diagnostics
#include "rewrite-includes-bom.h"
| // RUN: grep '^\xEF\xBB\xBF' %S/Inputs/rewrite-includes-bom.h
// RUN: %clang_cc1 -E -frewrite-includes -I %S/Inputs %s -o - | %clang_cc1 -fsyntax-only -verify -x c - | not grep '\xEF\xBB\xBF'
// expected-no-diagnostics
#include "rewrite-includes-bom.h"
|
Add getIds to file manager | #ifndef _FILE_MANAGER_INTERFACE_
#define _FILE_MANAGER_INTERFACE_
#include <string>
#include <cstdint>
class FileManagerInterface {
public:
virtual bool send(
const std::string & host,
const unsigned short host_port,
std::string & file_path,
uint64_t fr... | #ifndef _FILE_MANAGER_INTERFACE_
#define _FILE_MANAGER_INTERFACE_
#include <string>
#include <cstdint>
class FileManagerInterface {
public:
virtual uint64_t send(
const std::string & host,
const unsigned short host_port,
std::string & file_path,
uint64_... |
Enumerate strided array data types | /**
* @license Apache-2.0
*
* Copyright (c) 2018 The Stdlib 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 a... | |
Add another test for pretty printing if-then-else | int f(int d)
{
int i = 0, j, k, l;
if (d%2==0)
if (d%3==0)
i+=2;
else
i+=3;
if (d%2==0)
{
if (d%3==0)
i+=7;
}
else
i+=11;
l = d;
if (d%2==0)
while (l--)
if (1)
i+=13;
else
... | |
Fix typo in C template | #include <display.h>
/* Warning! C support in KnightOS is highly experimental. Your milage may vary. */
void main(void) {
SCREEN *screen;
get_lcd_lock();
screen = screen_allocate();
screen_clear(screen);
draw_string(screen, 0, 0, "Hello world!");
screen_draw(screen);
while (1);
}
| #include <display.h>
/* Warning! C support in KnightOS is highly experimental. Your mileage may vary. */
void main(void) {
SCREEN *screen;
get_lcd_lock();
screen = screen_allocate();
screen_clear(screen);
draw_string(screen, 0, 0, "Hello world!");
screen_draw(screen);
while (1);
}
|
Add BSTNode Create 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);
#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);
#endif |
Add a mssissing file at previous commit | //Vertigo v2.0 board setting
#define USE_FUTABA
#define USE_IMU_MPU9250
#define USE_ADS1246_MPX6115A
#define STM32F427X
| |
Fix GLContext::createGLContext() impl (must return a value) | // LAF OS Library
// Copyright (C) 2022 Igara Studio S.A.
// Copyright (C) 2015-2016 David Capello
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.
#ifndef OS_GL_CONTEXT_INCLUDED
#define OS_GL_CONTEXT_INCLUDED
#pragma once
namespace os {
class GLContext {
pu... | // LAF OS Library
// Copyright (C) 2022 Igara Studio S.A.
// Copyright (C) 2015-2016 David Capello
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.
#ifndef OS_GL_CONTEXT_INCLUDED
#define OS_GL_CONTEXT_INCLUDED
#pragma once
namespace os {
class GLContext {
pu... |
Use a dummy target so the test passes when default target is for a toolchain implements useIntegratedAs() -> true | // RUN: %clang -### -c -save-temps -integrated-as %s 2>&1 | FileCheck %s
// CHECK: cc1as
// CHECK: -mrelax-all
// RUN: %clang -### -fintegrated-as -c -save-temps %s 2>&1 | FileCheck %s -check-prefix FIAS
// FIAS: cc1as
// RUN: %clang -### -fno-integrated-as -S %s 2>&1 \
// RUN: | FileCheck %s -check-prefix NOFI... | // RUN: %clang -### -c -save-temps -integrated-as %s 2>&1 | FileCheck %s
// CHECK: cc1as
// CHECK: -mrelax-all
// RUN: %clang -### -fintegrated-as -c -save-temps %s 2>&1 | FileCheck %s -check-prefix FIAS
// FIAS: cc1as
// RUN: %clang -target none -### -fno-integrated-as -S %s 2>&1 \
// RUN: | FileCheck %s -chec... |
Fix sockops map name for testing | /*
* Copyright (C) 2018 Authors of Cilium
*
* This program 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, or
* (at your option) any later version.
*
* This progr... | /*
* Copyright (C) 2018-2019 Authors of Cilium
*
* This program 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, or
* (at your option) any later version.
*
* This ... |
Define the Glib functions as module functions. | #include <ruby.h>
#include <glib.h>
static VALUE utf8_size(VALUE self, VALUE string)
{
VALUE result;
Check_Type(string, T_STRING);
result = ULONG2NUM(g_utf8_strlen(StringValuePtr(string), RSTRING(string)->len));
return result;
}
static VALUE utf8_upcase(VALUE self, VALUE string)
{
VALUE result;
gchar *t... | #include <ruby.h>
#include <glib.h>
static VALUE utf8_size(VALUE self, VALUE string)
{
VALUE result;
Check_Type(string, T_STRING);
result = ULONG2NUM(g_utf8_strlen(StringValuePtr(string), RSTRING(string)->len));
return result;
}
static VALUE utf8_upcase(VALUE self, VALUE string)
{
VALUE result;
gchar *t... |
Add a copy constructor and * overload | #pragma once
#ifndef TESTING_UTIL_H
#define TESTING_UTIL_H 1
#include <Python.h>
/**
Use RAII to Py_XDECREF a pointer.
Inspired by std::unique_ptr.
*/
template <class T> class py_ptr {
private:
T* m_ptr;
public:
py_ptr() : m_ptr(nullptr) {}
py_ptr(T* ptr) : m_ptr(ptr) {}
~py_ptr() {
... | #pragma once
#ifndef TESTING_UTIL_H
#define TESTING_UTIL_H 1
#include <Python.h>
/**
Use RAII to Py_XDECREF a pointer.
Inspired by std::unique_ptr.
*/
template <class T> class py_ptr {
private:
T* m_ptr;
public:
py_ptr() : m_ptr(nullptr) {}
py_ptr(T* ptr) : m_ptr(ptr) {}
py_ptr(const py_ptr... |
Enable and disable raw mode in terminal | #include <unistd.h>
int main(int argc, char *argv[])
{
char c;
// Read 1 byte at a time
while(read(STDIN_FILENO, &c, 1) == 1);
return 0;
}
| #include <ctype.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <termios.h>
struct termios orig_termios;
void enableRawMode();
void disableRawMode();
int main(int argc, char *argv[])
{
enableRawMode();
// Read 1 byte at a time
while(1){
char input = '\0'; // Input from use... |
Use same int 64 type | // Copyright 2014 Toggl Desktop developers.
#ifndef SRC_PROXY_H_
#define SRC_PROXY_H_
#include <string>
#include "./types.h"
#include "Poco/Types.h"
namespace kopsik {
class Proxy {
public:
Proxy() :
host(""),
port(0),
username(""),
password("") {}
bool IsConfigured() const;
bool Has... | // Copyright 2014 Toggl Desktop developers.
#ifndef SRC_PROXY_H_
#define SRC_PROXY_H_
#include <string>
#include "./types.h"
#include "Poco/Types.h"
namespace kopsik {
class Proxy {
public:
Proxy() :
host(""),
port(0),
username(""),
password("") {}
bool IsConfigured() const;
bool Has... |
Implement a new RemoveSuccessor function | //===-- Transform/Utils/BasicBlockUtils.h - BasicBlock Utilities -*- C++ -*-==//
//
// This family of functions perform manipulations on basic blocks, and
// instructions contained within basic blocks.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_TRANSFORMS_UTILS_BAS... | //===-- Transform/Utils/BasicBlockUtils.h - BasicBlock Utilities -*- C++ -*-==//
//
// This family of functions perform manipulations on basic blocks, and
// instructions contained within basic blocks.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_TRANSFORMS_UTILS_BAS... |
Add a component splitter filter. | // ---------------------------------------------------------------------
//
// Copyright (C) 2019 by the SampleFlow authors.
//
// This file is part of the SampleFlow library.
//
// The deal.II library is free software; you can use it, redistribute
// it, and/or modify it under the terms of the GNU Lesser General
// Pu... | |
Add one empty header file | // The MIT License (MIT)
//
// Copyright (c) 2016 Northeastern University
//
// 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
... | |
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... |
Call lib init/cleanup in C client test. | #include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <mosquitto.h>
static int run = -1;
void on_connect(struct mosquitto *mosq, void *obj, int rc)
{
if(rc){
exit(1);
}else{
mosquitto_disconnect(mosq);
}
}
void on_disconnect(struct mosquitto *mosq, void *obj, int rc)
{
run = rc;
}
int main(in... | #include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <mosquitto.h>
static int run = -1;
void on_connect(struct mosquitto *mosq, void *obj, int rc)
{
if(rc){
exit(1);
}else{
mosquitto_disconnect(mosq);
}
}
void on_disconnect(struct mosquitto *mosq, void *obj, int rc)
{
run = rc;
}
int main(in... |
Allow to set custom DTB/OS_CALL addresses | #ifndef CONFIG_H
#define CONFIG_H
//#define QEMU
#define SIM
#define OS_CALL 0xC0000000
#define DTB 0xC3000000
#endif
| #ifndef CONFIG_H
#define CONFIG_H
//#define QEMU
#define SIM
#ifndef OS_CALL
#define OS_CALL 0xC0000000
#endif
#ifndef DTB
#define DTB 0xC3000000
#endif
#endif
|
Print the message from SK_ABORT in stack traces | /*
* Copyright 2017 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SkUserConfigManual_DEFINED
#define SkUserConfigManual_DEFINED
#define GR_TEST_UTILS 1
#define SK_BUILD_FOR_ANDROID_FRAMEWORK
#define SK_DEFAULT_FONT_CACHE_LIMIT ... | /*
* Copyright 2017 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SkUserConfigManual_DEFINED
#define SkUserConfigManual_DEFINED
#include <android/log.h>
#define GR_TEST_UTILS 1
#define SK_BUILD_FOR_ANDROID_FRAMEWORK
#define S... |
Add a typedef for iterators. | // Copyright (c) 2014 Rob Rix. All rights reserved.
#import <Foundation/Foundation.h>
@protocol REDIterable <NSObject>
@property (readonly) id(^red_iterator)(void);
@end
| // Copyright (c) 2014 Rob Rix. All rights reserved.
#import <Foundation/Foundation.h>
/// A nullary block iterating the elements of a collection over successive calls.
///
/// \return The next object in the collection, or nil if it has iterated the entire collection.
typedef id (^REDIteratingBlock)(void);
/// A col... |
Fix clang-6 compile error (virtual destructor) | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import <memory>
#include <fabric/IFabricPlatformUIOperationManager.h>
@cla... | /**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import <memory>
#include <fabric/IFabricPlatformUIOperationManager.h>
@cla... |
Use tab characters in help text. | // Copyright 2016, Jeffrey E. Bedard
#include "xstatus.h"
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
static const char helptext[] =
"DESCRIPTION: Simple X toolbar for minimalistic"
" window managers.\n"
"USAGE: xstatus [-d DELAY][-f FILE][-h]\n"
"\t-d DELAY Set delay between ... | // Copyright 2016, Jeffrey E. Bedard
#include "xstatus.h"
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
static const char helptext[] =
"DESCRIPTION: Simple X toolbar for minimalistic"
" window managers.\n"
"USAGE: xstatus [-d DELAY][-f FILE][-h]\n"
"\t-d DELAY\tSet delay between sta... |
Add test for overloading with _Complex in C | // RUN: clang -fsyntax-only -verify %s
char *foo(float) __attribute__((__overloadable__)); // expected-note 3 {{candidate function}}
void test_foo_1(float fv, double dv, float _Complex fc, double _Complex dc) {
char *cp1 = foo(fv);
char *cp2 = foo(dv);
// Note: GCC and EDG reject these two, but they are valid C9... | |
Tweak the kobo mxcfb cdecl | // standard Linux framebuffer headers
#include <linux/fb.h>
#include <linux/ioctl.h>
// specialized eink framebuffer headers
typedef unsigned int uint;
#include "include/mxcfb-kobo.h"
#include "cdecl.h"
cdecl_struct(mxcfb_rect)
cdecl_struct(mxcfb_alt_buffer_data)
cdecl_struct(mxcfb_update_data)
cdecl_const(MXCFB_SE... | // standard Linux framebuffer headers
#include <linux/fb.h>
#include <linux/ioctl.h>
// specialized eink framebuffer headers
typedef unsigned int uint;
#include "include/mxcfb-kobo.h"
#include "cdecl.h"
cdecl_struct(mxcfb_rect)
cdecl_struct(mxcfb_alt_buffer_data)
cdecl_struct(mxcfb_update_data)
cdecl_const(MXCFB_SE... |
Fix typo so all arguments are loaded. | #include "js.h"
int
main(int argc, char **argv)
{
js_State *J;
int i;
J = js_newstate();
for (i = 1; i < argc; i++) {
js_loadfile(J, argv[1]);
// js_run(J);
}
js_close(J);
return 0;
}
| #include "js.h"
int
main(int argc, char **argv)
{
js_State *J;
int i;
J = js_newstate();
for (i = 1; i < argc; i++) {
js_loadfile(J, argv[i]);
// js_run(J);
}
js_close(J);
return 0;
}
|
Add LinkList reverese using recursion and print using recursion | #include <stdio.h>
#include <stdlib.h>
/* Linked List Implementation in C */
// This program aims at "Revering the Link List"
typedef struct node{
int data;
struct node *link;
} node;
node* head; //global variable
void insert_append(int x){
node* temp;
temp = (node*)malloc(sizeof(node));
temp->data = x;
temp->li... | |
Add inline C function to import and cache Python functions. | #ifndef NPY_IMPORT_H
#define NPY_IMPORT_H
#include <Python.h>
#include <assert.h>
/*! \brief Fetch and cache Python function.
*
* Import a Python function and cache it for use. The function checks if
* cache is NULL, and if not NULL imports the Python function specified by
* \a module and \a function, increments ... | |
Add unsound dereferencing of unknown function pointer from ddverify pcwd | // PARAM: --disable sem.unknown_function.invalidate.globals --disable sem.unknown_function.spawn
// extracted from ddverify pcwd
// header declarations
struct file_operations {
void (*ioctl)();
};
struct miscdevice {
struct file_operations *fops;
};
struct cdev {
struct file_operations *ops;
};
// implementa... | |
Use gtk_widget_show_all instead of just show | #include <gtk/gtk.h>
#include "main-window.h"
int
main (int argc, char *argv[])
{
GtkWidget *window;
gtk_init(&argc, &argv);
window = main_window_create();
gtk_widget_show(window);
gtk_main();
return 0;
}
| #include <gtk/gtk.h>
#include "main-window.h"
int
main (int argc, char *argv[])
{
GtkWidget *window;
gtk_init(&argc, &argv);
window = main_window_create();
gtk_widget_show_all(window);
gtk_main();
return 0;
}
|
Change an old Option.h to Argument.h | /*
ArgParser - C++ Argument Parser reflecting the python module ArgParse.
Copyright (C) 2014-2015 Matthew Scott Krafczyk
This program 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 Licen... | /*
ArgParser - C++ Argument Parser reflecting the python module ArgParse.
Copyright (C) 2014-2015 Matthew Scott Krafczyk
This program 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 Licen... |
Fix asm generation with mlcd -a | #ifndef MLCD_COMMON_H
#define MLCD_COMMON_H
#define BYTE_TO_ASCII(byte) \
(byte & 0x80 ? '#' : ' '), \
(byte & 0x40 ? '#' : ' '), \
(byte & 0x20 ? '#' : ' '), \
(byte & 0x10 ? '#' : ' '), \
(byte & 0x08 ? '#' : ' '), \
(byte & 0x04 ? '#' : ' '), \
(byte & 0x02 ? '#' : ' '), \
(byte & 0x01 ? '#' : ' ')
#defin... | #ifndef MLCD_COMMON_H
#define MLCD_COMMON_H
#define BYTE_TO_ASCII(byte) \
(byte & 0x80 ? '1' : '0'), \
(byte & 0x40 ? '1' : '0'), \
(byte & 0x20 ? '1' : '0'), \
(byte & 0x10 ? '1' : '0'), \
(byte & 0x08 ? '1' : '0'), \
(byte & 0x04 ? '1' : '0'), \
(byte & 0x02 ? '1' : '0'), \
(byte & 0x01 ? '1' : '0')
#defin... |
Use <> instead of "" | //
// Use this file to import your target's public headers that you would like to expose to Swift.
//
#import "Konashi.h"
#import "Colorkit.h"
#import <EstimoteSDK/EstimoteSDK.h>
#import "ActionSheetPicker.h"
| //
// Use this file to import your target's public headers that you would like to expose to Swift.
//
#import <Konashi.h>
#import <Colorkit.h>
#import <EstimoteSDK/EstimoteSDK.h>
#import <ActionSheetPicker.h>
|
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... |
Remove stuff moved to interrupts header | #pragma once
#include <truth/types.h>
// The state of the CPU before an interrupt occurs.
struct cpu_state;
// Interrupt Service Routine function signature.
// ISRs with this signature are installed to a dispatch table.
typedef void (isr_f)(struct cpu_state *);
/* Install an interrupt handler.
* The handler will h... | #pragma once
#include <truth/types.h>
// Halt CPU.
extern void halt(void);
// Gets the CPU time step counter value.
extern uint64_t cpu_time(void);
// Puts CPU into sleep state until awoken by interrupt.
void cpu_sleep_state(void);
|
Store employee information in an array of structs | /* lab5.c: Employee records */
#include <stdio.h>
#include <string.h>
struct Employee {
char last[16];
char first[11];
char title[16];
int salary;
};
int main() {
struct Employee employees[BUFSIZ];
for (int i = 0; i < BUFSIZ; i++) {
printf("Enter the last name: ");
fflush(stdou... | |
Check that the mmap goes in the right place. | #include <fcntl.h>
#include <stdio.h>
#include <string.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include "distributed.h"
#include "stddefines.h"
void shm_init() {
int fd;
/* Map the shmem region */
fd = open(SHM_DEV, O_RDWR);
CHECK_ERROR(fd < 0);
shm_base = mmap(... | #include <fcntl.h>
#include <stdio.h>
#include <string.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include "distributed.h"
#include "stddefines.h"
void shm_init() {
int fd;
/* Map the shmem region */
fd = open(SHM_DEV, O_RDWR);
CHECK_ERROR(fd < 0);
shm_base = mmap(... |
Define __restrict__ and __restrict as synonyms for restrict. | #define _LP64 1
#define __8cc__ 1
#define __ELF__ 1
#define __LP64__ 1
#define __SIZEOF_DOUBLE__ 8
#define __SIZEOF_FLOAT__ 4
#define __SIZEOF_INT__ 4
#define __SIZEOF_LONG_DOUBLE__ 8
#define __SIZEOF_LONG_LONG__ 8
#define __SIZEOF_LONG__ 8
#define __SIZEOF_POINTER__ 8
#define __SIZEOF_PTRDIFF_T__ 8
#define __SIZEOF_SH... | #define _LP64 1
#define __8cc__ 1
#define __ELF__ 1
#define __LP64__ 1
#define __SIZEOF_DOUBLE__ 8
#define __SIZEOF_FLOAT__ 4
#define __SIZEOF_INT__ 4
#define __SIZEOF_LONG_DOUBLE__ 8
#define __SIZEOF_LONG_LONG__ 8
#define __SIZEOF_LONG__ 8
#define __SIZEOF_POINTER__ 8
#define __SIZEOF_PTRDIFF_T__ 8
#define __SIZEOF_SH... |
Add 'core' pseudo package for docgen to target. | /**
library core
Psuedo root of all pre-registered modules.
This is a fake module created to link together all of the modules that are
automatically loaded in the interpreter.
Except for the `builtin` module, all modules listed here can be imported from
any file inside of the interpreter. This is unlike other module... | |
Fix another Linux build error | // Copyright 2015-2017 Directive Games Limited - All Rights Reserved
#pragma once
#include "JsonArchive.h"
#include "IHttpRequest.h"
#include "Core.h"
#include "Interfaces/IHttpRequest.h"
RAPIDJSON_API DECLARE_LOG_CATEGORY_EXTERN(JsonUtilsLog, Log, All);
class RAPIDJSON_API JsonUtils
{
public:
template<class ... | // Copyright 2015-2017 Directive Games Limited - All Rights Reserved
#pragma once
#include "JsonArchive.h"
#include "IHttpRequest.h"
#include "Core.h"
#include "Interfaces/IHttpRequest.h"
#include "Interfaces/IHttpResponse.h"
RAPIDJSON_API DECLARE_LOG_CATEGORY_EXTERN(JsonUtilsLog, Log, All);
class RAPIDJSON_API ... |
Change documentation to fit return of NSNumber | //
// OCTClient+Activity.h
// OctoKit
//
// Created by Piet Brauer on 14.02.14.
// Copyright (c) 2014 GitHub. All rights reserved.
//
#import "OCTClient.h"
@class RACSignal;
@class OCTRepository;
@interface OCTClient (Activity)
// Check if the user starred the `repository`.
//
// repository - The repository used... | //
// OCTClient+Activity.h
// OctoKit
//
// Created by Piet Brauer on 14.02.14.
// Copyright (c) 2014 GitHub. All rights reserved.
//
#import "OCTClient.h"
@class RACSignal;
@class OCTRepository;
@interface OCTClient (Activity)
// Check if the user starred the `repository`.
//
// repository - The repository used... |
Add Appledoc to the header | #import <UIKit/UIKit.h>
@interface BCBalancedMultilineLabel : UILabel
@end
| #import <UIKit/UIKit.h>
/**
* A simple label subclass that draws itself such that each of its
* lines have as close to the same length as possible. It can be
* used anywhere that you could use an ordinary `UILabel` by simply
* changing the instantiated class.
*/
@interface BCBalancedMultilineLabel : UILabel
@end... |
Set m_view to 0 in GlContext ctor | /*
* Copyright 2011-2016 Branimir Karadzic. All rights reserved.
* License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause
*/
#ifndef BGFX_GLCONTEXT_NSGL_H_HEADER_GUARD
#define BGFX_GLCONTEXT_NSGL_H_HEADER_GUARD
#if BX_PLATFORM_OSX
namespace bgfx { namespace gl
{
struct SwapChainGL;
struct GlContext
{... | /*
* Copyright 2011-2016 Branimir Karadzic. All rights reserved.
* License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause
*/
#ifndef BGFX_GLCONTEXT_NSGL_H_HEADER_GUARD
#define BGFX_GLCONTEXT_NSGL_H_HEADER_GUARD
#if BX_PLATFORM_OSX
namespace bgfx { namespace gl
{
struct SwapChainGL;
struct GlContext
{... |
Check that logassert() fails properly | #define UTL_MAIN
#include "utl.h"
int main(int argc, char *argv[])
{
logopen("t_logassert.log","w");
logassert(5>10);
logassert(utl_ret(0));
logcheck(3/utl_ret(0) == 0);
logclose();
}
| |
Fix @import compatibility with .mm files | //
// Lottie.h
// Pods
//
// Created by brandon_withrow on 1/27/17.
//
//
@import Foundation;
#ifndef Lottie_h
#define Lottie_h
//! Project version number for Lottie.
FOUNDATION_EXPORT double LottieVersionNumber;
//! Project version string for Lottie.
FOUNDATION_EXPORT const unsigned char LottieVersionString[];
#... | //
// Lottie.h
// Pods
//
// Created by brandon_withrow on 1/27/17.
//
//
#if __has_feature(modules)
@import Foundation;
#else
#import <Foundation/Foundation.h>
#endif
#ifndef Lottie_h
#define Lottie_h
//! Project version number for Lottie.
FOUNDATION_EXPORT double LottieVersionNumber;
//! Project version string... |
Add a benchmark for higher memory intensity | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <ctype.h>
void nop( int delay ){
int tmp,i;
for( i=0; i<delay; i++ )
tmp = i + tmp;
}
int main(int argc, char **argv) {
int SEED = 2;
int MEM_SIZE = 1024 * 1024; // *32 bits (number of ints)
int DURATION = 6 * 1000 * 1000;... | |
Add an example of code that uses failing_allocs. | #include "../failing_allocs.h"
#include <assert.h>
#include <stdlib.h>
USE_FAILING_ALLOCS
typedef struct{
int* some_ints;
size_t count;
} Container;
Container* Container_create(size_t count)
{
Container* new_container = calloc(1, sizeof(Container));
if(!new_container) goto error;
new_container->some_ints... | |
Disable auto linking on windows so that CMake settings are not overriden. | #ifndef SOFAPYTHON_PYTHON_H
#define SOFAPYTHON_PYTHON_H
// This header simply includes Python.h, taking care of platform-specific stuff
// It should be included before any standard headers:
// "Since Python may define some pre-processor definitions which affect the
// standard headers on some systems, you must inclu... | #ifndef SOFAPYTHON_PYTHON_H
#define SOFAPYTHON_PYTHON_H
// This header simply includes Python.h, taking care of platform-specific stuff
// It should be included before any standard headers:
// "Since Python may define some pre-processor definitions which affect the
// standard headers on some systems, you must inclu... |
Fix UI arrow artifact in Cross References and Search widgets. | #pragma once
#include "uitypes.h"
#include <QtWidgets/QToolButton>
#include <QtCore/QParallelAnimationGroup>
#include <QtWidgets/QScrollArea>
#include <QtCore/QPropertyAnimation>
class BINARYNINJAUIAPI ExpandableGroup : public QWidget
{
Q_OBJECT
private:
QToolButton* m_button;
QParallelAnimationGroup* m_animati... | #pragma once
#include "uitypes.h"
#include <QtWidgets/QLabel>
#include <QtWidgets/QToolButton>
#include <QtCore/QParallelAnimationGroup>
#include <QtWidgets/QScrollArea>
#include <QtCore/QPropertyAnimation>
class BINARYNINJAUIAPI ExpandableGroup : public QWidget
{
Q_OBJECT
private:
QToolButton* m_button;
QLabel... |
Add wrapper for SDL2_image lib | /*
The MIT License (MIT)
Copyright (c) 2016 tagener-noisu
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, ... | |
Improve [NSArray flatten] doc formatting | //
// NSArray+EKFlatten.h
// EnumeratorKit
//
// Created by Adam Sharp on 23/07/13.
// Copyright (c) 2013 Adam Sharp. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "NSArray+EKEnumerable.h"
/**
* Extends NSArray with a single method `-flatten` to recursively
* build a single-level array with ... | //
// NSArray+EKFlatten.h
// EnumeratorKit
//
// Created by Adam Sharp on 23/07/13.
// Copyright (c) 2013 Adam Sharp. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "NSArray+EKEnumerable.h"
/**
Extends NSArray with a single method `-flatten` to recursively build a
single-level array with all ... |
Adjust declaration for returning int | #ifndef IPC_H
#define IPC_H
#include "../process/process.h"
void current_fds(proc_t *proc);
#endif
| #ifndef IPC_H
#define IPC_H
int current_fds(char *pidstr);
#endif
|
Add constructor with title attached | #ifndef _ACTIONBAR_H_
#define _ACTIONBAR_H_
#include <InputElement.h>
#include <Command.h>
#include <FWPlatform.h>
class ActionBar : public Element {
public:
ActionBar() { }
bool isA(const std::string & className) override {
if (className == "ActionBar") return true;
return Element::isA(className);
}... | #ifndef _ACTIONBAR_H_
#define _ACTIONBAR_H_
#include <InputElement.h>
#include <Command.h>
#include <FWPlatform.h>
class ActionBar : public Element {
public:
ActionBar() { }
ActionBar(const char * _title) : title(_title) { }
bool isA(const std::string & className) override {
if (className == "ActionBar")... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.