1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2024-11-18 13:54:36 -05:00

Tried to fix strlen on NULL

This commit is contained in:
Dave Davenport 2016-03-12 14:00:19 +01:00
parent abe44475fc
commit 545c423b61
4 changed files with 44 additions and 1 deletions

View file

@ -13,6 +13,9 @@ bin_PROGRAMS=rofi
dist_bin_SCRIPTS=script/rofi-sensible-terminal dist_bin_SCRIPTS=script/rofi-sensible-terminal
nodist_rofi_SOURCES=\
$(top_builddir)/gitconfig.h
rofi_SOURCES=\ rofi_SOURCES=\
source/rofi.c\ source/rofi.c\
source/view.c\ source/view.c\
@ -122,6 +125,7 @@ EXTRA_DIST=\
INSTALL.md\ INSTALL.md\
AUTHORS\ AUTHORS\
doc/rofi.doxy.in\ doc/rofi.doxy.in\
script/get_git_rev.sh\
Changelog Changelog
## ##
@ -305,3 +309,13 @@ ohcount: $(rofi_SOURCES)
doxy: doc/rofi.doxy $(rofi_SOURCES) doxy: doc/rofi.doxy $(rofi_SOURCES)
doxygen $(top_builddir)/doc/rofi.doxy doxygen $(top_builddir)/doc/rofi.doxy
clean-local:
-rm $(top_builddir)/gitconfig.h
$(top_builddir)/gitconfig.h: .FORCE
$(top_srcdir)/script/get_git_rev.sh $(top_srcdir) $(top_builddir)/gitconfig.h
$(rofi_SOURCES): $(top_builddir)/gitconfig.h
.PHONY: .FORCE
.FORCE:

21
script/get_git_rev.sh Executable file
View file

@ -0,0 +1,21 @@
#!/usr/bin/env bash
DIR=$1
FILE=$2
if [ -d "${DIR}/.git/" ]
then
echo -n "#define GIT_VERSION \"" > ${FILE}.tmp
REV=$(git log -1 --pretty=tformat:%h)
echo -n "${REV}" >> ${FILE}.tmp
echo "\"" >> ${FILE}.tmp
else
echo "#undef GIT_VERSION" > ${FILE}.tmp
fi
if ! diff ${FILE}.tmp ${FILE} > /dev/null
then
mv ${FILE}.tmp ${FILE}
else
rm ${FILE}.tmp
fi

View file

@ -419,7 +419,7 @@ static void _window_mode_load_data ( Mode *sw, unsigned int cd )
&& !client_has_window_type ( c, xcb->ewmh._NET_WM_WINDOW_TYPE_DESKTOP ) && !client_has_window_type ( c, xcb->ewmh._NET_WM_WINDOW_TYPE_DESKTOP )
&& !client_has_state ( c, xcb->ewmh._NET_WM_STATE_SKIP_PAGER ) && !client_has_state ( c, xcb->ewmh._NET_WM_STATE_SKIP_PAGER )
&& !client_has_state ( c, xcb->ewmh._NET_WM_STATE_SKIP_TASKBAR ) ) { && !client_has_state ( c, xcb->ewmh._NET_WM_STATE_SKIP_TASKBAR ) ) {
classfield = MAX ( classfield, strlen ( c->class ) ); classfield = MAX ( classfield, (c->class != NULL)?(strlen ( c->class )):0 );
if ( client_has_state ( c, xcb->ewmh._NET_WM_STATE_DEMANDS_ATTENTION ) ) { if ( client_has_state ( c, xcb->ewmh._NET_WM_STATE_DEMANDS_ATTENTION ) ) {
c->demands = TRUE; c->demands = TRUE;

View file

@ -63,6 +63,8 @@
#include "view.h" #include "view.h"
#include "view-internal.h" #include "view-internal.h"
#include "gitconfig.h"
// Pidfile. // Pidfile.
char *pidfile = NULL; char *pidfile = NULL;
const char *cache_dir = NULL; const char *cache_dir = NULL;
@ -303,6 +305,9 @@ static void help ( G_GNUC_UNUSED int argc, char **argv )
printf ( "\n" ); printf ( "\n" );
printf ( "For more information see: man rofi\n" ); printf ( "For more information see: man rofi\n" );
printf ( "Version: "VERSION "\n" ); printf ( "Version: "VERSION "\n" );
#ifdef GIT_VERSION
printf ( "Git: "GIT_VERSION "\n");
#endif
printf ( "Bugreports: "PACKAGE_BUGREPORT "\n" ); printf ( "Bugreports: "PACKAGE_BUGREPORT "\n" );
} }
@ -605,6 +610,9 @@ int main ( int argc, char *argv[] )
// Version // Version
if ( find_arg ( "-v" ) >= 0 || find_arg ( "-version" ) >= 0 ) { if ( find_arg ( "-v" ) >= 0 || find_arg ( "-version" ) >= 0 ) {
fprintf ( stdout, "Version: "VERSION "\n" ); fprintf ( stdout, "Version: "VERSION "\n" );
#ifdef GIT_VERSION
fprintf ( stdout, "Git: "GIT_VERSION "\n");
#endif
exit ( EXIT_SUCCESS ); exit ( EXIT_SUCCESS );
} }