title: C tailq queue substitution for performance issues
body: <p>I have a tailq with 100k+ entries of this struct:</p>
  
  <pre><code>struct entry {
  char *file_name;
  FILE *file;
  TAILQ_ENTRY(entry) tailq;
  };
  </code></pre>
  
  <p>The purpose is store thousands of file pointers for an application creates thousands of files and append stuffs to them.</p>
  
  <p>On each increase of the tailq I have a foreach:</p>
  
  <pre><code>int c;
  char temp[20];
  
  struct entry *np;
  
  TAILQ_FOREACH(np, &amp;tailq_head[y], tailq) {
      if(strcmp(np-&gt;file_name, temp) == 0){
          c = 1;
          break;
      }
  }
  </code></pre>
  
  <p>That searches for some temp name that already is on the tailq, if it isn't in the tail then add id, else do not.</p>
  
  <p>What can I do to improve performance? What is the faster structure that I can use? Should I calculate an integer hash to the temp variable to be compared in the foreach? Ideas? </p>