This is an automated email from the git hooks/post-receive script.

hmmr-guest pushed a commit to branch master
in repository aghermann.

commit af055c53434ed385e7ca422c6131a2172e5a4a9d
Author: Andrei Zavada <[email protected]>
Date:   Sun Aug 18 02:17:29 2013 +0300

    lose ASPRINTF and some asserts
---
 upstream/src/aghermann/model/achermann-tunable.cc |    2 -
 upstream/src/aghermann/ui/ui.cc                   |    6 +-
 upstream/src/common/lang.hh                       |    6 +-
 upstream/src/common/libcommon.cc                  |    3 +-
 upstream/src/libmetrics/psd.cc                    |    1 -
 upstream/src/libmetrics/swu.cc                    |    1 -
 upstream/src/libsigfile/edf.cc                    |  101 ++++++++++-----------
 upstream/src/libsigfile/source-base.cc            |   10 +-
 upstream/src/libsigfile/tsv.cc                    |    2 +-
 9 files changed, 60 insertions(+), 72 deletions(-)

diff --git a/upstream/src/aghermann/model/achermann-tunable.cc 
b/upstream/src/aghermann/model/achermann-tunable.cc
index 062b032..4b319e2 100644
--- a/upstream/src/aghermann/model/achermann-tunable.cc
+++ b/upstream/src/aghermann/model/achermann-tunable.cc
@@ -10,8 +10,6 @@
  */
 
 
-
-#include <cassert>
 #include <gsl/gsl_rng.h>
 #include "aghermann/globals.hh"
 #include "achermann-tunable.hh"
diff --git a/upstream/src/aghermann/ui/ui.cc b/upstream/src/aghermann/ui/ui.cc
index d458cfb..9917699 100644
--- a/upstream/src/aghermann/ui/ui.cc
+++ b/upstream/src/aghermann/ui/ui.cc
@@ -216,7 +216,8 @@ pop_ok_message( GtkWindow *parent,
                va_start (ap, fmt);
 
                char *_;
-               assert (vasprintf( &_, fmt, ap) > 0);
+               if (vasprintf( &_, fmt, ap) <= 0)
+                       abort();
                va_end (ap);
                gtk_message_dialog_format_secondary_markup( W, "%s", _);
                free( (void*)_);
@@ -247,7 +248,8 @@ pop_question( GtkWindow* parent,
                va_start (ap, fmt);
 
                char *_;
-               assert (vasprintf( &_, fmt, ap) > 0);
+               if (vasprintf( &_, fmt, ap) <= 0)
+                       abort();
                va_end (ap);
                gtk_message_dialog_format_secondary_markup( W, "%s", _);
                free( (void*)_);
diff --git a/upstream/src/common/lang.hh b/upstream/src/common/lang.hh
index 7289741..04d7e5c 100644
--- a/upstream/src/common/lang.hh
+++ b/upstream/src/common/lang.hh
@@ -17,8 +17,7 @@
 #endif
 
 #include <unistd.h>
-#include <cassert>
-#include <memory>
+#include <stdio.h>
 
 using namespace std;
 
@@ -57,9 +56,6 @@ typedef unsigned long hash_t;
 #define unlikely(x)    __builtin_expect (!!(x), 0)
 
 
-#define ASPRINTF(...) \
-       assert (asprintf(__VA_ARGS__) > 0)
-
 #define FABUF printf( __FILE__ ":%d (%s): %s\n", __LINE__, __FUNCTION__, 
__buf__);
 #define FAFA printf( __FILE__ ":%d (%s): fafa\n", __LINE__, __FUNCTION__);
 
diff --git a/upstream/src/common/libcommon.cc b/upstream/src/common/libcommon.cc
index 45f8cae..2fcb16e 100644
--- a/upstream/src/common/libcommon.cc
+++ b/upstream/src/common/libcommon.cc
@@ -68,7 +68,8 @@ sasprintf( const char* fmt, ...)
        char *_;
        va_list ap;
        va_start (ap, fmt);
-       assert (vasprintf( &_, fmt, ap) > 0);
+       if (vasprintf( &_, fmt, ap) <= 0)
+               abort();
        va_end (ap);
 
        string ret {_};
diff --git a/upstream/src/libmetrics/psd.cc b/upstream/src/libmetrics/psd.cc
index e457bae..7f8dfbe 100644
--- a/upstream/src/libmetrics/psd.cc
+++ b/upstream/src/libmetrics/psd.cc
@@ -14,7 +14,6 @@
 
 
 #include <map>
-#include <cassert>
 #include <unistd.h>
 
 #if defined(_OPENMP)
diff --git a/upstream/src/libmetrics/swu.cc b/upstream/src/libmetrics/swu.cc
index 4c8dd11..6fc10fd 100644
--- a/upstream/src/libmetrics/swu.cc
+++ b/upstream/src/libmetrics/swu.cc
@@ -11,7 +11,6 @@
  */
 
 
-#include <cassert>
 #include <unistd.h>
 
 #include "common/lang.hh"
diff --git a/upstream/src/libsigfile/edf.cc b/upstream/src/libsigfile/edf.cc
index 6d393d2..e9c701c 100644
--- a/upstream/src/libsigfile/edf.cc
+++ b/upstream/src/libsigfile/edf.cc
@@ -758,63 +758,58 @@ details( const int which) const
                                ++n_dicontinuities;
                        prev_offset = cur_offset;
                }
