LCOV - code coverage report
Current view: top level - preproc/grn - hpoint.cpp (source / functions) Hit Total Coverage
Test: GNU roff Lines: 14 14 100.0 %
Date: 2026-01-16 17:51:41 Functions: 2 2 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* Last non-groff version: hpoint.c  1.1  84/10/08
       2             :  *
       3             :  * Originally written by Barry Roitblat, 1982.
       4             :  * Adapted to GNU troff by Daniel Senderowicz 99/12/29.
       5             :  * Modified 2000-2024 by the Free Software Foundation, Inc.
       6             :  *
       7             :  * This file contains no AT&T code and is in the public domain.
       8             :  *
       9             :  * This file contains routines for manipulating the point data
      10             :  * structures for the gremlin picture editor.
      11             :  */
      12             : 
      13             : #ifdef HAVE_CONFIG_H
      14             : #include <config.h>
      15             : #endif
      16             : 
      17             : #include "gprint.h"
      18             : 
      19             : /* imports from main.cpp */
      20             : extern void *grnmalloc(size_t size, const char *what);
      21             : 
      22             : /*
      23             :  * Return pointer to empty point list.
      24             :  */
      25             : POINT *
      26        1723 : PTInit()
      27             : {
      28        1723 :   return ((POINT *) NULL);
      29             : }
      30             : 
      31             : 
      32             : /*
      33             :  * This routine creates a new point with coordinates x and y and links
      34             :  * it into the point list.
      35             :  */
      36             : POINT *
      37        1309 : PTMakePoint(double x,
      38             :             double y,
      39             :             POINT **pplist)
      40             : {
      41             :   POINT *pt;
      42             : 
      43        1309 :   if (Nullpoint(pt = *pplist)) {        /* empty list */
      44         414 :     *pplist = (POINT *) grnmalloc(sizeof(POINT), "initial point");
      45         414 :     pt = *pplist;
      46             :   } else {
      47        2177 :     while (!Nullpoint(pt->nextpt))
      48        1282 :       pt = pt->nextpt;
      49         895 :     pt->nextpt = (POINT *) grnmalloc(sizeof(POINT), "subsequent point");
      50         895 :     pt = pt->nextpt;
      51             :   }
      52             : 
      53        1309 :   pt->x = x;
      54        1309 :   pt->y = y;
      55        1309 :   pt->nextpt = PTInit();
      56        1309 :   return (pt);
      57             : }                               /* end PTMakePoint */
      58             : 
      59             : // Local Variables:
      60             : // fill-column: 72
      61             : // mode: C++
      62             : // End:
      63             : // vim: set cindent noexpandtab shiftwidth=2 textwidth=72:

Generated by: LCOV version 1.14