This file is indexed.

/usr/include/falcon/llist.h is in falconpl-dev 0.9.6.9-git20120606-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
/*
   FALCON - The Falcon Programming Language.
   FILE: llist.h

   Inlined linked list templates.
   -------------------------------------------------------------------
   Author: Giancarlo Niccolai
   Begin: ven dic 3 2004

   -------------------------------------------------------------------
   (C) Copyright 2004: the FALCON developers (see list in AUTHORS file)

   See LICENSE file for licensing details.
*/

/** \file
   Inlined linked list templates.
*/

#ifndef FLC_LLIST_H
#define FLC_LLIST_H
#include <falcon/types.h>

namespace Falcon {

/** Element for LinkedList class */

class LinkableElement
{
   LinkableElement *m_next;
   LinkableElement *m_prev;

public:

   LinkableElement( LinkableElement *prev=0, LinkableElement *next=0 ):
      m_next( next ),
      m_prev( prev )
   {}

   LinkableElement *next() const { return m_next; }
   void next( LinkableElement *n ) { m_next = n; }
   LinkableElement *prev() const { return m_prev; }
   void prev( LinkableElement *p ) { m_prev = p; }
};

/** Linked list class.
   This class is quite similar to a STL linked list; the main difference is that
   the elements that are in the list have the linked list pointers inside them;
   this is useful when is not advisable to have external pointers holding the
   items, and the control of allocated memory must be inside the linked item
   themselves.

   Class _T must be a subclass of Falcon::LinkableElement or the compilation
   of this module will fail.
*/
template< class _T >
class LinkedList
{
   LinkableElement *m_head;
   LinkableElement *m_tail;
   uint32 m_size;

public:
   LinkedList():
      m_head(0),
      m_tail(0),
      m_size(0)
   {}

   void push_front( _T *e )
   {
      LinkableElement *elem = static_cast< LinkableElement *>( e );
      elem->next( m_head );
      elem->prev(0);
      m_head = elem;
      if( m_tail == 0 )
         m_tail = elem;
      m_size++;
   }

   void push_back( _T *e )
   {
      LinkableElement *elem = static_cast< LinkableElement *>( e );
      elem->next( 0 );
      elem->prev( m_tail  );
      m_tail = elem;
      if( m_head == 0 )
         m_head = elem;
      m_size++;
   }

   _T *front() { return static_cast<_T *>( m_head ); }
   _T *back() { return static_cast<_T *>( m_tail ); }

   _T *pop_front()
   {
      _T *h = static_cast<_T *>( m_head );
      if (m_head != 0 ) {
         m_head = m_head->next();
         if ( m_head != 0 )
            m_head->prev(0);
         else
            m_tail = 0;
         m_size--;
      }
      return h;
   }

   _T *pop_back()
   {
      _T *t = static_cast<_T *>( m_tail );
      if (m_tail != 0 ) {
         m_tail = m_tail->prev();
         if ( m_tail != 0 )
            m_tail->next(0);
         else
            m_head = 0;
         m_size--;
      }
      return t;
   }

   void remove( _T * e ) {
      LinkableElement *elem = static_cast< LinkableElement *>( e );
      if ( m_size == 0 ) return;
      if ( elem == m_head ) {
         m_head = elem->next();
      }
      else {
         elem->prev()->next( elem->next() );
      }

      if ( elem == m_tail ) {
         m_tail = elem->prev();
      }
      else {
         elem->next()->prev( elem->prev() );
      }
      m_size--;
   }

   uint32 size() const { return m_size; }
   bool empty() const { return m_size == 0; }
};

}

#endif

/* end of llist.h */