Instruction stringlengths 14 778 | input_code stringlengths 0 4.24k | output_code stringlengths 1 5.44k |
|---|---|---|
Fix extra fread after EOF, non-wires-crossed version. | /*===- count.c - The 'count' testing tool ---------------------------------===*\
*
* The LLVM Compiler Infrastructure
*
* This file is distributed under the University of Illinois Open Source
* License. See LICENSE.TXT for details.
*
\*===-------------------------------------------------------... | /*===- count.c - The 'count' testing tool ---------------------------------===*\
*
* The LLVM Compiler Infrastructure
*
* This file is distributed under the University of Illinois Open Source
* License. See LICENSE.TXT for details.
*
\*===-------------------------------------------------------... |
Update import to be compatible with KSCrash 1.8.8+ | //
// BugsnagSink.h
//
// Created by Conrad Irwin on 2014-10-01.
//
// Copyright (c) 2014 Bugsnag, Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without r... | //
// BugsnagSink.h
//
// Created by Conrad Irwin on 2014-10-01.
//
// Copyright (c) 2014 Bugsnag, Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without r... |
Remove unneeded method from private header | /*
* cocos2d for iPhone: http://www.cocos2d-iphone.org
*
* Copyright (c) 2013-2014 Cocos2D Authors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including with... | /*
* cocos2d for iPhone: http://www.cocos2d-iphone.org
*
* Copyright (c) 2013-2014 Cocos2D Authors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including with... |
Return success rather than failure from shutdown() on FileDescriptor, since it is entirely immaterial. | #ifndef FILE_DESCRIPTOR_H
#define FILE_DESCRIPTOR_H
#include <io/channel.h>
class FileDescriptor : public Channel {
LogHandle log_;
protected:
int fd_;
public:
FileDescriptor(int);
~FileDescriptor();
virtual Action *close(EventCallback *);
virtual Action *read(size_t, EventCallback *);
virtual Action *write(B... | #ifndef FILE_DESCRIPTOR_H
#define FILE_DESCRIPTOR_H
#include <io/channel.h>
class FileDescriptor : public Channel {
LogHandle log_;
protected:
int fd_;
public:
FileDescriptor(int);
~FileDescriptor();
virtual Action *close(EventCallback *);
virtual Action *read(size_t, EventCallback *);
virtual Action *write(B... |
Structure defining information starter needs from the shadow to start up a user job. | typedef struct {
int cluster; /* Condor Cluster # */
int proc; /* Condor Proc # */
int job_class; /* STANDARD, VANILLA, PVM, PIPE, ... */
uid_t uid; /* Execute job under this UID */
gid_t gid; /* Execute job under this pid */
pid_t virt_pid; /* PVM virt pid of this process */
int soft_ki... | |
Add a bit_value function for the numeric value of a single bit | #pragma once
#include "../definitions.h"
#include "log.h"
namespace bitwise {
inline u16 compose_bytes(const u8 high, const u8 low) {
return static_cast<u16>((high << 8) + low);
}
inline bool check_bit(const u8 value, const u8 bit) {
return (value & (1 << bit)) != 0;
}
inline u8 set_bit(const u8 value, con... | #pragma once
#include "../definitions.h"
#include "log.h"
namespace bitwise {
inline u16 compose_bytes(const u8 high, const u8 low) {
return static_cast<u16>((high << 8) + low);
}
inline bool check_bit(const u8 value, const u8 bit) {
return (value & (1 << bit)) != 0;
}
inline u8 bit_value(const u8 value, c... |
Add a mechanism for handling fatal errors (and reboots) | /*
* Copyright (C) 2014 INRIA
*
* This file is subject to the terms and conditions of the GNU Lesser General
* Public License. See the file LICENSE in the top level directory for more
* details.
*/
/**
* @addtogroup core_util
* @{
*
* @file crash.h
* @brief Crash handling header
*
* Define a... | |
Add class for the progress window | #pragma once
#include "../Controls/Dialog.h"
#include "../resource.h"
class ProgressWindow : public Dialog {
public:
ProgressWindow() :
Dialog(L"3RVX-UpdateProgress", MAKEINTRESOURCE(IDD_DOWNLOAD)) {
ShowWindow(Dialog::DialogHandle(), SW_SHOWNORMAL);
}
}; | |
Add a test that local submodule visibility has no effect on debug info | // RUN: rm -rf %t
// RUN: %clang_cc1 -fmodules -fmodule-format=obj -debug-info-kind=limited -dwarf-ext-refs \
// RUN: -fimplicit-module-maps -x c -fmodules-cache-path=%t -I %S/Inputs \
// RUN: %s -emit-llvm -debugger-tuning=lldb -o - | FileCheck %s
#include "DebugSubmoduleA.h"
#include "DebugSubmoduleB.h"
// C... | // RUN: rm -rf %t
// RUN: %clang_cc1 -fmodules -fmodule-format=obj -debug-info-kind=limited -dwarf-ext-refs \
// RUN: -fimplicit-module-maps -x c -fmodules-cache-path=%t -I %S/Inputs \
// RUN: %s -emit-llvm -debugger-tuning=lldb -o - | FileCheck %s
//
// RUN: %clang_cc1 -fmodules -fmodule-format=obj -debug-info... |
Update example with new constraints on map/reduce prototype. | #include <gmp.h>
#include "m-array.h"
#include "m-algo.h"
ARRAY_DEF(mpz, mpz_t, M_CLASSIC_OPLIST(mpz))
ALGO_DEF(array_mpz, ARRAY_OPLIST(mpz, M_CLASSIC_OPLIST(mpz)))
static inline void my_mpz_inc(mpz_t d, const mpz_t a){
mpz_add(d, d, a);
}
static inline void my_mpz_sqr(mpz_t d, const mpz_t a){
mpz_mul(d, a, a);
... | #include <gmp.h>
#include "m-array.h"
#include "m-algo.h"
ARRAY_DEF(mpz, mpz_t, M_CLASSIC_OPLIST(mpz))
ALGO_DEF(array_mpz, ARRAY_OPLIST(mpz, M_CLASSIC_OPLIST(mpz)))
static inline void my_mpz_inc(mpz_t *d, const mpz_t a){
mpz_add(*d, *d, a);
}
static inline void my_mpz_sqr(mpz_t *d, const mpz_t a){
mpz_mul(*d, a,... |
Add a debugging print macro. | #ifndef util_h
#define util_h
#define min(a,b) ((a)<(b)?(a):(b))
int warn(const char *s);
void v();
#endif /*util_h*/
| #ifndef util_h
#define util_h
#define min(a,b) ((a)<(b)?(a):(b))
int warn(const char *s);
void v();
#ifdef DEBUG
#define dprintf(fmt, args...) fprintf(stderr, fmt, ##args)
#else
#define dprintf(fmt, ...) (0)
#endif
#endif /*util_h*/
|
Add generic response structure inside prd_fw_msg | /* Copyright 2017 IBM Corp.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writin... | /* Copyright 2017 IBM Corp.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writin... |
Disable freetype stream support, avoiding FILE interface. | /* custom ftoption.h which selects the minimum features needed by mupdf */
#include <freetype/config/ftoption.h>
#undef FT_CONFIG_OPTION_USE_LZW
#undef FT_CONFIG_OPTION_USE_ZLIB
#undef FT_CONFIG_OPTION_USE_BZIP2
#undef FT_CONFIG_OPTION_USE_PNG
#undef FT_CONFIG_OPTION_USE_HARFBUZZ
#undef FT_CONFIG_OPTION_MAC_FONTS
#un... | /* custom ftoption.h which selects the minimum features needed by mupdf */
#include <freetype/config/ftoption.h>
#undef FT_CONFIG_OPTION_USE_LZW
#undef FT_CONFIG_OPTION_USE_ZLIB
#undef FT_CONFIG_OPTION_USE_BZIP2
#undef FT_CONFIG_OPTION_USE_PNG
#undef FT_CONFIG_OPTION_USE_HARFBUZZ
#undef FT_CONFIG_OPTION_MAC_FONTS
#un... |
Fix up prototypes for read() and write() on Suns. | #ifndef FIX_UNISTD_H
#define FIX_UNISTD_H
#include <unistd.h>
/*
For some reason the g++ include files on Ultrix 4.3 fail to provide
these prototypes, even though the Ultrix 4.2 versions did...
Once again, OSF1 also chokes, unless _AES_SOURCE(?) is defined JCP
*/
#if defined(ULTRIX43) || defined(SUNOS41) || de... | #ifndef FIX_UNISTD_H
#define FIX_UNISTD_H
#if defined(SUNOS41)
# define read _hide_read
# define write _hide_write
#endif
#include <unistd.h>
#if defined(SUNOS41)
# undef read
# undef write
#endif
/*
For some reason the g++ include files on Ultrix 4.3 fail to provide
these prototypes, even though the Ultrix 4... |
Add C implementation for problem 2 | #include <stdio.h>
int main(int argc, char *argv[]){
int s, a, b, c;
s = 0;
a = 1;
b = 1;
c = a + b;
while(c < 4000000L){
s += c;
a = b + c;
b = a + c;
c = a + b;
}
printf("%d\n", s);
}
| |
Correct the allowed size of the uuid code | #ifndef hcidumpinternal_H
#define hcidumpinternal_H
#include <stdbool.h>
#include <stdint.h>
typedef struct beacon_info {
char uuid[20];
int32_t code;
int32_t manufacturer;
int32_t major;
int32_t minor;
int32_t power;
int32_t calibrated_power;
int32_t rssi;
int64_t time;
} beacon_i... | #ifndef hcidumpinternal_H
#define hcidumpinternal_H
#include <stdbool.h>
#include <stdint.h>
typedef struct beacon_info {
char uuid[36];
int32_t code;
int32_t manufacturer;
int32_t major;
int32_t minor;
int32_t power;
int32_t calibrated_power;
int32_t rssi;
int64_t time;
} beacon_i... |
Fix find&replace error in CornerCombinerBase codec | #pragma once
#include <spotify/json.hpp>
#include <noise/noise.h>
#include "noise/module/Wrapper.h"
#include "noise/module/CornerCombinerBase.h"
namespace spotify
{
namespace json
{
template<>
struct default_codec_t<noise::module::Wrapper<noise::module::CornerCombinerBase>>
{
using CornerCombinerBaseWrapper = n... | #pragma once
#include <spotify/json.hpp>
#include <noise/noise.h>
#include "noise/module/Wrapper.h"
#include "noise/module/CornerCombinerBase.h"
namespace spotify
{
namespace json
{
template<>
struct default_codec_t<noise::module::Wrapper<noise::module::CornerCombinerBase>>
{
using CornerCombinerBaseWrapper = n... |
Allow overrideSettings to take a nil value. | /*
Copyright 2012 Moblico Solutions LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this work except in compliance with the License.
You may obtain a copy of the License in the LICENSE file, or at:
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable l... | /*
Copyright 2012 Moblico Solutions LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this work except in compliance with the License.
You may obtain a copy of the License in the LICENSE file, or at:
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable l... |
Remove the import for EKNDeskTopViewController.h | //
// EKNAppDelegate.h
// EdKeyNote
//
// Created by canviz on 9/22/14.
// Copyright (c) 2014 canviz. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "EKNDeskTopViewController.h"
#import "EKNLoginViewController.h"
@interface EKNAppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomi... | //
// EKNAppDelegate.h
// EdKeyNote
//
// Created by canviz on 9/22/14.
// Copyright (c) 2014 canviz. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "EKNLoginViewController.h"
@interface EKNAppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@property (stro... |
Define USE_GUSI if USE_GUSI1 or USE_GUSI2 is defined. | /*
** Config file for dynamically-loaded ppc/cfm68k plugin modules.
*/
/* #define USE_GUSI1 /* Stdio implemented with GUSI */
#define USE_GUSI2 /* Stdio implemented with GUSI */
#define WITH_THREAD /* Use thread support (needs GUSI 2, not GUSI 1) */
#define USE_MSL /* Use MSL libraries */
#ifdef USE_MSL
#define M... | /*
** Config file for dynamically-loaded ppc/cfm68k plugin modules.
*/
/* #define USE_GUSI1 /* Stdio implemented with GUSI */
#define USE_GUSI2 /* Stdio implemented with GUSI */
#if defined(USE_GUSI1) || defined(USE_GUSI2)
#define USE_GUSI
#endif
#define WITH_THREAD /* Use thread support (needs GUSI 2, not GUSI 1) ... |
Fix comments: these are not trailing comments | //===---- CodeCompleteOptions.h - Code Completion Options -------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===-------------------------------------------------------... | //===---- CodeCompleteOptions.h - Code Completion Options -------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===-------------------------------------------------------... |
Change include to fix compilation. | #pragma once
#include <gsl/gsl_byte>
#include <gsl/span>
namespace Halley
{
class IMessage
{
public:
virtual ~IMessage() {}
virtual size_t getSerializedSize() = 0;
virtual void serializeTo(gsl::span<gsl::byte> dst) = 0;
};
}
| #pragma once
#include <gsl/gsl>
namespace Halley
{
class IMessage
{
public:
virtual ~IMessage() {}
virtual size_t getSerializedSize() = 0;
virtual void serializeTo(gsl::span<gsl::byte> dst) = 0;
};
}
|
Add accessor function prototypes for reoptimizer support passes. Make accessors return FunctionPass* as appropriate. | //===- Transforms/Instrumentation.h - Instrumentation passes ----*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file was developed by the LLVM research group and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
//
//===--------... | //===- Transforms/Instrumentation.h - Instrumentation passes ----*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file was developed by the LLVM research group and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
//
//===--------... |
Update Feather RP2040 to 8MB | #define MICROPY_HW_BOARD_NAME "Adafruit Feather RP2040"
#define MICROPY_HW_MCU_NAME "rp2040"
#define MICROPY_HW_NEOPIXEL (&pin_GPIO16)
#define DEFAULT_I2C_BUS_SCL (&pin_GPIO3)
#define DEFAULT_I2C_BUS_SDA (&pin_GPIO2)
#define DEFAULT_SPI_BUS_SCK (&pin_GPIO18)
#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO19)
#define DEFAULT... | #define MICROPY_HW_BOARD_NAME "Adafruit Feather RP2040"
#define MICROPY_HW_MCU_NAME "rp2040"
#define MICROPY_HW_NEOPIXEL (&pin_GPIO16)
#define DEFAULT_I2C_BUS_SCL (&pin_GPIO3)
#define DEFAULT_I2C_BUS_SDA (&pin_GPIO2)
#define DEFAULT_SPI_BUS_SCK (&pin_GPIO18)
#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO19)
#define DEFAULT... |
Add brackets around SERIAL_ERROR definition for compatibility | #ifndef _SERIAL_H_
#define _SERIAL_H_
#include "hardware/packet.h"
#define SERIAL_SUCCESS 1
#define SERIAL_ERROR !SERIAL_SUCCESS
unsigned int serial_connect(char device[]);
unsigned int serial_transmit(struct Packet packet);
unsigned int serial_close();
#endif
| #ifndef _SERIAL_H_
#define _SERIAL_H_
#include "hardware/packet.h"
#define SERIAL_SUCCESS 1
#define SERIAL_ERROR (!SERIAL_SUCCESS)
unsigned int serial_connect(char device[]);
unsigned int serial_transmit(struct Packet packet);
unsigned int serial_close();
#endif
|
Add FreeBSD as platform supporting malloc_usable_size | #ifndef PECTOR_MALLOC_ALLOCATOR_COMPAT_H
#define PECTOR_MALLOC_ALLOCATOR_COMPAT_H
#ifdef __APPLE__
#include <malloc/malloc.h>
#else
#include <malloc.h>
#endif
#if defined __GNUC__ || defined _WIN32 || defined __APPLE__
#define PT_SIZE_AWARE_COMPAT
#if defined __GNUC__ && !defined _WIN32 && !defined __APPLE__
#defin... | #ifndef PECTOR_MALLOC_ALLOCATOR_COMPAT_H
#define PECTOR_MALLOC_ALLOCATOR_COMPAT_H
#ifdef __APPLE__
#include <malloc/malloc.h>
#else
#include <malloc.h>
#endif
#if defined __GNUC__ || defined _WIN32 || defined __APPLE__ || defined __FreeBSD__
#define PT_SIZE_AWARE_COMPAT
#if defined _WIN32
#define PT_MALLOC_USABLE_S... |
Add new functions to header | /******************************
* AUTHOR : GUSTAVO MARTINS
* USE AS YOU WISH
* DATE : 11/25/2015
* LANG : ANSI C
* DESCR : A VERY SIMPLE
* 3D VECTOR LIBRARY
******************************/
#ifndef TVECTOR_H
#define TVECTOR_H
typedef struct SVector *TVector;
TVector createVector(double x, double y, double z);
TVector... | /******************************
* AUTHOR : GUSTAVO MARTINS
* USE AS YOU WISH
* DATE : 11/25/2015
* LANG : ANSI C
* DESCR : A VERY SIMPLE
* 3D VECTOR LIBRARY
******************************/
#ifndef TVECTOR_H
#define TVECTOR_H
typedef struct SVector *TVector;
TVector createVector(double x, double y, double z);
TVector... |
Include use case of epsilon | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "suspect.h"
suspect_context("Euler's Method",
suspect_test("Predicts y_{n+1} to within the expected threshhold",
suspect_assert("Expected 1 < 0", -1 < 0);
)
suspect_test("Does not explode",
suspect_assert("Expected -1 < 0", -1 < 0);
)
suspe... | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "suspect.h"
suspect_context("Euler's Method",
suspect_test("Expect actual to be within epsilon of target",
float actual = 5.426;
float epsilon = 0.01;
float target = 5.00;
suspect_epsilon(actual,epsilon,target);
)
suspect_test("Does not ex... |
Update ch1/ex3 v2 exercise with more readable code | #include <stdio.h>
float K_5_BY_9 = 5.0 / 9.0;
float K_32 = 32;
int main(void)
{
float fahr, celsius;
int lower, upper, step;
lower = 0;
upper = 300;
step = 20;
printf("|-----------|\n");
printf("|%4s|%6s|\n", "F", "C");
printf("|-----------|\n");
fahr = lower;
while (... | #include <stdio.h>
float K_5_BY_9 = 5.0 / 9.0;
float K_32 = 32;
int SUCCESS = 0;
int main(void)
{
float fahrenheit, celsius;
int lower, upper, step;
lower = 0;
upper = 300;
step = 20;
printf("|-----------|\n");
printf("|%4s|%6s|\n", "F", "C");
printf("|-----------|\n");
f... |
Fix descriptive comment at top of file. | /* node.h : interface to node functions, private to libsvn_fs
*
* ====================================================================
* Copyright (c) 2000 CollabNet. All rights reserved.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution... | /* txn.h : interface to Subversion transactions, private to libsvn_fs
*
* ====================================================================
* Copyright (c) 2000 CollabNet. All rights reserved.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this dist... |
Add user data to Game struct | /*
* Copyright (C) 2015 Luke San Antonio
* All rights reserved.
*/
#pragma once
#include "../common/id_map.hpp"
#include "boat.h"
#include "../collisionlib/motion.h"
namespace redc { namespace sail
{
struct Player
{
std::string name;
bool spawned;
Hull_Desc boat_config;
collis::Motion boat_motio... | /*
* Copyright (C) 2015 Luke San Antonio
* All rights reserved.
*/
#pragma once
#include "../common/id_map.hpp"
#include "boat.h"
#include "../collisionlib/motion.h"
namespace redc { namespace sail
{
struct Player
{
std::string name;
bool spawned;
Hull_Desc boat_config;
collis::Motion boat_motio... |
Fix declaration of alloc function. | /* $Id$ */
#include "ruby_libxml.h"
VALUE cXMLState;
VALUE LIBXML_STATE = Qnil;
static int dummy = 0;
void
ruby_xml_state_free(int dummy) {
xmlCleanupParser();
LIBXML_STATE = Qnil;
}
VALUE
ruby_xml_state_alloc() {
#ifdef DEBUG
fprintf(stderr, "Allocating state");
#endif
xmlInitParser();
return... | /* $Id$ */
#include "ruby_libxml.h"
VALUE cXMLState;
VALUE LIBXML_STATE = Qnil;
static int dummy = 0;
void
ruby_xml_state_free(int dummy) {
xmlCleanupParser();
LIBXML_STATE = Qnil;
}
VALUE
ruby_xml_state_alloc(VALUE klass) {
#ifdef DEBUG
fprintf(stderr, "Allocating state");
#endif
xmlInitParser();
... |
Create a constructor and deconstructor for the peer structure. | #include <miknet/miknet.h>
int mikpeer (miknode_t *n)
{
int sock, i, pos = 0;
struct sockaddr_storage addr;
socklen_t addrlen;
sock = accept(n->tcp, (struct sockaddr *)&addr, &addrlen);
if (sock < 0)
return mik_debug(ERR_SOCKET);
if (n->peerc >= n->peermax) {
close(sock);
return ERR_PEER_MAX;
}
n->pee... | |
Add color for error log | #pragma once
#include <cstdio>
namespace happyntrain {
#define LOG(message, level, ...) \
printf("[" level "] %s-%d " message "\n", __FILE__, __LINE__, ##__VA_ARGS__);
#define INFO(message, ...) LOG(message, "INFO", ##__VA_ARGS__);
#define DEBUG(message, ...) LOG(message, "DEBUG", ##__VA_ARGS__);
#define ERROR(mes... | #pragma once
#include <cstdio>
namespace happyntrain {
#define LOG(message, level, ...) \
printf("[%5s] %s-%d " message "\n", level, __FILENAME__, __LINE__, \
##__VA_ARGS__);
#define INFO(message, ...) LOG(message, "INFO", ##__VA_ARGS__);
#define DEBUG(message, ...) LO... |
Check the client_setup() return value | #include <stdio.h>
#include <stdlib.h>
#include <wayland-client.h>
#include <time.h>
#include "client.h"
#include "log.h"
struct client_state *state;
void sway_terminate(void) {
client_teardown(state);
exit(1);
}
int main(int argc, char **argv) {
init_log(L_INFO);
state = client_setup();
uint8_t r = 0, g = 0, ... | #include <stdio.h>
#include <stdlib.h>
#include <wayland-client.h>
#include <time.h>
#include "client.h"
#include "log.h"
struct client_state *state;
void sway_terminate(void) {
client_teardown(state);
exit(1);
}
int main(int argc, char **argv) {
init_log(L_INFO);
if (!(state = client_setup())) {
return -1;
}... |
Use QGst::init/cleanup in the tests to properly register the ValueVTables for the gstreamer types. | /*
Copyright (C) 2010 George Kiagiadakis <kiagiadakis.george@gmail.com>
This library is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2.1 of the License, or
(at your opti... | /*
Copyright (C) 2010 George Kiagiadakis <kiagiadakis.george@gmail.com>
This library is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2.1 of the License, or
(at your opti... |
Make sure none of the __asan_gen_ global strings end up in the symbol table, add a test. | // Make sure __asan_gen_* strings do not end up in the symbol table.
// RUN: %clang_asan %s -o %t.exe
// RUN: nm %t.exe | grep __asan_gen_ || exit 0
int x, y, z;
int main() { return 0; }
| |
Add solution for problem 1 | /*
* Multiples of 3 and 5
*
* If we list all the natural numbers below 10 that are multiples of 3 or 5,
* we get 3, 5, 6 and 9. The sum of these multiples is 23.
*
* Find the sum of all the multiples of 3 or 5 below 1000
*/
#include <stdio.h>
int
main(void)
{
int sum = 0, i = 0;
while (i < 1000) {
... | |
Change some char type variables to unsigned char | /*
* OLSRd Quagga plugin
*
* Copyright (C) 2006-2008 Immo 'FaUl' Wehrenberg <immo@chaostreff-dortmund.de>
* Copyright (C) 2007-2010 Vasilis Tsiligiannis <acinonyxs@yahoo.gr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 a... | /*
* OLSRd Quagga plugin
*
* Copyright (C) 2006-2008 Immo 'FaUl' Wehrenberg <immo@chaostreff-dortmund.de>
* Copyright (C) 2007-2010 Vasilis Tsiligiannis <acinonyxs@yahoo.gr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 a... |
Add address property to object | //
// GeocodeItem.h
// bikepath
//
// Created by Farheen Malik on 8/19/14.
// Copyright (c) 2014 Bike Path. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface GeocodeItem : NSObject
@end
| //
// GeocodeItem.h
// bikepath
//
// Created by Farheen Malik on 8/19/14.
// Copyright (c) 2014 Bike Path. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <MapKit/MapKit.h>
#import <GoogleMaps/GoogleMaps.h>
@interface GeocodeItem : NSObject
@property NSString *latitude;
@property NSString *lon... |
Include the necessary headers to make the swift-runtime-reporting test work. | // library.h
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBU... | // library.h
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBU... |
Add a temporary dummy header file to make an internal refactoring process go more smoothly. | // This is a placeholder to allow include-path compatibility with code written
// inside Google.
#ifndef STRINGS_STRINGPIECE_UTILS_H_
#define STRINGS_STRINGPIECE_UTILS_H_
#endif // STRINGS_STRINGPIECE_UTILS_H_
| |
Fix the call trace when resumed from hibernation | /*
* Common powerpc suspend code for 32 and 64 bits
*
* Copyright 2007 Johannes Berg <johannes@sipsolutions.net>
*
* 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 t... | /*
* Common powerpc suspend code for 32 and 64 bits
*
* Copyright 2007 Johannes Berg <johannes@sipsolutions.net>
*
* 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 t... |
Add missing include for make_unique | /* Copyright 2016 Streampunk Media Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in wri... | /* Copyright 2016 Streampunk Media Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in wri... |
Add list_iter for circular list test. | #include <stdio.h>
#include <stdlib.h>
#include <cl_list.h>
#include <cl_iterator.h>
#define QTD 100
| #include <stdio.h>
#include <stdlib.h>
#include <cl_list.h>
#include <cl_iterator.h>
#define QTD 100
void print_list_iter(cl_list_root *list) {
iterator_c *i = cl_iter_create(list, FORWARD);
printf("[");
if (i != NULL) {
do {
printf("'%d', ", *((int *) cl_iter_item(i)));
} while (cl_iter_next(i) && cl_iter... |
Add comment saying that even though the a.out file name is here, it really shouldn't be. | typedef struct {
int cluster; /* Condor Cluster # */
int proc; /* Condor Proc # */
int job_class; /* STANDARD, VANILLA, PVM, PIPE, ... */
uid_t uid; /* Execute job under this UID */
gid_t gid; /* Execute job under this pid */
pid_t virt_pid; /* PVM virt pid of this process */
int soft_ki... | typedef struct {
int cluster; /* Condor Cluster # */
int proc; /* Condor Proc # */
int job_class; /* STANDARD, VANILLA, PVM, PIPE, ... */
uid_t uid; /* Execute job under this UID */
gid_t gid; /* Execute job under this pid */
pid_t virt_pid; /* PVM virt pid of this process */
int soft_ki... |
Update for station2: Initial version (I.Hrivnacova) | // $Id$
// Category: sector
//
// Enum AliMpStationType
// ---------------------
// Enumeration for refering to bending and non-bending planes.
//
// Authors: David Guez, Ivana Hrivnacova; IPN Orsay
#ifndef ALI_MP_STATION_TYPE_H
#define ALI_MP_STATION_TYPE_H
enum AliMpStationType
{
kStation1, // station 1
kStat... | |
Set removed item's prev/next pointers to NULL. | #ifndef LLIST_H
#define LLIST_H
/* Doubly linked list */
#define DLLIST_PREPEND(list, item) STMT_START { \
(item)->prev = NULL; \
(item)->next = *(list); \
if (*(list) != NULL) (*(list))->prev = (item); \
*(list) = (item); \
} STMT_END
#define DLLIST_REMOVE(list, item) STMT_START { \
if ((item)->prev == NULL) \... | #ifndef LLIST_H
#define LLIST_H
/* Doubly linked list */
#define DLLIST_PREPEND(list, item) STMT_START { \
(item)->prev = NULL; \
(item)->next = *(list); \
if (*(list) != NULL) (*(list))->prev = (item); \
*(list) = (item); \
} STMT_END
#define DLLIST_REMOVE(list, item) STMT_START { \
if ((item)->prev == NULL) \... |
Use _vscprintf() for mingw-w64 compilers | #include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
int vasprintf(char **ret, const char *fmt, va_list ap)
{
char *buf;
int len;
size_t buflen;
va_list ap2;
#ifdef _MSC_VER
ap2 = ap;
len = _vscprintf(fmt, ap2); // NOTE MS specific extension ( :-( )
#else
va_copy(ap2, ap);
len = vsnprintf(NULL, 0, fmt,... | #include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
int vasprintf(char **ret, const char *fmt, va_list ap)
{
char *buf;
int len;
size_t buflen;
va_list ap2;
#if defined(_MSC_VER) || defined(__MINGW64_VERSION_MAJOR)
ap2 = ap;
len = _vscprintf(fmt, ap2); // NOTE MS specific extension ( :-( )
#else
va_cop... |
Change to use IRequest instead (use interfaces for classes where possible) | // Copyright 2010-2015 The CefSharp Authors. All rights reserved.
//
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
#pragma once
#include "Stdafx.h"
using namespace CefSharp;
namespace CefSharp
{
namespace Internals
{
public ref class CefRequest... | // Copyright 2010-2015 The CefSharp Authors. All rights reserved.
//
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
#pragma once
#include "Stdafx.h"
using namespace CefSharp;
namespace CefSharp
{
namespace Internals
{
public ref class CefRequest... |
Allow choice of D2D on compiler command line. | // Scintilla source code edit control
/** @file PlatWin.h
** Implementation of platform facilities on Windows.
**/
// Copyright 1998-2011 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
extern bool IsNT();
extern void Platform_Initi... | // Scintilla source code edit control
/** @file PlatWin.h
** Implementation of platform facilities on Windows.
**/
// Copyright 1998-2011 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
extern bool IsNT();
extern void Platform_Initi... |
Update comments of SecretConstant file | //
// SecretConstant.example.h
// PHPHub
//
// Created by Aufree on 9/30/15.
// Copyright (c) 2015 ESTGroup. All rights reserved.
//
#if DEBUG
#define Client_id @"kHOugsx4dmcXwvVbmLkd"
#define Client_secret @"PuuFCrF94MloSbSkxpwS"
#else
#define Client_id @"Set up a client id for production env"
#defi... | //
// SecretConstant.example.h
// PHPHub
//
// Created by Aufree on 9/30/15.
// Copyright (c) 2015 ESTGroup. All rights reserved.
//
#if DEBUG
#define Client_id @"kHOugsx4dmcXwvVbmLkd"
#define Client_secret @"PuuFCrF94MloSbSkxpwS"
#else
#define Client_id @"" // Set up a client id for production envir... |
Create contents of .h file | #ifndef ANN_H
#define ANN_H
#endif
| #ifndef ANN_H
#define ANN_H
#define INPUTS 3
#define HIDDEN 5
#define OUTPUTS 2
#define ROWS 5
typedef struct {
double input[HIDDEN][INPUTS + 1];
double hidden[ROWS - 3][HIDDEN][HIDDEN + 1];
double output[OUTPUTS][HIDDEN + 1];
} Links;
typedef struct {
int input[INPUTS];
int hidden[ROWS - 2][HIDD... |
Allow user to choose if they want :) | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define STTY "/bin/stty "
const char RAW[] = STTY "raw";
const char COOKED[] = STTY "cooked";
int main() {
system(RAW);
char str[] = "I AM AN IDIOT ";
size_t len = strlen(str);
while ( 1 ) {
for ( size_t i = 0 ; i < len ; i++ ) {
getchar()... | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define STTY "/bin/stty "
const char RAW[] = STTY "raw";
const char COOKED[] = STTY "cooked";
const char default_str[] = "I AM AN IDIOT ";
int main(int argc, char **argv) {
system(RAW);
const char *str;
if ( argc == 2 )
str = argv[1];
else
s... |
Add booting substate for message | //
// TKDApp.h
// Tokaido
//
// Created by Mucho Besos on 10/25/12.
// Copyright (c) 2012 Tilde. All rights reserved.
//
#import <Cocoa/Cocoa.h>
typedef enum : NSUInteger {
TKDAppOff,
TKDAppBooting,
TKDAppOn,
TKDAppShuttingDown
} TKDAppState;
@interface TKDApp : MTLModel
@property (nonatomic, co... | //
// TKDApp.h
// Tokaido
//
// Created by Mucho Besos on 10/25/12.
// Copyright (c) 2012 Tilde. All rights reserved.
//
#import <Cocoa/Cocoa.h>
typedef enum : NSUInteger {
TKDAppOff,
TKDAppBooting,
TKDAppOn,
TKDAppShuttingDown
} TKDAppState;
typedef enum : NSUInteger {
TKDAppBundling,
TK... |
Make pointer arithmetic warning go away | #include "coro.h"
#include "stack.h"
#include <assert.h>
#include <stdlib.h>
#include <string.h>
coro *coro_spawn(coro *me, coro_func f, size_t ssize) {
coro *c = (coro*)malloc(sizeof(coro));
assert(c != NULL);
c->running = 0;
c->base = malloc(ssize);
assert(c->base != NULL);
c->stack = c->base + ssize;
... | #include "coro.h"
#include "stack.h"
#include <assert.h>
#include <stdlib.h>
#include <string.h>
coro *coro_spawn(coro *me, coro_func f, size_t ssize) {
coro *c = (coro*)malloc(sizeof(coro));
assert(c != NULL);
c->running = 0;
c->base = malloc(ssize);
assert(c->base != NULL);
c->stack = (char*) c->base + s... |
Mark some functions as pure | #ifndef SEQUENCE_H
#define SEQUENCE_H
#include "object.h"
typedef enum IterType_ {ITERLIST, ITERVECTOR} IterType;
typedef struct Iter_ {
IterType type;
union {
struct {
Object *node;
bool first;
} list;
struct {
Object *object;
int inde... | #ifndef SEQUENCE_H
#define SEQUENCE_H
#include "object.h"
typedef enum IterType_ {ITERLIST, ITERVECTOR} IterType;
typedef struct Iter_ {
IterType type;
union {
struct {
Object *node;
bool first;
} list;
struct {
Object *object;
int inde... |
Include missing necessary include <set> | #pragma once
#include <unistd.h>
#include <iostream>
#include <list>
#include <map>
#include <mutex>
#include <unordered_map>
#include <queue>
#include <sstream>
#include <thread>
#include <tuple>
#include <vector> | #pragma once
#include <unistd.h>
#include <iostream>
#include <list>
#include <map>
#include <mutex>
#include <unordered_map>
#include <queue>
#include <sstream>
#include <set>
#include <thread>
#include <tuple>
#include <vector> |
Make the list of x64 processor names inclusive enough to compile the Alien plugin on 64-bit linux. | /*
* xabicc.c - platform-agnostic root for ALien call-outs and callbacks.
*
* Support for Call-outs and Call-backs from the IA32ABI Plugin.
* The plgin is misnamed. It should be the AlienPlugin, but its history
* dictates otherwise.
*/
#if i386|i486|i586|i686
# include "ia32abicc.c"
#elif powerpc|ppc
# include ... | /*
* xabicc.c - platform-agnostic root for ALien call-outs and callbacks.
*
* Support for Call-outs and Call-backs from the IA32ABI Plugin.
* The plgin is misnamed. It should be the AlienPlugin, but its history
* dictates otherwise.
*/
#if i386|i486|i586|i686
# include "ia32abicc.c"
#elif powerpc|ppc
# include ... |
Transpose the second matrix in the C reference for MatMul. | #include <stdlib.h>
#include "MatMulC.h"
void MatMulC(int rows, int len, double *a, double *b, double *c)
{
int i,j,k;
for( i = 0; i < rows; i++ ) {
for( j = 0; j < rows; j+=2 ) {
double sum0 = 0.0;
double sum1 = 0.0;
for( k = 0; k < rows; k++ ) {
sum0 += a[i*rows+k] * b[k*rows + j];... | #include <stdlib.h>
#include "MatMulC.h"
void MatMulC(int rows, int len, double *a, double *bin, double *c)
{
int i,j,k;
double *b = malloc(len * sizeof(double));
// Transpose bin with result in b.
for(int n = 0; n < len; n++ ) {
b[n] = bin[rows * (n % rows) + (n / rows)];
}
for( i = 0; i < rows; i++... |
Add default value to id on constructor | #ifndef _LINEARLAYOUT_H_
#define _LINEARLAYOUT_H_
#include <Element.h>
#include <Command.h>
#define FW_VERTICAL 1
#define FW_HORIZONTAL 2
class LinearLayout : public Element {
public:
LinearLayout(int _direction, int _id) : Element(_id), direction(_direction) { }
bool isA(const std::string & className) overri... | #ifndef _LINEARLAYOUT_H_
#define _LINEARLAYOUT_H_
#include <Element.h>
#include <Command.h>
#define FW_VERTICAL 1
#define FW_HORIZONTAL 2
class LinearLayout : public Element {
public:
LinearLayout(int _direction, int _id = 0) : Element(_id), direction(_direction) { }
bool isA(const std::string & className) ov... |
Initialize all members of ScopeMeasure | #ifndef NEWSBOAT_SCOPEMEASURE_H_
#define NEWSBOAT_SCOPEMEASURE_H_
#include <sys/time.h>
#include <string>
#include "logger.h"
namespace newsboat {
class ScopeMeasure {
public:
ScopeMeasure(const std::string& func, Level ll = Level::DEBUG);
~ScopeMeasure();
void stopover(const std::string& son = "");
private:
s... | #ifndef NEWSBOAT_SCOPEMEASURE_H_
#define NEWSBOAT_SCOPEMEASURE_H_
#include <sys/time.h>
#include <string>
#include "logger.h"
namespace newsboat {
class ScopeMeasure {
public:
ScopeMeasure(const std::string& func, Level ll = Level::DEBUG);
~ScopeMeasure();
void stopover(const std::string& son = "");
private:
s... |
Fix mistake FOX and reorder EXPORT/IMPORT | #ifndef TGBOT_EXPORT_H
#define TGBOT_EXPORT_H
#ifndef TGBOT_API
#ifdef TGBOT_DLL
#if defined _WIN32 || defined __CYGWIN__
#define TGBOT_HELPER_DLL_IMPORT __declspec(dllimport)
#define TGBOT_HELPER_DLL_EXPORT __declspec(dllexport)
#else
#if __GNUC__ >= 4
... | #ifndef TGBOT_EXPORT_H
#define TGBOT_EXPORT_H
#ifndef TGBOT_API
#ifdef TGBOT_DLL
#if defined _WIN32 || defined __CYGWIN__
#define TGBOT_HELPER_DLL_EXPORT __declspec(dllexport)
#define TGBOT_HELPER_DLL_IMPORT __declspec(dllimport)
#else
#if __GNUC__ >= 4
... |
Revert "[test] Address TestConcurrentMany*.py flakiness on macOS" | #include <atomic>
#include <thread>
typedef std::atomic<int> pseudo_barrier_t;
static inline void pseudo_barrier_wait(pseudo_barrier_t &barrier) {
--barrier;
while (barrier > 0)
std::this_thread::yield();
}
static inline void pseudo_barrier_init(pseudo_barrier_t &barrier, int count) {
barrier = count;
}
| #include <atomic>
// Note that although hogging the CPU while waiting for a variable to change
// would be terrible in production code, it's great for testing since it avoids
// a lot of messy context switching to get multiple threads synchronized.
typedef std::atomic<int> pseudo_barrier_t;
#define pseudo_barrier_wa... |
Add missing header into for DragNDrop category on StatesContoller | //
// StatesController+DragNDrop.h
// States
//
// Created by Dmitry Rodionov on 13/06/16.
// Copyright © 2016 Internals Exposed. All rights reserved.
//
#import "StatesController.h"
@interface StatesController (DragNDrop)
@end
| //
// StatesController+DragNDrop.h
// States
//
// Created by Dmitry Rodionov on 13/06/16.
// Copyright © 2016 Internals Exposed. All rights reserved.
//
#import "StatesController.h"
@interface StatesController (DragNDrop)
// This category implements the following NSTableViewDataSources methods:
- (BOOL)tableVi... |
Add more files to the PCH for faster compiles. | //@author A0094446X
#pragma once
#ifndef YOU_GUI_STDAFX_H_
#define YOU_GUI_STDAFX_H_
#include <QtWidgets>
#endif // YOU_GUI_STDAFX_H_
| //@author A0094446X
#pragma once
#ifndef YOU_GUI_STDAFX_H_
#define YOU_GUI_STDAFX_H_
#include <memory>
#include <QApplication>
#include <QList>
#include <QWidget>
#include <QtWidgets>
#include <boost/date_time/gregorian/greg_month.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
#endif // YOU_GUI_STDAFX_H_... |
Add groupbox to control header | #pragma once
#include "Control.h"
#include "Button.h"
#include "Checkbox.h"
#include "ComboBox.h"
#include "Label.h"
#include "ListView.h"
#include "Spinner.h"
#include "EditBox.h"
| #pragma once
#include "Control.h"
#include "Button.h"
#include "Checkbox.h"
#include "ComboBox.h"
#include "GroupBox.h"
#include "Label.h"
#include "ListView.h"
#include "Spinner.h"
#include "EditBox.h"
|
Add a sink function for nbtk.Action | #include <pygobject.h>
#include <clutter/clutter.h>
void pynbtk_register_classes (PyObject *d);
void pynbtk_add_constants (PyObject *module, const gchar *prefix);
extern PyMethodDef pynbtk_functions[];
DL_EXPORT(void)
init_nbtk(void)
{
PyObject *m, *d;
init_pygobject_check (2, 12, 0);
m = Py_InitM... | #include <pygobject.h>
#include <nbtk/nbtk.h>
void pynbtk_register_classes (PyObject *d);
void pynbtk_add_constants (PyObject *module, const gchar *prefix);
extern PyMethodDef pynbtk_functions[];
static void
sink_nbtkaction (GObject *object)
{
if (g_object_is_floating (object))
g_object_ref_sink (object);
}... |
Add comment for the speed threshold | //
// ADLivelyCollectionView.h
// ADLivelyCollectionView
//
// Created by Romain Goyet on 18/04/12.
// Copyright (c) 2012 Applidium. All rights reserved.
//
#import <UIKit/UIKit.h>
extern NSTimeInterval ADLivelyDefaultDuration;
typedef NSTimeInterval (^ADLivelyTransform)(CALayer * layer, float speed);
extern ADL... | //
// ADLivelyCollectionView.h
// ADLivelyCollectionView
//
// Created by Romain Goyet on 18/04/12.
// Copyright (c) 2012 Applidium. All rights reserved.
//
#import <UIKit/UIKit.h>
extern NSTimeInterval ADLivelyDefaultDuration;
typedef NSTimeInterval (^ADLivelyTransform)(CALayer * layer, float speed);
extern ADL... |
Add TODO re: command mode cursor. | #include "mode.h"
#include <stdlib.h>
#include <string.h>
#include <termbox.h>
#include "buf.h"
#include "editor.h"
static void command_mode_key_pressed(editor_t *editor, struct tb_event *ev) {
char ch;
switch (ev->key) {
case TB_KEY_ESC:
buf_printf(editor->status, "");
editor->mode = normal_mode();
... | #include "mode.h"
#include <stdlib.h>
#include <string.h>
#include <termbox.h>
#include "buf.h"
#include "editor.h"
// TODO(isbadawi): Command mode needs a cursor, but modes don't affect drawing.
static void command_mode_key_pressed(editor_t *editor, struct tb_event *ev) {
char ch;
switch (ev->key) {
case TB_... |
Copy documentation wording from UITextView+RACSignalSupport.h | //
// UIActionSheet+RACSignalSupport.h
// ReactiveCocoa
//
// Created by Dave Lee on 2013-06-22.
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
//
#import <UIKit/UIKit.h>
@class RACDelegateProxy;
@class RACSignal;
@interface UIActionSheet (RACSignalSupport)
// A delegate proxy which will be set as the ... | //
// UIActionSheet+RACSignalSupport.h
// ReactiveCocoa
//
// Created by Dave Lee on 2013-06-22.
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
//
#import <UIKit/UIKit.h>
@class RACDelegateProxy;
@class RACSignal;
@interface UIActionSheet (RACSignalSupport)
// A delegate proxy which will be set as the ... |
Fix typos, add instruction memory | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <math.h>
static int RegisterFile[32] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
int main() {
int data_memory[1024];
char string_memeory[2014];
} | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <math.h>
static int RegisterFile[32] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
int main() {
int data_memory[1024];
char* string_memory[2014];
char* instructions[100];
... |
Add some tests with RMWs | #include <stddef.h>
#include "atomic.h"
#include "rmc.h"
///
// Needs to live somewhere else at some point
// Argh, what do we name these.
#include "stdatomic.h"
#define atomic_fixup(e) ((_Atomic(__typeof__(*e))*)(e))
#define rmc_compare_exchange_strong(object, expected, desired) \
atomic_compare_exchange... | |
Update Skia milestone to 109 | /*
* Copyright 2016 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SK_MILESTONE
#define SK_MILESTONE 108
#endif
| /*
* Copyright 2016 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SK_MILESTONE
#define SK_MILESTONE 109
#endif
|
Add a codec for TileLocation | #pragma once
#include <spotify/json.hpp>
#include "TileLocation.h"
using namespace spotify::json::codec;
namespace spotify
{
namespace json
{
template<>
struct default_codec_t<TileLocation>
{
static object_t<TileLocation> codec()
{
auto codec = object<TileLocation>();
codec.required("filena... | |
Make room for 8 processors in the bus. | #ifndef AC_TLM_BUS_H_
#define AC_TLM_BUS_H_
#include <systemc>
#include "ac_tlm_protocol.H"
#include "ac_tlm_port.H"
#include "ac_memport.H"
// using statements
using tlm::tlm_transport_if;
//#define DEBUG
/// Namespace to isolate bus from ArchC
namespace user
{
/// A TLM bus
class ac_tlm_bus :
public sc_module,... | #ifndef AC_TLM_BUS_H_
#define AC_TLM_BUS_H_
#include <systemc>
#include "ac_tlm_protocol.H"
#include "ac_tlm_port.H"
#include "ac_memport.H"
// using statements
using tlm::tlm_transport_if;
//#define DEBUG
/// Namespace to isolate bus from ArchC
namespace user
{
/// A TLM bus
class ac_tlm_bus :
public sc_module,... |
Handle the condition where BS is typed while the cursor is at the first position on either of the last two lines of the screen. Ie. append contents of current line to the previous line and scroll the next line's contents up. |
/* This work is copyrighted. See COPYRIGHT.OLD & COPYRIGHT.NEW for *
* details. If they are missing then this copy is in violation of *
* the copyright conditions. */
/*
** lib_insdel.c
**
** The routine winsdel(win, n).
** positive n insert n lines above current line
**... |
/* This work is copyrighted. See COPYRIGHT.OLD & COPYRIGHT.NEW for *
* details. If they are missing then this copy is in violation of *
* the copyright conditions. */
/*
** lib_insdel.c
**
** The routine winsdel(win, n).
** positive n insert n lines above current line
**... |
Print newline on clean exit. | #include <stdio.h>
#include "common.h"
#include "wisp.h"
#include "lisp.h"
/* parser crap */
extern FILE *yyin;
int yyparse ();
void parser_init ();
extern int interactive;
extern char *prompt;
/* Initilize all the systems. */
void init ()
{
/* These *must* be called in this order. */
object_init ();
symtab_ini... | #include <stdio.h>
#include "common.h"
#include "wisp.h"
#include "lisp.h"
/* parser crap */
extern FILE *yyin;
int yyparse ();
void parser_init ();
extern int interactive;
extern char *prompt;
/* Initilize all the systems. */
void init ()
{
/* These *must* be called in this order. */
object_init ();
symtab_ini... |
Debug label inline function bug | // ucc -g tim.c
_Noreturn void abort()
{
__builtin_unreachable();
}
void realloc()
{
int local = 5;
abort();
}
| |
Remove unicode from cpp bug example | #define typename(x) _Generic((x), \
_Bool: "_BoolÓ, unsigned char: "unsigned charÓ, \
char: "char", signed char: "signed char", \
void *: "pointer to voidÓ, int *: "pointer to ... | #define typename(x) _Generic((x), \
_Bool: "_Bool", unsigned char: "unsigned char", \
char: "char", signed char: "signed char", \
void *: "pointer to void", int *: "pointer to ... |
Make subcommands' argc/argv compatible with getopt | #include "goontools.h"
void usage(char* prog)
{
fprintf(stderr, "\n");
fprintf(stderr, "Usage: %s <subcommand> <subcommand arguments>\n", prog);
fprintf(stderr, "\n");
fprintf(stderr, "subcommands:\n");
fprintf(stderr, " index index file\n");
fprintf(stderr, " sort sort file\n");
... | #include "goontools.h"
void usage(char* prog)
{
fprintf(stderr, "\n");
fprintf(stderr, "Usage: %s <subcommand> <subcommand arguments>\n", prog);
fprintf(stderr, "\n");
fprintf(stderr, "subcommands:\n");
fprintf(stderr, " index index file\n");
fprintf(stderr, " sort sort file\n");
... |
Set the header protection to end with _H. | #ifndef TIME_HAO
#define TIME_HAO
#include <time.h>
class Timer_hao
{
public:
double seconds;
int timing_flag;
time_t timerinit,timerend;
Timer_hao();
Timer_hao(double);
Timer_hao(const Timer_hao& );
~Timer_hao();
Timer_hao& operator = (const Timer_hao&);
void init()... | #ifndef TIME_HAO_H
#define TIME_HAO_H
#include <time.h>
class Timer_hao
{
public:
double seconds;
int timing_flag;
time_t timerinit,timerend;
Timer_hao();
Timer_hao(double);
Timer_hao(const Timer_hao& );
~Timer_hao();
Timer_hao& operator = (const Timer_hao&);
void in... |
Update number of armies on wastelands | // This program is free software licenced under MIT Licence. You can
// find a copy of this licence in LICENCE.txt in the top directory of
// source code.
//
#ifndef SETTINGS_H_INCLUDED
#define SETTINGS_H_INCLUDED
#include <vector>
#include <tuple>
/**
* This file contains gereral configuration and thing whoch sho... | // This program is free software licenced under MIT Licence. You can
// find a copy of this licence in LICENCE.txt in the top directory of
// source code.
//
#ifndef SETTINGS_H_INCLUDED
#define SETTINGS_H_INCLUDED
#include <vector>
#include <tuple>
/**
* This file contains gereral configuration and thing whoch sho... |
Add RoomBubbleCellData.h and MXKRoomBubbleTableViewCell+Riot.h to Objective-C bridging header. | //
// Use this file to import your target's public headers that you would like to expose to Swift.
//
@import MatrixSDK;
@import MatrixKit;
#import "WebViewViewController.h"
#import "RiotNavigationController.h"
#import "ThemeService.h"
#import "TableViewCellWithCheckBoxAndLabel.h"
#import "RecentsDataSource.h"
#impo... | //
// Use this file to import your target's public headers that you would like to expose to Swift.
//
@import MatrixSDK;
@import MatrixKit;
#import "WebViewViewController.h"
#import "RiotNavigationController.h"
#import "ThemeService.h"
#import "TableViewCellWithCheckBoxAndLabel.h"
#import "RecentsDataSource.h"
#impo... |
Use 8MB as the default stack size in CilkPlus. | #ifndef CILKPLUS_H
#define CILKPLUS_H
#include <cilk/cilk.h>
#define fibril
#define fibril_t __attribute__((unused)) int
#define fibril_init(fp)
#define fibril_join(fp) cilk_sync
#define fibril_fork_nrt(fp, fn, ag) cilk_spawn fn ag
#define fibril_fork_wrt(fp, rt, fn, ag) rt = cilk_spawn fn ag
#define fibril_rt_... | #ifndef CILKPLUS_H
#define CILKPLUS_H
#include <cilk/cilk.h>
#define fibril
#define fibril_t __attribute__((unused)) int
#define fibril_init(fp)
#define fibril_join(fp) cilk_sync
#define fibril_fork_nrt(fp, fn, ag) cilk_spawn fn ag
#define fibril_fork_wrt(fp, rt, fn, ag) rt = cilk_spawn fn ag
#define fibril_rt_... |
Fix C declaration errors on ARM. | #include <stdio.h>
void SpinYetAgain()
{
volatile unsigned int count = 0;
for(int i=0; i<1000; i++)
{
count++;
}
}
void SpinSomeMore()
{
volatile unsigned int count = 0;
for(int i=0; i<1000; i++)
{
count++;
}
SpinYetAgain();
}
void Spin()
{
volatile unsigned i... | #include <stdio.h>
void SpinYetAgain()
{
volatile unsigned int count = 0;
int i;
for(i=0; i<1000; i++)
{
count++;
}
}
void SpinSomeMore()
{
volatile unsigned int count = 0;
int i;
for(i=0; i<1000; i++)
{
count++;
}
SpinYetAgain();
}
void Spin()
{
volat... |
Set debug level to 2 and use a suitable printf function | // project-specific definitions for otaa sensor
//#define CFG_eu868 1
//#define CFG_us915 1
//#define CFG_au921 1
#define CFG_as923 1
#define LMIC_COUNTRY_CODE LMIC_COUNTRY_CODE_JP
//#define CFG_in866 1
#define CFG_sx1276_radio 1
//#define LMIC_USE_INTERRUPTS
| // project-specific definitions for otaa sensor
//#define CFG_eu868 1
//#define CFG_us915 1
//#define CFG_au921 1
#define CFG_as923 1
#define LMIC_COUNTRY_CODE LMIC_COUNTRY_CODE_JP
//#define CFG_in866 1
#define CFG_sx1276_radio 1
//#define LMIC_USE_INTERRUPTS
#define LMIC_DEBUG_LEVEL 2
#define LMIC_DEBUG_PRINTF_FN lm... |
Fix compilation warnings when using clang. | #ifndef KVAZAAR_INTERNAL_H_
#define KVAZAAR_INTERNAL_H_
/*****************************************************************************
* This file is part of Kvazaar HEVC encoder.
*
* Copyright (C) 2013-2015 Tampere University of Technology and others (see
* COPYING file).
*
* Kvazaar is free software: you can redistri... | #ifndef KVAZAAR_INTERNAL_H_
#define KVAZAAR_INTERNAL_H_
/*****************************************************************************
* This file is part of Kvazaar HEVC encoder.
*
* Copyright (C) 2013-2015 Tampere University of Technology and others (see
* COPYING file).
*
* Kvazaar is free software: you can redistri... |
Add basic operation function declaration | #include <stdlib.h>
#ifndef __STACK_H__
#define __STACK_H__
struct Stack;
typedef struct Stack Stack;
#endif | #include <stdlib.h>
#ifndef __STACK_H__
#define __STACK_H__
struct Stack;
typedef struct Stack Stack;
void Push(Stack s, void* e);
void* Pop(Stack s);
int Stack_Empty(Stack s);
#endif |
Change remaining glTbufferMask3DFX to an instance method. | /*
* Copyright (C) 2007 Jan Dvorak <jan.dvorak@kraxnet.cz>
*
* This program is distributed under the terms of the MIT license.
* See the included MIT-LICENSE file for the terms of this license.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO ... | /*
* Copyright (C) 2007 Jan Dvorak <jan.dvorak@kraxnet.cz>
*
* This program is distributed under the terms of the MIT license.
* See the included MIT-LICENSE file for the terms of this license.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO ... |
Replace long with int in the C version to improve performance. | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
int isPrime(unsigned long x)
{
if (sqrt(x) - (unsigned long)sqrt(x) == 0)
return 0;
for (unsigned long i = 2; i < ceil(sqrt(x)); i++)
if (x % i == 0)
return 0;
return 1;
}
int main( int argc, char** argv)
{
unsigned l... | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
int isPrime(unsigned int x)
{
if (sqrt(x) - (unsigned int)sqrt(x) == 0)
return 0;
for (unsigned int i = 2; i < ceil(sqrt(x)); i++)
if (x % i == 0)
return 0;
return 1;
}
int main( int argc, char** argv)
{
unsigned int ... |
Fix compilation on MacOSX (common symbols not allowed with MH_DYLIB output format) | #ifdef _WIN32
#define DL_EXPORT __declspec( dllexport )
#else
#define DL_EXPORT
#endif
DL_EXPORT int TestDynamicLoaderData;
DL_EXPORT void TestDynamicLoaderFunction()
{
}
| #ifdef _WIN32
#define DL_EXPORT __declspec( dllexport )
#else
#define DL_EXPORT
#endif
DL_EXPORT int TestDynamicLoaderData = 0;
DL_EXPORT void TestDynamicLoaderFunction()
{
}
|
Add sys file required for IEEE fp functions. | /*
* Copyright (c) 2004 Suleiman Souhlal <refugee@segfaulted.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
* ... | |
Correct line endings that got mixed up in r320088; NFC. | // RUN: %clang_cc1 -fdouble-square-bracket-attributes -std=c11 -E %s -o - | FileCheck %s
// CHECK: has_fallthrough
#if __has_c_attribute(fallthrough)
int has_fallthrough();
#endif
// CHECK: does_not_have_selectany
#if !__has_c_attribute(selectany)
int does_not_have_selectany();
#endif
| // RUN: %clang_cc1 -fdouble-square-bracket-attributes -std=c11 -E %s -o - | FileCheck %s
// CHECK: has_fallthrough
#if __has_c_attribute(fallthrough)
int has_fallthrough();
#endif
// CHECK: does_not_have_selectany
#if !__has_c_attribute(selectany)
int does_not_have_selectany();
#endif
|
Disable fuzz_full test until fixed | #include <stdio.h>
#include <stdlib.h>
#include "rxvm.h"
#include "test_common.h"
#include "test_modules.h"
#define NUM_MODS 7
const testmod_t mods[NUM_MODS] = {
test_rxvm_err, test_rxvm_match, test_rxvm_search,
test_rxvm_search_nomatch, test_rxvm_compile, test_fuzz_rxvm_match,
test_fuzz_full_rxv... | #include <stdio.h>
#include <stdlib.h>
#include "rxvm.h"
#include "test_common.h"
#include "test_modules.h"
//#define NUM_MODS 7
#define NUM_MODS 6
const testmod_t mods[NUM_MODS] = {
test_rxvm_err, test_rxvm_match, test_rxvm_search,
test_rxvm_search_nomatch, test_rxvm_compile, test_fuzz_rxvm... |
Disable raw mode when exiting | #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;
}
| #include <stdlib.h>
#include <termios.h>
#include <unistd.h>
struct termios orig_termios;
void disableRawMode() {
tcsetattr(STDIN_FILENO, TCSAFLUSH, &orig_termios);
}
void enableRawMode() {
tcgetattr(STDIN_FILENO, &orig_termios);
atexit(disableRawMode);
struct termios raw = orig_termios;
raw.c_lflag &= ~(... |
Revert "with Xcode4.4 __weak typeof(o) is all that's needed for weak references" | //
// BBlock.h
// BBlock
//
// Created by David Keegan on 4/10/12.
// Copyright (c) 2012 David Keegan. All rights reserved.
//
#import <Foundation/Foundation.h>
/// For when you need a weak reference of an object, example: `BBlockWeakObject(obj) wobj = obj;`
#define BBlockWeakObject(o) __weak typeof(o)
/// For w... | //
// BBlock.h
// BBlock
//
// Created by David Keegan on 4/10/12.
// Copyright (c) 2012 David Keegan. All rights reserved.
//
#import <Foundation/Foundation.h>
/// For when you need a weak reference of an object, example: `BBlockWeakObject(obj) wobj = obj;`
#define BBlockWeakObject(o) __weak __typeof__((__typeof... |
Document on getters of argc and argv | #include <stdint.h>
void __wasm_call_ctors(void);
int __argc(void);
void __argv(uintptr_t[static 1]);
void __args(char[static 1]);
int main(int, char**);
void _start(void)
{
int argc = __argc();
char* argv[argc + 1];
__argv((uintptr_t*)argv);
char args[(uintptr_t)argv[argc]];
__args(args);
... | #include <stdint.h>
void __wasm_call_ctors(void);
/*!
* `argc` getter
*
* This function returns 0 if passing arguments to main() is unsupported.
*/
int __argc(void);
/*!
* `argv` builder
*
* This function stores `argv` as offset from `argv[0]`,
* and appends `sizeof(args)`.
*
* For example, if the command ... |
Print the number of solutions. | // Copyright (c) 2016 Ed Schouten <ed@nuxi.nl>
//
// This file is distributed under a 2-clause BSD license.
// See the LICENSE file for details.
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include "infiniteloop.h"
static bool print_solution(const struct il_solution *s, void *thunk) {
char buf[1024... | // Copyright (c) 2016 Ed Schouten <ed@nuxi.nl>
//
// This file is distributed under a 2-clause BSD license.
// See the LICENSE file for details.
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include "infiniteloop.h"
static unsigned int solutions_found = 0;
static bool print_solution(const struct il_s... |
Add file with dummy client info | //
// MHClientSecret.h
// MyHub
//
// Created by Arcterus on 1/14/14.
// Copyright (c) 2014 kRaken Research. All rights reserved.
//
#ifndef MyHub_MHClientSecret_h
#define MyHub_MHClientSecret_h
#define CLIENT_ID "1234567890"
#define CLIENT_SECRET "1234567890abcdef"
#endif
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.