* [RFA] Renam sutruct using_direct members
@ 2009-05-25 18:39 Sami Wagiaalla
2009-06-04 21:30 ` Tom Tromey
0 siblings, 1 reply; 4+ messages in thread
From: Sami Wagiaalla @ 2009-05-25 18:39 UTC (permalink / raw)
To: GDB Patches
[-- Attachment #1: Type: text/plain, Size: 4155 bytes --]
struct using_direct
{
char *inner;
char *outer;
struct using_direct *next;
};
The names inner and outer are not very clear. I certainly found it
unintuitive while working on namespace support. This patch renames them
no import_src and import_dest respectively
2009-05-25 Sami Wagiaalla <swagiaal@redhat.com>
* cp-support.h (struct using_direct): renamed members inner, and
outer to import_src, and import_dest respectively.
Updated all reverences.
diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c
index c6c5617..05776e5 100644
--- a/gdb/cp-namespace.c
+++ b/gdb/cp-namespace.c
@@ -172,9 +172,9 @@ cp_add_using_directive (const char *name, unsigned
int outer_length,
for (current = using_list; current != NULL; current = current->next)
{
- if ((strncmp (current->inner, name, inner_length) == 0)
- && (strlen (current->inner) == inner_length)
- && (strlen (current->outer) == outer_length))
+ if ((strncmp (current->import_src, name, inner_length) == 0)
+ && (strlen (current->import_src) == inner_length)
+ && (strlen (current->import_dest) == outer_length))
return;
}
@@ -248,8 +248,8 @@ cp_add_using (const char *name,
gdb_assert (outer_len < inner_len);
retval = xmalloc (sizeof (struct using_direct));
- retval->inner = savestring (name, inner_len);
- retval->outer = savestring (name, outer_len);
+ retval->import_src = savestring (name, inner_len);
+ retval->import_dest = savestring (name, outer_len);
retval->next = next;
return retval;
@@ -271,14 +271,14 @@ cp_copy_usings (struct using_direct *using,
{
struct using_direct *retval
= obstack_alloc (obstack, sizeof (struct using_direct));
- retval->inner = obsavestring (using->inner, strlen (using->inner),
+ retval->import_src = obsavestring (using->import_src, strlen
(using->import_src),
obstack);
- retval->outer = obsavestring (using->outer, strlen (using->outer),
+ retval->import_dest = obsavestring (using->import_dest, strlen
(using->import_dest),
obstack);
retval->next = cp_copy_usings (using->next, obstack);
- xfree (using->inner);
- xfree (using->outer);
+ xfree (using->import_src);
+ xfree (using->import_dest);
xfree (using);
return retval;
@@ -380,9 +380,9 @@ cp_lookup_symbol_namespace (const char *namespace,
current != NULL;
current = current->next)
{
- if (strcmp (namespace, current->outer) == 0)
+ if (strcmp (namespace, current->import_dest) == 0)
{
- sym = cp_lookup_symbol_namespace (current->inner,
+ sym = cp_lookup_symbol_namespace (current->import_src,
name,
linkage_name,
block,
diff --git a/gdb/cp-support.c b/gdb/cp-support.c
index bf42636..f12d785 100644
--- a/gdb/cp-support.c
+++ b/gdb/cp-support.c
@@ -716,10 +716,10 @@ make_symbol_overload_list_using (const char
*func_name,
current != NULL;
current = current->next)
{
- if (strcmp (namespace, current->outer) == 0)
+ if (strcmp (namespace, current->import_dest) == 0)
{
make_symbol_overload_list_using (func_name,
- current->inner);
+ current->import_src);
}
}
diff --git a/gdb/cp-support.h b/gdb/cp-support.h
index 837ca6c..bd86638 100644
--- a/gdb/cp-support.h
+++ b/gdb/cp-support.h
@@ -37,15 +37,15 @@ struct type;
struct demangle_component;
/* This struct is designed to store data from using directives. It
- says that names from namespace INNER should be visible within
- namespace OUTER. OUTER should always be a strict initial substring
- of INNER. These form a linked list; NEXT is the next element of
- the list. */
+ says that names from namespace IMPORT_SRC should be visible within
+ namespace IMPORT_DEST. IMPORT_DEST should always be a strict initial
+ substring of IMPORT_SRC. These form a linked list; NEXT is the next
element
+ of the list. */
struct using_direct
{
- char *inner;
- char *outer;
+ char *import_src;
+ char *import_dest;
struct using_direct *next;
};
[-- Attachment #2: using_diret-rename.patch --]
[-- Type: text/plain, Size: 3613 bytes --]
diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c
index c6c5617..05776e5 100644
--- a/gdb/cp-namespace.c
+++ b/gdb/cp-namespace.c
@@ -172,9 +172,9 @@ cp_add_using_directive (const char *name, unsigned int outer_length,
for (current = using_list; current != NULL; current = current->next)
{
- if ((strncmp (current->inner, name, inner_length) == 0)
- && (strlen (current->inner) == inner_length)
- && (strlen (current->outer) == outer_length))
+ if ((strncmp (current->import_src, name, inner_length) == 0)
+ && (strlen (current->import_src) == inner_length)
+ && (strlen (current->import_dest) == outer_length))
return;
}
@@ -248,8 +248,8 @@ cp_add_using (const char *name,
gdb_assert (outer_len < inner_len);
retval = xmalloc (sizeof (struct using_direct));
- retval->inner = savestring (name, inner_len);
- retval->outer = savestring (name, outer_len);
+ retval->import_src = savestring (name, inner_len);
+ retval->import_dest = savestring (name, outer_len);
retval->next = next;
return retval;
@@ -271,14 +271,14 @@ cp_copy_usings (struct using_direct *using,
{
struct using_direct *retval
= obstack_alloc (obstack, sizeof (struct using_direct));
- retval->inner = obsavestring (using->inner, strlen (using->inner),
+ retval->import_src = obsavestring (using->import_src, strlen (using->import_src),
obstack);
- retval->outer = obsavestring (using->outer, strlen (using->outer),
+ retval->import_dest = obsavestring (using->import_dest, strlen (using->import_dest),
obstack);
retval->next = cp_copy_usings (using->next, obstack);
- xfree (using->inner);
- xfree (using->outer);
+ xfree (using->import_src);
+ xfree (using->import_dest);
xfree (using);
return retval;
@@ -380,9 +380,9 @@ cp_lookup_symbol_namespace (const char *namespace,
current != NULL;
current = current->next)
{
- if (strcmp (namespace, current->outer) == 0)
+ if (strcmp (namespace, current->import_dest) == 0)
{
- sym = cp_lookup_symbol_namespace (current->inner,
+ sym = cp_lookup_symbol_namespace (current->import_src,
name,
linkage_name,
block,
diff --git a/gdb/cp-support.c b/gdb/cp-support.c
index bf42636..f12d785 100644
--- a/gdb/cp-support.c
+++ b/gdb/cp-support.c
@@ -716,10 +716,10 @@ make_symbol_overload_list_using (const char *func_name,
current != NULL;
current = current->next)
{
- if (strcmp (namespace, current->outer) == 0)
+ if (strcmp (namespace, current->import_dest) == 0)
{
make_symbol_overload_list_using (func_name,
- current->inner);
+ current->import_src);
}
}
diff --git a/gdb/cp-support.h b/gdb/cp-support.h
index 837ca6c..bd86638 100644
--- a/gdb/cp-support.h
+++ b/gdb/cp-support.h
@@ -37,15 +37,15 @@ struct type;
struct demangle_component;
/* This struct is designed to store data from using directives. It
- says that names from namespace INNER should be visible within
- namespace OUTER. OUTER should always be a strict initial substring
- of INNER. These form a linked list; NEXT is the next element of
- the list. */
+ says that names from namespace IMPORT_SRC should be visible within
+ namespace IMPORT_DEST. IMPORT_DEST should always be a strict initial
+ substring of IMPORT_SRC. These form a linked list; NEXT is the next element
+ of the list. */
struct using_direct
{
- char *inner;
- char *outer;
+ char *import_src;
+ char *import_dest;
struct using_direct *next;
};
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RFA] Renam sutruct using_direct members
2009-05-25 18:39 [RFA] Renam sutruct using_direct members Sami Wagiaalla
@ 2009-06-04 21:30 ` Tom Tromey
2009-06-30 16:44 ` Sami Wagiaalla
0 siblings, 1 reply; 4+ messages in thread
From: Tom Tromey @ 2009-06-04 21:30 UTC (permalink / raw)
To: Sami Wagiaalla; +Cc: GDB Patches
>>>>> "Sami" == Sami Wagiaalla <swagiaal@redhat.com> writes:
Sami> struct using_direct
Sami> {
Sami> char *inner;
Sami> char *outer;
Sami> struct using_direct *next;
Sami> };
Sami> The names inner and outer are not very clear. I certainly found it
Sami> unintuitive while working on namespace support. This patch renames them
Sami> no import_src and import_dest respectively
Seems reasonable. I agree that these names are not very clear.
Sami> 2009-05-25 Sami Wagiaalla <swagiaal@redhat.com>
Sami> * cp-support.h (struct using_direct): renamed members inner, and
Sami> outer to import_src, and import_dest respectively.
Sami> Updated all reverences.
A few nits about the ChangeLog... It should mention all files that
were changed. Descriptions should start with a capital letter. All
lines should start with a single TAB (the second one did not in the
email).
For this one I would write:
2009-05-25 Sami Wagiaalla <swagiaal@redhat.com>
* cp-support.h (struct using_direct): Rename members inner and
outer to import_src, and import_dest respectively.
* cp-namespace.c (cp_add_using_directive): Update.
(cp_add_using): Update.
(cp_copy_usings): Update.
(cp_lookup_symbol_namespace): Update.
* cp-support.c (make_symbol_overload_list_using): Update.
Also, your patch seems to have been wrapped at some places... wrong
MUA setting somewhere?
This is ok with an updated ChangeLog.
Tom
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RFA] Renam sutruct using_direct members
2009-06-04 21:30 ` Tom Tromey
@ 2009-06-30 16:44 ` Sami Wagiaalla
2009-06-30 21:25 ` Tom Tromey
0 siblings, 1 reply; 4+ messages in thread
From: Sami Wagiaalla @ 2009-06-30 16:44 UTC (permalink / raw)
To: gdb-patches
I have expanded this patch to include a general rename of the
variables and arguments of all callers.
2009-06-29 Sami Wagiaalla <swagiaal@redhat.com>
* cp-support.h (struct using_direct): Rename members inner and
outer to import_src, and import_dest respectively.
* cp-namespace.c (cp_add_using_directive): Update.
(cp_add_using): Update.
(cp_copy_usings): Update.
(cp_lookup_symbol_namespace): Update.
(cp_scan_for_anonymous_namespaces): Update.
* cp-support.c (make_symbol_overload_list_using): Update.
* cp-support.h (cp_add_using_directive, cp_add_using): Rename
arguments from inner and outer to src and dest respectively.
* cp-namespace.c (cp_add_using_directive): Ditto.
(cp_add_using): Ditto.
diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c
index ef526ca..d2d8f2e 100644
--- a/gdb/cp-namespace.c
+++ b/gdb/cp-namespace.c
@@ -103,23 +103,23 @@ cp_scan_for_anonymous_namespaces (const struct
symbol *symbol)
"(anonymous namespace)",
ANONYMOUS_NAMESPACE_LEN) == 0)
{
- int outer_len = (previous_component == 0 ? 0 :
previous_component - 2);
- int inner_len = next_component;
+ int dest_len = (previous_component == 0 ? 0 : previous_component
- 2);
+ int src_len = next_component;
- char *outer = alloca (outer_len + 1);
- char *inner = alloca (inner_len + 1);
+ char *dest = alloca (dest_len + 1);
+ char *src = alloca (src_len + 1);
- memcpy (outer, name, outer_len);
- memcpy (inner, name, inner_len);
+ memcpy (dest, name, dest_len);
+ memcpy (src, name, src_len);
- outer[outer_len] = '\0';
- inner[inner_len] = '\0';
+ dest[dest_len] = '\0';
+ src[src_len] = '\0';
/* We've found a component of the name that's an
anonymous namespace. So add symbols in it to the
namespace given by the previous component if there is
one, or to the global namespace if there isn't. */
- cp_add_using_directive (outer, inner);
+ cp_add_using_directive (dest, src);
}
/* The "+ 2" is for the "::". */
previous_component = next_component + 2;
@@ -134,7 +134,7 @@ cp_scan_for_anonymous_namespaces (const struct
symbol *symbol)
has already been added, don't add it twice. */
void
-cp_add_using_directive (const char *outer, const char *inner)
+cp_add_using_directive (const char *dest, const char *src)
{
struct using_direct *current;
struct using_direct *new;
@@ -143,12 +143,12 @@ cp_add_using_directive (const char *outer, const
char *inner)
for (current = using_directives; current != NULL; current =
current->next)
{
- if (strcmp (current->inner, inner) == 0
- && strcmp (current->outer, outer) == 0)
+ if (strcmp (current->import_src, src) == 0
+ && strcmp (current->import_dest, dest) == 0)
return;
}
- using_directives = cp_add_using (outer, inner, using_directives);
+ using_directives = cp_add_using (dest, src, using_directives);
}
@@ -200,22 +200,22 @@ cp_is_anonymous (const char *namespace)
!= NULL);
}
-/* Create a new struct using direct whose inner namespace is INNER
- and whose outer namespace is OUTER.
+/* Create a new struct using direct which imports the namespace SRC
+ into the scope DEST.
Set its next member in the linked list to NEXT; allocate all memory
using xmalloc. It copies the strings, so NAME can be a temporary
string. */
struct using_direct *
-cp_add_using (const char *outer,
- const char *inner,
+cp_add_using (const char *dest,
+ const char *src,
struct using_direct *next)
{
struct using_direct *retval;
retval = xmalloc (sizeof (struct using_direct));
- retval->inner = savestring (inner, strlen(inner));
- retval->outer = savestring (outer, strlen(outer));
+ retval->import_src = savestring (src, strlen(src));
+ retval->import_dest = savestring (dest, strlen(dest));
retval->next = next;
return retval;
@@ -237,14 +237,14 @@ cp_copy_usings (struct using_direct *using,
{
struct using_direct *retval
= obstack_alloc (obstack, sizeof (struct using_direct));
- retval->inner = obsavestring (using->inner, strlen (using->inner),
+ retval->import_src = obsavestring (using->import_src, strlen
(using->import_src),
obstack);
- retval->outer = obsavestring (using->outer, strlen (using->outer),
+ retval->import_dest = obsavestring (using->import_dest, strlen
(using->import_dest),
obstack);
retval->next = cp_copy_usings (using->next, obstack);
- xfree (using->inner);
- xfree (using->outer);
+ xfree (using->import_src);
+ xfree (using->import_dest);
xfree (using);
return retval;
@@ -346,9 +346,9 @@ cp_lookup_symbol_namespace (const char *namespace,
current != NULL;
current = current->next)
{
- if (strcmp (namespace, current->outer) == 0)
+ if (strcmp (namespace, current->import_dest) == 0)
{
- sym = cp_lookup_symbol_namespace (current->inner,
+ sym = cp_lookup_symbol_namespace (current->import_src,
name,
linkage_name,
block,
diff --git a/gdb/cp-support.c b/gdb/cp-support.c
index bf42636..f12d785 100644
--- a/gdb/cp-support.c
+++ b/gdb/cp-support.c
@@ -716,10 +716,10 @@ make_symbol_overload_list_using (const char
*func_name,
current != NULL;
current = current->next)
{
- if (strcmp (namespace, current->outer) == 0)
+ if (strcmp (namespace, current->import_dest) == 0)
{
make_symbol_overload_list_using (func_name,
- current->inner);
+ current->import_src);
}
}
diff --git a/gdb/cp-support.h b/gdb/cp-support.h
index ea36608..b5a5c5f 100644
--- a/gdb/cp-support.h
+++ b/gdb/cp-support.h
@@ -37,15 +37,15 @@ struct type;
struct demangle_component;
/* This struct is designed to store data from using directives. It
- says that names from namespace INNER should be visible within
- namespace OUTER. OUTER should always be a strict initial substring
- of INNER. These form a linked list; NEXT is the next element of
- the list. */
+ says that names from namespace IMPORT_SRC should be visible within
+ namespace IMPORT_DEST. IMPORT_DEST should always be a strict initial
+ substring of IMPORT_SRC. These form a linked list; NEXT is the next
element
+ of the list. */
struct using_direct
{
- char *inner;
- char *outer;
+ char *import_src;
+ char *import_dest;
struct using_direct *next;
};
@@ -76,11 +76,11 @@ extern struct type *cp_lookup_rtti_type (const char
*name,
extern int cp_is_anonymous (const char *namespace);
-extern void cp_add_using_directive (const char *outer,
- const char *inner);
+extern void cp_add_using_directive (const char *dest,
+ const char *src);
-extern struct using_direct *cp_add_using (const char *outer,
- const char *inner,
+extern struct using_direct *cp_add_using (const char *dest,
+ const char *src,
struct using_direct *next);
extern void cp_initialize_namespace (void);
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RFA] Renam sutruct using_direct members
2009-06-30 16:44 ` Sami Wagiaalla
@ 2009-06-30 21:25 ` Tom Tromey
0 siblings, 0 replies; 4+ messages in thread
From: Tom Tromey @ 2009-06-30 21:25 UTC (permalink / raw)
To: Sami Wagiaalla; +Cc: gdb-patches
>>>>> "Sami" == Sami Wagiaalla <swagiaal@redhat.com> writes:
Sami> I have expanded this patch to include a general rename of the
Sami> variables and arguments of all callers.
Thanks. This is ok.
Sami> - int outer_len = (previous_component == 0 ? 0 :
Sami> previous_component - 2);
Your patch got word-wrapped somehow.
Tom
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-06-30 21:25 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-25 18:39 [RFA] Renam sutruct using_direct members Sami Wagiaalla
2009-06-04 21:30 ` Tom Tromey
2009-06-30 16:44 ` Sami Wagiaalla
2009-06-30 21:25 ` Tom Tromey
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox