Changes to attempt to silence bcc64x
[ACE_TAO.git] / ACE / apps / drwho / HT_Server.cpp
blob8c79e9762d10ca141f9bd3374229f3e0bffae8a9
1 #include "HT_Server.h"
2 #include "ace/ACE.h"
3 #include "ace/OS_NS_string.h"
4 #include "ace/OS_Memory.h"
6 // Insert a KEY_NAME into the hash table, if it doesn't already exist
7 // there. What gets returned is a pointer to the node inserted. Note
8 // that we do our own memory allocation here...
10 Protocol_Record *
11 HT_Server::insert (const char *key_name, int max_len)
13 Protocol_Record **prpp = 0;
15 // This is tricky...
17 for (prpp = &this->hash_table[ACE::hash_pjw (key_name) % this->hash_table_size];
18 *prpp != 0 && ACE_OS::strncmp ((*prpp)->get_login (), key_name, max_len) != 0;
19 prpp = &(*prpp)->next_)
20 continue;
22 if (*prpp == 0)
24 // Remember, the server must be very careful about stuff it
25 // receives from the rwho manager, since it may not be
26 // NUL-terminated. That's why we use ACE::strnnew ()...
28 ACE_NEW_RETURN (*prpp,
29 Protocol_Record (ACE::strnnew (key_name,
30 max_len),
31 *prpp),
32 0);
33 this->count_++;
36 return *prpp;