mirror of https://github.com/swig/swig
Minor code improvements
This commit is contained in:
parent
44a883a057
commit
b65ba2a8db
|
@ -243,10 +243,10 @@ static void set_access_mode(Node *n) {
|
|||
}
|
||||
|
||||
static void restore_access_mode(Node *n) {
|
||||
char* mode = Char(Getattr(n, "access"));
|
||||
if (strcmp(mode, "private") == 0)
|
||||
String *mode = Getattr(n, "access");
|
||||
if (Strcmp(mode, "private") == 0)
|
||||
cplus_mode = CPLUS_PRIVATE;
|
||||
else if (strcmp(mode, "protected") == 0)
|
||||
else if (Strcmp(mode, "protected") == 0)
|
||||
cplus_mode = CPLUS_PROTECTED;
|
||||
else
|
||||
cplus_mode = CPLUS_PUBLIC;
|
||||
|
@ -800,7 +800,7 @@ static String *make_class_name(String *name) {
|
|||
|
||||
/* Use typedef name as class name */
|
||||
|
||||
void add_typedef_name(Node *n, Node *decl, String *oldName, Symtab *cscope, String *scpname) {
|
||||
static void add_typedef_name(Node *n, Node *decl, String *oldName, Symtab *cscope, String *scpname) {
|
||||
String *class_rename = 0;
|
||||
SwigType *decltype = Getattr(decl, "decl");
|
||||
if (!decltype || !Len(decltype)) {
|
||||
|
@ -1043,7 +1043,7 @@ static String *resolve_create_node_scope(String *cname) {
|
|||
}
|
||||
|
||||
/* look for simple typedef name in typedef list */
|
||||
String *try_to_find_a_name_for_unnamed_structure(char *storage, Node *decls) {
|
||||
static String *try_to_find_a_name_for_unnamed_structure(const char *storage, Node *decls) {
|
||||
String *name = 0;
|
||||
Node *n = decls;
|
||||
if (storage && (strcmp(storage, "typedef") == 0)) {
|
||||
|
@ -1058,7 +1058,7 @@ String *try_to_find_a_name_for_unnamed_structure(char *storage, Node *decls) {
|
|||
}
|
||||
|
||||
/* traverse copied tree segment, and update outer class links*/
|
||||
void update_nested_classes(Node *n)
|
||||
static void update_nested_classes(Node *n)
|
||||
{
|
||||
Node *c = firstChild(n);
|
||||
while (c) {
|
||||
|
|
|
@ -2391,7 +2391,7 @@ int Language::classDeclaration(Node *n) {
|
|||
}
|
||||
AccessMode oldAccessMode = cplus_mode;
|
||||
Node *outerClass = Getattr(n, "nested:outer");
|
||||
if (outerClass && oldAccessMode != Dispatcher::PUBLIC)
|
||||
if (outerClass && oldAccessMode != PUBLIC)
|
||||
return SWIG_NOWRAP;
|
||||
ClassName = Copy(name);
|
||||
ClassPrefix = Copy(symname);
|
||||
|
|
|
@ -862,13 +862,9 @@ void SWIG_getoptions(int argc, char *argv[]) {
|
|||
}
|
||||
}
|
||||
|
||||
void Swig_flatten_nested() {
|
||||
String* name = NewString("");
|
||||
String* fname = NewString("feature:flatnested");
|
||||
String* val = NewString("1");
|
||||
Swig_feature_set(Swig_cparse_features(),name,0,fname, val, 0);
|
||||
Delete(fname);
|
||||
Delete(name);
|
||||
static void flatten_nested() {
|
||||
String *val = NewString("1");
|
||||
Swig_feature_set(Swig_cparse_features(), "", 0, "feature:flatnested", val, 0);
|
||||
Delete(val);
|
||||
}
|
||||
|
||||
|
@ -1167,7 +1163,7 @@ int SWIG_main(int argc, char *argv[], Language *l) {
|
|||
|
||||
// add "ignore" directive if nested classes are not supported
|
||||
if (!lang->nestedClassesSupported())
|
||||
Swig_flatten_nested();
|
||||
flatten_nested();
|
||||
|
||||
Node *top = Swig_cparse(cpps);
|
||||
|
||||
|
|
|
@ -1683,11 +1683,10 @@ List *Swig_make_inherit_list(String *clsname, List *names, String *Namespacepref
|
|||
|
||||
ilen = Len(names);
|
||||
for (i = 0; i < ilen; i++) {
|
||||
Node *s;
|
||||
String *base;
|
||||
String *n = Getitem(names, i);
|
||||
/* Try to figure out where this symbol is */
|
||||
s = Swig_symbol_clookup(n,0);
|
||||
Node *s = Swig_symbol_clookup(n, 0);
|
||||
if (s) {
|
||||
while (s && (Strcmp(nodeType(s), "class") != 0)) {
|
||||
/* Not a class. Could be a typedef though. */
|
||||
|
|
|
@ -38,7 +38,7 @@ extern void appendChild(Node *node, Node *child);
|
|||
extern void prependChild(Node *node, Node *child);
|
||||
extern void removeNode(Node *node);
|
||||
extern Node *copyNode(Node *node);
|
||||
extern void appendSibling(Node *node, Node *chd);
|
||||
extern void appendSibling(Node *node, Node *child);
|
||||
|
||||
/* Node restoration/restore functions */
|
||||
|
||||
|
|
Loading…
Reference in New Issue