summaryrefslogtreecommitdiff
path: root/src/common.c
diff options
context:
space:
mode:
authorFrank Scheelen <fscheelen@wise-guys.nl>2003-12-05 16:51:06 +0000
committerCaolán McNamara <caolanm@redhat.com>2011-09-19 14:21:35 +0100
commit30c0488cae69e85ea329c770cbc92a3f34d23e5a (patch)
tree7de0d3372b54e65c87d59df91185c75b6be80906 /src/common.c
parent28b7702be143f6230c11b1fecc9fff0e4bbfbe9e (diff)
Released libtextcat 2.2
Diffstat (limited to 'src/common.c')
-rw-r--r--src/common.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/common.c b/src/common.c
index 054dae4..f4ea1eb 100644
--- a/src/common.c
+++ b/src/common.c
@@ -32,9 +32,17 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include <stdio.h>
+#ifdef HAVE_STDLIB_H
#include <stdlib.h>
+#endif
+#ifdef HAVE_STRINGS_H
+#include <strings.h>
+#endif
+#ifdef HAVE_STRING_H
#include <string.h>
+#endif
#include <stdarg.h>
#include <ctype.h>
#include "common.h"
@@ -118,6 +126,7 @@ extern void* wg_realloc( void *ptr, size_t size )
}
result = realloc( ptr, size );
+
if ( !result ) {
wgmem_error( "Error while reallocing %u bytes.\n", size );
}
@@ -285,13 +294,15 @@ unsigned int wg_split( char **result, char *dest, char *src, int maxsegments )
extern void wg_timerstart(wgtimer_t *t)
{
+#ifdef HAVE_GETTIMEOFDAY
gettimeofday( &(t->start), NULL );
+#endif
}
-
extern uint4 wg_timerstop(wgtimer_t *t)
{
+#ifdef HAVE_GETTIMEOFDAY
uint4 result;
gettimeofday( &(t->stop), NULL );
result = (t->stop.tv_sec - t->start.tv_sec) * 1000000 +
@@ -301,6 +312,9 @@ extern uint4 wg_timerstop(wgtimer_t *t)
t->start.tv_usec = t->stop.tv_usec;
return result;
+#else
+ return 0;
+#endif
}