-               char *outp;
-               ASPRINTF( &outp,
-                         "File\t: %s\n"
-                         " subtype\t: %s\n"
-                         " PatientID\t: %s\n"
-                         " RecordingID\t: %s\n"
-                         " Date\t: %s\n"
-                         " Time\t: %s\n"
-                         " # of channels\t: %zu\n"
-                         " # of records\t: %zu\n"
-                         " Record size\t: %g sec\n"
-                         " # of discontinuities\t: %zu\n"
-                         " # of embedded annotations\t: %zu\n",
-                         agh::str::homedir2tilda( filename()).c_str(),
-                         subtype_s(),
-                         patient_id(),
-                         trim( string (header.recording_id, 80)).c_str(),
-                         trim( string (header.recording_date, 8)).c_str(),
-                         trim( string (header.recording_time, 8)).c_str(),
-                         channels.size(),
-                         n_data_records,
-                         data_record_size,
-                         n_dicontinuities,
-                         common_annotations.size());
-               recv << outp;
-               free( outp);
+               recv << agh::str::sasprintf(
+                       "File\t: %s\n"
+                       " subtype\t: %s\n"
+                       " PatientID\t: %s\n"
+                       " RecordingID\t: %s\n"
+                       " Date\t: %s\n"
+                       " Time\t: %s\n"
+                       " # of channels\t: %zu\n"
+                       " # of records\t: %zu\n"
+                       " Record size\t: %g sec\n"
+                       " # of discontinuities\t: %zu\n"
+                       " # of embedded annotations\t: %zu\n",
+                       agh::str::homedir2tilda( filename()).c_str(),
+                       subtype_s(),
+                       patient_id(),
+                       trim( string (header.recording_id, 80)).c_str(),
+                       trim( string (header.recording_date, 8)).c_str(),
+                       trim( string (header.recording_time, 8)).c_str(),
+                       channels.size(),
+                       n_data_records,
+                       data_record_size,
+                       n_dicontinuities,
+                       common_annotations.size());
 
                if ( which & with_channels ) {
                        size_t i = 0;
                        for ( auto &H : channels ) {
-                               ASPRINTF( &outp,
-                                         " Channel %zu:\n"
-                                         "  Label\t: %s\n"
-                                         "  Transducer type\t: %s\n"
-                                         "  Physical dimension\t: %s\n"
-                                         "  Physical min\t: % g\n"
-                                         "  Physical max\t: % g\n"
-                                         "  Digital min\t: % d\n"
-                                         "  Digital max\t: % d\n"
-                                         "  Filtering info\t: %s\n"
-                                         "  Samples/rec\t: %zu\n"
-                                         "  Scale\t: %g\n"
-                                         "  (reserved)\t: %s\n",
-                                         ++i,
-                                         trim( string (H.header.label, 
16)).c_str(),
-                                         H.transducer_type.c_str(),
-                                         H.physical_dim.c_str(),
-                                         H.physical_min,
-                                         H.physical_max,
-                                         H.digital_min,
-                                         H.digital_max,
-                                         H.filtering_info.c_str(),
-                                         H.samples_per_record,
-                                         H.scale,
-                                         H.reserved.c_str());
-                               recv << outp;
-                               free( outp);
+                               recv << agh::str::sasprintf(
+                                       " Channel %zu:\n"
+                                       "  Label\t: %s\n"
+                                       "  Transducer type\t: %s\n"
+                                       "  Physical dimension\t: %s\n"
+                                       "  Physical min\t: % g\n"
+                                       "  Physical max\t: % g\n"
+                                       "  Digital min\t: % d\n"
+                                       "  Digital max\t: % d\n"
+                                       "  Filtering info\t: %s\n"
+                                       "  Samples/rec\t: %zu\n"
+                                       "  Scale\t: %g\n"
+                                       "  (reserved)\t: %s\n",
+                                       ++i,
+                                       trim( string (H.header.label, 
16)).c_str(),
+                                       H.transducer_type.c_str(),
+                                       H.physical_dim.c_str(),
+                                       H.physical_min,
+                                       H.physical_max,
+                                       H.digital_min,
+                                       H.digital_max,
+                                       H.filtering_info.c_str(),
+                                       H.samples_per_record,
+                                       H.scale,
+                                       H.reserved.c_str());
                        }
                }
 
diff --git a/upstream/src/libsigfile/source-base.cc 
b/upstream/src/libsigfile/source-base.cc
index e1bfce5..d4d5081 100644
--- a/upstream/src/libsigfile/source-base.cc
+++ b/upstream/src/libsigfile/source-base.cc
@@ -131,12 +131,10 @@ unsigned long
 SFilterPack::
 dirty_signature() const
 {
-       char *tmp;
-       ASPRINTF( &tmp, "%g%d%g%d%d",
-                 low_pass_cutoff, low_pass_order, high_pass_cutoff, 
high_pass_order, (int)notch_filter);
-       string t2 {tmp};
-       free( tmp);
-       return hash<string>() (t2);
+       return hash<string>() (
+               agh::str::sasprintf(
+                       "%g%d%g%d%d",
+                       low_pass_cutoff, low_pass_order, high_pass_cutoff, 
high_pass_order, (int)notch_filter));
 }
 
 
diff --git a/upstream/src/libsigfile/tsv.cc b/upstream/src/libsigfile/tsv.cc
index f52e92f..e737d9a 100644
--- a/upstream/src/libsigfile/tsv.cc
+++ b/upstream/src/libsigfile/tsv.cc
@@ -165,7 +165,7 @@ _parse_header()
 {
       // 1. read metadata
        regex_t RE;
-       assert (0 == regcomp( &RE, 
"^#\\W*([a-zA-Z_][a-zA-Z_0-9]*)\\W*(:|=)\\W*(.+)\\W*\n", REG_EXTENDED));
+       regcomp( &RE, "^#\\W*([a-zA-Z_][a-zA-Z_0-9]*)\\W*(:|=)\\W*(.+)\\W*\n", 
REG_EXTENDED);
        regmatch_t M[1+1+2];
 
        _line0_mallocked_bytes = 4096;

-- 
Alioth's /git/debian-med/git-commit-notice on 
/srv/git.debian.org/git/debian-med/aghermann.git

_______________________________________________
debian-med-commit mailing list
[email protected]
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/debian-med-commit

Reply via email to