From 62d4f0cdad8ce1bbac6ad2279c707a92e36ee57e Mon Sep 17 00:00:00 2001 From: Dave Davenport Date: Fri, 22 Aug 2014 09:26:46 +0200 Subject: [PATCH] Make rofi compile happily under clang. * Set features in configure.ac * use config.h file, instead of hardcoded _GNU_SOURCE in each c file. * Fix mix up unsigned/signed. --- configure.ac | 2 ++ include/rofi.h | 1 - source/dmenu-dialog.c | 3 +-- source/history.c | 3 ++- source/rofi.c | 3 +-- source/run-dialog.c | 3 +-- source/script-dialog.c | 2 +- source/ssh-dialog.c | 2 +- source/textbox.c | 2 +- source/xrmoptions.c | 6 +++--- 10 files changed, 13 insertions(+), 14 deletions(-) diff --git a/configure.ac b/configure.ac index 3b911af2..9e1a85f4 100644 --- a/configure.ac +++ b/configure.ac @@ -16,6 +16,8 @@ AC_PROG_CC AC_PROG_CC_STDC AM_PROG_CC_C_O +AC_USE_SYSTEM_EXTENSIONS + ## # I3 check ## diff --git a/include/rofi.h b/include/rofi.h index d3029fac..8951eb5b 100644 --- a/include/rofi.h +++ b/include/rofi.h @@ -1,6 +1,5 @@ #ifndef __SIMPLESWITCHER_H__ #define __SIMPLESWITCHER_H__ -#include #include #include diff --git a/source/dmenu-dialog.c b/source/dmenu-dialog.c index 0d6833d8..b18de68e 100644 --- a/source/dmenu-dialog.c +++ b/source/dmenu-dialog.c @@ -25,8 +25,7 @@ * */ - -#define _GNU_SOURCE +#include #include #include #include diff --git a/source/history.c b/source/history.c index 49c6c393..faacb001 100644 --- a/source/history.c +++ b/source/history.c @@ -24,9 +24,10 @@ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ +#include +#include #include #include -#include #include #include #include diff --git a/source/rofi.c b/source/rofi.c index 9a9513cd..6dab655f 100644 --- a/source/rofi.c +++ b/source/rofi.c @@ -25,8 +25,7 @@ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ - -#define _GNU_SOURCE +#include #include #include #include diff --git a/source/run-dialog.c b/source/run-dialog.c index bd692d03..1b7c5e90 100644 --- a/source/run-dialog.c +++ b/source/run-dialog.c @@ -24,8 +24,7 @@ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ - -#define _GNU_SOURCE +#include #include #include #include diff --git a/source/script-dialog.c b/source/script-dialog.c index 940f394a..acd5d4c9 100644 --- a/source/script-dialog.c +++ b/source/script-dialog.c @@ -26,7 +26,7 @@ */ -#define _GNU_SOURCE +#include #include #include #include diff --git a/source/ssh-dialog.c b/source/ssh-dialog.c index 348c9502..fc510159 100644 --- a/source/ssh-dialog.c +++ b/source/ssh-dialog.c @@ -25,7 +25,7 @@ * */ -#define _GNU_SOURCE +#include #include #include #include diff --git a/source/textbox.c b/source/textbox.c index 878f0c5a..5641a2bb 100644 --- a/source/textbox.c +++ b/source/textbox.c @@ -25,7 +25,7 @@ */ -#define _GNU_SOURCE +#include #include #include #include diff --git a/source/xrmoptions.c b/source/xrmoptions.c index cad69158..b0e02850 100644 --- a/source/xrmoptions.c +++ b/source/xrmoptions.c @@ -24,7 +24,7 @@ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ -#define _GNU_SOURCE +#include #include #include #include @@ -144,10 +144,10 @@ void parse_xresource_options ( Display *display ) xrmOptions[i].mem = ( *xrmOptions[i].str ); } else if ( xrmOptions[i].type == xrm_Number ) { - *xrmOptions[i].num = (unsigned int) g_ascii_strtoll ( xrmValue.addr, NULL, 10 ); + *xrmOptions[i].num = (unsigned int) strtoul ( xrmValue.addr, NULL, 10 ); } else if ( xrmOptions[i].type == xrm_SNumber ) { - *xrmOptions[i].num = (int) g_ascii_strtoull ( xrmValue.addr, NULL, 10 ); + *xrmOptions[i].snum = (int) strtol ( xrmValue.addr, NULL, 10 ); } else if ( xrmOptions[i].type == xrm_Boolean ) { if ( xrmValue.size > 0 && g_ascii_strncasecmp ( xrmValue.addr, "true", xrmValue.size ) == 0 ) {