Fixes patches
This commit is contained in:
211
mingw-w64-ag/0008-Fix-multiple-global-symbols-definitions.patch
Normal file
211
mingw-w64-ag/0008-Fix-multiple-global-symbols-definitions.patch
Normal file
@@ -0,0 +1,211 @@
|
||||
From 127b82d81ff41cc4ab26695f6c42af2d7443909f Mon Sep 17 00:00:00 2001
|
||||
From: Shlomi Fish <shlomif@shlomifish.org>
|
||||
Date: Wed, 15 Apr 2020 20:23:52 +0300
|
||||
Subject: [PATCH 8/9] Subject: [PATCH 8/9] Fix multiple global symbols
|
||||
definitions.
|
||||
|
||||
See the use of extern here:
|
||||
|
||||
* https://www.geeksforgeeks.org/understanding-extern-keyword-in-c/
|
||||
|
||||
* https://en.wikipedia.org/wiki/External_variable
|
||||
|
||||
*
|
||||
https://stackoverflow.com/questions/496448/how-to-correctly-use-the-extern-keyword-in-c
|
||||
---
|
||||
src/ignore.c | 2 ++
|
||||
src/ignore.h | 2 +-
|
||||
src/log.c | 1 +
|
||||
src/log.h | 2 +-
|
||||
src/options.c | 2 ++
|
||||
src/options.h | 2 +-
|
||||
src/search.c | 13 +++++++++++++
|
||||
src/search.h | 20 ++++++++++----------
|
||||
src/util.c | 2 ++
|
||||
src/util.h | 4 ++--
|
||||
10 files changed, 35 insertions(+), 15 deletions(-)
|
||||
|
||||
diff --git a/src/ignore.c b/src/ignore.c
|
||||
index fa41889..32464d7 100644
|
||||
--- a/src/ignore.c
|
||||
+++ b/src/ignore.c
|
||||
@@ -20,6 +20,8 @@
|
||||
const int fnmatch_flags = FNM_PATHNAME;
|
||||
#endif
|
||||
|
||||
+ignores *root_ignores;
|
||||
+
|
||||
/* TODO: build a huge-ass list of files we want to ignore by default (build cache stuff, pyc files, etc) */
|
||||
|
||||
const char *evil_hardcoded_ignore_files[] = {
|
||||
diff --git a/src/ignore.h b/src/ignore.h
|
||||
index 20d5a6a..8db0f37 100644
|
||||
--- a/src/ignore.h
|
||||
+++ b/src/ignore.h
|
||||
@@ -29,7 +29,7 @@ struct ignores {
|
||||
};
|
||||
typedef struct ignores ignores;
|
||||
|
||||
-ignores *root_ignores;
|
||||
+extern ignores *root_ignores;
|
||||
|
||||
extern const char *evil_hardcoded_ignore_files[];
|
||||
extern const char *ignore_pattern_files[];
|
||||
diff --git a/src/log.c b/src/log.c
|
||||
index 1481b6d..f6f4e9a 100644
|
||||
--- a/src/log.c
|
||||
+++ b/src/log.c
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "log.h"
|
||||
#include "util.h"
|
||||
|
||||
+pthread_mutex_t print_mtx = PTHREAD_MUTEX_INITIALIZER;
|
||||
static enum log_level log_threshold = LOG_LEVEL_ERR;
|
||||
|
||||
void set_log_level(enum log_level threshold) {
|
||||
diff --git a/src/log.h b/src/log.h
|
||||
index 85847ee..318622c 100644
|
||||
--- a/src/log.h
|
||||
+++ b/src/log.h
|
||||
@@ -9,7 +9,7 @@
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
|
||||
-pthread_mutex_t print_mtx;
|
||||
+extern pthread_mutex_t print_mtx;
|
||||
|
||||
enum log_level {
|
||||
LOG_LEVEL_DEBUG = 10,
|
||||
diff --git a/src/options.c b/src/options.c
|
||||
index a469845..0ff5526 100644
|
||||
--- a/src/options.c
|
||||
+++ b/src/options.c
|
||||
@@ -21,6 +21,8 @@ const char *color_line_number = "\033[1;33m"; /* bold yellow */
|
||||
const char *color_match = "\033[30;43m"; /* black with yellow background */
|
||||
const char *color_path = "\033[1;32m"; /* bold green */
|
||||
|
||||
+cli_options opts;
|
||||
+
|
||||
/* TODO: try to obey out_fd? */
|
||||
void usage(void) {
|
||||
printf("\n");
|
||||
diff --git a/src/options.h b/src/options.h
|
||||
index 990ce6a..09cd058 100644
|
||||
--- a/src/options.h
|
||||
+++ b/src/options.h
|
||||
@@ -101,7 +101,7 @@ typedef struct {
|
||||
} cli_options;
|
||||
|
||||
/* global options. parse_options gives it sane values, everything else reads from it */
|
||||
-cli_options opts;
|
||||
+extern cli_options opts;
|
||||
|
||||
typedef struct option option_t;
|
||||
|
||||
diff --git a/src/search.c b/src/search.c
|
||||
index ff5e386..8539bac 100644
|
||||
--- a/src/search.c
|
||||
+++ b/src/search.c
|
||||
@@ -2,6 +2,19 @@
|
||||
#include "print.h"
|
||||
#include "scandir.h"
|
||||
|
||||
+size_t alpha_skip_lookup[256];
|
||||
+size_t *find_skip_lookup;
|
||||
+uint8_t h_table[H_SIZE] __attribute__((aligned(64)));
|
||||
+
|
||||
+work_queue_t *work_queue = NULL;
|
||||
+work_queue_t *work_queue_tail = NULL;
|
||||
+int done_adding_files = 0;
|
||||
+pthread_cond_t files_ready = PTHREAD_COND_INITIALIZER;
|
||||
+pthread_mutex_t stats_mtx = PTHREAD_MUTEX_INITIALIZER;
|
||||
+pthread_mutex_t work_queue_mtx = PTHREAD_MUTEX_INITIALIZER;
|
||||
+
|
||||
+symdir_t *symhash = NULL;
|
||||
+
|
||||
void search_buf(const char *buf, const size_t buf_len,
|
||||
const char *dir_full_path) {
|
||||
int binary = -1; /* 1 = yes, 0 = no, -1 = don't know */
|
||||
diff --git a/src/search.h b/src/search.h
|
||||
index 1071114..a1bc5d7 100644
|
||||
--- a/src/search.h
|
||||
+++ b/src/search.h
|
||||
@@ -31,9 +31,9 @@
|
||||
#include "uthash.h"
|
||||
#include "util.h"
|
||||
|
||||
-size_t alpha_skip_lookup[256];
|
||||
-size_t *find_skip_lookup;
|
||||
-uint8_t h_table[H_SIZE] __attribute__((aligned(64)));
|
||||
+extern size_t alpha_skip_lookup[256];
|
||||
+extern size_t *find_skip_lookup;
|
||||
+extern uint8_t h_table[H_SIZE] __attribute__((aligned(64)));
|
||||
|
||||
struct work_queue_t {
|
||||
char *path;
|
||||
@@ -41,12 +41,12 @@ struct work_queue_t {
|
||||
};
|
||||
typedef struct work_queue_t work_queue_t;
|
||||
|
||||
-work_queue_t *work_queue;
|
||||
-work_queue_t *work_queue_tail;
|
||||
-int done_adding_files;
|
||||
-pthread_cond_t files_ready;
|
||||
-pthread_mutex_t stats_mtx;
|
||||
-pthread_mutex_t work_queue_mtx;
|
||||
+extern work_queue_t *work_queue;
|
||||
+extern work_queue_t *work_queue_tail;
|
||||
+extern int done_adding_files;
|
||||
+extern pthread_cond_t files_ready;
|
||||
+extern pthread_mutex_t stats_mtx;
|
||||
+extern pthread_mutex_t work_queue_mtx;
|
||||
|
||||
|
||||
/* For symlink loop detection */
|
||||
@@ -64,7 +64,7 @@ typedef struct {
|
||||
UT_hash_handle hh;
|
||||
} symdir_t;
|
||||
|
||||
-symdir_t *symhash;
|
||||
+extern symdir_t *symhash;
|
||||
|
||||
void search_buf(const char *buf, const size_t buf_len,
|
||||
const char *dir_full_path);
|
||||
diff --git a/src/util.c b/src/util.c
|
||||
index cb23914..0431148 100644
|
||||
--- a/src/util.c
|
||||
+++ b/src/util.c
|
||||
@@ -21,6 +21,8 @@
|
||||
} \
|
||||
return ptr;
|
||||
|
||||
+FILE *out_fd = NULL;
|
||||
+ag_stats stats;
|
||||
void *ag_malloc(size_t size) {
|
||||
void *ptr = malloc(size);
|
||||
CHECK_AND_RETURN(ptr)
|
||||
diff --git a/src/util.h b/src/util.h
|
||||
index 0c9b9b1..338b05f 100644
|
||||
--- a/src/util.h
|
||||
+++ b/src/util.h
|
||||
@@ -12,7 +12,7 @@
|
||||
#include "log.h"
|
||||
#include "options.h"
|
||||
|
||||
-FILE *out_fd;
|
||||
+extern FILE *out_fd;
|
||||
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
@@ -51,7 +51,7 @@ typedef struct {
|
||||
} ag_stats;
|
||||
|
||||
|
||||
-ag_stats stats;
|
||||
+extern ag_stats stats;
|
||||
|
||||
/* Union to translate between chars and words without violating strict aliasing */
|
||||
typedef union {
|
||||
--
|
||||
2.27.0
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From 9ded9f120b3961580ea7b08de54d6ee7dcd7b603 Mon Sep 17 00:00:00 2001
|
||||
From: Yasuhiro Matsumoto <mattn.jp@gmail.com>
|
||||
Date: Tue, 18 Aug 2020 12:42:13 +0900
|
||||
Subject: [PATCH] Use "<NUL" for "git config"
|
||||
Subject: [PATCH 9/9] win32: Use "<NUL" for "git config"
|
||||
|
||||
Git for Windows break terminal sequence after git-config.
|
||||
---
|
||||
@@ -6,7 +6,7 @@ _longname=the_silver_searcher
|
||||
pkgbase=mingw-w64-${_realname}
|
||||
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
|
||||
pkgver=2.2.0
|
||||
pkgrel=1
|
||||
pkgrel=2
|
||||
pkgdesc="The Silver Searcher: An attempt to make something better than ack, which itself is better than grep (mingw-w64)"
|
||||
arch=('any')
|
||||
url="https://geoff.greer.fm/ag"
|
||||
@@ -25,7 +25,8 @@ source=("${_realname}-${pkgver}.tar.gz"::"https://github.com/ggreer/the_silver_s
|
||||
"0005-lang-Add-to-make-Makefile-Makefile.Debug-Makefile.Re.patch"
|
||||
"0006-lang-Add-makepkg-PKGBUILD-diff-patch-in-install.patch"
|
||||
"0007-lang-Add-cmake-CMakeLists.txt-CMakeCache.txt.patch"
|
||||
"0008-win32-Use-NUL-for-git-config.patch")
|
||||
"0008-Fix-multiple-global-symbols-definitions.patch"
|
||||
"0009-win32-Use-NUL-for-git-config.patch")
|
||||
sha256sums=('6a0a19ca5e73b2bef9481c29a508d2413ca1a0a9a5a6b1bd9bbd695a7626cbf9'
|
||||
'9a3c1cc11547219f699e953e05c53b779f396b3d54d1410ae78a62f7550ca7c7'
|
||||
'45b75b164cb283c4324e27a46c744e0f2df86e4860506e9a4f2c1e98e848f51e'
|
||||
@@ -34,7 +35,8 @@ sha256sums=('6a0a19ca5e73b2bef9481c29a508d2413ca1a0a9a5a6b1bd9bbd695a7626cbf9'
|
||||
'fada103d58911e876af36e76675793764c4019e009351d615dede9c3ba7618d1'
|
||||
'b80e3efd854425e0e5df29cdf585b5132b5ab19e93c06713a4f4f0653bed5f84'
|
||||
'0659935f2f5e6c38260a603ef696de7e3e5d8dd7f62ec7711b58bd657ab5b511'
|
||||
'5d97da8a363346ac5e952e4ea00c0d70406392a4b6de1adeac029f7814cfac77')
|
||||
'ae8cc32f94432b6482a379b0fdfc4095c836f3a947363a101ca69362b5a7f0a1'
|
||||
'6d98aedccb3c380fe2069373e8b45ddcc8d6c4936cb37da7967a7d5d29557164')
|
||||
|
||||
# Helper macros to help make tasks easier #
|
||||
apply_patch_with_msg() {
|
||||
@@ -55,7 +57,9 @@ prepare() {
|
||||
0004-lang-Add-autotools-ac-am-in-m4-pc.patch \
|
||||
0005-lang-Add-to-make-Makefile-Makefile.Debug-Makefile.Re.patch \
|
||||
0006-lang-Add-makepkg-PKGBUILD-diff-patch-in-install.patch \
|
||||
0007-lang-Add-cmake-CMakeLists.txt-CMakeCache.txt.patch
|
||||
0007-lang-Add-cmake-CMakeLists.txt-CMakeCache.txt.patch \
|
||||
0008-Fix-multiple-global-symbols-definitions.patch \
|
||||
0009-win32-Use-NUL-for-git-config.patch
|
||||
|
||||
# configure.ac forces -O2, so force it to -O0 if debugging.
|
||||
if check_option "debug" "y"; then
|
||||
|
||||
Reference in New Issue
Block a user