insert.c 564 B

12345678910111213141516171819202122232425262728
  1. #include <grass/gis.h>
  2. #include <grass/segment.h>
  3. #include "point.h"
  4. void insert(POINT ** pres_pt, int row, int col, int backrow, int backcol)
  5. {
  6. extern POINT *head_start_pt;
  7. POINT *new_pt;
  8. new_pt = (struct point *)G_malloc(sizeof(struct point));
  9. new_pt->row = row;
  10. new_pt->col = col;
  11. new_pt->backrow = backrow;
  12. new_pt->backcol = backcol;
  13. new_pt->next = NULL;
  14. if (head_start_pt == NULL) {
  15. head_start_pt = new_pt;
  16. *pres_pt = head_start_pt;
  17. }
  18. else {
  19. (*pres_pt)->next = new_pt;
  20. *pres_pt = (*pres_pt)->next;
  21. }
  22. }