From 5053702af19cf523f880cbc013c893dfd23dc73f Mon Sep 17 00:00:00 2001 From: seife Date: Sun, 3 Jan 2010 12:45:27 +0000 Subject: [PATCH] sectionsd: get rid of exceptions Fortunately, those exceptions do not trigger. If they did, they would kill the box as an unhandled exception would lead to an unclean shutdown of the drivers anyway, so we can just do without them as in the rest of neutrino. git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@134 e54a6e83-5905-42d5-8d5c-058d10e6a962 --- src/sectionsd/Makefile.am | 2 ++ src/sectionsd/sectionsd.cpp | 32 +++++++++++++++++++++++++------- 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/src/sectionsd/Makefile.am b/src/sectionsd/Makefile.am index 778506c2d..9af1d2465 100644 --- a/src/sectionsd/Makefile.am +++ b/src/sectionsd/Makefile.am @@ -9,6 +9,8 @@ INCLUDES = \ AM_CPPFLAGS = -D DO_NOT_INCLUDE_STUFF_NOT_NEEDED_FOR_SECTIONSD +AM_CXXFLAGS = -fno-rtti -fno-exceptions + noinst_LIBRARIES = libsectionsd.a libsectionsd_a_SOURCES = sectionsd.cpp dmxapi.cpp debug.cpp dmx.cpp SIsections.cpp SIevents.cpp SIutils.cpp SIlanguage.cpp edvbstring.cpp diff --git a/src/sectionsd/sectionsd.cpp b/src/sectionsd/sectionsd.cpp index 8f12ebcf4..c1c5caa7e 100644 --- a/src/sectionsd/sectionsd.cpp +++ b/src/sectionsd/sectionsd.cpp @@ -719,7 +719,8 @@ static void addEvent(const SIevent &evt, const unsigned table_id, const time_t z if (!eptr) { printf("[sectionsd::addEvent] new SIevent1 failed.\n"); - throw std::bad_alloc(); + return; + //throw std::bad_alloc(); } SIeventPtr e(eptr); @@ -854,7 +855,8 @@ static void addEvent(const SIevent &evt, const unsigned table_id, const time_t z { printf("[sectionsd::addEvent] new SIevent failed.\n"); unlockEvents(); - throw std::bad_alloc(); + return; + // throw std::bad_alloc(); } SIeventPtr e(eptr); @@ -987,7 +989,8 @@ static void addNVODevent(const SIevent &evt) if (!eptr) { printf("[sectionsd::addNVODevent] new SIevent failed.\n"); - throw std::bad_alloc(); + return; + //throw std::bad_alloc(); } SIeventPtr e(eptr); @@ -1561,7 +1564,8 @@ static bool addService(const SIservice &s, const int is_actual) if (!sp) { printf("[sectionsd::addService] new SIservice failed.\n"); - throw std::bad_alloc(); + return false; + //throw std::bad_alloc(); } SIservicePtr sptr(sp); @@ -5017,10 +5021,12 @@ bool sectionsd_parse_command(CBasicMessage::Header &rmsg, int connfd) dputs("Unknown format or version of request!"); } } // try +#ifdef WITH_EXCEPTIONS catch (std::exception& e) { fprintf(stderr, "Caught std-exception in connection-thread %s!\n", e.what()); } +#endif catch (...) { fprintf(stderr, "Caught exception in connection-thread!\n"); @@ -6373,7 +6379,11 @@ static void *sdtThread(void *) int rc; if (static_buf == NULL) - throw std::bad_alloc(); + { + xprintf("%s: could not allocate static_buf\n", __FUNCTION__); + pthread_exit(NULL); + //throw std::bad_alloc(); + } #ifdef UPDATE_NETWORKS for ( i = 0; i < MAX_SDTs; i++) messaging_sdt_tid[i] = 0; @@ -7184,7 +7194,11 @@ static void *eitThread(void *) int rc; if (static_buf == NULL) - throw std::bad_alloc(); + { + xprintf("%s: could not allocate static_buf\n", __FUNCTION__); + pthread_exit(NULL); + //throw std::bad_alloc(); + } dmxEIT.start(); // -> unlock if (!scanning) @@ -7503,7 +7517,11 @@ static void *cnThread(void *) int rc; if (static_buf == NULL) - throw std::bad_alloc(); + { + xprintf("%s: could not allocate static_buf\n", __FUNCTION__); + pthread_exit(NULL); + //throw std::bad_alloc(); + } dmxCN.start(); // -> unlock if (!scanning)