C and C++ Binaries

Utility Functions: cs_utility.h

Defines a set of utility operations for CodeSonar.



Links


Defines

#define CS_UTILITY_H
#define cs_uid_equal(a, b) ((a)==(b)) a and b are equal
#define cs_uid_hash(uid) ((cs_detcheck_nondet_event( "cs_uid_hash" ), (cs_hash_t)(uid))) Convert uid to a cs_hash_t.
#define cs_uid_hash_seed(uid, seed) ((cs_hash_t)(uid)+(cs_hash_t)(seed))
#define cs_uid_is_null(uid) ((uid)?cs_false:cs_true) Check if uid is null.
#define cs_uid_to_integer(uid) ((csuint32)(uid)) Convert uid to a csuint32.
#define CS_SFID_NULL (cs_sfid_get_null()) The null cs_sfid.
#define CS_SF_NULL (cs_sf_get_null()) The null cs_sf.
#define CS_UTILITY_INL_H

Functions

cs_const_string cs_version ( )
Get the CodeSurfer version number for the current installation.
int cs_major_version ( )
Get the major part of the CodeSurfer version number for the current installation.
int cs_minor_version ( )
Get the minor part of the CodeSurfer version number for the current installation.
int cs_patch_version ( )
Get the patch number for the current CodeSurfer installation.
csuint64 cs_bytes_hash ( const void * data, cs_size_t len )
Hash a block of memory.
cs_boolean cs_uid_equal ( cs_uid uid1, cs_uid uid2 )
Check: are two cs_uid objects equal?
cs_hash_t cs_uid_hash ( cs_uid uid )
Hash function for cs_uid.
cs_hash_t cs_uid_stable_hash ( cs_uid uid )
Get a hash value for a cs_uid, with stable results across sufficiently-similar analyses.
int cs_uid_stable_compare ( cs_uid uid_a, cs_uid uid_b )
Compare two cs_uid objects, with stable results across sufficiently-similar analyses.
cs_boolean cs_uid_is_null ( cs_uid uid )
Check: is the specified cs_uid null?
csuint32 cs_uid_to_integer ( cs_uid uid )
Convert a cs_uid to a csuint32.
cs_result cs_sfid_to_string ( cs_sfid sfid, cs_string out_string, cs_size_t capacity_bytes, cs_size_t * bytes_needed )
Construct a hexadecimal number representation (as a cs_string) of a given cs_sfid.
cs_result cs_string_to_sfid ( cs_const_string str, cs_sfid * out_sfid )
Convert a hexadecimal number (as a cs_const_string) to a cs_sfid.
cs_result cs_xmlencode ( cs_const_string str, cs_size_t str_len, cs_boolean use_private_use_area, cs_string buf, cs_size_t buf_bytes, cs_size_t * bytes_needed )
XML-encode a cs_const_string.
cs_const_string cs_xmlencode_string ( cs_const_string str, cs_size_t str_len, cs_boolean use_private_use_area )
XML-encode a cs_const_string, with buffer management included.
cs_result cs_xmldecode ( cs_const_string str, cs_string buf, cs_size_t buf_bytes, cs_size_t * bytes_needed )
XML-decode a cs_const_string.
cs_const_string cs_xmldecode_string ( cs_const_string str )
XML-decode a cs_const_string, with buffer management included.
cs_boolean cs_file_path_equal ( cs_const_file_path file_path1, cs_const_file_path file_path2 )
Check: are two cs_file_path objects equal?
cs_hash_t cs_file_path_hash ( cs_const_file_path file_path )
Get a hash value for a cs_file_path.
csuint64 cs_file_path_hash64 ( cs_const_file_path file_path, csuint64 hash_seed )
Get a 64-bit hash value for a cs_file_path with respect to a 64-bit seed.
cs_result cs_set_kind_name ( cs_set_kind kind, cs_const_string * out_string )
Get the name of a cs_set_kind.
cs_result cs_get_user_name ( cs_string buf, cs_size_t capacity_bytes, cs_size_t * bytes_needed )
Get the user name of the current user.
cs_result cs_get_machine_name ( cs_string buf, cs_size_t capacity_bytes, cs_size_t * bytes_needed )
Get the name of the current machine.
cs_const_string const * cs_get_startup_argv ( )
Get the argv array used to start the process hosting the plugin.
void cs_flush_managed_objects ( )
Flush managed objects to disk.
void cs_set_resident_capacity ( cs_size_t capacity_bytes )
Alter the number of bytes of managed objects that can be kept in memory.
cs_size_t cs_get_resident_capacity ( )
Get the number of bytes of managed objects that can be kept in memory.
void cs_set_io_buffer_capacity ( cs_size_t buffering_bytes )
Set the number of bytes to allocate for IO buffering.
cs_size_t cs_get_io_buffer_capacity_pending ( )
Get the IO buffer capacity specified in the last cs_set_io_buffer_capacity() call.
cs_result cs_get_io_buffer_capacity_current ( cs_size_t * buffering_bytes )
Get the number of bytes currently allocated for IO buffering.
void cs_exit ( int code )
Cleanly call "exit(int)".
cs_const_string cs_install_prefix ( )
Retrieve the file system path for the CodeSurfer installation.
cs_const_string cs_codesecure_home_directory ( )
Retrieve the file system path for the CodeSecure installation.
cs_result cs_load_project ( cs_const_string prj )
Loads the given project file.
cs_boolean cs_sf_equal ( cs_sf sf1, cs_sf sf2 )
Check: are two cs_sf objects equal?
int cs_sf_compare ( cs_sf sf_a, cs_sf sf_b )
Compare two cs_sf objects.
cs_hash_t cs_sf_hash ( cs_sf sf )
Hash function for cs_sf.
csuint64 cs_sf_hash64 ( cs_sf sf )
64-bit hash function for cs_sf.
cs_boolean cs_sf_is_null ( cs_sf sf )
Check: is the specified cs_sf null?
cs_sf cs_sf_get_null ( )
Get a null cs_sf.
cs_boolean cs_sfid_equal ( cs_sfid sfid1, cs_sfid sfid2 )
Check: are two cs_sfid objects equal?
int cs_sfid_compare ( cs_sfid sfid_a, cs_sfid sfid_b )
Compare two cs_sfid objects.
cs_hash_t cs_sfid_hash ( cs_sfid sfid )
Hash function for cs_sfid.
cs_hash_t cs_sfid_hash_seed ( cs_sfid sfid, cs_hash_t hash_seed )
Seeded hash function for cs_sfid.
cs_boolean cs_sfid_is_null ( cs_sfid sfid )
Check: is the specified cs_sfid null?
cs_sfid cs_sfid_get_null ( )
Get a null cs_sfid.
int cs_uid_compare ( cs_uid uid_a, cs_uid uid_b )
Compare two cs_uid objects.
cs_boolean cs_const_string64_is_null ( cs_const_string64 s )
Check: is the specified cs_const_string64 null?
cs_const_string64 cs_const_string64_get_null ( )
Get a null cs_const_string64.
cs_sf cs_sf_from_hash64 ( csuint64 h )
Recover a cs_sf from its 64-bit hash.

Function Descriptions

Function cs_version
cs_const_string cs_version ( )
Get the CodeSurfer version number for the current installation.
Returns A cs_string representation of the CodeSurfer version number for the current installation, in format "major#.minor#".
Function cs_major_version
int cs_major_version ( )
Get the major part of the CodeSurfer version number for the current installation.
Returns The major part of the CodeSurfer version number for the current installation (that is, the number before the "."), as an int.
Function cs_minor_version
int cs_minor_version ( )
Get the minor part of the CodeSurfer version number for the current installation.
Returns The minor part of the CodeSurfer version number (that is, the number after the "."), as an int.
Function cs_patch_version
int cs_patch_version ( )
Get the patch number for the current CodeSurfer installation.
Returns The patch number for the current CodeSurfer installation, as an int.
Function cs_bytes_hash
csuint64 cs_bytes_hash (
Hash a block of memory.
Parameters
data [in] Data to hash
len [in] Number of bytes to hash
Returns A hash of the data
Function cs_uid_equal
cs_boolean cs_uid_equal (
Check: are two cs_uid objects equal?
Parameters
uid1 [in] First argument to equality check
uid2 [in] Second argument to equality check
Returns A cs_boolean:
  • cs_true if uid1 is equal to uid2;
  • cs_false otherwise.
Function cs_uid_hash
cs_hash_t cs_uid_hash (
Hash function for cs_uid.
Parameters
uid [in] The cs_uid to hash.
Returns The hash for uid.
Notes For a fixed cs_uid u in a single analysis, cs_uid_hash(u) will always return the same value. However, cs_uid_hash() will not necessarily return this same value when called on the corresponding cs_uid u' in a different analysis. Function cs_uid_stable_hash() provides some degree of stability across analyses, although restrictions still apply. If you do not need hash values to be stable across different analyses, use cs_uid_hash(): it has better performance.
Function cs_uid_stable_hash
cs_hash_t cs_uid_stable_hash (
Get a hash value for a cs_uid, with stable results across sufficiently-similar analyses.
Parameters
uid [in] The cs_uid value to hash.
Returns A hash derived from uid.
Notes This hash value is stable in the following sense. Suppose there are two analyses A1 and A2 generated with exactly the same inputs (including identical analyzed code, underlying build commands and ordering, command line and configuration settings, increment order and contents). Let u1 be a cs_uid in A1, and u2 be the cs_uid in A2 that corresponds to u1. Then cs_uid_stable_hash(u1)==cs_uid_stable_hash(u2).

If you do not need hash values to be stable across analyses, use cs_uid_hash(): it has better performance.

Function cs_uid_stable_compare
int cs_uid_stable_compare (
Compare two cs_uid objects, with stable results across sufficiently-similar analyses.
Parameters
uid_a [in] First argument to comparison.
uid_b [in] Second argument to comparison.
Returns An integer N, such that:
  • N<0 if uid_a considered less than uid_b
  • N==0 if uid_a considered equal to uid_b
  • N>0 if uid_a considered greater than uid_b
Notes This function is provided so cs_uid objects can be stored in ordered containers that provide stable iteration order.

The comparison is stable in the following sense. Suppose there are two analyses A1 and A2 generated with exactly the same inputs (including identical analyzed code, underlying build commands and ordering, command line and configuration settings, increment order and contents). Let a1 and b1 be two cs_uid values in A1, and a2 and b2 be the cs_uid values in A2 that correspond to a1 and b1 respectively. Then cs_uid_stable_compare(a1,b1)==cs_uid_stable_compare(a2,b2).

If you do not need comparison results to be stable across different analyses, use cs_uid_compare(): it has better performance.

Function cs_uid_is_null
cs_boolean cs_uid_is_null (
Check: is the specified cs_uid null?
Parameters
uid [in] The cs_uid to test for nullness.
Returns A cs_boolean:
  • cs_true if uid is null,
  • cs_false otherwise.
Function cs_uid_to_integer
csuint32 cs_uid_to_integer (
Convert a cs_uid to a csuint32.
Parameters
uid [in] The cs_uid to convert.
Returns The integer value for uid, as a csuint32.
Function cs_sfid_to_string
cs_result cs_sfid_to_string (
Construct a hexadecimal number representation (as a cs_string) of a given cs_sfid.
Parameters
sfid [in] The cs_sfid of interest.
out_string [out] A user-allocated cs_string to be populated with the hexadecimal representation of sfid.
capacity_bytes [in] The capacity of out_string, measured in bytes.
bytes_needed [out] The number of bytes required to store the entire hexadecimal representation of sfid as a cs_string.
Returns A cs_result:
  • CS_TRUNCATED if out_string is not large enough to hold the entire string representation of sfid (and so the string was truncated),
  • CS_SUCCESS otherwise.
Notes The inverse function is cs_string_to_sfid().

Call this function with out_string NULL and capacity_bytes 0 (zero) to determine the memory needed to hold the entire representation.

Function cs_string_to_sfid
cs_result cs_string_to_sfid (
Convert a hexadecimal number (as a cs_const_string) to a cs_sfid.
Parameters
str [in] The cs_const_string to convert
out_sfid [out] The cs_sfid corresponding to str.
Returns A cs_result:
Notes The inverse function is cs_sfid_to_string().
Function cs_xmlencode
cs_result cs_xmlencode (
XML-encode a cs_const_string.
Parameters
str [in] The cs_const_string to be encoded.
str_len [in] The length of str.
use_private_use_area [in] Should the private-use-area be used?
Returns A cs_result:
  • CS_TRUNCATED if out_string is not large enough to hold the entire string representation of sfid (and so the string was truncated),
  • CS_SUCCESS otherwise.
Notes When parsing source code, CodeSonar may encounter code using an unspecified encoding. In general, CodeSonar's strategy for dealing with this ambiguity is to forward the bit stream as-is all the way to the UI (typically a web browser).

When use_private_use_area is cs_true, bytes 128 or higher will be escaped as code point 0xe000 + byte. They will appear in the XML as &#xe080..&#xe0ff. The CodeSonar hub expects XML to be encoded in this fashion.

If use_private_use_area is cs_false, the bytes will appear as-is in the XML. XML parsers will reject this XML if they do not use a character encoding matching the data.

Function cs_xmlencode_string
cs_const_string cs_xmlencode_string (
XML-encode a cs_const_string, with buffer management included.
Parameters
str [in] The cs_const_string to be encoded.
str_len [in] The length of str.
use_private_use_area [in] Should the private-use-area be used?
Returns The encoded string.
Notes When parsing source code, CodeSonar may encounter code using an unspecified encoding. In general, CodeSonar's strategy for dealing with this ambiguity is to forward the bit stream as-is all the way to the UI (typically a web browser).

When use_private_use_area is cs_true, bytes 128 or higher will be escaped as code point 0xe000 + byte. They will appear in the XML as &#xe080..&#xe0ff. The CodeSonar hub expects XML to be encoded in this fashion.

If use_private_use_area is cs_false, the bytes will appear as-is in the XML. XML parsers will reject this XML if they do not use a character encoding matching the data.

Function cs_xmldecode
cs_result cs_xmldecode (
XML-decode a cs_const_string.
Parameters
str [in] The cs_const_string to be decoded.
buf [out] The buffer in which to write the decoded string.
buf_bytes [in] The capacity of the buffer.
bytes_needed [out] The number of bytes needed to decode the string.
Returns A cs_result:
Function cs_xmldecode_string
cs_const_string cs_xmldecode_string (
XML-decode a cs_const_string, with buffer management included.
Parameters
str [in] The cs_const_string to be decoded.
Returns The decoded string.
Function cs_file_path_equal
cs_boolean cs_file_path_equal (
Check: are two cs_file_path objects equal?
Parameters
file_path1 [in] First argument to comparison.
file_path2 [in] Second argument to comparison.
Returns A cs_boolean:
  • cs_true if file_path1 is equal to file_path2;
  • cs_false otherwise.
Notes If file names on the host platform are case insensitive, so is this check.
Function cs_file_path_hash
cs_hash_t cs_file_path_hash (
Get a hash value for a cs_file_path.
Parameters
file_path [in] The cs_file_path to hash.
Returns A hash of file_path.
Notes If two file paths p1 and p2 are equal according to cs_file_path_equal(), then cs_file_path_hash(p1) will be equal to cs_file_hash(p2).
Function cs_file_path_hash64
csuint64 cs_file_path_hash64 (
Get a 64-bit hash value for a cs_file_path with respect to a 64-bit seed.
Parameters
file_path [in] The cs_file_path to hash.
hash_seed [inout] A 64-bit seed value for the hash.
Returns A 64-bit hash of file_path, as a csuint64.
Function cs_set_kind_name
cs_result cs_set_kind_name (
Get the name of a cs_set_kind.
Parameters
kind [in] The cs_set_kind for which the name is to be retrieved.
out_string [out] The string representation of the name of kind.
Returns A cs_result:
Time-Complexity O(1)
Function cs_get_user_name
cs_result cs_get_user_name (
Get the user name of the current user.
Parameters
buf [inout] A cs_string to write the user name to.
capacity_bytes [in] The allocated length of buf.
bytes_needed [out] The number of bytes written to buf.
Returns A cs_result:
Notes Call this function with buf NULL and capacity_bytes 0 (zero) to determine the memory needed to hold the entire user name.
Function cs_get_machine_name
cs_result cs_get_machine_name (
Get the name of the current machine.
Parameters
buf [inout] A cs_string to write the machine name to.
capacity_bytes [in] The allocated length of buf.
bytes_needed [out] The number of bytes written to buf.
Returns A cs_result:
Notes Call this function with buf NULL and capacity_bytes 0 (zero) to determine the memory needed to hold the entire machine name.
Function cs_get_startup_argv
cs_const_string const * cs_get_startup_argv ( )
Get the argv array used to start the process hosting the plugin.
Returns An array of cs_const_string, with the last element holding NULL. The format corresponds to the argument to a main function traditionally called 'argv'. ('argc' is implicit in the number of elements before reaching NULL.)
Notes CodeSurfer and CodeSonar ignore command-line arguments provided after a '--'; this can be used to pass arguments to the plugin. For example, 'csurf -l my-plugin.so -- --do-something-cool'. However, the full argument list will be provided as the return from this function; for the example, it would be {"csurf", "-l", "my-plugin.so", "--", "--do-something-cool"}.
Function cs_flush_managed_objects
void cs_flush_managed_objects ( )
Flush managed objects to disk.
Returns void
Notes Calling this function will free all managed objects from memory and write them to disk. It is illegal to call this function with certain types of outstanding iterators. An assertion of very limited usefulness will fire if you do so.
Function cs_set_resident_capacity
void cs_set_resident_capacity (
Alter the number of bytes of managed objects that can be kept in memory.
Parameters
capacity_bytes [in] The number of bytes of managed objects that can be kept resident.
Returns void
Notes A reasonable setting might be 1024*1024*256. This should probably not exceed 0.75 * min(RAM_SIZE,2GB). Setting this value too low can cause thrashing, but might be desirable if your algorithm has good access patterns or needs to use the memory for other purposes.

If called with a value less than the current number of bytes in use by resident objects, then objects will be paged out immediately.

Function cs_get_resident_capacity
cs_size_t cs_get_resident_capacity ( )
Get the number of bytes of managed objects that can be kept in memory.
Returns The number of bytes of managed objects that can be kept in memory at any time.
Function cs_set_io_buffer_capacity
void cs_set_io_buffer_capacity (
Set the number of bytes to allocate for IO buffering.
Parameters
buffering_bytes [in] The number of bytes to allocate for IO buffering.
Returns void
Notes A reasonable setting might be 1024*1024*128:
  • Too low a value may cause thrashing.
  • Too high a value may cause the tool to exhaust virtual address space.

The new value does not take effect until the next time cs_s_read_sdg() is called.

Function cs_get_io_buffer_capacity_pending
cs_size_t cs_get_io_buffer_capacity_pending ( )
Get the IO buffer capacity specified in the last cs_set_io_buffer_capacity() call.
Returns The number of bytes allocated for IO buffering.
Function cs_get_io_buffer_capacity_current
cs_result cs_get_io_buffer_capacity_current (
Get the number of bytes currently allocated for IO buffering.
Parameters
buffering_bytes [out] The number of bytes currently allocated for IO buffering.
Returns A cs_result:
Function cs_exit
void cs_exit (
Cleanly call "exit(int)".
Parameters
code [in] Exit code of the process.
Returns void
Notes Use this mechanism to cleanly call "exit(int)". Calling libc exit() directly can leave the intermediate files on the disk in an inconsistent state
Function cs_install_prefix
cs_const_string cs_install_prefix ( )
Retrieve the file system path for the CodeSurfer installation.
Returns The installation directory path for CodeSurfer. Note that this is always a subdirectory of cs_codesecure_home_directory(), called 'csurf'.
Function cs_codesecure_home_directory
cs_const_string cs_codesecure_home_directory ( )
Retrieve the file system path for the CodeSecure installation.
Returns The CodeSecure installation directory path.
Function cs_load_project
cs_result cs_load_project (
Loads the given project file.
Returns A cs_result:
Function cs_sf_equal
cs_boolean cs_sf_equal (
Check: are two cs_sf objects equal?
Parameters
sf1 [in] First argument to equality check.
sf2 [in] Second argument to equality check.
Returns A cs_boolean:
  • cs_true if sf1 and sf2 are the same cs_sf;
  • cs_false if not.
Function cs_sf_compare
int cs_sf_compare (
Compare two cs_sf objects.
Parameters
sf_a [in] First argument to comparison.
sf_b [in] Second argument to comparison.
Returns An integer N, such that:
  • N<0 if sf_a is considered less than sf_b
  • N==0 if sf_a and sf_b are the same cs_sf
  • N>0 if sf_a is considered greater than sf_b
Notes This function is provided so cs_sf objects can be stored in ordered containers. It is not based on any user-perceivable order of cs_sf objects.

For fixed cs_sf values a and b in a single analysis, cs_sf_compare(a,b) will always return the same value. However, cs_sf_compare() will not necessarily return this same value when called on the corresponding cs_sf values a' and b' in a different analysis. Function cs_sf_stable_compare() provides some degree of stability across analyses, although restrictions still apply. If you do not need comparison results to be stable across different analyses, use cs_sf_compare(): it has better performance.

Function cs_sf_hash
cs_hash_t cs_sf_hash (
Hash function for cs_sf.
Parameters
sf [in] A cs_sf to hash.
Returns A hash of sf.
Notes For a fixed cs_sf s in a single analysis, cs_sf_hash(s) will always return the same value. However, cs_sf_hash() will not necessarily return this same value when called on the corresponding cs_sf s' in a different analysis. Function cs_sf_stable_hash() provides some degree of stability across analyses, although restrictions still apply. If you do not need hash values to be stable across different analyses, use cs_sf_hash(): it has better performance.
Function cs_sf_hash64
csuint64 cs_sf_hash64 (
64-bit hash function for cs_sf.
Parameters
sf [in] A cs_sfid hash.
Returns A 64-bit hash of sfid, as a csuint64.
Notes The inverse function is cs_sf_from_hash64().
Function cs_sf_is_null
cs_boolean cs_sf_is_null (
Check: is the specified cs_sf null?
Parameters
sf [in] The cs_sf to check for nullity.
Returns A cs_boolean:
  • cs_true if sf is null;
  • cs_false otherwise.
Function cs_sf_get_null
cs_sf cs_sf_get_null ( )
Get a null cs_sf.
Returns A null cs_sf.
Function cs_sfid_equal
cs_boolean cs_sfid_equal (
Check: are two cs_sfid objects equal?
Parameters
sfid1 [in] First argument to equality check.
sfid2 [in] Second argument to equality check.
Returns A cs_boolean:
  • cs_true if sfid1 and sfid2 are the same cs_sfid;
  • cs_false if not.
Function cs_sfid_compare
int cs_sfid_compare (
Compare two cs_sfid objects.
Parameters
sfid_a [in] First argument to comparison.
sfid_b [in] Second argument to comparison.
Returns An integer N, such that:
  • N<0 if sfid_a is considered less than sfid_b
  • N==0 if sfid_a and sfid_b are the same cs_sfid
  • N>0 if sfid_a is considered greater than sfid_b
Notes This function is provided so cs_sfid objects can be stored in ordered containers. It is not based on any user-perceivable order of cs_sfid objects.

For fixed cs_sfid values a and b in a single analysis, cs_sfid_compare(a,b) will always return the same value. However, cs_sfid_compare() will not necessarily return this same value when called on the corresponding cs_sfid values a' and b' in a different analysis. Function cs_sfid_stable_compare() provides some degree of stability across analyses, although restrictions still apply. If you do not need comparison results to be stable across different analyses, use cs_sfid_compare(): it has better performance.

Function cs_sfid_hash
cs_hash_t cs_sfid_hash (
Hash function for cs_sfid.
Parameters
sfid [in] A cs_sfid to hash.
Returns A hash of sfid.
Notes For a fixed cs_sfid s in a single analysis, cs_sfid_hash(s) will always return the same value. However, cs_sfid_hash() will not necessarily return this same value when called on the corresponding cs_sfid s' in a different analysis. Function cs_sfid_stable_hash() provides some degree of stability across analyses, although restrictions still apply. If you do not need hash values to be stable across different analyses, use cs_sfid_hash(): it has better performance.
Function cs_sfid_hash_seed
cs_hash_t cs_sfid_hash_seed (
Seeded hash function for cs_sfid.
Parameters
sfid [in] A cs_sfid to hash.
hash_seed [in] The hash seed to use, as a cs_hash_t.
Returns A hash of sfid with respect to hash_seed.
Function cs_sfid_is_null
cs_boolean cs_sfid_is_null (
Check: is the specified cs_sfid null?
Parameters
sfid [in] The cs_sfid to check for nullity.
Returns A cs_boolean:
  • cs_true if all bits of sfid are zeroed;
  • cs_false otherwise.
Notes No CodeSonar API function should ever return a null cs_sfid, with the exception of cs_sfid_get_null().
Function cs_sfid_get_null
cs_sfid cs_sfid_get_null ( )
Get a null cs_sfid.
Returns A null cs_sfid.
Function cs_uid_compare
int cs_uid_compare (
Compare two cs_uid objects.
Parameters
uid_a [in] First argument to comparison.
uid_b [in] Second argument to comparison.
Returns An integer N, such that:
  • N<0 if uid_a is considered less than uid_b
  • N==0 if uid_a and uid_b are the same cs_uid
  • N>0 if uid_a is considered greater than uid_b
Notes This function is provided so cs_uid objects can be stored in ordered containers. It is not based on any user-perceivable order of cs_uid objects.

For fixed cs_uid values a and b in a single analysis, cs_uid_compare(a,b) will always return the same value. However, cs_uid_compare() will not necessarily return this same value when called on the corresponding cs_uid values a' and b' in a different analysis. Function cs_uid_stable_compare() provides some degree of stability across analyses, although restrictions still apply. If you do not need comparison results to be stable across different analyses, use cs_uid_compare(): it has better performance.

Function cs_const_string64_is_null
cs_boolean cs_const_string64_is_null (
Check: is the specified cs_const_string64 null?
Parameters
s [in] The cs_const_string64 to check for nullity.
Returns A cs_boolean:
  • cs_true if s is null;
  • cs_false otherwise.
Function cs_const_string64_get_null
cs_const_string64 cs_const_string64_get_null ( )
Get a null cs_const_string64.
Returns A null cs_const_string64.
Function cs_sf_from_hash64
cs_sf cs_sf_from_hash64 (
Recover a cs_sf from its 64-bit hash.
Parameters
h [in] A csuint64 representing the 64-bit hash of a cs_sf.
Returns The cs_sf corresponding to h.
Notes The inverse function is cs_sf_hash64().