Revision: 77530
          http://sourceforge.net/p/brlcad/code/77530
Author:   brlcad
Date:     2020-10-22 03:52:11 +0000 (Thu, 22 Oct 2020)
Log Message:
-----------
rename non-public symbols without the ged prefix

Modified Paths:
--------------
    brlcad/trunk/src/libged/ged_init.cpp

Modified: brlcad/trunk/src/libged/ged_init.cpp
===================================================================
--- brlcad/trunk/src/libged/ged_init.cpp        2020-10-22 03:44:31 UTC (rev 
77529)
+++ brlcad/trunk/src/libged/ged_init.cpp        2020-10-22 03:52:11 UTC (rev 
77530)
@@ -43,7 +43,7 @@
 
 #include "./include/plugin.h"
 
-static std::map<std::string, const struct ged_cmd *> ged_cmd_map;
+static std::map<std::string, const struct ged_cmd *> cmd_map;
 static size_t cmd_list_len = 0;
 static char **cmd_list = NULL;
 void *ged_cmds;
@@ -50,9 +50,10 @@
 
 extern "C" void libged_init(void);
 
-static std::set<void *> ged_handles;
+static std::set<void *> cmd_funcs;
 static struct bu_vls init_msgs = BU_VLS_INIT_ZERO;
 
+
 const char *
 ged_init_msgs()
 {
@@ -59,8 +60,9 @@
     return bu_vls_cstr(&init_msgs);
 }
 
-/* If func is NULL, just see if the string has a ged_cmd_map entry.
- * If func is defined, see if a) func and cmd have ged_cmd_map entries and
+
+/* If func is NULL, just see if the string has a cmd_map entry.
+ * If func is defined, see if a) func and cmd have cmd_map entries and
  * b) if they both do, whether they map to the same function. */
 int
 ged_cmd_valid(const char *cmd, const char *func)
@@ -76,13 +78,13 @@
     // probably what happened, so call libged_init again here.  By the time we
     // are calling ged_cmd_valid bu_setprogname should be set and we should be
     // ready to actually find the commands.
-    if (!ged_cmd_map.size()) {
+    if (!cmd_map.size()) {
        libged_init();
     }
 
     std::string scmd(cmd);
-    std::map<std::string, const struct ged_cmd *>::iterator cmd_it = 
ged_cmd_map.find(scmd);
-    if (cmd_it != ged_cmd_map.end()) {
+    std::map<std::string, const struct ged_cmd *>::iterator cmd_it = 
cmd_map.find(scmd);
+    if (cmd_it != cmd_map.end()) {
        cmd_invalid = 0;
     }
     if (cmd_invalid) {
@@ -91,8 +93,8 @@
 
     if (func) {
        ged_func_ptr c1 = cmd_it->second->i->cmd;
-       std::map<std::string, const struct ged_cmd *>::iterator func_it = 
ged_cmd_map.find(std::string(func));
-       if (func_it == ged_cmd_map.end()) {
+       std::map<std::string, const struct ged_cmd *>::iterator func_it = 
cmd_map.find(std::string(func));
+       if (func_it == cmd_map.end()) {
            // func not in table, nothing to validate against - return invalid
            return 1;
        }
@@ -124,7 +126,7 @@
     // probably what happened, so call libged_init again here.  By the time we
     // are calling ged_cmd_valid bu_setprogname should be set and we should be
     // ready to actually find the commands.
-    if (!ged_cmd_map.size()) {
+    if (!cmd_map.size()) {
        libged_init();
     }
 
@@ -131,7 +133,7 @@
     const char *ccmd = NULL;
     std::string scmd(cmd);
     std::map<std::string, const struct ged_cmd *>::iterator cmd_it;
-    for (cmd_it = ged_cmd_map.begin(); cmd_it != ged_cmd_map.end(); cmd_it++) {
+    for (cmd_it = cmd_map.begin(); cmd_it != cmd_map.end(); cmd_it++) {
        unsigned long edist = bu_editdist(cmd, cmd_it->first.c_str(), 0);
        if (edist < min_dist) {
            ccmd = (*cmd_it).first.c_str();
@@ -150,9 +152,9 @@
        bu_argv_free(cmd_list_len, (char **)cmd_list);
        cmd_list_len = 0;
     }
-    cmd_list = (char **)bu_calloc(ged_cmd_map.size(), sizeof(char *), "ged cmd 
argv");
+    cmd_list = (char **)bu_calloc(cmd_map.size(), sizeof(char *), "ged cmd 
argv");
     std::map<std::string, const struct ged_cmd *>::iterator m_it;
-    for (m_it = ged_cmd_map.begin(); m_it != ged_cmd_map.end(); m_it++) {
+    for (m_it = cmd_map.begin(); m_it != cmd_map.end(); m_it++) {
        const char *str = m_it->first.c_str();
        cmd_list[cmd_list_len] = bu_strdup(str);
        cmd_list_len++;
@@ -228,21 +230,21 @@
            for (int c = 0; c < plugin->cmd_cnt; c++) {
                const struct ged_cmd *cmd = cmds[c];
                std::string key(cmd->i->cname);
-               if (ged_cmd_map.find(key) != ged_cmd_map.end()) {
+               if (cmd_map.find(key) != cmd_map.end()) {
                    bu_vls_printf(&init_msgs, "Warning - plugin '%s' provides 
command '%s' but that command has already been loaded, skipping\n", pfile, 
cmd->i->cname);
                    continue;
                }
-               ged_cmd_map[key] = cmd;
+               cmd_map[key] = cmd;
 
                // MGED calls many of these commands with an _mged_ prefix - 
allow for that
                std::string mged_key = std::string("_mged_") + key;
-               ged_cmd_map[mged_key] = cmd;
+               cmd_map[mged_key] = cmd;
            }
-           ged_handles.insert(dl_handle);
+           cmd_funcs.insert(dl_handle);
        }
     }
 
-    ged_cmds = (void *)&ged_cmd_map;
+    ged_cmds = (void *)&cmd_map;
 }
 
 
@@ -249,13 +251,13 @@
 static void
 libged_clear(void)
 {
-    ged_cmd_map.clear();
+    cmd_map.clear();
     std::set<void *>::iterator h_it;
-    for (h_it = ged_handles.begin(); h_it != ged_handles.end(); h_it++) {
+    for (h_it = cmd_funcs.begin(); h_it != cmd_funcs.end(); h_it++) {
        void *handle = *h_it;
        bu_dlclose(handle);
     }
-    ged_handles.clear();
+    cmd_funcs.clear();
 }
 
 

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to