Skip to content

Commit

Permalink
using GNU extensions re-done
Browse files Browse the repository at this point in the history
git-svn-id: https://ggnfs.svn.sourceforge.net/svnroot/ggnfs/trunk@208 80ef69ca-9341-0410-9d60-8acc7774fa31
  • Loading branch information
inept committed Feb 2, 2006
1 parent cb679ca commit fbcf3e2
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 34 deletions.
7 changes: 7 additions & 0 deletions Changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
02/02/06 (relf)
* NEED_ASPRINTF, NEED_GETLINE are replaced with GGNFS_GNU_MISSING
which is now defined in ggnfs.h
* fixed all affected headers
* WARNING: if GNU extensions are used, <stdio.h> should not be included directly
but through ggnfs.h or at least after it

12/12/05 (trilliwig)
* Header file fixes for Linux.

Expand Down
2 changes: 1 addition & 1 deletion doc/ggnfs-doc/ggnfs-doc.tex
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
\documentclass[12pt]{article}
\usepackage{amsmath,amssymb}
\usepackage{fancybox}\usepackage{epsfig}\usepackage{psfig}
%\usepackage{fancybox}\usepackage{epsfig}\usepackage{psfig}
%\usepackage{showkeys}
\textwidth 6.5in\oddsidemargin 0in
\textheight 9in\topmargin -0.5in
Expand Down
7 changes: 7 additions & 0 deletions include/ggnfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,15 @@ extern "C" {
#define _USE_MATH_DEFINES
#define __STDC_FORMAT_MACROS

#if defined( __CYGWIN__ ) || defined( _MSC_VER ) || defined(__MINGW32__) || defined (MINGW32) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)
#define GGNFS_GNU_MISSING
#else
#define _GNU_SOURCE
#endif

#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include <math.h>

typedef unsigned char uchar;
Expand Down
13 changes: 3 additions & 10 deletions src/if.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
#pragma warning (disable: 4996) /* warning C4996: 'function' was declared deprecated */
#endif

#include "if.h"

#include <time.h>

#if defined (__MINGW32__) || defined (MINGW32)
Expand All @@ -29,14 +31,9 @@
#include <sys/times.h>
#endif

#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <gmp.h>
#include <limits.h>
#include "if.h"


int verbose = 0;
static size_t used_cols, ncol = 80;
Expand Down Expand Up @@ -397,7 +394,7 @@ int read_u32(FILE * ifile, u32_t * buffer, size_t count)

#endif

#ifdef NEED_GETLINE
#ifdef GGNFS_GNU_MISSING
#define GETL_INCR 128
/****************************************************/
ssize_t getline(char **lineptr, size_t * n, FILE * stream)
Expand All @@ -424,9 +421,7 @@ ssize_t getline(char **lineptr, size_t * n, FILE * stream)
}
return rv;
}
#endif

#ifdef NEED_ASPRINTF
/****************************************************/
int vasprintf(char **ptr, const char *template, va_list ap)
/****************************************************/
Expand All @@ -444,9 +439,7 @@ int vasprintf(char **ptr, const char *template, va_list ap)
free(*ptr);
}
}
#endif

#ifdef NEED_ASPRINTF
/****************************************************/
int asprintf(char **ptr, const char *template, ...)
/****************************************************/
Expand Down
15 changes: 1 addition & 14 deletions src/if.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,8 @@
#ifndef _IF_H
#define _IF_H

#include <gmp.h>
#include <stdlib.h>
#include <stdarg.h>
#include <stdio.h>

#include "ggnfs.h"

#if defined( __CYGWIN__ ) || defined( _MSC_VER ) || defined(__MINGW32__) || defined (MINGW32) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)
#define NEED_GETLINE
#define NEED_ASPRINTF
#endif

void*xmalloc(size_t size);
void*xvalloc(size_t size);
void*xcalloc(size_t n,size_t s);
Expand Down Expand Up @@ -65,12 +55,9 @@ int skip_blank_comments(char**,size_t*,FILE*);
before including stdio.h, but that seems to break things,
so here we go:
*/
#ifdef NEED_ASPRINTF
#ifdef GGNFS_GNU_MISSING
int asprintf(char**, const char*, ...);
int vasprintf(char **, const char *, va_list);
#endif

#ifdef NEED_GETLINE
ssize_t getline(char**,size_t*,FILE*);
#endif

Expand Down
3 changes: 2 additions & 1 deletion src/lasieve4/gnfs-lasieve4e.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
02111-1307, USA.
*/

#include "lasieve.h"

#include <assert.h>
#include <stdio.h>
#include <sys/types.h>
Expand Down Expand Up @@ -46,7 +48,6 @@
#include <signal.h>
#include <setjmp.h>

#include "lasieve.h"

#if defined (_MSC_VER)
#define GGNFS_x86_32_MSCASM_MMX
Expand Down
5 changes: 0 additions & 5 deletions src/lasieve4/lasieve.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@
#ifndef _LASIEVE_H
#define _LASIEVE_H

#include <gmp.h>
#include <stdlib.h>
#include <stdarg.h>
#include <stdio.h>

#include "ggnfs.h"
#include "asm/siever-config.h"
#include "if.h"
Expand Down
1 change: 0 additions & 1 deletion src/pol5/pol51m0b.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#define ZEIT
*/

#include <stdio.h>
#include "ggnfs.h"

#if defined(HAVE_ASM_INTEL) || defined(HAVE_ASM_ALPHA)
Expand Down
1 change: 0 additions & 1 deletion src/pol5/pol51m0n.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#define ZEIT
*/

#include <stdio.h>
#include "ggnfs.h"

#if defined(HAVE_ASM_INTEL) || defined(HAVE_ASM_ALPHA)
Expand Down
1 change: 0 additions & 1 deletion src/pol5/pol51opt.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#define ZEIT
*/

#include <stdio.h>
#include "ggnfs.h"

#include <math.h>
Expand Down

0 comments on commit fbcf3e2

Please sign in to comment.