Logo Search packages:      
Sourcecode: pan version File versions  Download package

PString Struct Reference

#include <pstring.h>

List of all members.

Detailed Description

PString is a thin wrapper class for passing strings around with their string lengths, so that the string walking overhead by replacing calls to strlen with a reference to the len field, and replacing calls to strcmp() with calls to pstring_strcmp() (which uses the faster memcmp).

When PStrings are going to be long-term items, such as Group names or Article Message-IDs, then the str field is usually allocated and managed by the PString iteslf via calls to pstring_copy(), pstring_set() or pstring_clear().

Most short-term PStrings are used as wrappers around character pointers that already exist. In this case, we can avoid the overhead of duplicating the existing character pointer, and then freeing the duplicate later, by using the _shallow() functions to make shallow copies (ie, no memory management takes place) of the character pointers. This is a measurable performance win, but care must be taken to not pass these shallow copies to the PString memory-management functions, or the already-existing character pointer could be freed accidentally.

Definition at line 45 of file pstring.h.

Public Attributes

guint hash
int len
char * str

The documentation for this struct was generated from the following file:

Generated by  Doxygen 1.6.0   Back to index