X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fgroff-font.c;h=2787a793c9d35a53c34aa686f7c83b8bad6fd1ba;hb=3bd4593ef9a57f23062c61ec465389f749ba3089;hp=12572cf4297000c13151aedcab0ee12818efc724;hpb=ecd77539d8be24ba673becc0f25bb453f4e2944d;p=pspp-builds.git diff --git a/src/groff-font.c b/src/groff-font.c index 12572cf4..2787a793 100644 --- a/src/groff-font.c +++ b/src/groff-font.c @@ -18,7 +18,8 @@ 02111-1307, USA. */ #include -#include +#include "font.h" +#include "error.h" #include #include #include @@ -27,7 +28,6 @@ #include "alloc.h" #include "error.h" #include "filename.h" -#include "font.h" #include "hash.h" #include "pool.h" #include "str.h" @@ -38,7 +38,7 @@ int font_number_to_index (int); int space_index; static int font_msg (int, const char *,...) - __attribute__ ((format (printf, 2, 3))); + PRINTF_FORMAT (2, 3); static void scan_badchars (char *, int); static void dup_char_metric (struct font_desc * font, int dest, int src); static void add_char_metric (struct font_desc * font, struct char_metrics *metrics, @@ -48,12 +48,6 @@ static void add_kern (struct font_desc * font, int ch1, int ch2, int adjust); /* Typical whitespace characters for tokenizing. */ static const char whitespace[] = " \t\n\r\v"; -void -groff_init (void) -{ - space_index = font_char_name_to_index ("space"); -} - /* Some notes on the groff_font(8) manpage: DESC file format: A typical PostScript `res' would be 72000, with @@ -92,7 +86,7 @@ groff_read_font (const char *fn) char *key; /* 0=kernpairs section, 1=charset section. */ - int charset; + int charset = 0; /* Index for previous line. */ int prev_index = -1; @@ -100,7 +94,7 @@ groff_read_font (const char *fn) /* Current location in file, used for error reporting. */ struct file_locator where; -#if unix +#ifdef unix fn = fn_tilde_expand (fn); #endif @@ -355,7 +349,7 @@ groff_read_font (const char *fn) goto file_lossage; } free (line); -#if unix +#ifdef unix free ((char *) fn); #endif @@ -381,7 +375,7 @@ lose: if (f != NULL) fclose (f); pool_destroy (font_pool); -#if unix +#ifdef unix free ((char *) fn); #endif err_pop_file_locator (&where); @@ -447,6 +441,20 @@ static struct } hash; +void +groff_init (void) +{ + space_index = font_char_name_to_index ("space"); +} + +void +groff_done (void) +{ + free (hash.tab) ; + pool_destroy(hash.ar); +} + + /* Searches for NAME in the global character code table, returns the index if found; otherwise inserts NAME and returns the new index. */