Browse Source

XML backend: revert some previous modifications

The new XML backend used to handle attributes by storing
them into statically allocated buffers. This is no longer
the case, so we can differentiate between valid attributes
(which are not NULL) and invalid ones (which are NULL)
as the previous XML backend did.
Emmanuel Deloget 12 years ago
parent
commit
b70c73c59d
3 changed files with 5 additions and 7 deletions
  1. 2 2
      clish/ptype/ptype.c
  2. 1 1
      clish/shell/shell_view.c
  3. 2 4
      clish/view/view.c

+ 2 - 2
clish/ptype/ptype.c

@@ -159,7 +159,7 @@ const char *clish_ptype_method__get_name(clish_ptype_method_e method)
 clish_ptype_method_e clish_ptype_method_resolve(const char *name)
 {
 	clish_ptype_method_e result = CLISH_PTYPE_REGEXP;
-	if (NULL != name && *name) {
+	if (NULL != name) {
 		unsigned i;
 		for (i = 0; i < CLISH_PTYPE_SELECT + 1; i++) {
 			if (0 == strcmp(name, method_names[i])) {
@@ -191,7 +191,7 @@ const char *clish_ptype_preprocess__get_name(
 clish_ptype_preprocess_e clish_ptype_preprocess_resolve(const char *name)
 {
 	clish_ptype_preprocess_e result = CLISH_PTYPE_NONE;
-	if (name && *name) {
+	if (name) {
 		unsigned i;
 		for (i = 0; i < CLISH_PTYPE_TOLOWER + 1; i++) {
 			if (0 == strcmp(name, preprocess_names[i])) {

+ 1 - 1
clish/shell/shell_view.c

@@ -19,7 +19,7 @@ clish_view_t *clish_shell_find_create_view(clish_shell_t * this,
 		clish_shell_insert_view(this, view);
 	} else {
 		/* set the prompt */
-		if (prompt && *prompt)
+		if (prompt)
 			clish_view__set_prompt(view, prompt);
 	}
 	return view;

+ 2 - 4
clish/view/view.c

@@ -330,10 +330,8 @@ const char *clish_view__get_name(const clish_view_t * this)
 /*--------------------------------------------------------- */
 void clish_view__set_prompt(clish_view_t * this, const char *prompt)
 {
-	if (prompt && *prompt) {
-		assert(!this->prompt);
-		this->prompt = lub_string_dup(prompt);
-	}
+	assert(!this->prompt);
+	this->prompt = lub_string_dup(prompt);
 }
 
 /*--------------------------------------------------------- */