~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Tina4/src/sys/lists/util.c

Version: ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /**@(#)List (List ) handling (extra utilities).
  2  */
  3 
  4 #include <stdio.h>
  5 #include <tina/sys.h>
  6 
  7 int     list_length(List * list)
  8 {
  9     int     count;
 10     List   *ptr;
 11 
 12     for (ptr = list, count = 0; ptr != NULL; ptr = ptr->next, ++count);
 13     return (count);
 14 }
 15 
 16 int     dd_list_length(List * list)
 17 {
 18     int     count;
 19     List *ptr;
 20 
 21     for (ptr = list, count = 0; ptr != NULL; ptr = ptr->next, ++count);
 22     return (count);
 23 }
 24 
 25 int     ddstr_length(List * start, List * end)
 26 {
 27     int     count;
 28     List *ptr;
 29 
 30     for (ptr = start, count = 0; ptr != end; ptr = ptr->next, ++count);
 31     if (end != NULL)
 32         ++count;
 33     return (count);
 34 }
 35 
 36 void    proplist_pprint(FILE * fp, List * plist)
 37 {
 38     List   *ptr;
 39     Prop   *prop;
 40 
 41     (void) fprintf(fp, "Begin proplist:\n");
 42     for (ptr = plist; ptr != NULL; ptr = ptr->next)
 43     {
 44         prop = (Prop *) ptr->to;
 45         (void) fprintf(fp, "type %ld ptr %d\n", prop->type, (long) prop->to);
 46     }
 47     (void) fprintf(fp, "End proplist:\n");
 48 }
 49 
 50 List   *list_nth(List * list, int n)
 51 {
 52     int     count;
 53     List   *ptr;
 54 
 55     for (ptr = list, count = 0; count < n; ptr = ptr->next, ++count);
 56     return (ptr);
 57 }
 58 
 59 List *ddlist_nth(List * ddlist, int n)
 60 {
 61     int     count;
 62     List *ptr;
 63 
 64     for (ptr = ddlist, count = 0; count < n; ptr = ptr->next, ++count);
 65     return (ptr);
 66 }
 67 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.