Commit 13c974ad authored by mjona's avatar mjona

Fixed realloc error handling in timer_group.c; changed the interval member in...

Fixed realloc error handling in timer_group.c; changed the interval member in the TIMER_GROUP structure from int* to int.

git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@1185 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
parent 3ede2a57
# Makefile.in generated by automake 1.11.3 from Makefile.am.
# Makefile.in generated by automake 1.11.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
# Foundation, Inc.
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
# Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
......@@ -47,12 +47,9 @@ DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
TODO config.guess config.rpath config.sub depcomp install-sh \
ltmain.sh missing mkinstalldirs
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/curses.m4 $(top_srcdir)/ax_python_devel.m4 \
$(top_srcdir)/drivers.m4 $(top_srcdir)/plugins.m4 \
$(top_srcdir)/configure.in
am__aclocal_m4_deps = $(top_srcdir)/curses.m4 \
$(top_srcdir)/ax_python_devel.m4 $(top_srcdir)/drivers.m4 \
$(top_srcdir)/plugins.m4 $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
......@@ -100,16 +97,12 @@ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
am__remove_distdir = \
if test -d "$(distdir)"; then \
find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
&& rm -rf "$(distdir)" \
|| { sleep 5 && rm -rf "$(distdir)"; }; \
else :; fi
{ test ! -d "$(distdir)" \
|| { find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
&& rm -fr "$(distdir)"; }; }
DIST_ARCHIVES = $(distdir).tar.gz
GZIP_ENV = --best
distuninstallcheck_listfiles = find . -type f -print
am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
| sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$'
distcleancheck_listfiles = find . -type f -print
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
......@@ -130,7 +123,6 @@ DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DRIVERS = @DRIVERS@
DRVLIBS = @DRVLIBS@
DSYMUTIL = @DSYMUTIL@
......@@ -158,7 +150,6 @@ LN_S = @LN_S@
LTLIBICONV = @LTLIBICONV@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@
......@@ -202,7 +193,6 @@ abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
......@@ -235,6 +225,7 @@ libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
lt_ECHO = @lt_ECHO@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
......@@ -432,7 +423,7 @@ all: config.h
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
am--refresh: Makefile
am--refresh:
@:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
......@@ -468,8 +459,10 @@ $(ACLOCAL_M4): $(am__aclocal_m4_deps)
$(am__aclocal_m4_deps):
config.h: stamp-h1
@if test ! -f $@; then rm -f stamp-h1; else :; fi
@if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) stamp-h1; else :; fi
@if test ! -f $@; then \
rm -f stamp-h1; \
$(MAKE) $(AM_MAKEFLAGS) stamp-h1; \
else :; fi
stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
@rm -f stamp-h1
......@@ -524,7 +517,7 @@ clean-binPROGRAMS:
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
echo " rm -f" $$list; \
rm -f $$list
lcd4linux$(EXEEXT): $(lcd4linux_OBJECTS) $(lcd4linux_DEPENDENCIES) $(EXTRA_lcd4linux_DEPENDENCIES)
lcd4linux$(EXEEXT): $(lcd4linux_OBJECTS) $(lcd4linux_DEPENDENCIES)
@rm -f lcd4linux$(EXEEXT)
$(lcd4linux_LINK) $(lcd4linux_OBJECTS) $(lcd4linux_LDADD) $(LIBS)
......@@ -790,11 +783,7 @@ dist-gzip: distdir
$(am__remove_distdir)
dist-bzip2: distdir
tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2
$(am__remove_distdir)
dist-lzip: distdir
tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz
tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
$(am__remove_distdir)
dist-lzma: distdir
......@@ -802,7 +791,7 @@ dist-lzma: distdir
$(am__remove_distdir)
dist-xz: distdir
tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
tardir=$(distdir) && $(am__tar) | xz -c >$(distdir).tar.xz
$(am__remove_distdir)
dist-tarZ: distdir
......@@ -833,8 +822,6 @@ distcheck: dist
bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
*.tar.lzma*) \
lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\
*.tar.lz*) \
lzip -dc $(distdir).tar.lz | $(am__untar) ;;\
*.tar.xz*) \
xz -dc $(distdir).tar.xz | $(am__untar) ;;\
*.tar.Z*) \
......@@ -854,7 +841,6 @@ distcheck: dist
&& am__cwd=`pwd` \
&& $(am__cd) $(distdir)/_build \
&& ../configure --srcdir=.. --prefix="$$dc_install_base" \
$(AM_DISTCHECK_CONFIGURE_FLAGS) \
$(DISTCHECK_CONFIGURE_FLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
......@@ -883,16 +869,8 @@ distcheck: dist
list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
distuninstallcheck:
@test -n '$(distuninstallcheck_dir)' || { \
echo 'ERROR: trying to run $@ with an empty' \
'$$(distuninstallcheck_dir)' >&2; \
exit 1; \
}; \
$(am__cd) '$(distuninstallcheck_dir)' || { \
echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \
exit 1; \
}; \
test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \
@$(am__cd) '$(distuninstallcheck_dir)' \
&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
|| { echo "ERROR: files left after uninstall:" ; \
if test -n "$(DESTDIR)"; then \
echo " (check DESTDIR support)"; \
......@@ -925,15 +903,10 @@ install-am: all-am
installcheck: installcheck-am
install-strip:
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
......@@ -1023,20 +996,20 @@ uninstall-am: uninstall-binPROGRAMS
.PHONY: CTAGS GTAGS all all-am am--refresh check check-am clean \
clean-binPROGRAMS clean-generic clean-libtool ctags dist \
dist-all dist-bzip2 dist-gzip dist-lzip dist-lzma dist-shar \
dist-tarZ dist-xz dist-zip distcheck distclean \
distclean-compile distclean-generic distclean-hdr \
distclean-libtool distclean-tags distcleancheck distdir \
distuninstallcheck dvi dvi-am html html-am info info-am \
install install-am install-binPROGRAMS install-data \
install-data-am install-dvi install-dvi-am install-exec \
install-exec-am install-html install-html-am install-info \
install-info-am install-man install-pdf install-pdf-am \
install-ps install-ps-am install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags uninstall uninstall-am uninstall-binPROGRAMS
dist-all dist-bzip2 dist-gzip dist-lzma dist-shar dist-tarZ \
dist-xz dist-zip distcheck distclean distclean-compile \
distclean-generic distclean-hdr distclean-libtool \
distclean-tags distcleancheck distdir distuninstallcheck dvi \
dvi-am html html-am info info-am install install-am \
install-binPROGRAMS install-data install-data-am install-dvi \
install-dvi-am install-exec install-exec-am install-html \
install-html-am install-info install-info-am install-man \
install-pdf install-pdf-am install-ps install-ps-am \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
pdf pdf-am ps ps-am tags uninstall uninstall-am \
uninstall-binPROGRAMS
# create subversion version
......
This diff is collapsed.
This diff is collapsed.
......@@ -203,7 +203,7 @@ static void drv_PICGraphic_blit(const int row, const int col, const int height,
delayDone = 0;
int row8, height8;
row8 = 8 * (row / 8);
height8 = 8 * (height / 8) + ! !(height % 8);
height8 = 8 * (height / 8) + !!(height % 8);
info("sending blit");
cmd[0] = 'b';
cmd[1] = row8;
......
......@@ -239,7 +239,7 @@ int timer_add(void (*callback) (void *data), void *data, const int interval, con
/* no inactive timers (or none at all) found, so we have to add a
new timer slot */
if (timer == nTimers) {
TIMER *tmp;
TIMER *tmp;
if ((tmp = realloc(Timers, (nTimers + 1) * sizeof(*Timers))) == NULL) {
/* signal unsuccessful timer creation */
......
......@@ -75,10 +75,10 @@
/* structure for storing all relevant data of a single timer group */
typedef struct TIMER_GROUP {
/* pointer to the group's triggering interval in milliseconds;
/* group's triggering interval in milliseconds;
this will be used to identify a specific timer group and also
as callback data for the underlying generic timer */
int *interval;
int interval;
/* marks timer group as being active (so it will get processed) or
inactive (which means the timer group has been deleted and its
......@@ -144,7 +144,7 @@ int timer_group_exists(const int interval)
if (TimerGroups[group].active == TIMER_INACTIVE)
continue;
if (*TimerGroups[group].interval == interval) {
if (TimerGroups[group].interval == interval) {
/* matching timer group found, so signal success by returning
a value of 1 */
return 1;
......@@ -192,23 +192,18 @@ int timer_add_group(const int interval)
/* no inactive timer groups (or none at all) found, so we have to
add a new timer group slot */
if (group == nTimerGroups) {
TIMER_GROUP *tmp;
TIMER_GROUP *tmp;
if ((tmp = realloc(TimerGroups, (nTimerGroups + 1) * sizeof(*TimerGroups))) == NULL) {
/* signal unsuccessful timer group creation */
return -1;
}
TimerGroups = tmp;
nTimerGroups++;
if ((TimerGroups[group].interval = malloc(sizeof(int))) == NULL) {
/* signal unsuccessful timer group creation */
return -1;
}
}
/* initialize timer group's interval */
*TimerGroups[group].interval = interval;
TimerGroups[group].interval = interval;
/* set timer group to active so that it is processed and not
overwritten by the memory optimization routine above */
......@@ -216,7 +211,7 @@ int timer_add_group(const int interval)
/* finally, request a generic timer that calls this group and
signal success or failure */
return timer_add(timer_process_group, TimerGroups[group].interval, interval, 0);
return timer_add(timer_process_group, &TimerGroups[group].interval, interval, 0);
}
......@@ -260,14 +255,14 @@ int timer_remove_group(const int interval)
if (TimerGroups[group].active == TIMER_INACTIVE)
continue;
if (*TimerGroups[group].interval == interval) {
if (TimerGroups[group].interval == interval) {
/* we have found the timer group slot, so mark it as being
inactive; we will not actually delete the slot, so its
allocated memory may be re-used */
TimerGroups[group].active = TIMER_INACTIVE;
/* remove the generic timer that calls this group */
if (timer_remove(timer_process_group, TimerGroups[group].interval)) {
if (timer_remove(timer_process_group, &TimerGroups[group].interval)) {
/* signal successful removal of timer group */
return 0;
} else {
......@@ -422,8 +417,8 @@ int timer_add_widget(void (*callback) (void *data), void *data, const int interv
/* no inactive widget slots (or none at all) found, so we have to
add a new widget slot */
if (widget == nTimerGroupWidgets) {
TIMER_GROUP_WIDGET *tmp;
TIMER_GROUP_WIDGET *tmp;
if ((tmp = realloc(TimerGroupWidgets, (nTimerGroupWidgets + 1) * sizeof(*TimerGroupWidgets))) == NULL) {
/* signal unsuccessful creation of widget slot */
return -1;
......@@ -509,11 +504,7 @@ void timer_exit_group(void)
/* loop through all timer groups and remove them one by one */
for (group = 0; group < nTimerGroups; group++) {
/* remove generic timer */
timer_remove(timer_process_group, TimerGroups[group].interval);
/* free memory allocated for callback data (i.e. the group's
triggering interval in milliseconds) */
free(TimerGroups[group].interval);
timer_remove(timer_process_group, &TimerGroups[group].interval);
}
/* reset number of allocated timer groups */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment