Code::Blocks  SVN r11506
Macros | Functions | Variables
prefix.cpp File Reference
#include <stdlib.h>
#include <stdio.h>
#include <limits.h>
#include <string.h>
#include "prefix.h"
#include <pthread.h>
Include dependency graph for prefix.cpp:

Go to the source code of this file.


#define _PREFIX_C_
#define BR_PTHREADS   1
#define NULL   ((void *) 0)
#define br_return_val_if_fail(expr, val)   if (!(expr)) return val


static void br_thread_local_store_fini ()
static void br_str_free (void *str)
static void br_thread_local_store_init ()
const char * br_thread_local_store (char *str)
 br_thread_local_store: str: A dynamically allocated string. More...
char * br_strcat (const char *str1, const char *str2)
 br_strcat: str1: A string. More...
static char * br_strndup (char *str, size_t size)
char * br_extract_dir (const char *path)
 br_extract_dir: path: A path. More...
char * br_extract_prefix (const char *path)
 br_extract_prefix: path: The full path of an executable or library. More...


static pthread_key_t br_thread_key
static pthread_once_t br_thread_key_once = PTHREAD_ONCE_INIT

Macro Definition Documentation


#define _PREFIX_C_

Definition at line 36 of file prefix.cpp.


#define BR_PTHREADS   1

Definition at line 44 of file prefix.cpp.

◆ br_return_val_if_fail

#define br_return_val_if_fail (   expr,
)    if (!(expr)) return val

Definition at line 64 of file prefix.cpp.

Referenced by br_extract_dir(), br_extract_prefix(), and br_strndup().


#define NULL   ((void *) 0)

Definition at line 59 of file prefix.cpp.

Referenced by _string_format(), _string_split(), cbStatusBar::AddField(), NativeParser::AddProjectDefinedMacros(), array_slice(), base_compilestring(), base_getstackinfos(), br_thread_local_store_fini(), br_thread_local_store_init(), CompilerGCC::BuildMenu(), class_instance(), SQFile::Close(), closure_getinfos(), SQCompiler::Compile(), CrashHandlerSaveEditorFiles(), CreateClass(), CreateDefaultDelegate(), CreateStaticNamespace(), MainFrame::CreateToolbars(), GDB_driver::DetectCygwinMount(), MainFrame::DoAddPlugin(), DebuggerGDB::DoBreak(), Associations::DoClearAssociation(), wxToolBarAddOnXmlHandler::DoCreateResource(), UnfocusablePopupWindow::DoSetSize(), SystemHeadersThread::Entry(), wxCrc32::FromString(), generator_getstatus(), NbStyleFF2::GetBestTabCtrlSize(), DebuggerManager::GetDebuggerHavingWatch(), DebuggerState::GetDriver(), MainFrame::GetEditorDescription(), ProjectBuildTarget::GetFile(), cbProject::GetFile(), InfoPane::GetLogger(), DebuggerManager::GetMenu(), BasicSearchTree::GetNode(), EditorManager::GetNotebookStack(), SearchTreeNode::GetParent(), NativeParser::GetProjectByParser(), CodeCompletion::GetToolBarPriority(), ConfigManager::GetUserDataFolder(), InfoPane::GetWindow(), ParserThread::HandleNamespace(), DebuggerState::HasDriver(), IdType2Name(), wxSwitcherItem::Init(), wxSwitcherDialog::Init(), ConfigManager::InitPaths(), instance_getclass(), EditorManager::IsOpen(), CompilerGCC::KillProcess(), main(), ConfigManager::MigrateFolders(), TemplateManager::New(), TemplateManager::NewFromTemplate(), TemplateManager::NewProjectFromUserTemplate(), CompilerGCC::NotifyJobDone(), CompilerGCC::OnConfig(), MainFrame::OnEditMenuUpdateUI(), NativeParser::OnEditorActivated(), NativeParser::OnEditorClosed(), CodeCompletion::OnGotoDeclaration(), DebuggerGDB::OnMenuWatchDereference(), CodeCompletion::OnProjectSavedTimer(), MainFrame::OnSwitchTabs(), MainFrame::OnToggleStartPage(), DebuggerMenuHandler::OnUpdateUI(), DebuggerToolbarHandler::OnUpdateUI(), MainFrame::OnViewMenuUpdateUI(), ParseCDBWatchValue(), NativeParser::RemoveClassBrowser(), FindReplace::ReplaceInFiles(), DebuggerGDB::ResetProject(), Wiz::RunProjectWizard(), wxScintilla::SetLastKeydownProcessed(), sq_createinstance(), sq_getattributes(), sq_getbase(), sq_getclass(), sq_getfreevariable(), sq_getinstanceup(), sq_getlocal(), sq_getstring(), sq_getthread(), sq_getuserdata(), sq_getuserpointer(), sq_newclass(), sq_newthread(), sq_objtostring(), sq_open(), sq_resetobject(), sq_setattributes(), sq_setdelegate(), sq_writeclosure(), SQCompiler::SQCompiler(), SQFile::SQFile(), sqstd_createblob(), sqstd_getfile(), sqstd_rex_compile(), sqstd_rex_match(), sqstd_rex_matchnode(), sqstd_rex_searchrange(), table_rawget(), thread_getstatus(), TranslateIndex(), SearchTree< wxString >::UnserializeItem(), weakref_ref(), wxScintilla::wxScintilla(), and ClassBrowser::~ClassBrowser().

