Instruction stringlengths 14 778 | input_code stringlengths 0 4.24k | output_code stringlengths 1 5.44k |
|---|---|---|
Remove user from mobile list when disinhabiting | /*
* This file is part of Kotaka, a mud library for DGD
* http://github.com/shentino/kotaka
*
* Copyright (C) 2012 Raymond Jennings
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundati... | /*
* This file is part of Kotaka, a mud library for DGD
* http://github.com/shentino/kotaka
*
* Copyright (C) 2012 Raymond Jennings
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundati... |
Reorder the includes of the master include in alphabetical order. | /*!
* Master header of the nstl library.
*
* @author Louis Dionne
*/
#ifndef NSTL_H
#define NSTL_H
#include <nstl/operator.h>
#include <nstl/type.h>
#include <nstl/primitive.h>
#include <nstl/pair.h>
#include <nstl/algorithm.h>
#include <nstl/vector.h>
#endif /* !NSTL_H */
| /*!
* Master header of the nstl library.
*
* @author Louis Dionne
*/
#ifndef NSTL_H
#define NSTL_H
#include <nstl/algorithm.h>
#include <nstl/operator.h>
#include <nstl/pair.h>
#include <nstl/primitive.h>
#include <nstl/type.h>
#include <nstl/vector.h>
#endif /* !NSTL_H */
|
Document local persisted logging API. | @class UINavigationController, UIViewController;
@interface ARAnalyticalProvider : NSObject
/// Init
- (id)initWithIdentifier:(NSString *)identifier;
/// Set a per user property
- (void)identifyUserWithID:(NSString *)userID andEmailAddress:(NSString *)email;
- (void)setUserProperty:(NSString *)property toValue:(NSStr... | @class UINavigationController, UIViewController;
@interface ARAnalyticalProvider : NSObject
/// Init
- (id)initWithIdentifier:(NSString *)identifier;
/// Set a per user property
- (void)identifyUserWithID:(NSString *)userID andEmailAddress:(NSString *)email;
- (void)setUserProperty:(NSString *)property toValue:(NSStr... |
Clean unused argument in bx_exc_bindings | #include "bindex.h"
VALUE bx_mBindex;
static VALUE
bx_current_bindings(VALUE self)
{
return current_bindings();
}
static VALUE
bx_exc_set_backtrace(VALUE self, VALUE bt)
{
/* rb_check_backtrace can raise an exception, if the input arguments are not
* to its likings. Set the bindings afterwards, so we don't wa... | #include "bindex.h"
VALUE bx_mBindex;
static VALUE
bx_current_bindings(VALUE self)
{
return current_bindings();
}
static VALUE
bx_exc_set_backtrace(VALUE self, VALUE bt)
{
/* rb_check_backtrace can raise an exception, if the input arguments are not
* to its likings. Set the bindings afterwards, so we don't wa... |
Add global __RESTKIT__ define for aiding conditional compilation | //
// RestKit.h
// RestKit
//
// Created by Blake Watters on 2/19/10.
// Copyright (c) 2009-2012 RestKit. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//... | //
// RestKit.h
// RestKit
//
// Created by Blake Watters on 2/19/10.
// Copyright (c) 2009-2012 RestKit. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//... |
Revert to lowercase macro arguments | // http://stackoverflow.com/a/7933931/141220
#define TDTSuppressPerformSelectorLeakWarning(CODE) \
do { \
_Pragma("clang diagnostic push") \
_Pragma("clang diagnostic ignored \"-Warc-performSelector-leaks\"") \
CODE; \
_Pragma("clang diagnostic pop") \
} while (0)
| // http://stackoverflow.com/a/7933931/141220
#define TDTSuppressPerformSelectorLeakWarning(code) \
do { \
_Pragma("clang diagnostic push") \
_Pragma("clang diagnostic ignored \"-Warc-performSelector-leaks\"") \
code; \
_Pragma("clang diagnostic pop") \
} while (0)
|
Clear bit when writing to VDP2(TVMD) | /*
* Copyright (c) 2012-2016 Israel Jacquez
* See LICENSE for details.
*
* Israel Jacquez <mrkotfw@gmail.com>
*/
#include <vdp2/tvmd.h>
#include "vdp-internal.h"
void
vdp2_tvmd_display_clear(void)
{
_state_vdp2()->regs.tvmd &= 0x7FFF;
/* Change the DISP bit during VBLANK */
vdp2_tvmd_vb... | /*
* Copyright (c) 2012-2016 Israel Jacquez
* See LICENSE for details.
*
* Israel Jacquez <mrkotfw@gmail.com>
*/
#include <vdp2/tvmd.h>
#include "vdp-internal.h"
void
vdp2_tvmd_display_clear(void)
{
_state_vdp2()->regs.tvmd &= 0x7EFF;
/* Change the DISP bit during VBLANK */
vdp2_tvmd_vb... |
Add 1 more macro for debugging 3 things. | //
// SRDebug.h
// Sensorama
//
// Created by Wojciech Adam Koszek (h) on 09/04/2016.
// Copyright © 2016 Wojciech Adam Koszek. All rights reserved.
//
#ifndef SRDebug_h
#define SRDebug_h
#define SRPROBE0() do { \
NSLog(@"%s", __func__); \
} while (0)
#define SRPROBE1(x1) ... | //
// SRDebug.h
// Sensorama
//
// Created by Wojciech Adam Koszek (h) on 09/04/2016.
// Copyright © 2016 Wojciech Adam Koszek. All rights reserved.
//
#ifndef SRDebug_h
#define SRDebug_h
#define SRPROBE0() do { \
NSLog(@"%s", __func__); \
} while (0)
#define SRPROBE1(x1) ... |
Add test intended for commit in r231317 | // RUN: %clang_cc1 -fsyntax-only -verify -fms-extensions %s -triple x86_64-apple-darwin
// expected-error@+1 {{argument to 'section' attribute is not valid for this target: mach-o section specifier requires a segment and section separated by a comma}}
#pragma data_seg(".my_const")
int a = 1;
#pragma data_seg("__THINGY... | |
Check against sum, 30 second improvement | #include <stdio.h>
#define CAP 8
const int currency[CAP] = {1, 2, 5, 10, 20, 50, 100, 200};
int total[CAP] = {0, 0, 0, 0, 0, 0, 0, 0};
const int limit = 200;
static inline int calculate_total(void)
{
int sum = 0;
for (int i=0; i < CAP; i++)
sum += total[i];
return sum;
}
int... | #include <stdio.h>
#define CAP 8
const int currency[CAP] = {1, 2, 5, 10, 20, 50, 100, 200};
int total[CAP] = {0, 0, 0, 0, 0, 0, 0, 0};
const int limit = 200;
static inline int calculate_total(void)
{
int sum = 0;
for (int i=0; i < CAP; i++)
sum += total[i];
return sum;
}
int... |
Handle instances when "realloc()" fails. | /*
* A simple Brainfuck interpreter.
*
* This file was written by Damien Dart, <damiendart@pobox.com>. This is free
* and unencumbered software released into the public domain. For more
* information, please refer to the accompanying "UNLICENCE" file.
*/
#include <errno.h>
#include <stdint.h>
#include <stdio.h>
#... | /*
* A simple Brainfuck interpreter.
*
* This file was written by Damien Dart, <damiendart@pobox.com>. This is free
* and unencumbered software released into the public domain. For more
* information, please refer to the accompanying "UNLICENCE" file.
*/
#include <errno.h>
#include <stdint.h>
#include <stdio.h>
#... |
Fix copy paste error in file header | /*===-- vectorize_ocaml.c - LLVM OCaml Glue ---------------------*- C++ -*-===*\
|* *|
|* The LLVM Compiler Infrastructure *|
|* ... | /*===-- transform_utils_ocaml.c - LLVM OCaml Glue ---------------*- C++ -*-===*\
|* *|
|* The LLVM Compiler Infrastructure *|
|* ... |
Add a non-ip network string xmit concept | /* Copyright 2019 Lenovo */
#include <arpa/inet.h>
#include <crypt.h>
#include <net/if.h>
#include <sys/socket.h>
#include <stdio.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#define OUI_ETHERTYPE 0x88b7
#define MA... | |
Fix test to use %t for newly created files. | // REQUIRES: shell
// RUN: mkdir -p out.dir
// RUN: cat %s > out.dir/test.c
// RUN: %clang -E -MMD %s -o out.dir/test
// RUN: test ! -f %out.d
// RUN: test -f out.dir/test.d
// RUN: rm -rf out.dir/test.d out.dir/ out.d
int main (void)
{
return 0;
}
| // REQUIRES: shell
// RUN: mkdir -p %t/out.dir
// RUN: cat %s > %t/out.dir/test.c
// RUN: %clang -E -MMD %s -o %t/out.dir/test
// RUN: test ! -f %out.d
// RUN: test -f %t/out.dir/test.d
// RUN: rm -rf %t/out.dir/test.d %t/out.dir/ out.d
int main (void)
{
return 0;
}
|
Test incomplete tenative multi-dimension expressions | // RUN: %ucc -fsyntax-only %s
int a[][2];
int main()
{
a[0][0] = 3;
/* this tests a bug where the above assignment would attempt to check integer
* promotions (on a dereference of an array in the LHS), and attempt to find
* the size of `a` before it had been completed. integer promotions are now
* handled pro... | |
Add newline to remove compiler warning. | #ifndef LOCATION_OPENLOCATIONCODE_CODEAREA_H_
#define LOCATION_OPENLOCATIONCODE_CODEAREA_H_
#include <cstdlib>
namespace openlocationcode {
struct LatLng {
double latitude;
double longitude;
};
class CodeArea {
public:
CodeArea(double latitude_lo, double longitude_lo, double latitude_hi,
double lo... | #ifndef LOCATION_OPENLOCATIONCODE_CODEAREA_H_
#define LOCATION_OPENLOCATIONCODE_CODEAREA_H_
#include <cstdlib>
namespace openlocationcode {
struct LatLng {
double latitude;
double longitude;
};
class CodeArea {
public:
CodeArea(double latitude_lo, double longitude_lo, double latitude_hi,
double lo... |
Add end of line at end. | // RUN: clang -triple x86_64-unknown-unknown -emit-llvm -o %t %s &&
// RUN: grep 'define signext i8 @f0()' %t &&
// RUN: grep 'define signext i16 @f1()' %t &&
// RUN: grep 'define i32 @f2()' %t &&
// RUN: grep 'define float @f3()' %t &&
// RUN: grep 'define double @f4()' %t &&
// RUN: grep 'define x86_fp80 @f5()' %t &&... | // RUN: clang -triple x86_64-unknown-unknown -emit-llvm -o %t %s &&
// RUN: grep 'define signext i8 @f0()' %t &&
// RUN: grep 'define signext i16 @f1()' %t &&
// RUN: grep 'define i32 @f2()' %t &&
// RUN: grep 'define float @f3()' %t &&
// RUN: grep 'define double @f4()' %t &&
// RUN: grep 'define x86_fp80 @f5()' %t &&... |
Make xwait return exit status | #if !defined(XV6_USER)
#include <sys/wait.h>
#define xfork() fork()
static inline void xwait()
{
int status;
if (wait(&status) < 0)
edie("wait");
if (!WIFEXITED(status))
die("bad status %u", status);
}
#define mtenable(x) do { } while(0)
#define mtenable_type(x, y) do { } while (0)
#define mtdisable(x) ... | #pragma once
#include "libutil.h"
#if !defined(XV6_USER)
#include <sys/wait.h>
#define xfork() fork()
static inline int xwait()
{
int status;
if (wait(&status) < 0)
edie("wait");
if (!WIFEXITED(status))
die("bad status %u", status);
return WEXITSTATUS(status);
}
#define mtenable(x) do { } while(0)
#... |
Add a backport of G_DBUS_METHOD_INVOCATION_HANDLED | /*
* Copyright © 2019 Red Hat, Inc
*
* This program 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 option) any later version.
*
* This library i... | /*
* Copyright © 2019 Red Hat, Inc
*
* This program 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 option) any later version.
*
* This library i... |
Use MemAvailable for "free mem" | #ifndef SYSSTATS_H
#define SYSSTATS_H
#include <stdbool.h>
#include <ncurses.h>
#include <sys/timerfd.h>
#include "../util/file_utils.h"
#define MAXTOT 16
#define BASE 1024
#define MAXPIDS "/proc/sys/kernel/pid_max"
#define MEMFREE "MemFree:"
#define SECS 60
#define TIME_READ_DEFAULT 0
#define SYS_TIMER_EXPIR... | #ifndef SYSSTATS_H
#define SYSSTATS_H
#include <stdbool.h>
#include <ncurses.h>
#include <sys/timerfd.h>
#include "../util/file_utils.h"
#define MAXTOT 16
#define BASE 1024
#define MAXPIDS "/proc/sys/kernel/pid_max"
#define MEMFREE "MemAvailable:"
#define SECS 60
#define TIME_READ_DEFAULT 0
#define SYS_TIMER_... |
Use the correct type for the linked list pointer. | /* WebVTT parser
Copyright 2011 Mozilla Foundation
*/
#ifndef _WEBVTT_H_
#define _WEBVTT_H_
/* webvtt files are a sequence of cues
each cue has a start and end time for presentation
and some text content (which my be marked up)
there may be other attributes, but we ignore them
we store these in a link... | /* WebVTT parser
Copyright 2011 Mozilla Foundation
*/
#ifndef _WEBVTT_H_
#define _WEBVTT_H_
/* webvtt files are a sequence of cues
each cue has a start and end time for presentation
and some text content (which my be marked up)
there may be other attributes, but we ignore them
we store these in a link... |
Make close button properties optional. | //
// YTConnector.h
// AKYouTube
//
// Created by Anton Pomozov on 10.09.13.
// Copyright (c) 2013 Akademon Ltd. All rights reserved.
//
#import <Foundation/Foundation.h>
@class YTConnector;
@protocol YTLoginViewControllerInterface <NSObject>
@property (nonatomic, strong, readonly) UIWebView *webView;
@property... | //
// YTConnector.h
// AKYouTube
//
// Created by Anton Pomozov on 10.09.13.
// Copyright (c) 2013 Akademon Ltd. All rights reserved.
//
#import <Foundation/Foundation.h>
@class YTConnector;
@protocol YTLoginViewControllerInterface <NSObject>
@property (nonatomic, strong, readonly) UIWebView *webView;
@optiona... |
Fix crash wrong order of member initialization. | #ifndef FUNCTION_DECLARATION_H
#define FUNCTION_DECLARATION_H
#include "AstNode.h"
namespace liquid {
class FunctionDeclaration : public Statement
{
friend class ClassDeclaration;
Identifier* type;
Identifier* id;
VariableList* arguments;
Block* block;
YYLTYPE location;
public:
FunctionDecl... | #ifndef FUNCTION_DECLARATION_H
#define FUNCTION_DECLARATION_H
#include "AstNode.h"
namespace liquid {
class FunctionDeclaration : public Statement
{
friend class ClassDeclaration;
Identifier* type;
Identifier* id;
VariableList* arguments;
Block* block;
YYLTYPE location;
public:
FunctionDecl... |
Add MPS compile time option for enabling/disabling assertions | /*
* Copyright The Mbed TLS Contributors
* SPDX-License-Identifier: Apache-2.0
*
* 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
*
... | /*
* Copyright The Mbed TLS Contributors
* SPDX-License-Identifier: Apache-2.0
*
* 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
*
... |
Add RDA5981 exif logic for I2S module | /* mbed Microcontroller Library
* Copyright (c) 2006-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
*
* ... | |
Remove signature of deleted function | /*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* Copyright (C) 2017, James R. Barlow (https://github.com/jbarlow83/)
*/
#pragma once
#include "pikepdf.h"
... | /*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* Copyright (C) 2017, James R. Barlow (https://github.com/jbarlow83/)
*/
#pragma once
#include "pikepdf.h"
... |
Remove unnecessary import for 'mach-o/arch.h' | //
// src/tbd/symbol.h
// tbd
//
// Created by inoahdev on 4/24/17.
// Copyright © 2017 inoahdev. All rights reserved.
//
#pragma once
#include <mach-o/arch.h>
#include <string>
#include "flags.h"
class symbol {
public:
explicit symbol(const char *string, bool weak, int flags_length) noexcept;
void add_... | //
// src/tbd/symbol.h
// tbd
//
// Created by inoahdev on 4/24/17.
// Copyright © 2017 inoahdev. All rights reserved.
//
#pragma once
#include <string>
#include "flags.h"
class symbol {
public:
explicit symbol(const char *string, bool weak, int flags_length) noexcept;
void add_architecture(int number) n... |
Enable including all bindings in implicit bindings | #ifndef SAUCE_SAUCE_INTERNAL_IMPLICIT_BINDINGS_H_
#define SAUCE_SAUCE_INTERNAL_IMPLICIT_BINDINGS_H_
// #include <sauce/internal/bindings/all.h>
namespace sauce {
namespace internal {
/**
* Attempts to supply a Binding to Bindings when none is found for a dependency.
*/
struct ImplicitBindings {};
}
namespace i =... | #ifndef SAUCE_SAUCE_INTERNAL_IMPLICIT_BINDINGS_H_
#define SAUCE_SAUCE_INTERNAL_IMPLICIT_BINDINGS_H_
#include <sauce/internal/bindings/all.h>
namespace sauce {
namespace internal {
/**
* Attempts to supply a Binding to Bindings when none is found for a dependency.
*/
struct ImplicitBindings {};
}
namespace i = ::... |
Update RingOpenGL - Add Function (Source Code) : void glAccum(GLenum op,GLfloat value) | #include "ring.h"
/*
OpenGL 2.1 Extension
Copyright (c) 2017 Mahmoud Fayed <msfclipper@yahoo.com>
*/
#include <GL/glew.h>
#include <GL/glut.h>
RING_API void ringlib_init(RingState *pRingState)
{
}
| #include "ring.h"
/*
OpenGL 2.1 Extension
Copyright (c) 2017 Mahmoud Fayed <msfclipper@yahoo.com>
*/
#include <GL/glew.h>
#include <GL/glut.h>
RING_FUNC(ring_glAccum)
{
if ( RING_API_PARACOUNT != 2 ) {
RING_API_ERROR(RING_API_MISS2PARA);
return ;
}
if ( ! RING_API_ISNUMBER(1) ) {
RING_API_ERROR(RING_AP... |
Update the version number of release. | #define MAJOR_VERSION 3
#define MINOR_VERSION 1
#define BUILD_VERSION 0
#define BUILD_REVISION 5172
#define STRINGIFY(x) #x
#define MACRO_STRINGIFY(x) STRINGIFY(x)
#define REVISION_STRING MACRO_STRINGIFY(BUILD_REVISION)
#define VERSION_STRING MACRO_STRINGIFY(MAJOR_VERSION) "." MACRO_STRINGIFY(MINOR_VERSION) "." MACRO... | #define MAJOR_VERSION 3
#define MINOR_VERSION 2
#define BUILD_VERSION 6
#define BUILD_REVISION 45159
#define STRINGIFY(x) #x
#define MACRO_STRINGIFY(x) STRINGIFY(x)
#define REVISION_STRING MACRO_STRINGIFY(BUILD_REVISION)
#define VERSION_STRING MACRO_STRINGIFY(MAJOR_VERSION) "." MACRO_STRINGIFY(MINOR_VERSION) "." MACR... |
Add recursive divide and conquer algorithm for arrays | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define N 100
typedef int Item;
Item max(Item *, int, int);
int main(void) {
int i;
Item m, a[N];
srand(time(NULL));
for (i = 0; i < N; ++i) {
a[i] = rand() % 1000;
}
m = max(a, 0, N-1);
printf("Max array value is: %d\n", m);
return 0;
}
I... | |
Fix signed and unsigned comparison | #include <stdlib.h>
#include <string.h>
#include "rna_transcription.h"
char *to_rna(const char *dna) {
size_t len = strlen(dna);
char *rna = malloc(sizeof(char) * len);
for (int i = 0; i < len; i++) {
switch (dna[i]) {
case 'G':
rna[i] = 'C';
break;
case 'C':
rna[i] = 'G';
br... | #include <stdlib.h>
#include <string.h>
#include "rna_transcription.h"
char *to_rna(const char *dna) {
size_t len = strlen(dna);
char *rna = malloc(sizeof(char) * len);
for (size_t i = 0; i < len; i++) {
switch (dna[i]) {
case 'G':
rna[i] = 'C';
break;
case 'C':
rna[i] = 'G';
... |
Work around missing parsing functionality | #ifndef VAST_CONCEPT_PARSEABLE_VAST_KEY_H
#define VAST_CONCEPT_PARSEABLE_VAST_KEY_H
#include "vast/key.h"
#include "vast/concept/parseable/core/choice.h"
#include "vast/concept/parseable/core/list.h"
#include "vast/concept/parseable/core/operators.h"
#include "vast/concept/parseable/core/parser.h"
#include "vast/conc... | #ifndef VAST_CONCEPT_PARSEABLE_VAST_KEY_H
#define VAST_CONCEPT_PARSEABLE_VAST_KEY_H
#include "vast/key.h"
#include "vast/concept/parseable/core/choice.h"
#include "vast/concept/parseable/core/list.h"
#include "vast/concept/parseable/core/operators.h"
#include "vast/concept/parseable/core/parser.h"
#include "vast/conc... |
Solve Easy Fibonacci in c | #include <stdio.h>
int main() {
int n, a, b, x, i;
scanf("%d", &n);
if (n == 0) {
printf("0\n");
return 0;
}
a = 1;
b = 1;
printf("0");
for (i = 1; i < n; i++) {
printf(" %d", a);
x = a;
a = b;
b = b + x;
}
printf("\n");
... | |
Add start of desktop shell code. | #include "e.h"
#include "e_comp_wl.h"
#include "e_mod_main.h"
#include "e_desktop_shell_protocol.h"
EAPI E_Module_Api e_modapi = { E_MODULE_API_VERSION, "Wl_Desktop_Shell" };
EAPI void *
e_modapi_init(E_Module *m)
{
E_Wayland_Desktop_Shell *shell = NULL;
/* try to allocate space for the shell structure */
i... | |
Add standard integer/floating point types | ////
// __| | | _ _| __ / __| \ |
// \__ \ __ | | / _| . |
// ____/ _| _| ___| ____| ___| _|\_|
//
// Copyright (c) 2017 Jacob Hauberg Hansen
//
// This library is free software; you can redistribute and modify it
// under the terms of the MIT license. See LICENSE for details.
//
#ifndef zint_h
... | |
Add back Luke test of a function followed by its concrete implementation. | /* Header testing function definitions parsing. */
//Defining a standard function.
void f(int, int);
inline int g(char *ch, char **str);
// Defining a function pointer.
int(*fnPtr)(char, float);
// Adding dllexport and stdcall annotation to a function.
int __declspec(dllexport) __stdcall function1();
| /* Header testing function definitions parsing. */
//Defining a standard function.
void f(int, int);
// Defining a function with its implementation following
inline int g(char *ch, char **str)
{
JUNK
{ }
int localVariable = 1;
}
// Defining a function pointer.
int(*fnPtr)(char, float);
// Adding dll... |
Add example of ALGO_FOR_EACH and ALGO_REDUCE | /* Based on https://en.cppreference.com/w/cpp/algorithm/for_each
Need to be built in C11 mode */
#include <stdio.h>
#include "m-array.h"
#include "m-algo.h"
/* Define a dynamic array of int */
ARRAY_DEF(vector_int, int)
#define M_OPL_vector_int_t() ARRAY_OPLIST(vector_int)
/* Define operator increment on int */
... | |
Update License to match other licenses | /*
* licensed to the apache software foundation (asf) under one
* or more contributor license agreements. see the notice file
* distributed with this work for additional information
* regarding copyright ownership. the asf licenses this file
* to you under the apache license, version 2.0 (the
* "license"); you ... | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you ... |
Move assert test of EOF to after testing if a filter is done. | #include "fitz_base.h"
#include "fitz_stream.h"
fz_error
fz_process(fz_filter *f, fz_buffer *in, fz_buffer *out)
{
fz_error reason;
unsigned char *oldrp;
unsigned char *oldwp;
assert(!out->eof);
oldrp = in->rp;
oldwp = out->wp;
if (f->done)
return fz_iodone;
reason = f->process(f, in, out);
assert(i... | #include "fitz_base.h"
#include "fitz_stream.h"
fz_error
fz_process(fz_filter *f, fz_buffer *in, fz_buffer *out)
{
fz_error reason;
unsigned char *oldrp;
unsigned char *oldwp;
oldrp = in->rp;
oldwp = out->wp;
if (f->done)
return fz_iodone;
assert(!out->eof);
reason = f->process(f, in, out);
assert(i... |
Remove canopy_os_assert implementation because linux implementation now just expands to assert macro in header file | // Copyright 2015 SimpleThings, Inc.
//
// 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... | // Copyright 2015 SimpleThings, Inc.
//
// 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... |
Update Skia milestone to 105 | /*
* 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 104
#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 105
#endif
|
Add dummy implementation of game_logic.h for testing | #include "game_logic.h"
new_game_result bship_logic_new_game(void){
new_game_result r;
r.gid = 5;
r.pid = 7;
return r;
}
plyr_id bship_logic_join_game(game_id gid) {
if(gid != 5)
return ERR_NO_SUCH_GAME;
return 8;
}
int bship_logic_submit_grid(plyr_id pid, grid _g) {
if(pid < 7 || pid > 8)
return ERR_INVAL... | |
Add address as property of Search Item object | //
// SearchItem.h
// bikepath
//
// Created by Farheen Malik on 8/15/14.
// Copyright (c) 2014 Bike Path. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <MapKit/MapKit.h>
#import <GoogleMaps/GoogleMaps.h>
@interface SearchItem : NSObject
@property NSString *searchQuery;
@property CLLocationDe... | //
// SearchItem.h
// bikepath
//
// Created by Farheen Malik on 8/15/14.
// Copyright (c) 2014 Bike Path. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <MapKit/MapKit.h>
#import <GoogleMaps/GoogleMaps.h>
@interface SearchItem : NSObject
@property NSString *searchQuery;
@property CLLocationDe... |
Rename parameter to not be the same as the name of the function that does it | #pragma once
#include "../main.h"
class Socket {
public:
virtual ~Socket() {}
virtual unsigned int apiVersion() = 0;
virtual void connect(const std::string& server, const std::string& port, const std::string& bind = "") {}
virtual std::string receive() { return ""; }
virtual void send(const std::string& dat... | #pragma once
#include "../main.h"
class Socket {
public:
virtual ~Socket() {}
virtual unsigned int apiVersion() = 0;
virtual void connect(const std::string& server, const std::string& port, const std::string& bindAddr = "") {}
virtual std::string receive() { return ""; }
virtual void send(const std::string&... |
Fix linker warnings in rendering tests | /*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2010-03-31 17:34:48 +0200 (Wed, 31 Mar 2010) $
Version: $Revision: 21985 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Inf... | /*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2010-03-31 17:34:48 +0200 (Wed, 31 Mar 2010) $
Version: $Revision: 21985 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Inf... |
Add needed extern "C" to hgl winsys | /**************************************************************************
*
* Copyright 2009 Artur Wyszynski <harakash@gmail.com>
* Copyright 2013 Alexander von Gluck IV <kallisti5@unixzen.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated doc... | /**************************************************************************
*
* Copyright 2009 Artur Wyszynski <harakash@gmail.com>
* Copyright 2013 Alexander von Gluck IV <kallisti5@unixzen.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated doc... |
Disable unsupported Inet configuration breaking iOS integration. | /*
*
* Copyright (c) 2016-2017 Nest Labs, Inc.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE... | /*
*
* Copyright (c) 2016-2017 Nest Labs, Inc.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE... |
Clean up instance variables and imports | #pragma once
#include "../3RVX/Window.h"
class NotifyIcon;
class Settings;
class UpdaterWindow : public Window {
public:
UpdaterWindow();
~UpdaterWindow();
void DoModal();
private:
HICON _smallIcon;
HICON _largeIcon;
NotifyIcon *_notifyIcon;
HMENU _menu;
UINT _menuFlags;
Setti... | #pragma once
#include "../../3RVX/Window.h"
#include "Version.h"
class NotifyIcon;
class Settings;
class UpdaterWindow : public Window {
public:
UpdaterWindow();
~UpdaterWindow();
void DoModal();
private:
HICON _smallIcon;
HICON _largeIcon;
NotifyIcon *_notifyIcon;
HMENU _menu;
UIN... |
Remove pathname dependence. Also rewrite test to use FileCheck at the same time. | // RUN: %clang_cc1 -std=c99 %s -emit-llvm -o - | grep -v llvm.isunordered | not grep call
_Bool A, B, C, D, E, F;
void TestF(float X, float Y) {
A = __builtin_isgreater(X, Y);
B = __builtin_isgreaterequal(X, Y);
C = __builtin_isless(X, Y);
D = __builtin_islessequal(X, Y);
E = __builtin_islessgreater(X, Y);
... | // RUN: %clang_cc1 -std=c99 %s -emit-llvm -o - | FileCheck %s
// CHECK: @Test
// CHECK-NOT: call
_Bool A, B, C, D, E, F;
void TestF(float X, float Y) {
A = __builtin_isgreater(X, Y);
B = __builtin_isgreaterequal(X, Y);
C = __builtin_isless(X, Y);
D = __builtin_islessequal(X, Y);
E = __builtin_islessgreater(... |
Change test now %ebx is callee-save | // RUN: %ucc -DFIRST -S -o- %s | grep -F 'movl (%%rax), %%eax'
// RUN: %ucc -DSECOND -S -o- %s | grep -F 'movl 4(%%rbx), %%ebx'
#ifdef FIRST
f(int *p)
{
return *p;
// should see that p isn't used after/.retains==1 and not create a new reg,
// but re-use the current
}
#elif defined(SECOND)
struct A
{
int i, j;
... | // RUN: %ucc -DFIRST -S -o- %s | grep -F 'movl (%%rax), %%eax'
// RUN: %ucc -DSECOND -S -o- %s | grep -F 'movl 4(%%rcx), %%ecx'
#ifdef FIRST
f(int *p)
{
return *p;
// should see that p isn't used after/.retains==1 and not create a new reg,
// but re-use the current
}
#elif defined(SECOND)
struct A
{
int i, j;
... |
Add json-scanner.h to the exported headers | #ifndef __JSON_GLIB_H__
#define __JSON_GLIB_H__
#include <json-glib/json-types.h>
#include <json-glib/json-generator.h>
#include <json-glib/json-parser.h>
#include <json-glib/json-version.h>
#endif /* __JSON_GLIB_H__ */
| #ifndef __JSON_GLIB_H__
#define __JSON_GLIB_H__
#include <json-glib/json-types.h>
#include <json-glib/json-scanner.h>
#include <json-glib/json-generator.h>
#include <json-glib/json-parser.h>
#include <json-glib/json-version.h>
#endif /* __JSON_GLIB_H__ */
|
Remove the include for json-scanner.h | #ifndef __JSON_GLIB_H__
#define __JSON_GLIB_H__
#include <json-glib/json-types.h>
#include <json-glib/json-scanner.h>
#include <json-glib/json-generator.h>
#include <json-glib/json-parser.h>
#include <json-glib/json-version.h>
#include <json-glib/json-enum-types.h>
#endif /* __JSON_GLIB_H__ */
| #ifndef __JSON_GLIB_H__
#define __JSON_GLIB_H__
#include <json-glib/json-types.h>
#include <json-glib/json-generator.h>
#include <json-glib/json-parser.h>
#include <json-glib/json-version.h>
#include <json-glib/json-enum-types.h>
#endif /* __JSON_GLIB_H__ */
|
Add convenience macros for generation locally handled errors | //
// NSTLocalFileError.h
// Pods
//
// Created by Anatoly Shcherbinin on 5.04.22.
//
#ifndef NSTLocalFileError_h
#define NSTLocalFileError_h
///Quick error domain for errors that should be generated and handled localy in one source file
#define NSTLocalFileErrorDomain (@__FILE_NAME__)
///Convenience method for g... | |
Exit the tests with success if they aren't failing | #include <assert.h>
#include "../src/chip8.c"
void test_clear_screen(void) {
int i;
chip8_t * chip8 = chip8_new();
chip8->memory[0x200] = 0x00;
chip8->memory[0x201] = 0xE0;
chip8_fetch_current_opcode(chip8);
chip8_decode_current_opcode(chip8);
i = 0;
while (i < 64 * 32) {
assert(chip8->memory[i+... | #include <assert.h>
#include "../src/chip8.c"
void test_clear_screen(void) {
int i;
chip8_t * chip8 = chip8_new();
chip8->memory[0x200] = 0x00;
chip8->memory[0x201] = 0xE0;
chip8_fetch_current_opcode(chip8);
chip8_decode_current_opcode(chip8);
i = 0;
while (i < 64 * 32) {
assert(chip8->memory[i+... |
Add logging to syscall arg compare for debugging purposes | #include "plrCompare.h"
int plrC_compareArgs(const syscallArgs_t *args1, const syscallArgs_t *args2) {
int foundDiff = 0;
if (args1->addr != args2->addr) { foundDiff = 1; }
else if (args1->arg[0] != args2->arg[0]) { foundDiff = 2; }
else if (args1->arg[1] != args2->arg[1]) { foundDiff = 3; }
else if... | #include "plrCompare.h"
#include <stdio.h>
int plrC_compareArgs(const syscallArgs_t *args1, const syscallArgs_t *args2) {
int faultVal = 0;
#define CompareElement(elem, faultBit) \
if (args1->elem != args2->elem) { \
faultVal |= 1 << faultBit; \
printf("Argument miscompare in "... |
Fix inhibit_loop_to_libcall compilation on e2k | /**
* @file
* @brief
*
* @author Anton Kozlov
* @date 21.07.2015
*/
#ifndef STR_INHIBIT_LIBCALL_H_
#define STR_INHIBIT_LIBCALL_H_
/* FIXME __attribute__ ((__optimize__ ("-fno-tree-loop-distribute-patterns")))
* can be not supported in cross-compiler
*/
#define HAVE_CC_INHIBIT_LOOP_TO_LIBCALL 1
#ifdef HA... | /**
* @file
* @brief
*
* @author Anton Kozlov
* @date 21.07.2015
*/
#ifndef STR_INHIBIT_LIBCALL_H_
#define STR_INHIBIT_LIBCALL_H_
/* FIXME __attribute__ ((__optimize__ ("-fno-tree-loop-distribute-patterns")))
* can be not supported in cross-compiler
*/
#ifndef __e2k__
#define HAVE_CC_INHIBIT_LOOP_TO_LIBC... |
Remove unnecessary includes and newlines | #pragma once
#include <iostream>
#include <fstream>
#include <string>
#include <unordered_map>
#include <algorithm>
//#include <locale>
class ConfigFileReader
{
public:
ConfigFileReader(const char* file_name);
std::string find(std::string key);
private:
std::ifstream iniFile;
s... | #pragma once
#include <iostream>
#include <fstream>
#include <string>
#include <unordered_map>
#include <algorithm>
class ConfigFileReader
{
public:
ConfigFileReader(const char* file_name);
std::string find(std::string key);
private:
std::ifstream iniFile;
std::unordered_map<st... |
Convert also 0x80..0x9f characters to '?' | /* Copyright (c) 2004 Timo Sirainen */
#include "lib.h"
#include "str.h"
#include "str-sanitize.h"
void str_sanitize_append(string_t *dest, const char *src, size_t max_len)
{
const char *p;
for (p = src; *p != '\0'; p++) {
if ((unsigned char)*p < 32)
break;
}
str_append_n(dest, src, (size_t)(p - src));
fo... | /* Copyright (c) 2004 Timo Sirainen */
#include "lib.h"
#include "str.h"
#include "str-sanitize.h"
void str_sanitize_append(string_t *dest, const char *src, size_t max_len)
{
const char *p;
for (p = src; *p != '\0'; p++) {
if (((unsigned char)*p & 0x7f) < 32)
break;
}
str_append_n(dest, src, (size_t)(p - s... |
Fix os.copyfile with spaces in argument paths. | /**
* \file os_copyfile.c
* \brief Copy a file from one location to another.
* \author Copyright (c) 2002-2008 Jason Perkins and the Premake project
*/
#include <stdlib.h>
#include "premake.h"
int os_copyfile(lua_State* L)
{
int z;
const char* src = luaL_checkstring(L, 1);
const char* dst = luaL_checkstring... | /**
* \file os_copyfile.c
* \brief Copy a file from one location to another.
* \author Copyright (c) 2002-2008 Jason Perkins and the Premake project
*/
#include <stdlib.h>
#include "premake.h"
int os_copyfile(lua_State* L)
{
int z;
const char* src = luaL_checkstring(L, 1);
const char* dst = luaL_checkstring... |
Add more features ( made it more functional ) | #ifndef ROLE_H_
#define ROLE_H_
#include "State.h"
class Role{
public:
State& state;
int x,y;
Role(State _state, int _id = 0, int _x = 0, int _y = 0) : state(_state), id(_id), x(_x), y(_y) {}
int getID(){
return id;
}
virtual void move() = 0;
private:
//changing id is i... |
#ifndef ROLE_H_
#define ROLE_H_
#include "State.h"
#include "Location.h"
#include <vector>
// this class is partial abstract
class Role {
public:
// reference to the main state
State& state;
// neighbors
std::vector<int> neighbors;
private:
// position of the ant
int x, y;
// ant's id... |
Fix those functions not being virtual. | class dccChat : public Module {
public:
void onDCCReceive(std::string dccid, std::string message);
};
class dccSender : public Module {
public:
void dccSend(std::string dccid, std::string message);
}; | class dccChat : public Module {
public:
virtual void onDCCReceive(std::string dccid, std::string message);
};
class dccSender : public Module {
public:
virtual void dccSend(std::string dccid, std::string message);
virtual bool hookDCCMessage(std::string modName, std::string hookMsg);
}; |
Remove override form Begin Auto End methods of QtCreator plugin as they don't override anymore | %{Cpp:LicenseTemplate}\
#ifndef %{GUARD}
#define %{GUARD}
#include <Cutelyst/Controller>
%{JS: Cpp.openNamespaces('%{Class}')}\
using namespace Cutelyst;
class %{CN} : public Controller
{
Q_OBJECT
@if %{CustomNamespace}
C_NAMESPACE("%{CustomNamespaceValue}")
@endif
public:
explicit %{CN}(QObject *paren... | %{Cpp:LicenseTemplate}\
#ifndef %{GUARD}
#define %{GUARD}
#include <Cutelyst/Controller>
%{JS: Cpp.openNamespaces('%{Class}')}\
using namespace Cutelyst;
class %{CN} : public Controller
{
Q_OBJECT
@if %{CustomNamespace}
C_NAMESPACE("%{CustomNamespaceValue}")
@endif
public:
explicit %{CN}(QObject *paren... |
Fix this test to work for arm and on all platforms. | // RUN: %clang_cc1 -emit-llvm -march=armv7a %s
// XFAIL: *
// XTARGET: arm
typedef struct __simd128_uint16_t
{
__neon_uint16x8_t val;
} uint16x8_t;
void b(uint16x8_t sat, uint16x8_t luma)
{
__asm__("vmov.16 %1, %0 \n\t"
"vtrn.16 %0, %1 \n\t"
:"=w"(luma), "=w"(sa... | // RUN: %clang -S -emit-llvm -arch arm -march=armv7a %s
typedef unsigned short uint16_t;
typedef __attribute__((neon_vector_type(8))) uint16_t uint16x8_t;
void b(uint16x8_t sat, uint16x8_t luma)
{
__asm__("vmov.16 %1, %0 \n\t"
"vtrn.16 %0, %1 \n\t"
:"=w"(luma), "=w"(... |
Make the demo use the popover | /*
* This file is part of ui-tests
*
* Copyright © 2016 Ikey Doherty <ikey@solus-project.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... | /*
* This file is part of ui-tests
*
* Copyright © 2016 Ikey Doherty <ikey@solus-project.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... |
Allow allocation of a Sparc TargetMachine. | //===-- llvm/Target/TargetMachineImpls.h - Target Descriptions --*- C++ -*-===//
//
// This file defines the entry point to getting access to the various target
// machine implementations available to LLVM.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_TARGET_TARGETMA... | //===-- llvm/Target/TargetMachineImpls.h - Target Descriptions --*- C++ -*-===//
//
// This file defines the entry point to getting access to the various target
// machine implementations available to LLVM.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_TARGET_TARGETMA... |
Add resource message bearing some abstract integer. | //
// Copyright (C) 2008 SIPez LLC.
// Licensed to SIPfoundry under a Contributor Agreement.
//
// Copyright (C) 2008 SIPfoundry Inc.
// Licensed by SIPfoundry under the LGPL license.
//
// $$
///////////////////////////////////////////////////////////////////////////////
#ifndef _MpIntResourceMsg_h_
#define _MpIn... | |
Add UEFI2.6 MemoryAttributes Table definition. | /** @file
GUIDs used for UEFI Memory Attributes Table in the UEFI 2.6 specification.
Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distr... | |
Update test to match recent llvm-gcc change. | // RUN: %llvmgcc %s -S -emit-llvm -O0 -o - | FileCheck %s
// PR 5406
// XFAIL: *
// XTARGET: arm
typedef struct { char x[3]; } A0;
void foo (int i, ...);
// CHECK: call arm_aapcscc void (i32, ...)* @foo(i32 1, i32 {{.*}}) nounwind
int main (void)
{
A0 a3;
a3.x[0] = 0;
a3.x[0] = 0;
a3.x[2] = 26;
foo (1, ... | // RUN: %llvmgcc %s -S -emit-llvm -O0 -o - | FileCheck %s
// PR 5406
// XFAIL: *
// XTARGET: arm
typedef struct { char x[3]; } A0;
void foo (int i, ...);
// CHECK: call void (i32, ...)* @foo(i32 1, i32 {{.*}}) nounwind
int main (void)
{
A0 a3;
a3.x[0] = 0;
a3.x[0] = 0;
a3.x[2] = 26;
foo (1, a3 );
retur... |
Add ExperimentSuit to test PExperment and PTrial | #include <cxxtest/TestSuite.h>
#include "../log/EyeLog.h"
class ExperimentSuite: public CxxTest::TestSuite
{
public:
bool entryVecsAreEqual(const PEntryVec& v1, const PEntryVec& v2)
{
if (v1.size() != v2.size())
return false;
for (auto i = PEntryVec::size_type(0); i < v1.size(); i+... | |
Add note to help FreeBSD users. | /*
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
#include "e.h"
#include <execinfo.h>
/* a tricky little devil, requires e and it's libs to be built
* with the -rdynamic flag to GCC for any sort of decent output.
*/
void e_sigseg_act(int x, siginfo_t *info, void *data){
void *array[255];
size_t size... | /*
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
* NOTE TO FreeBSD users. Install libexecinfo from
* ports/devel/libexecinfo and add -lexecinfo to LDFLAGS
* to add backtrace support.
*/
#include "e.h"
#include <execinfo.h>
/* a tricky little devil, requires e and it's libs to be built
* with the -rdynamic... |
Use nullptr instead of 0 | /* The Halfling Project - A Graphics Engine and Projects
*
* The Halfling Project is the legal property of Adrian Astley
* Copyright Adrian Astley 2013
*/
#ifndef COMMON_D3D_UTIL_H
#define COMMON_D3D_UTIL_H
#include "common/dxerr.h"
//------------------------------------------------------------------------------... | /* The Halfling Project - A Graphics Engine and Projects
*
* The Halfling Project is the legal property of Adrian Astley
* Copyright Adrian Astley 2013
*/
#ifndef COMMON_D3D_UTIL_H
#define COMMON_D3D_UTIL_H
#include "common/dxerr.h"
//------------------------------------------------------------------------------... |
Add container_of and length_of macros to base |
size_t align_to(size_t offset, size_t align);
|
#define container_of(p,T,memb) (T *)((char *)(p) - offsetof(T,member))
#define length_of(array) (sizeof (array) / sizeof 0[array])
size_t align_to(size_t offset, size_t align);
|
Debug level 1 now only shows error messages (and no backgrounding in gmetad). | /**
* @file debug_msg.c Debug Message function
*/
/* $Id$ */
#include "gangliaconf.h"
int debug_level = 0;
/**
* @fn void debug_msg(const char *format, ...)
* Prints the message to STDERR if DEBUG is #defined
* @param format The format of the msg (see printf manpage)
* @param ... Optional arguments
*/
void
deb... | /**
* @file debug_msg.c Debug Message function
*/
/* $Id$ */
#include "gangliaconf.h"
int debug_level = 0;
/**
* @fn void debug_msg(const char *format, ...)
* Prints the message to STDERR if DEBUG is #defined
* @param format The format of the msg (see printf manpage)
* @param ... Optional arguments
*/
void
deb... |
Fix a memory leak in t-factor. | /*
Copyright (C) 2011 Sebastian Pancratz
This file is part of FLINT.
FLINT is free software: you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License (LGPL) as published
by the Free Software Foundation; either version 2.1 of the License, or
(at your opt... | /*
Copyright (C) 2011 Sebastian Pancratz
This file is part of FLINT.
FLINT is free software: you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License (LGPL) as published
by the Free Software Foundation; either version 2.1 of the License, or
(at your opt... |
Update GITTreeEntry tests to use GHUnit framework instead of SenTestKit | //
// GITTreeEntryTests.h
// CocoaGit
//
// Created by Geoffrey Garside on 06/10/2008.
// Copyright 2008 ManicPanda.com. All rights reserved.
//
#import <SenTestingKit/SenTestingKit.h>
@class GITRepo, GITTree;
@interface GITTreeEntryTests : GHTestCase {
GITRepo * repo;
GITTree * tree;
NSUInteger entry... | //
// GITTreeEntryTests.h
// CocoaGit
//
// Created by Geoffrey Garside on 06/10/2008.
// Copyright 2008 ManicPanda.com. All rights reserved.
//
#import <GHUnit/GHUnit.h>
@class GITRepo, GITTree;
@interface GITTreeEntryTests : GHTestCase {
GITRepo * repo;
GITTree * tree;
NSUInteger entryMode;
NSSt... |
Remove older benchmarking loop and do correct error handling with real parse interface. | #include <stdio.h>
#include <stdlib.h>
#include "udon.h"
int main (int argc, char *argv[]) {
int i;
int found = 0;
if(argc < 2) return 1;
UdonParser *udon = udon_new_parser_from_file(argv[1]);
if(udon == NULL) {
udon_emit_error(stderr);
return udon_error_value();
}
for(i=0; ... | #include <stdio.h>
#include <stdlib.h>
#include "udon.h"
int main (int argc, char *argv[]) {
int i;
if(argc < 2) return 1;
UdonParser *udon = udon_new_parser_from_file(argv[1]);
if(udon == NULL) {
udon_emit_error(stderr);
return udon_error_value();
}
int res = udon_parse(udon);
... |
Add a support tool to generate Util.Systems.Constants package | /* Generate a package from system header definitions
-- Copyright (C) 2011 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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 ... | |
Print an error when lstopo fails to export to XML | /*
* Copyright © 2009 CNRS
* Copyright © 2009-2010 INRIA. All rights reserved.
* Copyright © 2009 Université Bordeaux 1
* Copyright © 2009-2011 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
*/
#include <private/autogen/config.h>
#ifdef HWLOC_HAVE_XML
#include <hwloc.h>
#inclu... | /*
* Copyright © 2009 CNRS
* Copyright © 2009-2010 INRIA. All rights reserved.
* Copyright © 2009 Université Bordeaux 1
* Copyright © 2009-2011 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
*/
#include <private/autogen/config.h>
#ifdef HWLOC_HAVE_XML
#include <hwloc.h>
#inclu... |
Set up the getxattr function | //
// main.c
// fast-xattr-test
//
// Created by David Schlachter on 2015-07-09.
// Copyright (c) 2015 David Schlachter. All rights reserved.
//
#include <stdio.h>
int main(int argc, const char * argv[]) {
// insert code here...
printf("Hello, World!\n");
return 0;
}
| //
// main.c
// fast-xattr-test
//
// Created by David Schlachter on 2015-07-09.
// Copyright (c) 2015 David Schlachter. All rights reserved.
//
#include <stdio.h>
#include <sys/xattr.h>
#include <stdlib.h>
int main(int argc, const char * argv[]) {
const char *path;
const char *name;
void *value = mal... |
Fix regression test to work with iconv filter enabled | #include <stdio.h>
#include <stdlib.h>
#include <parserutils/parserutils.h>
#include "input/filter.h"
#include "testutils.h"
static void *myrealloc(void *ptr, size_t len, void *pw)
{
UNUSED(pw);
return realloc(ptr, len);
}
int main(int argc, char **argv)
{
parserutils_filter *input;
parserutils_filter_optpara... | #include <stdio.h>
#include <stdlib.h>
#include <parserutils/parserutils.h>
#include "input/filter.h"
#include "testutils.h"
static void *myrealloc(void *ptr, size_t len, void *pw)
{
UNUSED(pw);
return realloc(ptr, len);
}
int main(int argc, char **argv)
{
parserutils_filter *input;
parserutils_filter_optpara... |
Fix missing comment in header. | // Copyright (c) 2021 The Orbit Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef USER_SPACE_INSTRUMENTATION_ATTACH_H_
#define USER_SPACE_INSTRUMENTATION_ATTACH_H_
#include <sys/types.h>
#include "OrbitBase/Result.h"
namespa... | // Copyright (c) 2021 The Orbit Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef USER_SPACE_INSTRUMENTATION_ATTACH_H_
#define USER_SPACE_INSTRUMENTATION_ATTACH_H_
#include <sys/types.h>
#include "OrbitBase/Result.h"
namespa... |
Fix typo in include file names. | /*-
* Copyright (c) 2015 Alexander Nasonov.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list ... | /*-
* Copyright (c) 2015 Alexander Nasonov.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list ... |
Use vector_get rather than accessing array directly | #include "location.h"
#include "inventory.h"
#include "person.h"
void location_init(struct location *location, char *name, char *description)
{
location->name = name;
location->description = description;
inventory_init(&location->inventory);
vector_init(&location->people, sizeof(struct person *));
}
v... | #include "location.h"
#include "inventory.h"
#include "person.h"
void location_init(struct location *location, char *name, char *description)
{
location->name = name;
location->description = description;
inventory_init(&location->inventory);
vector_init(&location->people, sizeof(struct person *));
}
v... |
Solve Fibonacci, How Many Calls? in c | #include <stdio.h>
#include <string.h>
long int f[39];
long int r[39];
long int fib(long int n) {
if (n == 0) {
return f[0];
}
if (f[n] != 0) {
return f[n];
}
f[n] = fib(n - 1) + fib(n - 2);
r[n] = r[n - 1] + r[n - 2] + 2;
return f[n];
}
int main() {
int i, j;
l... | |
Support GNU extensions on non-GNU platforms | /* -*- c -*- */
/*
Project: libFIRM
File name: ir/ana/gnu_ext.c
Purpose: Provide some GNU CC extensions to the rest of the world
Author: Florian
Modified by:
Created: Sat Nov 13 19:35:27 CET 2004
CVS-ID: $Id$
Copyright: (c) 1999-2005 Universitt Karlsruhe
Licence: ... | |
Fix bugs with libc, executor | #include <stdio.h>
int main(int argc, char ** argv){
printf("Test\n");
return 0;
}
| #include <stdlib.h>
#include <stdio.h>
int main(int argc, char ** argv){
printf("Test\n");
void* test = malloc(1024*1024);
if(test > 0){
printf("Malloc\n");
free(test);
printf("Free\n");
}else{
printf("Malloc Failed\n");
}
return 0;
}
|
Fix printf() by adding CR manually | #include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <termios.h>
#include <unistd.h>
struct termios orig_termios;
void disable_raw_mode() {
tcsetattr(STDIN_FILENO, TCSAFLUSH, &orig_termios);
}
void enable_raw_mode() {
tcgetattr(STDIN_FILENO, &orig_termios);
atexit(disable_raw_mode);
struct termios... | #include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <termios.h>
#include <unistd.h>
struct termios orig_termios;
void disable_raw_mode() {
tcsetattr(STDIN_FILENO, TCSAFLUSH, &orig_termios);
}
void enable_raw_mode() {
tcgetattr(STDIN_FILENO, &orig_termios);
atexit(disable_raw_mode);
struct termios... |
Fix missing parenthesis around f as parameter | #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);
ListNode* List_Search(List* l, void* k, int f(v... | #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);
ListNode* List_Search(List* l, void* k, int (f)... |
Add test for delete connection method | #include "kms-endpoint.h"
#include <glib.h>
int main(int argc, char **argv) {
GObject *ep;
GValue val = G_VALUE_INIT;
GError *err = NULL;
KmsConnection *conn = NULL;
g_type_init();
ep = g_object_new(KMS_TYPE_ENDPOINT, "localname", "test_ep", NULL);
if (ep == NULL) {
g_print("Create endpont is: NULL\n");
... | #include "kms-endpoint.h"
#include <glib.h>
int main(int argc, char **argv) {
GObject *ep;
GValue val = G_VALUE_INIT;
GError *err = NULL;
KmsConnection *conn = NULL;
g_type_init();
ep = g_object_new(KMS_TYPE_ENDPOINT, "localname", "test_ep", NULL);
if (ep == NULL) {
g_print("Create endpont is: NULL\n");
... |
Add passing problem parameters as program arguments | /* headers */
#include <stdlib.h>
#include <time.h>
#include "lattice.h"
#include "clusters.h"
#include "io_helpers.h"
/* main body function */
int main()
{
int L; /* square lattice size */
double p; /* occupation probability of each lattice site */
int *lattice; /* lattice array */
/* initialize ran... | /* headers */
#include <stdlib.h>
#include <time.h>
#include "lattice.h"
#include "clusters.h"
#include "io_helpers.h"
/* main body function */
int main(int argc, char ** argv)
{
int L; /* square lattice size */
double p; /* occupation probability of each lattice site */
int *lattice; /* lattice array */
... |
Fix this test on machines that don't run clang -cc1as when asked to assemble. | // RUN: %clang -### %s -c -o tmp.o -Wa,--noexecstack 2>&1 | grep "mnoexecstack"
| // RUN: %clang -### %s -c -o tmp.o -triple i686-pc-linux-gnu -integrated-as -Wa,--noexecstack 2>&1 | grep "mnoexecstack"
|
Disable threading in a test. NFC. | #include "Inputs/zeroFunctionFile.h"
int foo(int x) {
return NOFUNCTIONS(x);
}
int main() {
return foo(2);
}
// RUN: llvm-profdata merge %S/Inputs/zeroFunctionFile.proftext -o %t.profdata
// RUN: llvm-cov report %S/Inputs/zeroFunctionFile.covmapping -instr-profile %t.profdata 2>&1 | FileCheck --check-prefix=REPO... | #include "Inputs/zeroFunctionFile.h"
int foo(int x) {
return NOFUNCTIONS(x);
}
int main() {
return foo(2);
}
// RUN: llvm-profdata merge %S/Inputs/zeroFunctionFile.proftext -o %t.profdata
// RUN: llvm-cov report %S/Inputs/zeroFunctionFile.covmapping -instr-profile %t.profdata 2>&1 | FileCheck --check-prefix=REPO... |
Add button driving and reset encoder warning when bot picked up | task blink();
task usercontrol(){
int DY, DT;
bool isReset = false;
startTask(blink);
//Enable Positioning System
startTask(positionsystem);
while(true){
//Driving
DY = threshold(PAIRED_CH2^2 / MAX_POWER, 5);
DT = threshold(PAIRED_CH1^2 / MAX_POWER, 5);
drive(DY, DT);
//Mogo
mogo(threshold(PAIRED_... | task blink();
task usercontrol(){
int DY, DT;
bool isReset = false;
startTask(blink);
//Enable Positioning System
startTask(positionsystem);
while(true){
//Driving
DY = threshold(PAIRED_CH2^2 / MAX_POWER, 5) + ((PAIRED_BTN8U - PAIRED_BTN8D) * MAX_POWER);
DT = threshold(PAIRED_CH1^2 / MAX_POWER, 5) + ((PA... |
Make diego happy before he notices. | /*
* Principal component analysis
* Copyright (c) 2004 Michael Niedermayer <michaelni@gmx.at>
*
* 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 of the License, o... | /*
* Principal component analysis
* Copyright (c) 2004 Michael Niedermayer <michaelni@gmx.at>
*
* 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 of the License, o... |
Tweak to test commiting from submodule | /*
Config (Singleton), extends ofxXMLSettings
Loads app configuration properties from xml file.
*/
#pragma once
#ifndef BBC_CONFIG
#define BBC_CONFIG
#include "XmlSettingsEx.h"
#define CONFIG_GET(_key, _attr, _def) bbc::utils::Config::instance()->getAttribute("config:"_key, _attr, _def)
namespace bbc {
n... | /*
Config (Singleton), extends ofxXMLSettings
Loads app configuration properties from xml file.
*/
#pragma once
#ifndef BBC_CONFIG
#define BBC_CONFIG
#include "XmlSettingsEx.h"
#define CONFIG_GET(_key, _attr, _def) bbc::utils::Config::instance()->getAttribute("config:"_key, _attr, _def)
namespace bbc {
n... |
Implement classof for SetCondInst so that instcombine doesn't break on dyn_cast<SetCondInst> | //===-- llvm/iBinary.h - Binary Operator node definitions --------*- C++ -*--=//
//
// This file contains the declarations of all of the Binary Operator classes.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_IBINARY_H
#define LLVM_IBINARY_H
#include "llvm/InstrTypes.... | //===-- llvm/iBinary.h - Binary Operator node definitions --------*- C++ -*--=//
//
// This file contains the declarations of all of the Binary Operator classes.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_IBINARY_H
#define LLVM_IBINARY_H
#include "llvm/InstrTypes.... |
Use fmtlib's sprintf instead of tinyformat | #pragma once
#define TINYFORMAT_USE_VARIADIC_TEMPLATES
#ifdef __GNUC__
// Tinyformat has a number of non-annotated switch fallthrough cases
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
#endif
#include "dependencies/tinyformat/tinyformat.h"
#ifdef __GNUC__
#pragma GCC diagnosti... | #pragma once
#include "fmt/printf.h"
#include "library/strings.h"
namespace OpenApoc
{
template <typename... Args> static UString format(const UString &fmt, Args &&... args)
{
return fmt::sprintf(fmt.str(), std::forward<Args>(args)...);
}
UString tr(const UString &str, const UString domain = "ufo_string");
} // n... |
Fix basic type redefinition errors | #pragma once
#include <string>
#include <cstdlib>
// Integer types
typedef char int8_t;
typedef unsigned char uint8_t;
typedef short int16_t;
typedef unsigned short uint16_t;
typedef long int32_t;
typedef unsigned long uint32_t;
typedef long long int64_t;
typedef unsigned long long uint64_t;
#ifndef _swap_int
templ... | #pragma once
#include <string>
#include <cstdlib>
// Integer types
#ifdef int8_t
typedef char int8_t;
#endif // !int8_t
#ifdef uint8_t
typedef unsigned char uint8_t;
#endif // !uint8_t
#ifdef int16_t
typedef short int16_t;
#endif // !int16_t
#ifdef uint16_t
typedef unsigned short uint16_t;
#endif // !uint16_t
#if... |
Fix Valgrind complaint about unitialized heap memory | #include "syshead.h"
#include "skbuff.h"
struct sk_buff *alloc_skb(unsigned int size)
{
struct sk_buff *skb = malloc(sizeof(struct sk_buff));
skb->data = malloc(size);
skb->head = skb->data;
skb->tail = skb->data;
skb->end = skb->tail + size;
return skb;
}
void *skb_reserve(struct sk_buff *s... | #include "syshead.h"
#include "skbuff.h"
struct sk_buff *alloc_skb(unsigned int size)
{
struct sk_buff *skb = malloc(sizeof(struct sk_buff));
memset(skb, 0, sizeof(struct sk_buff));
skb->data = malloc(size);
memset(skb->data, 0, size);
skb->head = skb->data;
skb->tail = skb->data;
skb... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.