ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/common/object.C
(Generate patch)

Comparing deliantra/server/common/object.C (file contents):
Revision 1.34 by root, Tue Sep 12 01:09:53 2006 UTC vs.
Revision 1.35 by root, Tue Sep 12 18:15:34 2006 UTC

416 */ 416 */
417 417
418object * 418object *
419find_object_name (const char *str) 419find_object_name (const char *str)
420{ 420{
421 const char *name = shstr::find (str); 421 shstr_cmp str_ (str);
422 object *op; 422 object *op;
423 423
424 for (op = objects; op != NULL; op = op->next) 424 for (op = objects; op != NULL; op = op->next)
425 if (&op->name == name) 425 if (op->name == str_)
426 break; 426 break;
427 427
428 return op; 428 return op;
429} 429}
430 430
850 freed.push_back (*i);//D 850 freed.push_back (*i);//D
851 //delete *i; 851 //delete *i;
852 mortals.erase (i); 852 mortals.erase (i);
853 } 853 }
854 854
855 if (mortals.size())//D 855 if (mortals.size() && 0)//D
856 LOG (llevDebug, "%d objects in mortal queue\n", mortals.size());//D 856 LOG (llevDebug, "%d objects in mortal queue\n", mortals.size());//D
857} 857}
858 858
859object::object () 859object::object ()
860{ 860{
2720 * The returned string is shared. 2720 * The returned string is shared.
2721 */ 2721 */
2722const char * 2722const char *
2723get_ob_key_value (const object *op, const char *const key) 2723get_ob_key_value (const object *op, const char *const key)
2724{ 2724{
2725 key_value * 2725 key_value *link;
2726 link; 2726 shstr_cmp canonical_key (key);
2727 const char *
2728 canonical_key;
2729 2727
2730 canonical_key = shstr::find (key);
2731
2732 if (canonical_key == NULL) 2728 if (!canonical_key)
2733 { 2729 {
2734 /* 1. There being a field named key on any object 2730 /* 1. There being a field named key on any object
2735 * implies there'd be a shared string to find. 2731 * implies there'd be a shared string to find.
2736 * 2. Since there isn't, no object has this field. 2732 * 2. Since there isn't, no object has this field.
2737 * 3. Therefore, *this* object doesn't have this field. 2733 * 3. Therefore, *this* object doesn't have this field.
2738 */ 2734 */
2739 return NULL; 2735 return 0;
2740 } 2736 }
2741 2737
2742 /* This is copied from get_ob_key_link() above - 2738 /* This is copied from get_ob_key_link() above -
2743 * only 4 lines, and saves the function call overhead. 2739 * only 4 lines, and saves the function call overhead.
2744 */ 2740 */
2745 for (link = op->key_values; link != NULL; link = link->next) 2741 for (link = op->key_values; link; link = link->next)
2746 {
2747 if (link->key == canonical_key) 2742 if (link->key == canonical_key)
2748 {
2749 return link->value; 2743 return link->value;
2750 } 2744
2751 }
2752 return NULL; 2745 return 0;
2753} 2746}
2754 2747
2755 2748
2756/* 2749/*
2757 * Updates the canonical_key in op to value. 2750 * Updates the canonical_key in op to value.

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines