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 struct dlist_head *n = head->next; uintptr_t poison = head->poison; assertf(((!poison || (void *) ~poison == head) && n->prev == head && p->next == head), "\n" "head: %p, poison: %p, ~poison: %p,\n" "n: %p, n->prev: %p,\n" "p: %p, p->next: %p\n", head, (void *)poison, (void *) ~poison, n, n->prev, p, p->next); } #endif
/** * @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->prev; const struct dlist_head *n = head->next; uintptr_t poison = head->poison; assertf(((!poison || (void *) ~poison == head) && n->prev == head && p->next == head), "\n" "head: %p, poison: %p, ~poison: %p,\n" "n: %p, n->prev: %p,\n" "p: %p, p->next: %p\n", head, (void *)poison, (void *) ~poison, n, n->prev, p, p->next); #endif } #endif
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]; return mx; } int main() { int n; scanf("%d", &n); int a[N]; int i; for(i = 0; i < n; ++i) scanf("%d", &a[i]); printf("%d\n", lis(a, n)); }
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) \ EMIT_PKG_ERROR("sqlite: %s", sqlite3_errmsg(db)) int sbuf_set(struct sbuf **, const char *); const char * sbuf_get(struct sbuf *); void sbuf_reset(struct sbuf *); void sbuf_free(struct sbuf *); int mkdirs(const char *path); int file_to_buffer(const char *, char **, off_t *); int format_exec_cmd(char **, const char *, const char *, const char *); int split_chr(char *, char); int file_fetch(const char *, const char *); int is_dir(const char *); int is_conf_file(const char *path, char newpath[MAXPATHLEN]); int sha256_file(const char *, char[65]); void sha256_str(const char *, char[65]); #endif
#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 *); const char * sbuf_get(struct sbuf *); void sbuf_reset(struct sbuf *); void sbuf_free(struct sbuf *); int mkdirs(const char *path); int file_to_buffer(const char *, char **, off_t *); int format_exec_cmd(char **, const char *, const char *, const char *); int split_chr(char *, char); int file_fetch(const char *, const char *); int is_dir(const char *); int is_conf_file(const char *path, char newpath[MAXPATHLEN]); int sha256_file(const char *, char[65]); void sha256_str(const char *, char[65]); #endif
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. // //===----------------------------------------------------------------------===// // // The GenericValue class is used to represent an LLVM value of arbitrary type. // //===----------------------------------------------------------------------===// #ifndef GENERIC_VALUE_H #define GENERIC_VALUE_H #include "Support/DataTypes.h" namespace llvm { typedef uint64_t PointerTy; union GenericValue { bool BoolVal; unsigned char UByteVal; signed char SByteVal; unsigned short UShortVal; signed short ShortVal; unsigned int UIntVal; signed int IntVal; uint64_t ULongVal; int64_t LongVal; double DoubleVal; float FloatVal; PointerTy PointerVal; unsigned char Untyped[8]; GenericValue() {} GenericValue(void *V) { PointerVal = (PointerTy)(intptr_t)V; } }; inline GenericValue PTOGV(void *P) { return GenericValue(P); } inline void* GVTOP(const GenericValue &GV) { return (void*)(intptr_t)GV.PointerVal; } } // End llvm namespace #endif
//===-- 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. // //===----------------------------------------------------------------------===// // // The GenericValue class is used to represent an LLVM value of arbitrary type. // //===----------------------------------------------------------------------===// #ifndef GENERIC_VALUE_H #define GENERIC_VALUE_H #include "Support/DataTypes.h" namespace llvm { typedef uintptr_t PointerTy; union GenericValue { bool BoolVal; unsigned char UByteVal; signed char SByteVal; unsigned short UShortVal; signed short ShortVal; unsigned int UIntVal; signed int IntVal; uint64_t ULongVal; int64_t LongVal; double DoubleVal; float FloatVal; PointerTy PointerVal; unsigned char Untyped[8]; GenericValue() {} GenericValue(void *V) { PointerVal = (PointerTy)(intptr_t)V; } }; inline GenericValue PTOGV(void *P) { return GenericValue(P); } inline void* GVTOP(const GenericValue &GV) { return (void*)(intptr_t)GV.PointerVal; } } // End llvm namespace #endif
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 - The `git_time` to base the returned date on. // timeZone - The timezone used by the time passed in. // // Returns an `NSDate` object representing the passed in `time`. + (NSDate *)gt_dateFromGitTime:(git_time)time timeZone:(NSTimeZone **)timeZone; // Converts the date to a `git_time`. // // timeZone - An `NSTimeZone` to describe the time offset. This is optional, if // `nil` the default time zone will be used. - (git_time)gt_gitTimeUsingTimeZone:(NSTimeZone *)timeZone; @end @interface NSTimeZone (GTTimeAdditions) // The difference, in minutes, between the current default timezone and GMT. @property (nonatomic, readonly) int gt_gitTimeOffset; @end
// // 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 - The `git_time` to base the returned date on. // timeZone - The timezone used by the time passed in. Optional. // // Returns an `NSDate` object representing the passed in `time`. + (NSDate *)gt_dateFromGitTime:(git_time)time timeZone:(NSTimeZone **)timeZone; // Converts the date to a `git_time`. // // timeZone - An `NSTimeZone` to describe the time offset. This is optional, if // `nil` the default time zone will be used. - (git_time)gt_gitTimeUsingTimeZone:(NSTimeZone *)timeZone; @end @interface NSTimeZone (GTTimeAdditions) // The difference, in minutes, between the current default timezone and GMT. @property (nonatomic, readonly) int gt_gitTimeOffset; @end
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, COLOR_BLACK, COLOR_BLACK); init_pair(color_yellow, COLOR_YELLOW, COLOR_BLACK); init_pair(color_blue, COLOR_BLUE, COLOR_BLACK); init_pair(color_red, COLOR_RED, COLOR_BLACK); init_pair(color_green, COLOR_GREEN, COLOR_BLACK); init_pair(color_cyan, COLOR_CYAN, COLOR_BLACK); init_pair(color_magenta, COLOR_MAGENTA, COLOR_BLACK); if (LINES < 24 || COLS < 80) { shutdown(); printf("Terminal too small."); exit(1); } do { erase(); new_game(); } while (play()); shutdown(); return 0; } static void shutdown(void) { endwin(); return; }
#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_set(0); keypad(stdscr, TRUE); start_color(); init_pair(color_black, COLOR_BLACK, COLOR_BLACK); init_pair(color_yellow, COLOR_YELLOW, COLOR_BLACK); init_pair(color_blue, COLOR_BLUE, COLOR_BLACK); init_pair(color_red, COLOR_RED, COLOR_BLACK); init_pair(color_green, COLOR_GREEN, COLOR_BLACK); init_pair(color_cyan, COLOR_CYAN, COLOR_BLACK); init_pair(color_magenta, COLOR_MAGENTA, COLOR_BLACK); if (LINES < 24 || COLS < 80) { shutdown(); printf("Terminal too small."); exit(1); } do { erase(); new_game(); } while (play()); shutdown(); return 0; } static void shutdown(void) { endwin(); return; }
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). */ /* Defines a length-prefixed string. * The string contents start at the byte after the struct itself. */ typedef struct string { unsigned len; }* string; typedef unsigned char byte; /* Returns a pointer to the beginning of character data of the given string. */ static inline byte* string_data(string s) { byte* c = (byte*)s; return c + sizeof(struct string); } /* Converts a C string to a TGL string. * The string must be free()d by the caller. */ static string covert_string(char* str) { unsigned int len = strlen(str); string result = malloc(sizeof(struct string) + len); result->len = len; memcpy(string_data(result), str, len); return result; } /* Duplicates the given TGL string. * The string must be free()d by the caller. */ static string dupe_string(string str) { string result = malloc(sizeof(struct string) + str->len); memcpy(result, str, sizeof(struct string) + str->len); return result; } /* END: String handling */ int main(int argc, char** argv) { printf("hello world\n"); return 0; }
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/suggestions) */ @interface BBASearchSuggestionsResult : NSObject @property (nonatomic, copy) NSString *type; @property (nonatomic, copy) NSArray *items; /** * Describes the mapping of server search result data to `BBASearchSuggestionsResult` */ + (FEMObjectMapping *) searchSuggestionsResultMapping; @end
// // 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/suggestions) */ @interface BBASearchSuggestionsResult : NSObject @property (nonatomic, copy) NSString *type; /** * Contains `BBASearchServiceSuggestion` objects */ @property (nonatomic, copy) NSArray *items; /** * Describes the mapping of server search result data to `BBASearchSuggestionsResult` */ + (FEMObjectMapping *) searchSuggestionsResultMapping; @end
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 = NULL; avail = pool; exit(0); }
#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; p->link = p; return p; } int addterm(Poly *p, int32_t coef, unsigned char a, unsigned char b, unsigned char c) { Poly *q, *r; int32_t abc; abc = (a << 16) + (b << 8) + c; for(r = p->link; abc < r->abc; r = p->link) p = r; if(abc == r->abc) { r->coef += coef; return 0; } if(avail == NULL) return -1; q = avail; avail = avail->link; q->coef = coef; q->abc = abc; q->link = r; p->link = q; return 0; } 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 = NULL; avail = pool; exit(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 NSString *ASFQueryFromParameters(NSDictionary *parameters); extern NSString *ASFURLEncodedString(NSString *string); extern NSString *ASFURLDecodedString(NSString *string); extern NSDictionary *ASFParametersFromQuery(NSString *query); @interface ASFRequestBuilder : NSObject + (NSMutableURLRequest *)requestWithMethod:(NSString *)method URLString:(NSString *)URLString parameters:(NSDictionary *)parameters token:(NSString *)token error:(NSError *__autoreleasing *)error; + (NSMutableURLRequest *)requestWithURL:(NSURL *)URL method:(NSString *)method parameters:(NSDictionary *)parameters error:(NSError *__autoreleasing *)error; @end
// // 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 NSString *ASFQueryFromParameters(NSDictionary *parameters); extern NSString *ASFURLEncodedString(NSString *string); extern NSString *ASFURLDecodedString(NSString *string); extern NSDictionary *ASFParametersFromQuery(NSString *query); @interface ASFRequestBuilder : NSObject + (NSMutableURLRequest *)requestWithMethod:(NSString *)method URLString:(NSString *)URLString parameters:(NSDictionary *)parameters token:(NSString *)token error:(NSError *__autoreleasing *)error; @end
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 without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // #define kOCErrorServerUnauthorized 401 #define kOCErrorServerForbidden 403 #define kOCErrorServerPathNotFound 404 #define kOCErrorProxyAuth 407 #define kOCErrorServerTimeout 408
// // 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 without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // #define kOCErrorServerUnauthorized 401 #define kOCErrorServerForbidden 403 #define kOCErrorServerPathNotFound 404 #define kOCErrorServerMethodNotPermitted 405c #define kOCErrorProxyAuth 407 #define kOCErrorServerTimeout 408
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 BitcoinAddressValidator(QObject *parent = 0); State validate(QString &input, int &pos) const; static const int MaxAddressLength = 35; }; #endif // BITCOINADDRESSVALIDATOR_H
#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 BitcoinAddressValidator(QObject *parent = 0); State validate(QString &input, int &pos) const; static const int MaxAddressLength = 35; }; #endif // BITCOINADDRESSVALIDATOR_H
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 <typename T> std::unique_ptr<T> makeTensor(const vespalib::eval::TensorSpec &spec) { auto value = DefaultTensorEngine::ref().from_spec(spec); const T *tensor = dynamic_cast<const T *>(value->as_tensor()); ASSERT_TRUE(tensor); value.release(); return std::unique_ptr<T>(const_cast<T *>(tensor)); } }
// 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 <typename T> std::unique_ptr<const T> makeTensor(const vespalib::eval::TensorSpec &spec) { auto value = DefaultTensorEngine::ref().from_spec(spec); const T *tensor = dynamic_cast<const T *>(value->as_tensor()); ASSERT_TRUE(tensor); value.release(); return std::unique_ptr<const T>(tensor); } }
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 distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notice for more information. =========================================================================*/ /* * Copyright 2003 Sandia Corporation. * Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive * license for use of this work by or on behalf of the * U.S. Government. Redistribution and use in source and binary forms, with * or without modification, are permitted provided that this Notice and any * statement of authorship are reproduced on all copies. */ #include <vtkstd/string> class Tokenizer { public: Tokenizer(const char *s, const char *delim = " \t\n"); Tokenizer(const vtkstd::string &s, const char *delim = " \t\n"); vtkstd::string GetNextToken(); vtkstd::string GetRemainingString() const; bool HasMoreTokens() const; void Reset(); private: vtkstd::string FullString; vtkstd::string Delim; vtkstd::string::size_type Position; };
/*========================================================================= 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 distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notice for more information. =========================================================================*/ /* * Copyright 2003 Sandia Corporation. * Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive * license for use of this work by or on behalf of the * U.S. Government. Redistribution and use in source and binary forms, with * or without modification, are permitted provided that this Notice and any * statement of authorship are reproduced on all copies. */ #include <vtkstd/string> class Tokenizer { public: Tokenizer(const char *s, const char *delim = " \t\n\r"); Tokenizer(const vtkstd::string &s, const char *delim = " \t\n\r"); vtkstd::string GetNextToken(); vtkstd::string GetRemainingString() const; bool HasMoreTokens() const; void Reset(); private: vtkstd::string FullString; vtkstd::string Delim; vtkstd::string::size_type Position; };
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:(OEXRegistrationFormField *)field withText:(NSString *)currentValue; @end
// // 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 no error +(NSString *)validateField:(OEXRegistrationFormField *)field withText:(NSString *)currentValue; @end
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) : renderWindow(window) {} std::shared_ptr<sf::RenderWindow> renderWindow; }; public: FUState(FUContext context); virtual ~FUState(); virtual void handleEvent(sf::Event &event); virtual void update(sf::Time dt); virtual void draw(); virtual void pause(); virtual void resume(); protected: bool mIsPaused; }; #endif // FUSTATE_H
#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) {} std::shared_ptr<sf::RenderWindow> renderWindow; }; public: FUState(FUContext context); virtual ~FUState(); virtual void handleEvent(sf::Event &event); virtual void update(sf::Time dt); virtual void draw(); virtual void pause(); virtual void resume(); protected: bool mIsPaused; }; #endif // FUSTATE_H
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, LPCWSTR title = L""); ~SettingsTab(); /// <summary>Processes messages sent to the tab page.</summary> virtual INT_PTR CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); /// <summary>Persists changes made on the tab page</summary> virtual void SaveSettings() = 0; protected: /// <summary> /// Performs intitialization for the tab page, similar to a constructor. /// Since tab page windows are created on demand, this method could be /// called much later than the constructor for the tab. /// </summary> virtual void Initialize() = 0; /// <summary>Applies the current settings state to the tab page.</summary> virtual void LoadSettings() = 0; };
#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, LPCWSTR tabTemplate, LPCWSTR title = L""); ~SettingsTab(); /// <summary>Processes messages sent to the tab page.</summary> virtual INT_PTR CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); /// <summary>Persists changes made on the tab page</summary> virtual void SaveSettings() = 0; protected: /// <summary> /// Performs intitialization for the tab page, similar to a constructor. /// Since tab page windows are created on demand, this method could be /// called much later than the constructor for the tab. /// </summary> virtual void Initialize() = 0; /// <summary>Applies the current settings state to the tab page.</summary> virtual void LoadSettings() = 0; };
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; #endif
#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 xmemreport (void); #endif /* MEM_H__ */ /* Local Variables: mode: C tab-width: 2 indent-tabs-mode: nil End: vim: sw=2:sts=2:expandtab */
#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_t xmembytes(); size_t xmemnew(); size_t xmemfreed(); void xmemreport (void); #endif /* MEM_H__ */ /* Local Variables: mode: C tab-width: 2 indent-tabs-mode: nil End: vim: sw=2:sts=2:expandtab */
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) = default; Body& operator=(Body&& rhs) = default; explicit Body(const char* raw_string) : std::string(raw_string) {} explicit Body(const char* raw_string, size_t length) : std::string(raw_string, length) {} explicit Body(size_t to_fill, char character) : std::string(to_fill, character) {} explicit Body(const std::string& std_string) : std::string(std_string) {} explicit Body(const std::string& std_string, size_t position, size_t length = std::string::npos) : std::string(std_string, position, length) {} explicit Body(std::initializer_list<char> il) : std::string(il) {} template <class InputIterator> explicit Body(InputIterator first, InputIterator last) : std::string(first, last) {} }; } // namespace cpr #endif
#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) = default; Body& operator=(Body&& rhs) = default; explicit Body(const char* raw_string) : std::string(raw_string) {} explicit Body(const char* raw_string, size_t length) : std::string(raw_string, length) {} explicit Body(size_t to_fill, char character) : std::string(to_fill, character) {} explicit Body(const std::string& std_string) : std::string(std_string) {} explicit Body(const std::string& std_string, size_t position, size_t length = std::string::npos) : std::string(std_string, position, length) {} explicit Body(std::string&& std_string) : std::string(std::move(std_string)) {} explicit Body(std::initializer_list<char> il) : std::string(il) {} template <class InputIterator> explicit Body(InputIterator first, InputIterator last) : std::string(first, last) {} }; } // namespace cpr #endif
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 main() { static char stack[SIGSTKSZ]; stack_t ss = { .ss_size = SIGSTKSZ, .ss_sp = stack, }; struct sigaction sa = { .sa_handler = handler, .sa_flags = SA_ONSTACK }; sigaltstack(&ss, 0); sigfillset(&sa.sa_mask); sigaction(SIGSEGV, &sa, 0); if (setjmp(try) < 3) { recurse(0); } else { printf("caught exception!\n"); } return 0; }
#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 main() { char* stack; stack = malloc(sizeof(stack) * SIGSTKSZ); stack_t ss = { .ss_size = SIGSTKSZ, .ss_sp = stack, }; struct sigaction sa = { .sa_handler = handler, .sa_flags = SA_ONSTACK }; sigaltstack(&ss, 0); sigfillset(&sa.sa_mask); sigaction(SIGSEGV, &sa, 0); if (setjmp(try) < 3) { recurse(0); } else { printf("caught exception!\n"); } return 0; }
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 is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef DELWINK_PATTS_ADMIN_H #define DELWINK_PATTS_ADMIN_H #include <cquel.h> #ifdef __cplusplus extern "C" { #endif int patts_create_user(const struct dlist *info, const char *host, const char *passwd); int patts_create_task(const struct dlist *info); int patts_enable_user(const char *id); int patts_enable_task(const char *id); int patts_disable_user(const char *id); int patts_disable_task(const char *id); int patts_grant_admin(const char *id); int patts_revoke_admin(const char *id); #ifdef __cplusplus } #endif #endif
/* * 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 is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef DELWINK_PATTS_ADMIN_H #define DELWINK_PATTS_ADMIN_H #include <cquel.h> #ifdef __cplusplus extern "C" { #endif int patts_create_user(const struct dlist *info, const char *host, const char *passwd); int patts_create_task(const struct dlist *info); int patts_delete_user(const char *id); int patts_delete_task(const char *id); int patts_grant_admin(const char *id); int patts_revoke_admin(const char *id); #ifdef __cplusplus } #endif #endif
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 *** "; for ( size_t i=0; i<40; i++ ) { ret.push_back( charTable[ ( data[i] >> 4 ) & 0xF ] ); ret.push_back( charTable[ ( data[i] >> 0 ) & 0xF ] ); } ret.append("..."); for ( size_t i=data.size()-40; i<data.size(); i++ ) { ret.push_back( charTable[ ( data[i] >> 4 ) & 0xF ] ); ret.push_back( charTable[ ( data[i] >> 0 ) & 0xF ] ); } } else { for ( const auto& val: data ) { ret.push_back( charTable[ ( val >> 4 ) & 0xF ] ); ret.push_back( charTable[ ( val >> 0 ) & 0xF ] ); } } return ret; } #endif // UTILS_H
#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 *** "; for ( size_t i=0; i<40; i++ ) { ret.push_back( charTable[ ( data[i] >> 4 ) & 0xF ] ); ret.push_back( charTable[ ( data[i] >> 0 ) & 0xF ] ); } ret.append("..."); for ( size_t i=data.size()-40; i<data.size(); i++ ) { ret.push_back( charTable[ ( data[i] >> 4 ) & 0xF ] ); ret.push_back( charTable[ ( data[i] >> 0 ) & 0xF ] ); } } else { for ( const auto& val: data ) { ret.push_back( charTable[ ( val >> 4 ) & 0xF ] ); ret.push_back( charTable[ ( val >> 0 ) & 0xF ] ); } } return ret; } #endif // UTILS_H
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"; break; case ControlModes::RPY_DEPTH: s = "RPY Depth"; break; case ControlModes::DEPTH_HOLD: s = "Depth Hold"; break; default: s = "Invalid Control Mode"; break; } return s; } #endif
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)); while (fgets(s, 1000, stdin)) { word_pt w; int i, sl=strlen(s); for (sl--; sl>=0 && s[sl]=='\n'; sl--) { s[sl]='\0'; } w=hash_get(l->words, s); if (!w) { printf("No such word \"%s\".\n", s); continue; } printf("%s[%d,%s]:", s, w->defaulttag, tagname(l, w->defaulttag)); for (i=0; w->sorter[i]>0; i++) { printf("\t%s %d", (char *)array_get(l->tags, w->sorter[i]), w->tagcount[w->sorter[i]]); } printf("\n"); } /* Free the memory held by util.c. */ util_teardown(); }
#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)); while (fgets(s, 1000, stdin)) { word_pt w; int i, sl=strlen(s); for (sl--; sl>=0 && s[sl]=='\n'; sl--) { s[sl]='\0'; } w=hash_get(l->words, s); if (!w) { printf("No such word \"%s\".\n", s); continue; } printf("%s[%d,%s]:", s, w->defaulttag, tagname(l, w->defaulttag)); for (i=0; w->sorter[i]>0; i++) { printf("\t%s %d", (char *)array_get(l->tags, w->sorter[i]), w->tagcount[w->sorter[i]]); } printf("\n"); } /* Free the memory held by util.c. */ util_teardown(); return 0; }
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 * queue); bool packet_queue_is_empty(packet_queue_t * queue); bool packet_queue_is_full(packet_queue_t * queue); uint32_t packet_queue_add(packet_queue_t * queue, radio_packet_t * packet); uint32_t packet_queue_get(packet_queue_t * queue, radio_packet_t ** packet); #endif
#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 packet_queue_is_empty(packet_queue_t * queue); bool packet_queue_is_full(packet_queue_t * queue); uint32_t packet_queue_add(packet_queue_t * queue, radio_packet_t * packet); uint32_t packet_queue_get(packet_queue_t * queue, radio_packet_t ** packet); #endif
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 License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef AVUTIL_RANDOM_SEED_H #define AVUTIL_RANDOM_SEED_H #include <stdint.h> /** * Gets a seed to use in conjuction with random functions. */ uint32_t ff_random_get_seed(void); #endif /* AVUTIL_RANDOM_SEED_H */
/* * 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 License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef AVUTIL_RANDOM_SEED_H #define AVUTIL_RANDOM_SEED_H #include <stdint.h> /** * Gets a seed to use in conjunction with random functions. */ uint32_t ff_random_get_seed(void); #endif /* AVUTIL_RANDOM_SEED_H */
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 License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, see <http://www.gnu.org/licenses/>. */ /* check statistics */ #include <config.h> #include <glib.h> typedef void test_func_t(void); test_func_t stat_test1; test_func_t stat_test2; test_func_t stat_test3; test_func_t stat_test4; static test_func_t *test_funcs[] = { stat_test1, stat_test2, stat_test3, stat_test4, NULL }; int main(void) { test_func_t **func_p; for (func_p = test_funcs; *func_p; ++func_p) { (*func_p)(); } return 0; }
/* -*- 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 License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, see <http://www.gnu.org/licenses/>. */ /* check statistics */ #include <config.h> #include <glib.h> typedef void test_func_t(void); test_func_t stat_test1; test_func_t stat_test2; test_func_t stat_test3; test_func_t stat_test4; static test_func_t *test_funcs[] = { stat_test1, stat_test2, stat_test3, stat_test4, NULL }; int main(void) { test_func_t **func_p; for (func_p = test_funcs; *func_p; ++func_p) { (*func_p)(); } return 0; }
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 applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "udc.h" #include <stdlib.h> struct gt_udc_backend gt_udc_backend_libusbg = { .udc = NULL, };
/* * 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 applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <stdio.h> #include <usbg/usbg.h> #include "backend.h" #include "udc.h" static int udc_func(void *data) { usbg_udc *u; const char *name; usbg_for_each_udc(u, backend_ctx.libusbg_state) { name = usbg_get_udc_name(u); if (name == NULL) { fprintf(stderr, "Error getting udc name\n"); return -1; } puts(name); } return 0; } struct gt_udc_backend gt_udc_backend_libusbg = { .udc = udc_func, };
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++; }); h++; } void __tsan_on_report() { fprintf(stderr, "Report.\n"); f(); } int main() { fprintf(stderr, "Hello world.\n"); f(); pthread_mutex_t mutex = {0}; pthread_mutex_lock(&mutex); fprintf(stderr, "g = %ld.\n", g); fprintf(stderr, "h = %ld.\n", h); fprintf(stderr, "Done.\n"); } // CHECK: Hello world. // CHECK: Report. // CHECK: g = 1 // CHECK: h = 2 // CHECK: Done.
// 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++; }); h++; } void __tsan_on_report() { fprintf(stderr, "Report.\n"); f(); } int main() { fprintf(stderr, "Hello world.\n"); f(); pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; pthread_mutex_unlock(&mutex); // Unlock of an unlocked mutex fprintf(stderr, "g = %ld.\n", g); fprintf(stderr, "h = %ld.\n", h); fprintf(stderr, "Done.\n"); } // CHECK: Hello world. // CHECK: Report. // CHECK: g = 1 // CHECK: h = 2 // CHECK: Done.
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 { namespace Internal { namespace Action { /// Define action for updating task class FilterTask : public Query { public: /// Constructor explicit FilterTask(const Filter& filter) : filter(filter) {} /// Destructor virtual ~FilterTask() = default; private: /// Execute add task. Response execute(State& tasks) override; FilterTask& operator=(const FilterTask&) = delete; const Filter& filter; }; } // namespace Action } // namespace Internal } // namespace QueryEngine } // namespace You #endif // YOU_QUERYENGINE_INTERNAL_ACTION_FILTER_TASK_H_
/// \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 { namespace Internal { namespace Action { /// Define action for updating task class FilterTask : public Query { public: /// Constructor explicit FilterTask(const Filter& filter) : filter(filter) {} /// Destructor virtual ~FilterTask() = default; private: /// Execute add task. Response execute(State& tasks) override; FilterTask& operator=(const FilterTask&) = delete; Filter filter; }; } // namespace Action } // namespace Internal } // namespace QueryEngine } // namespace You #endif // YOU_QUERYENGINE_INTERNAL_ACTION_FILTER_TASK_H_
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 permission notice appear in ** supporting documentation, and that the names of the University of ** Wisconsin and the copyright holders not be used in advertising or ** publicity pertaining to distribution of the software without specific, ** written prior permission. The University of Wisconsin and the ** copyright holders make no representations about the suitability of this ** software for any purpose. It is provided "as is" without express ** or implied warranty. ** ** THE UNIVERSITY OF WISCONSIN AND THE COPYRIGHT HOLDERS DISCLAIM ALL ** WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES ** OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE UNIVERSITY OF ** WISCONSIN OR THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT ** OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS ** OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE ** OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE ** OR PERFORMANCE OF THIS SOFTWARE. ** ** Author: Mike Litzkow ** */ #define _POSIX_SOURCE #include <signal.h> #include "condor_debug.h" static char *_FileName_ = __FILE__; typedef void (*SIG_HANDLER)(); void install_sig_handler( int sig, SIG_HANDLER handler ) { struct sigaction act; act.sa_handler = handler; sigemptyset( &act.sa_mask ); act.sa_flags = 0; if( sigaction(sig,&act,0) < 0 ) { EXCEPT( "sigaction" ); } }
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 bp = boost::python; bp::type_info info = boost::python::type_id< QueryT >(); bp::converter::registration * registration = boost::python::converter::registry::query( info ); return registration != 0; } } //namespace myrrh } //namespace python #endif //MYRRH_PYTHON_REGISTRY_H_
/** @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 once. */ template< typename QueryT > const boost::python::converter::registration * get_registration() { namespace bp = boost::python; const bp::type_info info = boost::python::type_id< QueryT >(); const bp::converter::registration * registration = boost::python::converter::registry::query( info ); // need to check for m_to_python converter: see http://stackoverflow.com/a/13017303/959926 if( registration != 0 && registration->m_to_python != 0 ) { return registration; } else { return 0; } } } //namespace myrrh } //namespace python #endif //MYRRH_PYTHON_REGISTRY_H_
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? "); scanf("%d", &chute); printf("Seu chute foi %d\n", chute); int acertou = chute == numerosecreto; if(acertou) { printf("Parabéns! Você acertou!\n"); printf("Jogue de novo, você é um bom jogador!\n"); } else { int maior = chute > numerosecreto; if(maior) { printf("Seu chute foi maior que o número secreto\n"); } else { printf("Seu chute foi menor que o número secreto\n"); } printf("Você errou!\n"); printf("Mas não desanime, tente de novo!\n"); } }
#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++) { printf("Tentativa %d de 3\n", i); printf("Qual é o seu chute? "); scanf("%d", &chute); printf("Seu chute foi %d\n", chute); int acertou = chute == numerosecreto; if(acertou) { printf("Parabéns! Você acertou!\n"); printf("Jogue de novo, você é um bom jogador!\n"); } else { int maior = chute > numerosecreto; if(maior) { printf("Seu chute foi maior que o número secreto\n"); } else { printf("Seu chute foi menor que o número secreto\n"); } printf("Você errou!\n"); printf("Mas não desanime, tente de novo!\n"); } } printf("Fim de jogo!\n"); }
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 writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #import <Foundation/Foundation.h> #import <themis/themis.h> @interface SKeygen : NSObject { NSData* _priv_key; NSData* _pub_key; } - (id)init; - (NSData*)priv_key: error:(NSError**)errorPtr; - (NSData*)pub_key: error:(NSError**)errorPtr; @end
/* * 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 writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #import <Foundation/Foundation.h> #import <themis/themis.h> @interface SMessage : NSObject { NSMutableData* _priv_key; NSMutableData* _pub_key; } - (id)initWithPrivateKey: (NSData*)private_key peerPublicKey:(NSData*)peer_pub_key; - (NSData*)wrap: (NSData*)message error:(NSError**)errorPtr; - (NSData*)unwrap: (NSData*)message error:(NSError**)errorPtr; @end
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 CheckCPUsupportAES() { unsigned int CPUInfo[4]; __cpuid(1, CPUInfo[0], CPUInfo[1], CPUInfo[2], CPUInfo[3]); return (CPUInfo[2] & (1 << 25)) && (CPUInfo[2] & (1 << 19)); /* Check AES and SSE4.1 */ } #else /* defined(__clang__) || defined(__GNUC__) */ static int CheckCPUsupportAES() { unsigned int CPUInfo[4]; __cpuid(CPUInfo, 1); return (CPUInfo[2] & (1 << 25)) && (CPUInfo[2] & (1 << 19)); /* Check AES and SSE4.1 */ } #endif /* defined(__clang__) || defined(__GNUC__) */ int main(int argc, char ** argv) { const int res = !CheckCPUsupportAES(); #ifndef SILENT printf("This CPU %s AES-NI\n", res ? "does not support" : "supports"); #endif return res; }
/** * 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 int CPUInfo[4]; __cpuid(1, CPUInfo[0], CPUInfo[1], CPUInfo[2], CPUInfo[3]); return (CPUInfo[2] & (1 << 25)) && (CPUInfo[2] & (1 << 19)); /* Check AES and SSE4.1 */ } #else /* defined(__clang__) || defined(__GNUC__) */ static int CheckCPUsupportAES() { unsigned int CPUInfo[4]; __cpuid(CPUInfo, 1); return (CPUInfo[2] & (1 << 25)) && (CPUInfo[2] & (1 << 19)); /* Check AES and SSE4.1 */ } #endif /* defined(__clang__) || defined(__GNUC__) */ int main(int argc, char ** argv) { const int res = !CheckCPUsupportAES(); printf("This CPU %s AES-NI\n", res ? "does not support" : "supports"); return res; }
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$ */ //////////////////////////////////////////////////////////////////////////// // // // TRD preprocessor for the database SHUTTLE // // // //////////////////////////////////////////////////////////////////////////// #include "AliPreprocessor.h" class AliTRDPreprocessor : public AliPreprocessor { public: AliTRDPreprocessor(AliShuttleInterface *shuttle); virtual ~AliTRDPreprocessor(); protected: virtual void Initialize(Int_t run, UInt_t startTime, UInt_t endTime); virtual UInt_t Process(TMap* /*dcsAliasMap*/); private: ClassDef(AliTRDPreprocessor,0); }; #endif
#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$ */ //////////////////////////////////////////////////////////////////////////// // // // TRD preprocessor for the database SHUTTLE // // // //////////////////////////////////////////////////////////////////////////// #include "AliPreprocessor.h" class AliTRDPreprocessor : public AliPreprocessor { public: AliTRDPreprocessor(AliShuttleInterface *shuttle); virtual ~AliTRDPreprocessor(); protected: virtual void Initialize(Int_t run, UInt_t startTime, UInt_t endTime); virtual UInt_t Process(TMap* /*dcsAliasMap*/); private: ClassDef(AliTRDPreprocessor,0) // The SHUTTLE preprocessor for TRD }; #endif
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; float v = texture2D(m_SamplerV, loc).r; return yuvCoeff * (vec3(y, u, v) + offsets); }
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_SamplerU, loc).r; lowp float v = texture2D(m_SamplerV, loc).r; return yuvCoeff * (vec3(y, u, v) + offsets); }
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 can't be needed by the user. // * Eliminate names for types that are unused in the entire translation unit // * Fix various problems that we might have in PHI nodes and casts // * Link uses of 'void %foo(...)' to 'void %foo(sometypes)' // // Note: This code produces dead declarations, it is a good idea to run DCE // after this pass. // //===----------------------------------------------------------------------===// #ifndef LLVM_TRANSFORMS_CLEANUPGCCOUTPUT_H #define LLVM_TRANSFORMS_CLEANUPGCCOUTPUT_H class Pass; // CleanupGCCOutputPass - Perform all of the function body transformations. // Pass *createCleanupGCCOutputPass(); // FunctionResolvingPass - Go over the functions that are in the module and // look for functions that have the same name. More often than not, there will // be things like: // void "foo"(...) // void "foo"(int, int) // because of the way things are declared in C. If this is the case, patch // things up. // // This is an interprocedural pass. // Pass *createFunctionResolvingPass(); #endif
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 tty[10 + UT_LINESIZE] = "/dev/" ; char msg[n+1] ; memcpy(msg, s, n) ; msg[n++] = '\n' ; setutxent() ; for (;;) { size_t linelen ; int fd ; struct utmpx *utx = getutxent() ; if (!utx) break ; if (utx->ut_type != USER_PROCESS) continue ; linelen = strnlen(utx->ut_line, UT_LINESIZE) ; memcpy(tty + 5, utx->ut_line, linelen) ; tty[5 + linelen] = 0 ; fd = open_append(tty) ; if (fd == -1) continue ; allwrite(fd, msg, n) ; fd_close(fd) ; } endutxent() ; }
/* 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 tty[10 + UT_LINESIZE] = "/dev/" ; char msg[n+1] ; memcpy(msg, s, n) ; msg[n++] = '\n' ; setutxent() ; for (;;) { size_t linelen ; int fd ; struct utmpx *utx = getutxent() ; if (!utx) break ; if (utx->ut_type != USER_PROCESS) continue ; linelen = strnlen(utx->ut_line, UT_LINESIZE) ; memcpy(tty + 5, utx->ut_line, linelen) ; tty[5 + linelen] = 0 ; fd = open_append(tty) ; if (fd == -1) continue ; allwrite(fd, msg, n) ; fd_close(fd) ; } endutxent() ; }
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 obj) { free((void*)(((intptr_t)obj) - 1)); } static void *alloc(size_t size) { return calloc(size, 1); } PRIVATE struct gc_ops gc_ops_none = { .allocate_class = allocate_class, .free_object = free_object, .malloc = alloc, .free = free }; PRIVATE struct gc_ops *gc = &gc_ops_none; PRIVATE BOOL isGCEnabled = NO; #ifndef ENABLE_GC PRIVATE void enableGC(BOOL exclusive) { fprintf(stderr, "Attempting to enable garbage collection, but your" "Objective-C runtime was built without garbage collection" "support\n"); abort(); } #endif
#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 obj) { free((void*)(((intptr_t*)obj) - 1)); } static void *alloc(size_t size) { return calloc(size, 1); } PRIVATE struct gc_ops gc_ops_none = { .allocate_class = allocate_class, .free_object = free_object, .malloc = alloc, .free = free }; PRIVATE struct gc_ops *gc = &gc_ops_none; PRIVATE BOOL isGCEnabled = NO; #ifndef ENABLE_GC PRIVATE void enableGC(BOOL exclusive) { fprintf(stderr, "Attempting to enable garbage collection, but your" "Objective-C runtime was built without garbage collection" "support\n"); abort(); } #endif
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_run++; if (message) return message; } while (0)
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 API key before calling this method" userInfo:nil]; } static NSString __attribute__((unused)) * const ECHONEST_API_URL = @"http://developer.echonest.com/api/v4/";
// // 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 API key before calling this method" userInfo:nil]; } #define CHECK_OAUTH_KEYS if (nil == [ENAPI consumerKey] && nil == [ENAPI sharedSecret]) { @throw [NSException exceptionWithName:@"OAuthKeysNotSetException" reason:@"Set the consumer key & shared secret before calling this method" userInfo:nil]; } static NSString __attribute__((unused)) * const ECHONEST_API_URL = @"http://developer.echonest.com/api/v4/";
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_secondeViewController_chartTypeColumn =0, ENUM_secondeViewController_chartTypeBar, ENUM_secondeViewController_chartTypeArea, ENUM_secondeViewController_chartTypeAreaspline, ENUM_secondeViewController_chartTypeLine, ENUM_secondeViewController_chartTypeSpline, ENUM_secondeViewController_chartTypeScatter, }; @interface SecondViewController : UIViewController @property(nonatomic,assign)NSInteger ENUM_secondeViewController_chartType; @property(nonatomic,copy)NSString *receivedChartType; @end
// // 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){ SecondeViewControllerChartTypeColumn =0, SecondeViewControllerChartTypeBar, SecondeViewControllerChartTypeArea, SecondeViewControllerChartTypeAreaspline, SecondeViewControllerChartTypeLine, SecondeViewControllerChartTypeSpline, SecondeViewControllerChartTypeScatter, }; @interface SecondViewController : UIViewController @property(nonatomic,assign)NSInteger SecondeViewControllerChartType; @property(nonatomic,copy)NSString *receivedChartType; @end
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 isValid() const; bool hasAudioProperties() const; QString title() const; QString album() const; QString artist() const; int track() const; int year() const; QString genre() const; QString comment() const; int length() const; int bitrate() const; int sampleRate() const; int channels() const; QImage thumbnailImage() const; QByteArray thumbnail() const; private: TagLib::FileRef m_fileRef; TagLib::Tag *m_tag; TagLib::AudioProperties *m_audioProperties; }; #endif // TAGREADER_H
#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 &file); ~TagReader(); bool isValid() const; bool hasAudioProperties() const; QString title() const; QString album() const; QString artist() const; int track() const; int year() const; QString genre() const; QString comment() const; int length() const; int bitrate() const; int sampleRate() const; int channels() const; QImage thumbnailImage() const; QByteArray thumbnail() const; private: TagLib::FileRef m_fileRef; TagLib::Tag *m_tag; TagLib::AudioProperties *m_audioProperties; }; #endif // TAGREADER_H
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_KEY_ESC: buf_printf(editor->status, ""); editor->mode = normal_mode(); return; case TB_KEY_BACKSPACE2: buf_delete(editor->status, editor->status->len - 1, 1); if (editor->status->len == 0) { editor->mode = normal_mode(); return; } return; case TB_KEY_ENTER: { char *command = strdup(editor->status->buf + 1); editor_execute_command(editor, command); free(command); editor->mode = normal_mode(); return; } case TB_KEY_SPACE: ch = ' '; break; default: ch = ev->ch; } char s[2] = {ch, '\0'}; buf_append(editor->status, s); } static editing_mode_t impl = {command_mode_key_pressed}; editing_mode_t *command_mode(void) { return &impl; }
#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_KEY_ESC: buf_printf(editor->status, ""); editor->mode = normal_mode(); return; case TB_KEY_BACKSPACE2: buf_delete(editor->status, editor->status->len - 1, 1); if (editor->status->len == 0) { editor->mode = normal_mode(); return; } return; case TB_KEY_ENTER: { if (editor->status->len > 1) { char *command = strdup(editor->status->buf + 1); editor_execute_command(editor, command); free(command); } editor->mode = normal_mode(); return; } case TB_KEY_SPACE: ch = ' '; break; default: ch = ev->ch; } char s[2] = {ch, '\0'}; buf_append(editor->status, s); } static editing_mode_t impl = {command_mode_key_pressed}; editing_mode_t *command_mode(void) { return &impl; }
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; } #else #include <sys/time.h> double currentTime() { static bool first_call = true; static timeval reference_time; if (first_call) { first_call = false; gettimeofday(&reference_time, NULL); return 0.0; } else { timeval t; gettimeofday(&t, NULL); return ((t.tv_sec - reference_time.tv_sec)*1000.0 + (t.tv_usec - reference_time.tv_usec)/1000.0); } } #endif
// 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); return (t * 1000.0) / freq; } #else #include <sys/time.h> double currentTime() { static bool first_call = true; static timeval reference_time; if (first_call) { first_call = false; gettimeofday(&reference_time, NULL); return 0.0; } else { timeval t; gettimeofday(&t, NULL); return ((t.tv_sec - reference_time.tv_sec)*1000.0 + (t.tv_usec - reference_time.tv_usec)/1000.0); } } #endif
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); displayLCDString(LCD_LINE_BOTTOM, 0, bottom); } void lcd_clear() { clearLCDLine(LCD_LINE_TOP); clearLCDLine(LCD_LINE_BOTTOM); }
/* 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); displayLCDString(LCD_LINE_BOTTOM, 0, bottom); } void lcd_clear() { clearLCDLine(LCD_LINE_TOP); clearLCDLine(LCD_LINE_BOTTOM); }
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; }; struct URP { struct URI uri; struct rule * rules; }; struct URI * parse_uri(char * raw_uri) { struct URI *uri = malloc (sizeof (struct URI)); int scheme_found = 0; int scheme_end = 0; char * tmp_uriptr; for (tmp_uriptr = raw_uri; *tmp_uriptr != '\0'; ++tmp_uriptr) { if (*tmp_uriptr == ':') { if (!scheme_found) { scheme_end = tmp_uriptr - raw_uri; uri->scheme = (char *) malloc(scheme_end); strncpy(uri->scheme, raw_uri, scheme_end); scheme_found = 1; } } } return uri; } int main() { char * raw_uri = "scheme://dir1/dir2/dir3"; struct URI * parsed_uri; parsed_uri = parse_uri(raw_uri); printf("%s\n", parsed_uri->scheme); }
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. // //===----------------------------------------------------------------------===// // // This file defines a very simple Doxygen comment parser. // //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_AST_BRIEF_COMMENT_PARSER_H #define LLVM_CLANG_AST_BRIEF_COMMENT_PARSER_H #include "clang/AST/CommentLexer.h" namespace clang { namespace comments { /// A very simple comment parser that extracts "a brief description". /// /// Due to a variety of comment styles, it considers the following as "a brief /// description", in order of priority: /// \li a \\brief or \\short command, /// \li the first paragraph, /// \li a \\result or \\return or \\returns paragraph. class BriefParser { Lexer &L; const CommandTraits &Traits; /// Current lookahead token. Token Tok; SourceLocation ConsumeToken() { SourceLocation Loc = Tok.getLocation(); L.lex(Tok); return Loc; } public: BriefParser(Lexer &L, const CommandTraits &Traits); /// Return \\brief paragraph, if it exists; otherwise return the first /// paragraph. std::string Parse(); }; } // end namespace comments } // end namespace clang #endif
//===--- 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. // //===----------------------------------------------------------------------===// // // This file defines a very simple Doxygen comment parser. // //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_AST_BRIEF_COMMENT_PARSER_H #define LLVM_CLANG_AST_BRIEF_COMMENT_PARSER_H #include "clang/AST/CommentLexer.h" namespace clang { namespace comments { /// A very simple comment parser that extracts "a brief description". /// /// Due to a variety of comment styles, it considers the following as "a brief /// description", in order of priority: /// \li a \\brief or \\short command, /// \li the first paragraph, /// \li a \\result or \\return or \\returns paragraph. class BriefParser { Lexer &L; const CommandTraits &Traits; /// Current lookahead token. Token Tok; SourceLocation ConsumeToken() { SourceLocation Loc = Tok.getLocation(); L.lex(Tok); return Loc; } public: BriefParser(Lexer &L, const CommandTraits &Traits); /// Return the best "brief description" we can find. std::string Parse(); }; } // end namespace comments } // end namespace clang #endif
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/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * This file is part of mbed TLS (https://tls.mbed.org) */ #if defined(DEVICE_TRNG) #define MBEDTLS_ENTROPY_HARDWARE_ALT #endif #if defined(DEVICE_CRYPTO) #include "mbedtls_device.h" #endif
/** * 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/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * This file is part of mbed TLS (https://tls.mbed.org) */ #if defined(DEVICE_TRNG) #define MBEDTLS_ENTROPY_HARDWARE_ALT #endif #if defined(MBEDTLS_HW_SUPPORT) #include "mbedtls_device.h" #endif
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 checkAreaExist(area * z, int zSize, char * areaName); int getAreaCapacity(area * z, int zSize, char * areaName); #endif
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 little corners that I haven't explored fully. - Tom Duff */ send(to, from, count) register short *to, *from; register count; { register n=(count+7)/8; switch(count%8){ case 0: do{*to = *from++; case 7: *to = *from++; case 6: *to = *from++; case 5: *to = *from++; case 4: *to = *from++; case 3: *to = *from++; case 2: *to = *from++; case 1: *to = *from++; }while(--n>0); } }
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_DEPTH > 'Z' - 'A') #error Angle labels are currently lettered. Sorry for this limitation. #endif /* * All polygons have a fixed limit to the total measure of their angles. * For example, the angles of a triangle always sum up to 180 degrees. */ #define INTERIOR_DEGREES (180 * ((POLYGON_DEPTH) - 2)) /* * Geometric lengths cannot be negative or zero. * We will reserve non-positive measures to indicate un-solved "unknowns". */ #define KNOWN(measure) ((measure) > 0) extern int solve_polygon(double * angles, double * sides); extern int already_solved(double * angels, double * sides); extern int find_angle(double * angles); extern int find_side(double * sides, const double * angles); extern int arc_find_angles(double * angles, const double * sides); #endif
#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 sides! #endif #if (POLYGON_DEPTH > 'Z' - 'A') #error Angle labels are currently lettered. Sorry for this limitation. #endif /* * All polygons have a fixed limit to the total measure of their angles. * For example, the angles of a triangle always sum up to 180 degrees. */ #define INTERIOR_DEGREES (180 * ((POLYGON_DEPTH) - 2)) /* * Geometric lengths cannot be negative or zero. * We will reserve non-positive measures to indicate un-solved "unknowns". */ #define KNOWN(measure) ((measure) > 0) extern int solve_polygon(double * angles, double * sides); extern int already_solved(double * angels, double * sides); extern int find_angle(double * angles); extern int find_side(double * sides, const double * angles); extern int arc_find_angles(double * angles, const double * sides); #endif
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. FOUNDATION_EXPORT const unsigned char ASN1DecoderVersionString[]; // In this header, you should import all the public headers of your framework using statements like #import <ASN1Decoder/PublicHeader.h>
// // 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. FOUNDATION_EXPORT const unsigned char ASN1DecoderVersionString[]; // In this header, you should import all the public headers of your framework using statements like #import <ASN1Decoder/PublicHeader.h>
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 __ARCH_MACHINE_CPU_REGISTERS_H #define CR0_MONITOR_COPROC BIT(1) /* Trap on FPU "WAIT" commands. */ #define CR0_EMULATION BIT(2) /* Enable OS emulation of FPU. */ #define CR0_TASK_SWITCH BIT(3) /* Trap on any FPU usage, for lazy FPU. */ #define CR0_NUMERIC_ERROR BIT(5) /* Internally handle FPU problems. */ #define CR4_OSFXSR BIT(9) /* Enable SSE et. al. features. */ #define CR4_OSXMMEXCPT BIT(10) /* Enable SSE exceptions. */ /* We use a dummy variable to synchronize reads and writes to the control registers. * this allows us to write inline asm blocks that do not have enforced memory * clobbers for ordering. */ static unsigned long control_reg_order; #include <mode/machine/cpu_registers.h> #endif
/* * 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 __ARCH_MACHINE_CPU_REGISTERS_H #define CR0_MONITOR_COPROC BIT(1) /* Trap on FPU "WAIT" commands. */ #define CR0_EMULATION BIT(2) /* Enable OS emulation of FPU. */ #define CR0_TASK_SWITCH BIT(3) /* Trap on any FPU usage, for lazy FPU. */ #define CR0_NUMERIC_ERROR BIT(5) /* Internally handle FPU problems. */ #define CR4_OSFXSR BIT(9) /* Enable SSE et. al. features. */ #define CR4_OSXMMEXCPT BIT(10) /* Enable SSE exceptions. */ #define CR4_OSXSAVE BIT(18) /* Enavle XSAVE feature set */ /* We use a dummy variable to synchronize reads and writes to the control registers. * this allows us to write inline asm blocks that do not have enforced memory * clobbers for ordering. */ static unsigned long control_reg_order; #include <mode/machine/cpu_registers.h> #endif
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, CWNotificationStyleNavigationBarNotification }; enum { CWNotificationAnimationStyleTop, CWNotificationAnimationStyleBottom, CWNotificationAnimationStyleLeft, CWNotificationAnimationStyleRight }; @property (strong, nonatomic) UIColor *notificationLabelBackgroundColor; @property (strong, nonatomic) UIColor *notificationLabelTextColor; @property (nonatomic) NSInteger notificationStyle; @property (nonatomic) NSInteger notificationAnimationInStyle; @property (nonatomic) NSInteger notificationAnimationOutStyle; @property (nonatomic) BOOL notificationIsShowing; - (void)displayNotificationWithMessage:(NSString *)message forDuration:(CGFloat)duration; - (void)displayNotificationWithMessage:(NSString *)message completion:(void (^)(void))completion; - (void)dismissNotification; @end
// // 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){ CWNotificationStyleStatusBarNotification, CWNotificationStyleNavigationBarNotification }; typedef NS_ENUM(NSInteger, CWNotificationAnimationStyle) { CWNotificationAnimationStyleTop, CWNotificationAnimationStyleBottom, CWNotificationAnimationStyleLeft, CWNotificationAnimationStyleRight }; @property (strong, nonatomic) UIColor *notificationLabelBackgroundColor; @property (strong, nonatomic) UIColor *notificationLabelTextColor; @property (nonatomic) CWNotificationStyle notificationStyle; @property (nonatomic) CWNotificationAnimationStyle notificationAnimationInStyle; @property (nonatomic) CWNotificationAnimationStyle notificationAnimationOutStyle; @property (nonatomic) BOOL notificationIsShowing; - (void)displayNotificationWithMessage:(NSString *)message forDuration:(CGFloat)duration; - (void)displayNotificationWithMessage:(NSString *)message completion:(void (^)(void))completion; - (void)dismissNotification; @end
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 #define PIC_MASTER_IMR 0x21 #define PIC_MASTER_ISR PIC_MASTER_CMD #define PIC_MASTER_POLL PIC_MASTER_ISR #define PIC_MASTER_OCW3 PIC_MASTER_ISR #define PIC_SLAVE_CMD 0xa0 #define PIC_SLAVE_IMR 0xa1 /* i8259A PIC related value */ #define PIC_CASCADE_IR 2 #define MASTER_ICW4_DEFAULT 0x01 #define SLAVE_ICW4_DEFAULT 0x01 #define PIC_ICW4_AEOI 2 extern void setup_pit_timer(void); #endif /* !_MACH_IO_PORTS_H */
/* * 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 #define PIC_MASTER_IMR 0x21 #define PIC_MASTER_ISR PIC_MASTER_CMD #define PIC_MASTER_POLL PIC_MASTER_ISR #define PIC_MASTER_OCW3 PIC_MASTER_ISR #define PIC_SLAVE_CMD 0xa0 #define PIC_SLAVE_IMR 0xa1 /* i8259A PIC related value */ #define PIC_CASCADE_IR 2 #define MASTER_ICW4_DEFAULT 0x01 #define SLAVE_ICW4_DEFAULT 0x01 #define PIC_ICW4_AEOI 2 extern void setup_pit_timer(void); #endif /* __ASM_I8253_H */
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_CONTROLDATA_UTILS_H extern ControlFileData *get_controlfile(char *DataDir, const char *progname); #endif /* COMMON_CONTROLDATA_UTILS_H */
/* * 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_CONTROLDATA_UTILS_H #include "catalog/pg_control.h" extern ControlFileData *get_controlfile(char *DataDir, const char *progname); #endif /* COMMON_CONTROLDATA_UTILS_H */
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 #ifndef NO_TESTING friend class TestSpeciesDialog; #endif public: /// @brief Constructor. /// /// @param parent Parent widget. explicit SpeciesDialog(QWidget *parent = 0); /// @brief Returns a Species object corresponding to the dialog values. /// /// @return Species object corresponding to the dialog values. Species getSpecies(); private slots: /// @brief Emits the accepted signal. void on_ok_clicked(); /// @brief Emits the rejected signal. void on_cancel_clicked(); /// @brief Removes currently selected subspecies. void on_removeSubspecies_clicked(); /// @brief Adds a new subspecies. void on_addSubspecies_clicked(); private: /// @brief Widget loaded from ui file. std::unique_ptr<Ui::SpeciesDialog> ui_; }; } // namespace fish_detector #endif // SPECIES_DIALOG_H
/// @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 public: /// @brief Constructor. /// /// @param parent Parent widget. explicit SpeciesDialog(QWidget *parent = 0); /// @brief Returns a Species object corresponding to the dialog values. /// /// @return Species object corresponding to the dialog values. Species getSpecies(); private slots: /// @brief Calls inherited accept function. void on_ok_clicked(); /// @brief Calls inherited reject function. void on_cancel_clicked(); /// @brief Removes currently selected subspecies. void on_removeSubspecies_clicked(); /// @brief Adds a new subspecies. void on_addSubspecies_clicked(); private: /// @brief Widget loaded from ui file. std::unique_ptr<Ui::SpeciesDialog> ui_; }; } // namespace fish_detector #endif // SPECIES_DIALOG_H
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) NSArray *validProtocols; @property (nonatomic, assign) BOOL leftToRight; @property (nonatomic, assign) BOOL textSelectable; @property (nonatomic, strong) UIColor *selectionColor; @property (nonatomic, copy) void (^detectionBlock)(STTweetHotWord hotWord, NSString *string, NSString *protocol, NSRange range); - (void)setAttributes:(NSDictionary *)attributes; - (void)setAttributes:(NSDictionary *)attributes hotWord:(STTweetHotWord)hotWord; - (NSDictionary *)attributes; - (NSDictionary *)attributesForHotWord:(STTweetHotWord)hotWord; - (CGSize)suggestedFrameSizeToFitEntireStringConstraintedToWidth:(CGFloat)width; @end
// // 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, strong) NSArray *validProtocols; @property (nonatomic, assign) BOOL leftToRight; @property (nonatomic, assign) BOOL textSelectable; @property (nonatomic, strong) UIColor *selectionColor; @property (nonatomic, copy) void (^detectionBlock)(STTweetHotWord hotWord, NSString *string, NSString *protocol, NSRange range); - (void)setAttributes:(NSDictionary *)attributes; - (void)setAttributes:(NSDictionary *)attributes hotWord:(STTweetHotWord)hotWord; - (NSDictionary *)attributes; - (NSDictionary *)attributesForHotWord:(STTweetHotWord)hotWord; - (CGSize)suggestedFrameSizeToFitEntireStringConstraintedToWidth:(CGFloat)width; @end
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 // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // #import "RMGalleryViewController.h" #import "RMGalleryTransition.h"
// // 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 // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // #import "RMGalleryViewController.h" #import "RMGalleryTransition.h"
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) { printf ("%llu:\t%llu\n", ++i, rdtsc); } close (fileStat); }
#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) ) > 0) { printf ("%llu:\t%llu\n", ++i, rdtsc); } close (fileStat); return EXIT_SUCCESS; }
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, &fstore); }
#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(fd, F_PREALLOCATE, &fstore); }
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_ # include <boost/mpl/at.hpp> # include <boost/preprocessor/iteration/iterate.hpp> # include <boost/preprocessor/repetition/enum_shifted_params.hpp> # include <boost/preprocessor/repetition/enum_shifted.hpp> # define _arg_enum___(x) BOOST_PP_ENUM_SHIFTED(BOOST_PP_ITERATION(), _arg_enum_, x) # define _arg_enum_(z,n,x) x(n) # define _MPL_ARG_(n) typename boost::mpl::at_c<T,n>::type namespace detail { template<int N, typename T> struct BuildSig; # define BOOST_PP_ITERATION_PARAMS_1 (3, (1, 11, "BuildSignature.h")) # include BOOST_PP_ITERATE() } template<typename T> struct BuildSignature { typedef boost::mpl::size<T> Size; typedef typename ::detail::BuildSig<Size::value,T>::type type; }; # endif #else template<typename T> struct BuildSig<BOOST_PP_ITERATION(), T> { typedef typename boost::mpl::at_c<T,0>::type type(_arg_enum___(_MPL_ARG_)); }; #endif
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; extern char *optarg; extern int optind, optopt; while ((c = getopt(argc, argv, "hedt")) != -1) { switch (c) { case 'h': print_usage(stdout); return 0; case 'e': case 'd': case 't': mode = c; break; case '?': return 1; } } // Make sure all arguments were processed. if (optind != argc) { print_usage(stderr); return 1; } // Dispatch to the chosen subprogram. switch (mode) { case 'e': return encode(); case 'd': return decode(); case 't': return transmit(); } }
// 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; extern char *optarg; extern int optind, optopt; while ((c = getopt(argc, argv, "hedt")) != -1) { switch (c) { case 'h': print_usage(stdout); return 0; case 'e': case 'd': case 't': mode = c; break; case '?': print_usage(stderr); return 1; } } // Make sure all arguments were processed. if (optind != argc) { print_usage(stderr); return 1; } // Dispatch to the chosen subprogram. switch (mode) { case 'e': return encode(); case 'd': return decode(); case 't': return transmit(); } }
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){ assert (j != 0); //UNKNOWN! } else { assert (j == 0); } int k; if (k > 0) { assert (k == 0); //UNKNOWN! } else { assert (k != 0); //UNKNOWN! } return 0; }
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 lock *lock_alloc_and_init(const char *path); extern void lock_free(struct lock **lock); // Need to test lock->status to find out what happened when calling these. extern void lock_get_quick(struct lock *lock); extern void lock_get(struct lock *lock); extern int lock_test(const char *path); extern int lock_release(struct lock *lock); extern void lock_add_to_list(struct lock **locklist, struct lock *lock); extern void locks_release_and_free(struct lock **locklist); #endif
#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_init(const char *path); extern void lock_free(struct lock **lock); // Need to test lock->status to find out what happened when calling these. extern void lock_get_quick(struct lock *lock); extern void lock_get(struct lock *lock); extern int lock_test(const char *path); extern int lock_release(struct lock *lock); extern void lock_add_to_list(struct lock **locklist, struct lock *lock); extern void locks_release_and_free(struct lock **locklist); #endif
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 barrier when we acquire the lock. if (fLocked.exchange(true, std::memory_order_acquire)) { // Lock was contended. Fall back to an out-of-line spin loop. this->contendedAcquire(); } } void release() { // To act as a mutex, we need a release barrier when we release the lock. fLocked.store(false, std::memory_order_release); } private: void contendedAcquire(); std::atomic<bool> fLocked{false}; }; #endif//SkSpinlock_DEFINED
/* * 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 need an acquire barrier when we acquire the lock. if (fLocked.exchange(true, std::memory_order_acquire)) { // Lock was contended. Fall back to an out-of-line spin loop. this->contendedAcquire(); } } void release() { // To act as a mutex, we need a release barrier when we release the lock. fLocked.store(false, std::memory_order_release); } private: SK_API void contendedAcquire(); std::atomic<bool> fLocked{false}; }; #endif//SkSpinlock_DEFINED
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 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 writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ #ifndef NRFX_CONFIG_H__ #define NRFX_CONFIG_H__ #if NRF52 #include "../../nrf52xxx-compat/include/nrfx52_config.h" #elif NRF52840_XXAA #include "../../nrf52xxx-compat/include/nrfx52840_config.h" #else #error Unsupported chip selected #endif #endif // NRFX_CONFIG_H__
/* * 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 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 writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ #ifndef NRFX_CONFIG_H__ #define NRFX_CONFIG_H__ #if NRF52 #include "nrfx52_config.h" #elif NRF52840_XXAA #include "nrfx52840_config.h" #else #error Unsupported chip selected #endif #endif // NRFX_CONFIG_H__
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>; #pragma create TClass vector<unsigned int>; #pragma create TClass vector<unsigned long>; #pragma create TClass vector<float>; #pragma create TClass vector<double>; #pragma create TClass vector<char*>; #pragma create TClass vector<const char*>; #pragma create TClass vector<string>; #if (!(G__GNUC==3 && G__GNUC_MINOR==1)) && !defined(G__KCC) && (!defined(G__VISUAL) || G__MSC_VER<1300) // gcc3.1,3.2 has a problem with iterator<void*,...,void&> #pragma create TClass vector<void*>; #endif
#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>; #pragma create TClass vector<unsigned int>; #pragma create TClass vector<unsigned long>; #pragma create TClass vector<float>; #pragma create TClass vector<double>; #pragma create TClass vector<char*>; #pragma create TClass vector<const char*>; #pragma create TClass vector<string>; #pragma create TClass vector<Long64_t>; #pragma create TClass vector<ULong64_t>; #if (!(G__GNUC==3 && G__GNUC_MINOR==1)) && !defined(G__KCC) && (!defined(G__VISUAL) || G__MSC_VER<1300) // gcc3.1,3.2 has a problem with iterator<void*,...,void&> #pragma create TClass vector<void*>; #endif
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 *) __attribute__((weak)); void *memset(void *, int, size_t) __attribute__((weak)); void *calloc(size_t nelem, size_t elsize) __attribute__((weak)); void *calloc(size_t nelem, size_t elsize) { void *Result = malloc(nelem*elsize); return memset(Result, 0, nelem*elsize); }
//===-- 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. Question is how // to handle overriding of memory allocation functions in that case. #ifndef __GNUC__ #define __attribute__(X) #endif // For now, turn off the weak linkage attribute on Mac OS X. #if defined(__GNUC__) && defined(__APPLE_CC__) #define __ATTRIBUTE_WEAK__ #elif defined(__GNUC__) #define __ATTRIBUTE_WEAK__ __attribute__((weak)) #else #define __ATTRIBUTE_WEAK__ #endif void *malloc(size_t) __ATTRIBUTE_WEAK__; void free(void *) __ATTRIBUTE_WEAK__; void *memset(void *, int, size_t) __ATTRIBUTE_WEAK__; void *calloc(size_t nelem, size_t elsize) __ATTRIBUTE_WEAK__; void *calloc(size_t nelem, size_t elsize) { void *Result = malloc(nelem*elsize); return memset(Result, 0, nelem*elsize); }
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. |* |*===----------------------------------------------------------------------===*| |* |* This file implements the call back routines for the edge profiling |* instrumentation pass. This should be used with the -insert-edge-profiling |* LLVM pass. |* \*===----------------------------------------------------------------------===*/ #include "Profiling.h" #include <stdlib.h> static unsigned *ArrayStart; static unsigned NumElements; /* EdgeProfAtExitHandler - When the program exits, just write out the profiling * data. */ static void EdgeProfAtExitHandler() { /* Note that if this were doing something more intellegent with the instrumentation, that we could do some computation here to expand what we collected into simple edge profiles. Since we directly count each edge, we just write out all of the counters directly. */ write_profiling_data(Edge, ArrayStart, NumElements); } /* llvm_start_edge_profiling - This is the main entry point of the edge * profiling library. It is responsible for setting up the atexit handler. */ int llvm_start_edge_profiling(int argc, const char **argv, unsigned *arrayStart, unsigned numElements) { int Ret = save_arguments(argc, argv); ArrayStart = arrayStart; NumElements = numElements; atexit(EdgeProfAtExitHandler); return Ret; }
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 @"YOUR_FLURRY_API_KEY" // Create an account at http://www.localytics.com // Code and integration instructions at // http://wiki.localytics.com/doku.php #define USES_LOCALYTICS #define kLocalyticsAppKey @"YOUR_LOCALITICS_APP_KEY" // Create an account at http://www.google.com/analytics // Code and integration instructions at // http://code.google.com/mobile/analytics/docs/iphone/ #define USES_GANTRACKER #define kGANAccountIDKey @"YOUR_GOOGLE_ANALYTICS_ACCOUNT_ID" #define kGANCategoryKey @"YOUR_APP_NAME"
// // 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 Flurry //#define USES_FLURRY //#define kFlurryAPIKey @"YOUR_FLURRY_API_KEY" // Create an account at http://www.localytics.com // Code and integration instructions at // http://wiki.localytics.com/doku.php // Uncomment the following two lines to use Localytics //#define USES_LOCALYTICS //#define kLocalyticsAppKey @"YOUR_LOCALITICS_APP_KEY" // Create an account at http://www.google.com/analytics // Code and integration instructions at // http://code.google.com/mobile/analytics/docs/iphone/ // Uncomment the following three lines to use Google Analytics //#define USES_GANTRACKER //#define kGANAccountIDKey @"YOUR_GOOGLE_ANALYTICS_ACCOUNT_ID" //#define kGANCategoryKey @"YOUR_APP_NAME"
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" #define PCA9555_CMD_INPUT_PORT_0 0 #define PCA9555_CMD_INPUT_PORT_1 1 #define PCA9555_CMD_OUTPUT_PORT_0 2 #define PCA9555_CMD_OUTPUT_PORT_1 3 #define PCA9555_CMD_POLARITY_INVERSION_PORT_0 4 #define PCA9555_CMD_POLARITY_INVERSION_PORT_1 5 #define PCA9555_CMD_CONFIGURATION_PORT_0 6 #define PCA9555_CMD_CONFIGURATION_PORT_1 7 #define PCA9555_IO_0 (1 << 0) #define PCA9555_IO_1 (1 << 1) #define PCA9555_IO_2 (1 << 2) #define PCA9555_IO_3 (1 << 3) #define PCA9555_IO_4 (1 << 4) #define PCA9555_IO_5 (1 << 5) #define PCA9555_IO_6 (1 << 6) #define PCA9555_IO_7 (1 << 7) static inline int pca9555_read(int port, int addr, int reg, int *data_ptr) { return i2c_read8(port, addr, reg, data_ptr); } static inline int pca9555_write(int port, int addr, int reg, int data) { return i2c_write8(port, addr, reg, data); } #endif /* __CROS_EC_IOEXPANDER_PCA9555_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--; } if (m < 0) { m += 60; h--; } if (h < 0) { h += 24; d--; } printf("%d dia(s)\n", d); printf("%d hora(s)\n", h); printf("%d minuto(s)\n", m); printf("%d segundo(s)\n", s); return 0; }
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, MASTER_STOP_AT_SENSOR, MASTER_GOTO_LOCATION, MASTER_DUMP_VELOCITY_TABLE, MASTER_UPDATE_FEEDBACK_THRESHOLD, MASTER_UPDATE_FEEDBACK_ALPHA, MASTER_UPDATE_STOP_OFFSET, MASTER_UPDATE_CLEARANCE_OFFSET, MASTER_ACCELERATION_COMPLETE, MASTER_NEXT_NODE_ESTIMATE, MASTER_SENSOR_FEEDBACK, MASTER_UNEXPECTED_SENSOR_FEEDBACK } master_req_type; typedef struct { master_req_type type; int arg1; int arg2; int arg3; } master_req; #endif
#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, MASTER_STOP_AT_SENSOR, MASTER_GOTO_LOCATION, MASTER_DUMP_VELOCITY_TABLE, MASTER_UPDATE_FEEDBACK_THRESHOLD, MASTER_UPDATE_FEEDBACK_ALPHA, MASTER_UPDATE_STOP_OFFSET, MASTER_UPDATE_CLEARANCE_OFFSET, MASTER_ACCELERATION_COMPLETE, MASTER_NEXT_NODE_ESTIMATE, MASTER_SENSOR_FEEDBACK, MASTER_UNEXPECTED_SENSOR_FEEDBACK } master_req_type; typedef struct { master_req_type type; int arg1; int arg2; } master_req; #endif
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+RelativeDates.h" #import "UIColor+AdjustColor.h" #import "UIColor+Serialization.h" /* TODOS: BKImageLoader -imageWithContentsOfURL:completionHandler: -imageWithContentsOFURLPath:completionHandler: UIImage: +imageWithContentsOfURLPath: NSURLRequest: +requestWithString: +requestWithURL: NSDate: -dateStringWithFormat: -dateStringWithStyle: */
// // 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+RelativeDates.h" #import "UIColor+AdjustColor.h" #import "UIColor+Serialization.h" #import "NSData+Base64Encoding.h" /* TODOS: BKImageLoader -imageWithContentsOfURL:completionHandler: -imageWithContentsOFURLPath:completionHandler: UIImage: +imageWithContentsOfURLPath: NSURLRequest: +requestWithString: +requestWithURL: NSDate: -dateStringWithFormat: -dateStringWithStyle: */
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, format); printTimeString(); printf(" "); vprintf(format, args); printf("\n"); if (flushAfterLog) { fflush(stdout); } va_end(args); }
#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, format); printTimeString(); putchar(' '); vprintf(format, args); putchar('\n'); if (flushAfterLog) { fflush(stdout); } va_end(args); }
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" "print (hwmess % (myrank, nprocs, procnm)) \n" ""; int main(int argc, char *argv[]) { int ierr, rank, size; ierr = MPI_Init(&argc, &argv); ierr = MPI_Comm_rank(MPI_COMM_WORLD, &rank); ierr = MPI_Comm_size(MPI_COMM_WORLD, &size); MPI_Barrier(MPI_COMM_WORLD); Py_Initialize(); PyRun_SimpleString(helloworld); Py_Finalize(); MPI_Barrier(MPI_COMM_WORLD); if (rank == 0) { printf("\n"); fflush(stdout); fflush(stderr); } MPI_Barrier(MPI_COMM_WORLD); Py_Initialize(); PyRun_SimpleString(helloworld); Py_Finalize(); MPI_Barrier(MPI_COMM_WORLD); ierr = MPI_Finalize(); return 0; }
/* * 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" "myrank = MPI.COMM_WORLD.Get_rank() \n" "nprocs = MPI.COMM_WORLD.Get_size() \n" "procnm = MPI.Get_processor_name() \n" "print (hwmess % (myrank, nprocs, procnm)) \n" ""; int main(int argc, char *argv[]) { int i,n=5; MPI_Init(&argc, &argv); for (i=0; i<n; i++) { Py_Initialize(); PyRun_SimpleString(helloworld); Py_Finalize(); } MPI_Finalize(); return 0; }
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_pebcessing(window, window_get_root_layer(window)); app_event_loop(); deinit_pebcessing(); deinit(); return 0; }
#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_stack_push(window, true); } static void deinit(void) { window_destroy(window); } int main(void) { init(); init_pebcessing(window, window_get_root_layer(window)); app_event_loop(); deinit_pebcessing(); deinit(); return 0; }
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 *data; }; struct sk_buff_head { struct list_head head; uint32_t qlen; pthread_mutex_t lock; }; struct sk_buff *alloc_skb(unsigned int size); void free_skb(struct sk_buff *skb); uint8_t *skb_push(struct sk_buff *skb, unsigned int len); uint8_t *skb_head(struct sk_buff *skb); void *skb_reserve(struct sk_buff *skb, unsigned int len); void skb_dst_set(struct sk_buff *skb, struct dst_entry *dst); static inline void skb_queue_init(struct sk_buff_head *list) { list_init(&list->head); list->qlen = 0; pthread_mutex_init(&list->lock, NULL); } #endif
#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 *data; }; struct sk_buff_head { struct list_head head; uint32_t qlen; pthread_mutex_t lock; }; struct sk_buff *alloc_skb(unsigned int size); void free_skb(struct sk_buff *skb); uint8_t *skb_push(struct sk_buff *skb, unsigned int len); uint8_t *skb_head(struct sk_buff *skb); void *skb_reserve(struct sk_buff *skb, unsigned int len); void skb_dst_set(struct sk_buff *skb, struct dst_entry *dst); static inline uint32_t skb_queue_len(const struct sk_buff_head *list) { return list->qlen; } static inline void skb_queue_init(struct sk_buff_head *list) { list_init(&list->head); list->qlen = 0; pthread_mutex_init(&list->lock, NULL); } #endif
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_module *cdev, void *priv); #define TTYS_DEF(name, uart) \ CHAR_DEV_DEF(name, uart_cdev_open, NULL, NULL, uart) #endif /* TTYS_H_ */
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 TIMEZONE_SIZE sizeof(struct timezone) #define FILEDES_SIZE sizeof(struct filedes) #define RLIMIT_SIZE sizeof(struct rlimit) #define UTSNAME_SIZE sizeof(struct utsname) #define POLLFD_SIZE sizeof(struct pollfd) #define RUSAGE_SIZE sizeof(struct rusage) #define MAX_STRING 1024 #define EIGHT 8 #define STATFS_ARRAY_SIZE (rval * sizeof(struct statfs)) #define PROC_SIZE sizeof(PROC)
#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 TIMEZONE_SIZE sizeof(struct timezone) #define FILEDES_SIZE sizeof(struct filedes) #define RLIMIT_SIZE sizeof(struct rlimit) #define UTSNAME_SIZE sizeof(struct utsname) #define POLLFD_SIZE sizeof(struct pollfd) #define RUSAGE_SIZE sizeof(struct rusage) #define MAX_STRING 1024 #define EIGHT 8 #define STATFS_ARRAY_SIZE (rval * sizeof(struct statfs)) #define PROC_SIZE sizeof(PROC) #define SIZE_T_SIZE sizeof(size_t) #define U_SHORT_SIZE sizeof(u_short)
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, * this list of conditions and the following disclaimer. * * - Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * - Neither the name of the University of Glasgow nor the names of its * contributors may be used to endorse or promote products derived from this * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ /* * 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_ */
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", &e); printf("Nota do exame: %.1f\n", e); if (e + m / 2.0 > 5.0) { printf("Aluno aprovado.\n"); } else { printf("Aluno reprovado.\n"); } printf("Media final: %.1f\n", (e + m) / 2.0); } else { printf("Aluno reprovado.\n"); } return 0; }
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 Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include <config.h> #include <glib.h> #include <glib/gi18n-lib.h> #include <gmodule.h> #include <gio/gio.h> #include "cc-empathy-accounts-panel.h" void g_io_module_load (GIOModule *module) { textdomain (GETTEXT_PACKAGE); cc_empathy_accounts_panel_register (module); } void g_io_module_unload (GIOModule *module) { }
/* -*- 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 Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include <config.h> #include <glib.h> #include <glib/gi18n-lib.h> #include <gmodule.h> #include <gio/gio.h> #include "cc-empathy-accounts-panel.h" void g_io_module_load (GIOModule *module) { cc_empathy_accounts_panel_register (module); } void g_io_module_unload (GIOModule *module) { }