Function Documentation

◆ br_extract_dir()

char* br_extract_dir ( const char *  path)

br_extract_dir: path: A path.

Returns: A directory name. This string should be freed when no longer needed.

Extracts the directory component of path. Similar to g_dirname() or the dirname commandline application.

Example: br_extract_dir ("/usr/local/foobar"); –> Returns: "/usr/local"

Definition at line 379 of file prefix.cpp.

References br_return_val_if_fail, and br_strndup().

◆ br_extract_prefix()

char* br_extract_prefix ( const char *  path)

br_extract_prefix: path: The full path of an executable or library.

Returns: The prefix, or NULL on error. This string should be freed when no longer needed.

Extracts the prefix from path. This function assumes that your executable or library is installed in an LSB-compatible directory structure.

Example: br_extract_prefix ("/usr/bin/gnome-panel"); –> Returns "/usr" br_extract_prefix ("/usr/local/lib/"); –> Returns "/usr/local" br_extract_prefix ("/usr/local/"); –> Returns "/usr"

Definition at line 414 of file prefix.cpp.

References br_return_val_if_fail, and br_strndup().

◆ br_str_free()

static void br_str_free ( void *  str)

Definition at line 254 of file prefix.cpp.

Referenced by br_thread_local_store(), and br_thread_local_store_init().

◆ br_strcat()

char* br_strcat ( const char *  str1,
const char *  str2 

br_strcat: str1: A string.

str2: Another string. Returns: A newly-allocated string. This string should be freed when no longer needed.

Concatenate str1 and str2 to a newly allocated string.

Definition at line 334 of file prefix.cpp.

◆ br_strndup()

static char* br_strndup ( char *  str,
size_t  size 

Definition at line 353 of file prefix.cpp.

References br_return_val_if_fail.

Referenced by br_extract_dir(), and br_extract_prefix().

◆ br_thread_local_store()

const char* br_thread_local_store ( char *  str)

br_thread_local_store: str: A dynamically allocated string.

Returns: str. This return value must not be freed.

Store str in a thread-local variable and return str. The next you run this function, that variable is freed too. This function is created so you don't have to worry about freeing strings.

Example: char *foo; foo = thread_local_store (strdup ("hello")); –> foo == "hello" foo = thread_local_store (strdup ("world")); –> foo == "world"; "hello" is now freed.

Definition at line 298 of file prefix.cpp.

References br_str_free(), and br_thread_local_store_init().

◆ br_thread_local_store_fini()

static void br_thread_local_store_fini ( )

Definition at line 240 of file prefix.cpp.

References NULL.

Referenced by br_thread_local_store_init().

◆ br_thread_local_store_init()

static void br_thread_local_store_init ( )

Definition at line 262 of file prefix.cpp.

References br_str_free(), br_thread_local_store_fini(), and NULL.

Referenced by br_thread_local_store().

Variable Documentation

◆ br_thread_key

pthread_key_t br_thread_key

Definition at line 232 of file prefix.cpp.

◆ br_thread_key_once

pthread_once_t br_thread_key_once = PTHREAD_ONCE_INIT

Definition at line 236 of file prefix.cpp.