Instruction
stringlengths
14
778
input_code
stringlengths
0
4.24k
output_code
stringlengths
1
5.44k
Fix gcc warning when -Wall (implicit return).
#include <stdio.h> int main() { printf("hello, world\n"); }
#include <stdio.h> int main() { printf("hello, world\n"); return 0; }
Fix dlist compilation with NDEBUG flag
/** * @file * @brief Paranoia checks of doubly-linked lists * * @date 05.12.2013 * @author Eldar Abusalimov */ #include <inttypes.h> #include <assert.h> #include <util/dlist.h> #if DLIST_DEBUG_VERSION void __dlist_debug_check(const struct dlist_head *head) { const struct dlist_head *p = head->prev; const str...
/** * @file * @brief Paranoia checks of doubly-linked lists * * @date 05.12.2013 * @author Eldar Abusalimov */ #include <inttypes.h> #include <assert.h> #include <util/dlist.h> #if DLIST_DEBUG_VERSION void __dlist_debug_check(const struct dlist_head *head) { #ifndef NDEBUG const struct dlist_head *p = head->p...
Add longest increasing subsequence in C language.
#include <stdio.h> const int N = 1e5; int lis(int a[], int n) { int i, j; int dp[N]; for(i = 0; i < n; ++i) dp[i] = 1; for(i = 0; i < n; ++i) for(j = 0; j < i; ++j) if(a[j] < a[i]) if(dp[i] < dp[j] + 1) dp[i] = dp[j] + 1; int mx = 0; for(i = 0; i < n; ++i) if(mx < dp[i]) mx = dp[i]; re...
Remove last occurences of the dead struct array
#ifndef _PKG_UTIL_H #define _PKG_UTIL_H #include <sys/types.h> #include <sys/sbuf.h> #include <sys/param.h> #define ARRAY_INIT {0, 0, NULL} struct array { size_t cap; size_t len; void **data; }; #define STARTS_WITH(string, needle) (strncasecmp(string, needle, strlen(needle)) == 0) #define ERROR_SQLITE(db) \ EM...
#ifndef _PKG_UTIL_H #define _PKG_UTIL_H #include <sys/types.h> #include <sys/sbuf.h> #include <sys/param.h> #define STARTS_WITH(string, needle) (strncasecmp(string, needle, strlen(needle)) == 0) #define ERROR_SQLITE(db) \ EMIT_PKG_ERROR("sqlite: %s", sqlite3_errmsg(db)) int sbuf_set(struct sbuf **, const char *); ...
Use uintptr_t for pointer values in the ExecutionEngine.
//===-- GenericValue.h - Represent any type of LLVM value -------*- 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. // //===--------...
//===-- GenericValue.h - Represent any type of LLVM value -------*- 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. // //===--------...
Document the timeZone as being optional.
// // NSDate+GTTimeAdditions.h // ObjectiveGitFramework // // Created by Danny Greg on 27/03/2013. // Copyright (c) 2013 GitHub, Inc. All rights reserved. // #import <Foundation/Foundation.h> #import "git2.h" @interface NSDate (GTTimeAdditions) // Creates a new `NSDate` from the provided `git_time`. // // time ...
// // NSDate+GTTimeAdditions.h // ObjectiveGitFramework // // Created by Danny Greg on 27/03/2013. // Copyright (c) 2013 GitHub, Inc. All rights reserved. // #import <Foundation/Foundation.h> #import "git2.h" @interface NSDate (GTTimeAdditions) // Creates a new `NSDate` from the provided `git_time`. // // time ...
Print random seed for sharing / debugging purposes
#include <stdlib.h> #include <curses.h> #include <time.h> #include "game.h" #include "ui.h" static void shutdown(void); int main(int argc, char ** argv) { srand(time(NULL)); initscr(); cbreak(); noecho(); curs_set(0); keypad(stdscr, TRUE); start_color(); init_pair(color_black, COL...
#include <stdlib.h> #include <curses.h> #include <time.h> #include "game.h" #include "ui.h" static void shutdown(void); int main(int argc, char ** argv) { time_t random_seed = time(NULL); printf("Random game #%ld\n", random_seed); srand(random_seed); initscr(); cbreak(); noecho(); curs_s...
Add length-prefixed string handling functions.
/* Main program for TGL (Text Generation Language). */ #include <stdio.h> #include <unistd.h> #include <sys/types.h> #include <sys/wait.h> #include <fcntl.h> int main(int argc, char** argv) { printf("hello world\n"); return 0; }
/* Main program for TGL (Text Generation Language). */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> #include <unistd.h> #include <sys/types.h> #include <sys/wait.h> #include <fcntl.h> /* BEGIN: String handling (strings may have NUL bytes within, and are not * NUL-terminated). */ /* ...
Document contents of items array
// // BBASearchSuggestionsResult.h // BBBAPI // // Created by Owen Worley on 12/01/2015. // Copyright (c) 2015 Blinkbox Entertainment Ltd. All rights reserved. // #import <Foundation/Foundation.h> @class FEMObjectMapping; /** * Represents data returned from the book search suggestions service (search/suggestion...
// // BBASearchSuggestionsResult.h // BBBAPI // // Created by Owen Worley on 12/01/2015. // Copyright (c) 2015 Blinkbox Entertainment Ltd. All rights reserved. // #import <Foundation/Foundation.h> @class FEMObjectMapping; /** * Represents data returned from the book search suggestions service (search/suggestion...
Add infrastructure for constructing polynomials
#include <stdlib.h> #include <stdio.h> typedef struct Poly Poly; struct Poly { int32_t coef; int32_t abc; Poly *link; }; int add(Poly *q, Poly *p); Poly *avail; int main(int argc, char **argv) { Poly *pool, *p; pool = calloc(500, sizeof(*pool)); for(p = pool; p < pool+499; p++) p->link = p+1; p->link = N...
#include <stdlib.h> #include <stdio.h> #include <stdint.h> typedef struct Poly Poly; struct Poly { int32_t coef; int32_t abc; Poly *link; }; int add(Poly *q, Poly *p); Poly *avail; Poly* makepoly(void) { Poly *p; if(avail == NULL) return NULL; p = avail; avail = avail->link; p->abc = -1; p->coef = 0; ...
Remove private method from the public interface
// // ASFRequestBuilder.h // ASFFeedly // // Created by Anton Simakov on 12/12/13. // Copyright (c) 2013 Anton Simakov. All rights reserved. // #import <Foundation/Foundation.h> extern NSURL *ASFURLByAppendingParameters(NSURL *URL, NSDictionary *parameters); extern NSString *ASFQueryFromURL(NSURL *URL); extern NS...
// // ASFRequestBuilder.h // ASFFeedly // // Created by Anton Simakov on 12/12/13. // Copyright (c) 2013 Anton Simakov. All rights reserved. // #import <Foundation/Foundation.h> extern NSURL *ASFURLByAppendingParameters(NSURL *URL, NSDictionary *parameters); extern NSString *ASFQueryFromURL(NSURL *URL); extern NS...
Add error constant for not permmited methods in the server
// // OCErrorMsg.h // Owncloud iOs Client // // Copyright (c) 2014 ownCloud (http://www.owncloud.org/) // // 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 w...
// // OCErrorMsg.h // Owncloud iOs Client // // Copyright (c) 2014 ownCloud (http://www.owncloud.org/) // // 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 w...
Fix typo in a comment: it's base58, not base48.
#ifndef BITCOINADDRESSVALIDATOR_H #define BITCOINADDRESSVALIDATOR_H #include <QValidator> /** Base48 entry widget validator. Corrects near-miss characters and refuses characters that are no part of base48. */ class BitcoinAddressValidator : public QValidator { Q_OBJECT public: explicit BitcoinAddressVali...
#ifndef BITCOINADDRESSVALIDATOR_H #define BITCOINADDRESSVALIDATOR_H #include <QValidator> /** Base58 entry widget validator. Corrects near-miss characters and refuses characters that are not part of base58. */ class BitcoinAddressValidator : public QValidator { Q_OBJECT public: explicit BitcoinAddressVal...
Return unique pointer to const tensor instead.
// Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once #include <vespa/eval/eval/tensor_spec.h> #include <vespa/eval/tensor/default_tensor_engine.h> #include <vespa/vespalib/testkit/test_kit.h> namespace vespalib::tensor::test { template <typena...
// Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once #include <vespa/eval/eval/tensor_spec.h> #include <vespa/eval/tensor/default_tensor_engine.h> #include <vespa/vespalib/testkit/test_kit.h> namespace vespalib::tensor::test { template <typena...
Add carriage return to the list of default delimiters to correctly handle "windows-style" end of line on "unix-style" systems.
/*========================================================================= Program: Visualization Toolkit Module: Tokenizer.h Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen All rights reserved. See Copyright.txt or http://www.kitware.com/Copyright.htm for details. This software is distr...
/*========================================================================= Program: Visualization Toolkit Module: Tokenizer.h Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen All rights reserved. See Copyright.txt or http://www.kitware.com/Copyright.htm for details. This software is distr...
Add comment for validation method
// // OEXRegistrationFieldValidation.h // edXVideoLocker // // Created by Jotiram Bhagat on 03/03/15. // Copyright (c) 2015 edX. All rights reserved. // #import <Foundation/Foundation.h> #import "OEXRegistrationFormField.h" @interface OEXRegistrationFieldValidator : NSObject +(NSString *)validateField:(OEXRegistra...
// // OEXRegistrationFieldValidation.h // edXVideoLocker // // Created by Jotiram Bhagat on 03/03/15. // Copyright (c) 2015 edX. All rights reserved. // #import <Foundation/Foundation.h> #import "OEXRegistrationFormField.h" @interface OEXRegistrationFieldValidator : NSObject /// Returns an error string, or nil if ...
Delete an unnecessary forward decleration
#ifndef FUSTATE_H #define FUSTATE_H #include <SFML/Window/Event.hpp> #include <SFML/System/Time.hpp> #include <SFML/Graphics/RenderWindow.hpp> #include <memory> class FUStateManager; class FUState { public: struct FUContext { FUContext(std::shared_ptr<sf::RenderWindow> window) : renderWindo...
#ifndef FUSTATE_H #define FUSTATE_H #include <SFML/Window/Event.hpp> #include <SFML/System/Time.hpp> #include <SFML/Graphics/RenderWindow.hpp> #include <memory> class FUState { public: struct FUContext { FUContext(std::shared_ptr<sf::RenderWindow> window) : renderWindow(window) {} s...
Include dialog resources to make things easier
#pragma once #include "../Controls/Controls.h" #include "../Controls/TabPage.h" /// <summary> /// Abstract class that encapsulates functionality for dealing with /// property sheet pages (tabs). /// </summary> class SettingsTab : public TabPage { public: SettingsTab(HINSTANCE hInstance, LPCWSTR tabTemplate, LPCWS...
#pragma once #include "../Controls/Controls.h" #include "../Controls/TabPage.h" #include "../resource.h" /// <summary> /// Abstract class that encapsulates functionality for dealing with /// property sheet pages (tabs). /// </summary> class SettingsTab : public TabPage { public: SettingsTab(HINSTANCE hInstance, L...
Move typedef to digraph header
#ifndef THM_CONFIG_HG #define THM_CONFIG_HG // Vertex ID type // # of vertices < MAX(thm_Vid) typedef unsigned long thm_Vid; // Arc reference type // # of arcs in any digraph <= MAX(thm_Arcref) typedef unsigned long thm_Arcref; // Block label type // # of blocks < MAX(thm_Blklab) typedef unsigned long thm_Blklab; #...
#ifndef THM_CONFIG_HG #define THM_CONFIG_HG // Block label type (must be unsigned) // # of blocks <= MAX(thm_Blklab) typedef uint32_t thm_Blklab; #endif
Add report functions for x*()
#ifndef MEM_H__ #define MEM_H__ #include <stdlib.h> void *xmalloc (size_t size); void *xcalloc (size_t count, size_t size); void *xrealloc (void *ptr, size_t size); char *xstralloc (size_t len); void *xmemdupz (const void *data, size_t len); char *xstrndup (const char *str, size_t len); void xfree (void *ptr); void ...
#ifndef MEM_H__ #define MEM_H__ #include <stdlib.h> void *xmalloc (size_t size); void *xcalloc (size_t count, size_t size); void *xrealloc (void *ptr, size_t size); char *xstralloc (size_t len); void *xmemdupz (const void *data, size_t len); char *xstrndup (const char *str, size_t len); void xfree (void *ptr); size_...
Move constructor from std::string for cpr::Body
#ifndef CPR_BODY_H #define CPR_BODY_H #include <cstring> #include <initializer_list> #include <string> #include "defines.h" namespace cpr { class Body : public std::string { public: Body() = default; Body(const Body& rhs) = default; Body(Body&& rhs) = default; Body& operator=(const Body& rhs) = d...
#ifndef CPR_BODY_H #define CPR_BODY_H #include <cstring> #include <initializer_list> #include <string> #include "defines.h" namespace cpr { class Body : public std::string { public: Body() = default; Body(const Body& rhs) = default; Body(Body&& rhs) = default; Body& operator=(const Body& rhs) = d...
Set pipe status on clear
#include "pipe/p_context.h" #include "pipe/p_defines.h" #include "pipe/p_state.h" #include "nv30_context.h" void nv30_clear(struct pipe_context *pipe, struct pipe_surface *ps, unsigned clearValue) { pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height, clearValue); }
#include "pipe/p_context.h" #include "pipe/p_defines.h" #include "pipe/p_state.h" #include "nv30_context.h" void nv30_clear(struct pipe_context *pipe, struct pipe_surface *ps, unsigned clearValue) { pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height, clearValue); ps->status = PIPE_SURFACE_STATUS_CLEAR; }
Update Skia milestone to 86
/* * 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 85 #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 86 #endif
Put alternate stack on heap
#include <stdio.h> #include <signal.h> #include <unistd.h> #include <assert.h> #include <stdlib.h> #include <setjmp.h> jmp_buf try; void handler(int sig) { static int i = 0; write(2, "stack overflow\n", 15); longjmp(try, ++i); _exit(1); } unsigned recurse(unsigned x) { return recurse(x)+1; } int ma...
#include <stdio.h> #include <signal.h> #include <unistd.h> #include <assert.h> #include <stdlib.h> #include <setjmp.h> jmp_buf try; void handler(int sig) { static int i = 0; write(2, "stack overflow\n", 15); longjmp(try, ++i); _exit(1); } unsigned recurse(unsigned x) { return recurse(x)+1; } int ma...
Change scope of state column
/* * libpatts - Backend library for PATTS Ain't Time Tracking Software * Copyright (C) 2014 Delwink, LLC * * 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 Foundation. * * This program i...
/* * libpatts - Backend library for PATTS Ain't Time Tracking Software * Copyright (C) 2014 Delwink, LLC * * 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 Foundation. * * This program i...
Make the hex dump size limit much smaller
#ifndef UTILS_H #define UTILS_H #include <string> /** \brief Convert given container to it's hex representation */ template< typename T > std::string toHex( const T& data ) { static const char charTable[] = "0123456789abcdef"; std::string ret; if ( data.size() > 1024 ) { ret = "*** LARGE *** ...
#ifndef UTILS_H #define UTILS_H #include <string> /** \brief Convert given container to it's hex representation */ template< typename T > std::string toHex( const T& data ) { static const char charTable[] = "0123456789abcdef"; std::string ret; if ( data.size() > 80 ) { ret = "*** LARGE *** ";...
Write control mode to string function
#ifndef VORTEX_HELPER_H #define VORTEX_HELPER_H #include "uranus_dp/control_mode_enum.h" inline std::string controlModeString(ControlMode control_mode) { std::string s; switch(control_mode) { case ControlModes::OPEN_LOOP: s = "Open Loop"; break; case ControlModes::SIXDOF: s = "Six DOF"; ...
Return 0 from main as it should.
#include "config.h" #include <stdio.h> #include <string.h> #include "lexicon.h" #include "hash.h" #include "array.h" #include "util.h" #include "mem.h" int main(int argc, char **argv) { lexicon_pt l=read_lexicon_file(argv[1]); char s[4000]; printf("Read %ld lexical entries.\n", (long int)hash_size(l->words))...
#include "config.h" #include <stdio.h> #include <string.h> #include "lexicon.h" #include "hash.h" #include "array.h" #include "util.h" #include "mem.h" int main(int argc, char **argv) { lexicon_pt l=read_lexicon_file(argv[1]); char s[4000]; printf("Read %ld lexical entries.\n", (long int)hash_size(l->words))...
Fix types of head and tail.
#ifndef PACKET_QUEUE_H_INCLUDED__ #define PACKET_QUEUE_H_INCLUDED__ #include "radio.h" #include <stdbool.h> #define PACKET_QUEUE_SIZE 10 typedef struct { radio_packet_t * head; radio_packet_t * tail; radio_packet_t packets[PACKET_QUEUE_SIZE]; } packet_queue_t; uint32_t packet_queue_init(packet_queue_t ...
#ifndef PACKET_QUEUE_H_INCLUDED__ #define PACKET_QUEUE_H_INCLUDED__ #include "radio.h" #include <stdbool.h> #define PACKET_QUEUE_SIZE 10 typedef struct { uint32_t head; uint32_t tail; radio_packet_t packets[PACKET_QUEUE_SIZE]; } packet_queue_t; uint32_t packet_queue_init(packet_queue_t * queue); bool ...
Fix typo: 'conjuction' -> 'conjunction'.
/* * Copyright (c) 2009 Baptiste Coudurier <baptiste.coudurier@gmail.com> * * This file is part of FFmpeg. * * FFmpeg 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 ...
/* * Copyright (c) 2009 Baptiste Coudurier <baptiste.coudurier@gmail.com> * * This file is part of FFmpeg. * * FFmpeg 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 ...
Remove empty line at EOF
/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* Copyright (C) 2015 Red Hat, Inc. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the Lic...
/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* Copyright (C) 2015 Red Hat, Inc. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the Lic...
Add gadget udc command at libusbg backend
/* * Copyright (c) 2012-2015 Samsung Electronics Co., 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 appli...
/* * Copyright (c) 2012-2015 Samsung Electronics Co., 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 appli...
Make test work on Linux, pt. 2
// Check that calling dispatch_once from a report callback works. // RUN: %clang_tsan %s -o %t // RUN: not %run %t 2>&1 | FileCheck %s #include <dispatch/dispatch.h> #include <pthread.h> #include <stdio.h> long g = 0; long h = 0; void f() { static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ g++;...
// Check that calling dispatch_once from a report callback works. // RUN: %clang_tsan %s -o %t // RUN: not %run %t 2>&1 | FileCheck %s #include <dispatch/dispatch.h> #include <pthread.h> #include <stdio.h> long g = 0; long h = 0; void f() { static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ g++;...
Store filter by value in FilterTask
/// \file update_task.h /// Defines action for updating tasks. /// \author A0112054Y #pragma once #ifndef YOU_QUERYENGINE_INTERNAL_ACTION_FILTER_TASK_H_ #define YOU_QUERYENGINE_INTERNAL_ACTION_FILTER_TASK_H_ #include <functional> #include "../../filter.h" #include "../../api.h" namespace You { namespace QueryEngine ...
/// \file update_task.h /// Defines action for updating tasks. /// \author A0112054Y #pragma once #ifndef YOU_QUERYENGINE_INTERNAL_ACTION_FILTER_TASK_H_ #define YOU_QUERYENGINE_INTERNAL_ACTION_FILTER_TASK_H_ #include <functional> #include "../../filter.h" #include "../../api.h" namespace You { namespace QueryEngine ...
Install a sig handler using sigaction(), ensure that handler stays installed across invocations.
/* ** Copyright 1994 by Miron Livny, and Mike Litzkow ** ** Permission to use, copy, modify, and distribute this software and its ** documentation for any purpose and without fee is hereby granted, ** provided that the above copyright notice appear in all copies and that ** both that copyright notice and this permiss...
Fix for inner class registration check
/** @file Copyright John Reid 2013 */ #ifndef MYRRH_PYTHON_REGISTRY_H_ #define MYRRH_PYTHON_REGISTRY_H_ #ifdef _MSC_VER # pragma once #endif //_MSC_VER namespace myrrh { namespace python { /** * Queries if the the type specified is in the registry. */ template< typename QueryT > bool in_registry() { namespace ...
/** @file Copyright John Reid 2013 */ #ifndef MYRRH_PYTHON_REGISTRY_H_ #define MYRRH_PYTHON_REGISTRY_H_ #ifdef _MSC_VER # pragma once #endif //_MSC_VER namespace myrrh { namespace python { /** * Queries if the the type specified is in the registry. This can be used to avoid registering * the same type more than...
Update files, Alura, Introdução a C, Aula 2.5
#include <stdio.h> int main() { // imprime o cabecalho do nosso jogo printf("******************************************\n"); printf("* Bem vindo ao nosso jogo de adivinhação *\n"); printf("******************************************\n"); int numerosecreto = 42; int chute; printf("Qual é o seu chute? "...
#include <stdio.h> int main() { // imprime o cabecalho do nosso jogo printf("******************************************\n"); printf("* Bem vindo ao nosso jogo de adivinhação *\n"); printf("******************************************\n"); int numerosecreto = 42; int chute; for(int i = 1; i <= 3; i++) {...
Add some correction to Obj-C wrappers
/* * Copyright (C) 2015 CossackLabs * * 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 (C) 2015 CossackLabs * * 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...
Print CPUID result to output
/** * cpuid.c * * Checks if CPU has support of AES instructions * * @author kryukov@frtk.ru * @version 4.0 * * For Putty AES NI project * http://putty-aes-ni.googlecode.com/ */ #ifndef SILENT #include <stdio.h> #endif #if defined(__clang__) || defined(__GNUC__) #include <cpuid.h> static int CheckCPUsupport...
/** * cpuid.c * * Checks if CPU has support of AES instructions * * @author kryukov@frtk.ru * @version 4.0 * * For Putty AES NI project * http://putty-aes-ni.googlecode.com/ */ #include <stdio.h> #if defined(__clang__) || defined(__GNUC__) #include <cpuid.h> static int CheckCPUsupportAES() { unsigned i...
Add a comment behind ClassDef
#ifndef ALI_TRD_PREPROCESSOR_H #define ALI_TRD_PREPROCESSOR_H /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * * See cxx source for full Copyright notice */ /* $Id$ */ //////////////////////////////////////////////////////////////////////////// // ...
#ifndef ALI_TRD_PREPROCESSOR_H #define ALI_TRD_PREPROCESSOR_H /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * * See cxx source for full Copyright notice */ /* $Id$ */ //////////////////////////////////////////////////////////////////////////// // ...
Add precision prefixes to shaders
uniform sampler2D m_SamplerY; uniform sampler2D m_SamplerU; uniform sampler2D m_SamplerV; uniform mat3 yuvCoeff; // Y - 16, Cb - 128, Cr - 128 const mediump vec3 offsets = vec3(-0.0625, -0.5, -0.5); lowp vec3 sampleRgb(vec2 loc) { float y = texture2D(m_SamplerY, loc).r; float u = texture2D(m_SamplerU, loc).r; ...
uniform sampler2D m_SamplerY; uniform sampler2D m_SamplerU; uniform sampler2D m_SamplerV; uniform mediump mat3 yuvCoeff; // Y - 16, Cb - 128, Cr - 128 const mediump vec3 offsets = vec3(-0.0625, -0.5, -0.5); lowp vec3 sampleRgb(vec2 loc) { lowp float y = texture2D(m_SamplerY, loc).r; lowp float u = texture2D(m_S...
Split the CleanupGCCOutput pass into two passes, and add real life actual documentation on when they do.
//===- llvm/Transforms/CleanupGCCOutput.h - Cleanup GCC Output ---*- C++ -*--=// // // //===----------------------------------------------------------------------===// #ifndef LLVM_TRANSFORMS_CLEANUPGCCOUTPUT_H #define LLVM_TRANSFORMS_CLEANUPGCCOUTPUT_H class Pass; Pass *createCleanupGCCOutputPass(); #endif
//===- llvm/Transforms/CleanupGCCOutput.h - Cleanup GCC Output ---*- C++ -*--=// // // These passes are used to cleanup the output of GCC. GCC's output is // unneccessarily gross for a couple of reasons. This pass does the following // things to try to clean it up: // // * Eliminate names for GCC types that we know ca...
Include posixishard as late as possible
/* ISC license. */ #include <string.h> #include <utmpx.h> #include <skalibs/posixishard.h> #include <skalibs/allreadwrite.h> #include <skalibs/strerr2.h> #include <skalibs/djbunix.h> #include "hpr.h" #ifndef UT_LINESIZE #define UT_LINESIZE 32 #endif void hpr_wall (char const *s) { size_t n = strlen(s) ; char t...
/* ISC license. */ #include <string.h> #include <utmpx.h> #include <skalibs/allreadwrite.h> #include <skalibs/strerr2.h> #include <skalibs/djbunix.h> #include <skalibs/posixishard.h> #include "hpr.h" #ifndef UT_LINESIZE #define UT_LINESIZE 32 #endif void hpr_wall (char const *s) { size_t n = strlen(s) ; char t...
Fix bug spotted by Justin Hibbits.
#include "visibility.h" #include "objc/runtime.h" #include "gc_ops.h" #include "class.h" #include <stdlib.h> #include <stdio.h> static id allocate_class(Class cls, size_t extraBytes) { intptr_t *addr = calloc(cls->instance_size + extraBytes + sizeof(intptr_t), 1); return (id)(addr + 1); } static void free_object(id...
#include "visibility.h" #include "objc/runtime.h" #include "gc_ops.h" #include "class.h" #include <stdlib.h> #include <stdio.h> static id allocate_class(Class cls, size_t extraBytes) { intptr_t *addr = calloc(cls->instance_size + extraBytes + sizeof(intptr_t), 1); return (id)(addr + 1); } static void free_object(id...
Test for switch with return inside a case.
#include <stdio.h> void fred(int x) { switch (x) { case 1: printf("1\n"); return; case 2: printf("2\n"); break; case 3: printf("3\n"); return; } printf("out\n"); } int main() { fred(1); fred(2); fred(3); return 0; }
Define a minimal unit testing framework.
// Thanks to JeraTech for this minimalist TDD code, // which I've modified to resemble AngularJS's a bit more. // http://www.jera.com/techinfo/jtns/jtn002.html int tests_run = 0; #define _it_should(message, test) do { if (!(test)) return message; } while (0) #define _run_test(test) do { char *message = test(); tests_r...
Add macro for checking OAuth keys.
// // ENAPI_utils.h // libechonest // // Created by Art Gillespie on 3/15/11. art@tapsquare.com // #import "NSMutableDictionary+QueryString.h" #import "NSData+MD5.h" #import "ENAPI.h" #define CHECK_API_KEY if (nil == [ENAPI apiKey]) { @throw [NSException exceptionWithName:@"APIKeyNotSetException" reason:@"Set the ...
// // ENAPI_utils.h // libechonest // // Created by Art Gillespie on 3/15/11. art@tapsquare.com // #import "NSMutableDictionary+QueryString.h" #import "NSData+MD5.h" #import "ENAPI.h" #define CHECK_API_KEY if (nil == [ENAPI apiKey]) { @throw [NSException exceptionWithName:@"APIKeyNotSetException" reason:@"Set the ...
Correct the naming notations of enumeration
// // ViewController.h // AAChartKit // // Created by An An on 17/3/13. // Copyright © 2017年 An An. All rights reserved. // source code ----*** https://github.com/AAChartModel/AAChartKit ***--- source code // #import <UIKit/UIKit.h> typedef NS_ENUM(NSInteger,ENUM_secondeViewController_chartType){ ENUM_seconde...
// // ViewController.h // AAChartKit // // Created by An An on 17/3/13. // Copyright © 2017年 An An. All rights reserved. // source code ----*** https://github.com/AAChartModel/AAChartKit ***--- source code // #import <UIKit/UIKit.h> typedef NS_ENUM(NSInteger,SecondeViewControllerChartType){ SecondeViewControl...
Use our package taglib headers and not the hosts!
#ifndef TAGREADER_H #define TAGREADER_H #include <taglib/fileref.h> #include <taglib/tag.h> #include <taglib/mpegfile.h> #include <taglib/id3v2tag.h> #include <taglib/attachedpictureframe.h> #include <QString> #include <QImage> class TagReader { public: TagReader(const QString &file); ~TagReader(); bool...
#ifndef TAGREADER_H #define TAGREADER_H #include "taglib/fileref.h" #include "taglib/tag.h" #include "taglib/mpeg/mpegfile.h" #include "taglib/mpeg/id3v2/id3v2tag.h" #include "taglib/mpeg/id3v2/frames/attachedpictureframe.h" #include <QString> #include <QImage> class TagReader { public: TagReader(const QString &...
Fix struct if-expression test warning
// RUN: %check -e %s main() { struct A { int i; } a, b, c; a = b ? : c; // CHECK: error: struct involved in if-expr }
// RUN: %check -e %s main() { struct A { int i; } a, b, c; a = b ? : c; // CHECK: error: struct involved in ?: }
Fix segfault on empty : command.
#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_...
#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_...
Add a comment that currentTime returns result in milliseconds.
// A currentTime function for use in the tests. #ifdef _WIN32 extern "C" bool QueryPerformanceCounter(uint64_t *); extern "C" bool QueryPerformanceFrequency(uint64_t *); double currentTime() { uint64_t t, freq; QueryPerformanceCounter(&t); QueryPerformanceFrequency(&freq); return (t * 1000.0) / freq; }...
// A currentTime function for use in the tests. // Returns time in milliseconds. #ifdef _WIN32 extern "C" bool QueryPerformanceCounter(uint64_t *); extern "C" bool QueryPerformanceFrequency(uint64_t *); double currentTime() { uint64_t t, freq; QueryPerformanceCounter(&t); QueryPerformanceFrequency(&freq); ...
Change power expander to float
/* COR:a.bc PE:a.bc BAC:a.bc */ void lcd_voltage() { string top, bottom; sprintf(top, "COR:%1.2f PE:%1.2f", nImmediateBatteryLevel * 0.001, SensorValue(PowerExpanderBattery) / 280); sprintf(bottom, "BAC:%1.2f", BackupBatteryLevel * 0.001); displayLCDString(LCD_LINE_TOP, 0, top); display...
/* COR:a.bc PE:a.bc BAC:a.bc */ void lcd_voltage() { string top, bottom; sprintf(top, "COR:%1.2f PE:%1.2f", nImmediateBatteryLevel * 0.001, SensorValue(PowerExpanderBattery) / 280.0); sprintf(bottom, "BAC:%1.2f", BackupBatteryLevel * 0.001); displayLCDString(LCD_LINE_TOP, 0, top); displ...
CREATE start of di in C
#include <stdio.h> #include <string.h> #include <stdlib.h> struct URI { char * scheme; char * user; char * password; char * host; char * port; char * path; char * query; char * fragment; }; struct rule { char * name; char * rule; char * levels; char * priority; }; stru...
Add UIKit import to allow for compiling without precompiled header
// // IFTTTAnimator.h // JazzHands // // Created by Devin Foley on 9/28/13. // Copyright (c) 2013 IFTTT Inc. All rights reserved. // @protocol IFTTTAnimatable; @interface IFTTTAnimator : NSObject - (void)addAnimation:(id<IFTTTAnimatable>)animation; - (void)animate:(CGFloat)time; @end
// // IFTTTAnimator.h // JazzHands // // Created by Devin Foley on 9/28/13. // Copyright (c) 2013 IFTTT Inc. All rights reserved. // #import <UIKit/UIKit.h> @protocol IFTTTAnimatable; @interface IFTTTAnimator : NSObject - (void)addAnimation:(id<IFTTTAnimatable>)animation; - (void)animate:(CGFloat)time; @end
Revert "kStartFolder switch back to Sencha configuration"
/* * Constants.h * phonegap-mac * * Created by shazron on 10-04-08. * Copyright 2010 Nitobi Software Inc. All rights reserved. * */ #define kStartPage @"index.html" //Sencha Demos #define kStartFolder @"www/sencha" // PhoneGap Docs Only //#define kStartFolder @"www/phonegap-docs/template/phonegap/"
/* * Constants.h * phonegap-mac * * Created by shazron on 10-04-08. * Copyright 2010 Nitobi Software Inc. All rights reserved. * */ #define kStartPage @"index.html" //Sencha Demos //#define kStartFolder @"www/sencha" // PhoneGap Docs Only #define kStartFolder @"www/phonegap-docs/template/phonegap/"
Update comment to match the reality.
//===--- CommentBriefParser.h - Dumb comment parser -------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===-------------------------------------------------------...
//===--- CommentBriefParser.h - Dumb comment parser -------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===-------------------------------------------------------...
Move mbed TLS configuration symbol to macro section
/** * Copyright (C) 2006-2016, ARM Limited, All Rights Reserved * 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/l...
/** * Copyright (C) 2006-2016, ARM Limited, All Rights Reserved * 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/l...
Add Area capacity functions. Add addArea function
#ifndef AREA_H #define AREA_H #include "base.h" typedef struct area area; struct area{ char name[10]; int capacity; int areasAround; char ** adjec; // STRINGS SIZE ARE ALWAYS 10 }; void listAreas(area * a, int size); void addArea(area * a, int size); void deleteArea(area * a, int size); #endif
#ifndef AREA_H #define AREA_H #include "base.h" typedef struct area area; struct area{ char name[10]; int capacity; int areasAround; char ** adjec; // STRINGS SIZE ARE ALWAYS 10 }; void listAreas(area * a, int size); void addArea(area ** a, int *size); void deleteArea(area ** a, int *size); int checkAreaExis...
Add test for Duff device
/* name: TEST036 description: Duff's device output: */ /* Disgusting, no? But it compiles and runs just fine. I feel a combination of pride and revulsion at this discovery. If no one's thought of it before, I think I'll name it after myself. It amazes me that after 10 years of writing C there are still ...
Allow POLYGON_DEPTH to be configurable by compile commands.
#ifndef _POLYGON_H_ #define _POLYGON_H_ /* * geometric properties of the polygon meant for solving * * The default C pre-processor configuration here is to solve triangles. */ #define POLYGON_DEPTH 3 #if (POLYGON_DEPTH < 3) #error You cannot have a polygon with fewer than 3 sides! #endif #if (POLYGON_DE...
#ifndef _POLYGON_H_ #define _POLYGON_H_ /* * geometric properties of the polygon meant for solving * * The default C pre-processor configuration here is to solve triangles. */ #ifndef POLYGON_DEPTH #define POLYGON_DEPTH 3 #endif #if (POLYGON_DEPTH < 3) #error You cannot have a polygon with fewer than 3 ...
Remove double whitespace on header file
// // ASN1Decoder.h // ASN1Decoder // // Created by Filippo Maguolo on 8/29/17. // Copyright © 2017 Filippo Maguolo. All rights reserved. // #import <UIKit/UIKit.h> //! Project version number for ASN1Decoder. FOUNDATION_EXPORT double ASN1DecoderVersionNumber; //! Project version string for ASN1Decoder. FOUNDATIO...
// // ASN1Decoder.h // ASN1Decoder // // Created by Filippo Maguolo on 8/29/17. // Copyright © 2017 Filippo Maguolo. All rights reserved. // #import <UIKit/UIKit.h> //! Project version number for ASN1Decoder. FOUNDATION_EXPORT double ASN1DecoderVersionNumber; //! Project version string for ASN1Decoder. FOUNDATIO...
Add missing CR4 bit definition
/* * Copyright 2014, General Dynamics C4 Systems * * This software may be distributed and modified according to the terms of * the GNU General Public License version 2. Note that NO WARRANTY is provided. * See "LICENSE_GPLv2.txt" for details. * * @TAG(GD_GPL) */ #ifndef __ARCH_MACHINE_CPU_REGISTERS_H #define _...
/* * Copyright 2014, General Dynamics C4 Systems * * This software may be distributed and modified according to the terms of * the GNU General Public License version 2. Note that NO WARRANTY is provided. * See "LICENSE_GPLv2.txt" for details. * * @TAG(GD_GPL) */ #ifndef __ARCH_MACHINE_CPU_REGISTERS_H #define _...
Make types for enums, add types to properties
// // CWStatusBarNotification // CWNotificationDemo // // Created by Cezary Wojcik on 11/15/13. // Copyright (c) 2013 Cezary Wojcik. All rights reserved. // #import <Foundation/Foundation.h> @interface CWStatusBarNotification : NSObject enum { CWNotificationStyleStatusBarNotification, CWNotificationStyle...
// // CWStatusBarNotification // CWNotificationDemo // // Created by Cezary Wojcik on 11/15/13. // Copyright (c) 2013 Cezary Wojcik. All rights reserved. // #import <Foundation/Foundation.h> @interface CWStatusBarNotification : NSObject typedef NS_ENUM(NSInteger, CWNotificationStyle){ CWNotificationStyleStat...
Fix include wrapper symbol to something sane.
/* * Machine specific IO port address definition for generic. * Written by Osamu Tomita <tomita@cinet.co.jp> */ #ifndef _MACH_IO_PORTS_H #define _MACH_IO_PORTS_H /* i8253A PIT registers */ #define PIT_MODE 0x43 #define PIT_CH0 0x40 #define PIT_CH2 0x42 /* i8259A PIC registers */ #define PIC_MASTER_CMD 0x20...
/* * Machine specific IO port address definition for generic. * Written by Osamu Tomita <tomita@cinet.co.jp> */ #ifndef __ASM_I8253_H #define __ASM_I8253_H /* i8253A PIT registers */ #define PIT_MODE 0x43 #define PIT_CH0 0x40 #define PIT_CH2 0x42 /* i8259A PIC registers */ #define PIC_MASTER_CMD 0x20 #defi...
Add missing include for self-containment
/* * controldata_utils.h * Common code for pg_controldata output * * Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/common/controldata_utils.h */ #ifndef COMMON_CONTROLDATA_UTILS_H #define COMMON_CONTR...
/* * controldata_utils.h * Common code for pg_controldata output * * Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/common/controldata_utils.h */ #ifndef COMMON_CONTROLDATA_UTILS_H #define COMMON_CONTR...
Remove unused friend class declaration
/// @file /// @brief Defines SpeciesDialog class. #ifndef SPECIES_DIALOG_H #define SPECIES_DIALOG_H #include <memory> #include <QWidget> #include <QDialog> #include "fish_detector/common/species.h" namespace Ui { class SpeciesDialog; } namespace fish_detector { class SpeciesDialog : public QDialog { Q_OBJECT...
/// @file /// @brief Defines SpeciesDialog class. #ifndef SPECIES_DIALOG_H #define SPECIES_DIALOG_H #include <memory> #include <QWidget> #include <QDialog> #include "fish_detector/common/species.h" namespace Ui { class SpeciesDialog; } namespace fish_detector { class SpeciesDialog : public QDialog { Q_OBJECT...
Make enum available to swift
// // STTweetLabel.h // STTweetLabel // // Created by Sebastien Thiebaud on 09/29/13. // Copyright (c) 2013 Sebastien Thiebaud. All rights reserved. // typedef enum { STTweetHandle = 0, STTweetHashtag, STTweetLink } STTweetHotWord; @interface STTweetLabel : UILabel @property (nonatomic, strong) NSArr...
// // STTweetLabel.h // STTweetLabel // // Created by Sebastien Thiebaud on 09/29/13. // Copyright (c) 2013 Sebastien Thiebaud. All rights reserved. // typedef NS_ENUM(NSInteger, STTweetHotWord) { STTweetHandle = 0, STTweetHashtag, STTweetLink }; @interface STTweetLabel : UILabel @property (nonatomic...
Add new line at end of file to fix build
// // RMGallery.h // RMGallery // // Created by Hermés Piqué on 16/05/14. // Copyright (c) 2014 Robot Media. 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 //...
// // RMGallery.h // RMGallery // // Created by Hermés Piqué on 16/05/14. // Copyright (c) 2014 Robot Media. 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 //...
Add subclassing headers for the table and collection view adapter to the umbrella header
// // FTFountainiOS.h // FTFountain // // Created by Tobias Kräntzer on 18.07.15. // Copyright (c) 2015 Tobias Kräntzer. All rights reserved. // // Adapter #import "FTTableViewAdapter.h" #import "FTCollectionViewAdapter.h"
// // FTFountainiOS.h // FTFountain // // Created by Tobias Kräntzer on 18.07.15. // Copyright (c) 2015 Tobias Kräntzer. All rights reserved. // // Adapter #import "FTTableViewAdapter.h" #import "FTTableViewAdapter+Subclassing.h" #import "FTCollectionViewAdapter.h" #import "FTCollectionViewAdapter+Subclassing.h"
Fix trivial error: return void in main function.
#include <stdio.h> #include <linux/types.h> #include <unistd.h> #include <fcntl.h> int main (int argc, char * argv []) { __u64 rdtsc = 0; __u64 i = 0; int fileStat = open (argv [1], O_RDONLY, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP); while (read (fileStat, &rdtsc, sizeof (rdtsc) ) > 0) { p...
#include <stdio.h> #include <linux/types.h> #include <unistd.h> #include <fcntl.h> #include <stdlib.h> int main (int argc, char * argv []) { __u64 rdtsc = 0; __u64 i = 0; int fileStat = open (argv [1], O_RDONLY, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP); while (read (fileStat, &rdtsc, sizeof (rdtsc...
Add proper header for darwin build
#define _FILE_OFFSET_BITS 64 #include <fcntl.h> int native_fallocate(int fd, uint64_t len) { fstore_t fstore; fstore.fst_flags = F_ALLOCATECONTIG; fstore.fst_posmode = F_PEOFPOSMODE; fstore.fst_offset = 0; fstore.fst_length = len; fstore.fst_bytesalloc = 0; return fcntl(fd, F_PREALLOCATE, ...
#define _FILE_OFFSET_BITS 64 #include <fcntl.h> #include <stdint.h> int native_fallocate(int fd, uint64_t len) { fstore_t fstore; fstore.fst_flags = F_ALLOCATECONTIG; fstore.fst_posmode = F_PEOFPOSMODE; fstore.fst_offset = 0; fstore.fst_length = len; fstore.fst_bytesalloc = 0; return fcntl...
Add an XFAIL test which compiles differently from a .ast.
// RUN: clang -emit-llvm -S -o %t1.ll %s && // RUN: clang -emit-ast -o %t.ast %s && // RUN: clang -emit-llvm -S -o %t2.ll %t.ast && // RUN: diff %t1.ll %t2.ll // XFAIL: * int main() { return 0; }
Add code to build arbitrary length function signature from mpl.
//use a different header for this section as it needs //the boost pre-processor //next step is to convert the boost mpl types back to a worklet //signature. To get this to work with all functor we need to use //boost pre-processor #if !BOOST_PP_IS_ITERATING # ifndef __buildSignature_ # define __buildSignature_ # in...
Print usage message on getopt error
// Copyright 2016 Mitchell Kember. Subject to the MIT License. #include "translate.h" #include "transmit.h" #include "util.h" #include <stdio.h> #include <unistd.h> int main(int argc, char **argv) { setup_util(argv[0]); // Initialize the default mode. int mode = 'e'; // Get command line options. int c; exter...
// Copyright 2016 Mitchell Kember. Subject to the MIT License. #include "translate.h" #include "transmit.h" #include "util.h" #include <stdio.h> #include <unistd.h> int main(int argc, char **argv) { setup_util(argv[0]); // Initialize the default mode. int mode = 'e'; // Get command line options. int c; exter...
Add branching test for congruence domain
// PARAM: --sets solver td3 --enable ana.int.congruence --disable ana.int.def_exc int main(){ // A refinement of a congruence class should only take place for the == and != operator. int i; if (i==0){ assert(i==0); } else { assert(i!=0); //UNKNOWN! } int j; if (j != 0){ as...
Fix a build issue on Solaris
#ifndef LOCK_H #define LOCK_H enum lockstat { GET_LOCK_NOT_GOT=0, GET_LOCK_ERROR, GET_LOCK_GOT }; typedef struct lock lock_t; struct lock { int fd; enum lockstat status; char *path; lock_t *next; }; extern struct lock *lock_alloc(void); extern int lock_init(struct lock *lock, const char *path); extern struct...
#ifndef LOCK_H #define LOCK_H enum lockstat { GET_LOCK_NOT_GOT=0, GET_LOCK_ERROR, GET_LOCK_GOT }; struct lock { int fd; enum lockstat status; char *path; struct lock *next; }; extern struct lock *lock_alloc(void); extern int lock_init(struct lock *lock, const char *path); extern struct lock *lock_alloc_and_in...
Make Cmake work with debug build
/* * Copyright 2015 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #ifndef SkSpinlock_DEFINED #define SkSpinlock_DEFINED #include <atomic> class SkSpinlock { public: void acquire() { // To act as a mutex, we need an acquire barr...
/* * Copyright 2015 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #ifndef SkSpinlock_DEFINED #define SkSpinlock_DEFINED #include "SkTypes.h" #include <atomic> class SkSpinlock { public: void acquire() { // To act as a mutex, we...
Fix weird includes in compat package
/* * 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 ...
Add missing TClass creation for vector<Long64_t> and vector<ULong64_t>
#include <string> #include <vector> #ifndef __hpux using namespace std; #endif #pragma create TClass vector<bool>; #pragma create TClass vector<char>; #pragma create TClass vector<short>; #pragma create TClass vector<long>; #pragma create TClass vector<unsigned char>; #pragma create TClass vector<unsigned short>; #pra...
#include <string> #include <vector> #ifndef __hpux using namespace std; #endif #pragma create TClass vector<bool>; #pragma create TClass vector<char>; #pragma create TClass vector<short>; #pragma create TClass vector<long>; #pragma create TClass vector<unsigned char>; #pragma create TClass vector<unsigned short>; #pra...
Disable __attribute__((weak)) on Mac OS X and other lame platforms.
//===-- memory.c - String functions for the LLVM libc Library ----*- C -*-===// // // A lot of this code is ripped gratuitously from glibc and libiberty. // //===----------------------------------------------------------------------===// #include <stdlib.h> void *malloc(size_t) __attribute__((weak)); void free(void ...
//===-- memory.c - String functions for the LLVM libc Library ----*- C -*-===// // // A lot of this code is ripped gratuitously from glibc and libiberty. // //===---------------------------------------------------------------------===// #include <stdlib.h> // If we're not being compiled with GCC, turn off attributes...
Add edge profiling support to the runtime library
/*===-- EdgeProfiling.c - Support library for edge profiling --------------===*\ |* |* The LLVM Compiler Infrastructure |* |* This file was developed by the LLVM research group and is distributed under |* the University of Illinois Open Source License. See LICENSE.TXT for details. |* |*===---------...
Add octApron test where thread function has tracked arg
// SKIP PARAM: --sets ana.activated[+] octApron #include <pthread.h> #include <assert.h> void *t_fun(int arg) { assert(arg == 3); // TODO (cast through void*) return NULL; } int main(void) { int x = 3; pthread_t id; pthread_create(&id, NULL, t_fun, x); return 0; }
Comment out services by default
// // TrackingControllerDefs.h // // Created by Matt Martel on 02/20/09 // Copyright Mundue LLC 2008-2011. All rights reserved. // // Create an account at http://www.flurry.com // Code and integration instructions at // http://dev.flurry.com/createProjectSelectPlatform.do #define USES_FLURRY #define kFlurryAPIKey @...
// // TrackingControllerDefs.h // // Created by Matt Martel on 02/20/09 // Copyright Mundue LLC 2008-2011. All rights reserved. // // Create an account at http://www.flurry.com // Code and integration instructions at // http://dev.flurry.com/createProjectSelectPlatform.do // Uncomment the following two lines to use...
Add driver header for PCA9555 I/O port controller
/* Copyright 2017 The Chromium OS Authors. All rights reserved. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. * * NXP PCA9555 I/O Port expander driver header */ #ifndef __CROS_EC_IOEXPANDER_PCA9555_H #define __CROS_EC_IOEXPANDER_PCA9555_H #include "i2c.h" ...
Solve Event Time in c
#include <stdio.h> int main() { int d, dd, h, hh, m, mm, s, ss; scanf("Dia %d", &d); scanf("%d : %d : %d\n", &h, &m, &s); scanf("Dia %d", &dd); scanf("%d : %d : %d", &hh, &mm, &ss); s = ss - s; m = mm - m; h = hh - h; d = dd - d; if (s < 0) { s += 60; m--; ...
Remove unused argument space from master req
#ifndef __TRAIN_MASTER_H__ #define __TRAIN_MASTER_H__ void __attribute__ ((noreturn)) train_master(); typedef enum { MASTER_CHANGE_SPEED, MASTER_REVERSE, // step 1 MASTER_REVERSE2, // step 2 (used by delay courier) MASTER_REVERSE3, // step 3 (used by delay courier) MASTER_WHERE_ARE_YOU, MAST...
#ifndef __TRAIN_MASTER_H__ #define __TRAIN_MASTER_H__ void __attribute__ ((noreturn)) train_master(); typedef enum { MASTER_CHANGE_SPEED, MASTER_REVERSE, // step 1 MASTER_REVERSE2, // step 2 (used by delay courier) MASTER_REVERSE3, // step 3 (used by delay courier) MASTER_WHERE_ARE_YOU, MAST...
Add NSData+Base64Encoding.h to main header
// // BotKit.h // BotKit // // Created by Mark Adams on 9/28/12. // Copyright (c) 2012 thoughtbot. All rights reserved. // #import "BKCoreDataManager.h" #import "BKManagedViewController.h" #import "BKManagedTableViewController.h" #import "NSObject+BKCoding.h" #import "NSArray+ObjectAccess.h" #import "NSDate+Relati...
// // BotKit.h // BotKit // // Created by Mark Adams on 9/28/12. // Copyright (c) 2012 thoughtbot. All rights reserved. // #import "BKCoreDataManager.h" #import "BKManagedViewController.h" #import "BKManagedTableViewController.h" #import "NSObject+BKCoding.h" #import "NSArray+ObjectAccess.h" #import "NSDate+Relati...
Use putchar instead of printf.
#include "log.h" #include "timeutil.h" #include <stdarg.h> #include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <string.h> static bool flushAfterLog = false; void proxyLogSetFlush(bool enabled) { flushAfterLog = enabled; } void proxyLog(const char* format, ...) { va_list args; va_start(args, f...
#include "log.h" #include "timeutil.h" #include <stdarg.h> #include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <string.h> static bool flushAfterLog = false; void proxyLogSetFlush(bool enabled) { flushAfterLog = enabled; } void proxyLog(const char* format, ...) { va_list args; va_start(args, f...
Update and simplify embedding demo
#include <stdio.h> #include <mpi.h> #include <Python.h> const char helloworld[] = \ "from mpi4py import MPI \n" "hwmess = 'Hello, World! I am process %d of %d on %s.' \n" "myrank = MPI.COMM_WORLD.Get_rank() \n" "nprocs = MPI.COMM_WORLD.Get_size() \n" "procnm = MPI.Get_processor_name() \n" "pri...
/* * You can use safely use mpi4py between multiple * Py_Initialize()/Py_Finalize() calls ... * but do not blame me for the memory leaks ;-) * */ #include <mpi.h> #include <Python.h> const char helloworld[] = \ "from mpi4py import MPI \n" "hwmess = 'Hello, World! I am process %d of %d on %s.' \n" ...
Add missing brackets needed for Clang
#pragma once namespace mmh { template <typename Size, typename Object> constexpr Size sizeof_t() { return gsl::narrow<Size>(sizeof Object); } template <typename Size, typename Value> constexpr Size sizeof_t(const Value& value) { return gsl::narrow<Size>(sizeof value); } } // namespace mmh
#pragma once namespace mmh { template <typename Size, typename Object> constexpr Size sizeof_t() { return gsl::narrow<Size>(sizeof(Object)); } template <typename Size, typename Value> constexpr Size sizeof_t(const Value& value) { return gsl::narrow<Size>(sizeof value); } } // namespace mmh
Change so that window_set_fullscreen() is called only on the Aplite platform
#include <pebble.h> #include "pebcessing/pebcessing.h" static Window *window = NULL; static void init(void) { window = window_create(); window_set_fullscreen(window, true); window_stack_push(window, true); } static void deinit(void) { window_destroy(window); } int main(void) { init(); init_pebcessi...
#include <pebble.h> #include "pebcessing/pebcessing.h" static Window *window = NULL; static void init(void) { window = window_create(); // Make the window fullscreen. // All Windows are fullscreen-only on the Basalt platform. #ifdef PBL_PLATFORM_APLITE window_set_fullscreen(window, true); #endif window_stac...
Add skb queue length getter
#ifndef SKBUFF_H_ #define SKBUFF_H_ #include "netdev.h" #include "dst.h" #include "list.h" #include <pthread.h> struct sk_buff { struct list_head list; struct dst_entry *dst; struct netdev *netdev; uint16_t protocol; uint32_t len; uint8_t *tail; uint8_t *end; uint8_t *head; uint8_t...
#ifndef SKBUFF_H_ #define SKBUFF_H_ #include "netdev.h" #include "dst.h" #include "list.h" #include <pthread.h> struct sk_buff { struct list_head list; struct dst_entry *dst; struct netdev *netdev; uint16_t protocol; uint32_t len; uint8_t *tail; uint8_t *end; uint8_t *head; uint8_t...
Add main C file with standard includes
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <sys/socket.h> int main(int argc, char* argv[]){ }
Save errno when freeing a cdb
/* ISC license. */ #include <sys/mman.h> #include <skalibs/cdb.h> extern void cdb_free (struct cdb *c) { if (c->map) munmap(c->map, c->size) ; *c = cdb_zero ; }
/* ISC license. */ #include <sys/mman.h> #include <errno.h> #include <skalibs/cdb.h> extern void cdb_free (struct cdb *c) { if (c->map) { int e = errno ; munmap(c->map, c->size) ; errno = e ; } *c = cdb_zero ; }
Add TTYS_DEF macro to oldfs
/** * @file * * @date 21.04.2016 * @author Anton Bondarev */ #ifndef TTYS_H_ #define TTYS_H_ #include <fs/idesc.h> #include <drivers/tty.h> struct uart; struct tty_uart { struct idesc idesc; struct tty tty; struct uart *uart; }; #endif /* TTYS_H_ */
/** * @file * * @date 21.04.2016 * @author Anton Bondarev */ #ifndef TTYS_H_ #define TTYS_H_ #include <fs/idesc.h> #include <drivers/tty.h> #include <drivers/char_dev.h> struct uart; struct tty_uart { struct idesc idesc; struct tty tty; struct uart *uart; }; extern struct idesc *uart_cdev_open(struct dev_mo...
Add macros for sized of "size_t" and "u_short".
#define STAT_SIZE sizeof(struct stat) #define STATFS_SIZE sizeof(struct statfs) #define GID_T_SIZE sizeof(gid_t) #define INT_SIZE sizeof(int) #define LONG_SIZE sizeof(long) #define FD_SET_SIZE sizeof(fd_set) #define TIMEVAL_SIZE sizeof(struct timeval) #define TIMEVAL_ARRAY_SIZE (sizeof(struct timeval) * 2) #define TIME...
#define STAT_SIZE sizeof(struct stat) #define STATFS_SIZE sizeof(struct statfs) #define GID_T_SIZE sizeof(gid_t) #define INT_SIZE sizeof(int) #define LONG_SIZE sizeof(long) #define FD_SET_SIZE sizeof(fd_set) #define TIMEVAL_SIZE sizeof(struct timeval) #define TIMEVAL_ARRAY_SIZE (sizeof(struct timeval) * 2) #define TIME...
Add BSD 3-clause open source header
/* * tuple.h - define data structure for tuples */ #ifndef _TUPLE_H_ #define _TUPLE_H_ #define MAX_TUPLE_SIZE 4096 union Tuple { unsigned char bytes[MAX_TUPLE_SIZE]; char *ptrs[MAX_TUPLE_SIZE/sizeof(char *)]; }; #endif /* _TUPLE_H_ */
/* * Copyright (c) 2013, Court of the University of Glasgow * All rights reserved. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * - Redistributions of source code must retain the above copyright notice, * thi...
Solve Average 3 in c
#include <stdio.h> int main() { float a, b, c, d, e, m; scanf("%f %f %f %f", &a, &b, &c, &d); m = (a * 2 + b * 3 + c * 4 + d) / 10; printf("Media: %.1f\n", m); if (m >= 7.0) { printf("Aluno aprovado.\n"); } else if (m >= 5.0) { printf("Aluno em exame.\n"); scanf("%f...
Remove call to textdomain ()
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- * * Copyright (C) 2010 Red Hat, Inc. * Copyright (C) 2010 Collabora Ltd. * * 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 F...
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- * * Copyright (C) 2010 Red Hat, Inc. * Copyright (C) 2010 Collabora Ltd. * * 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 F...