Skip to content
Browse files

if no match is found in Augeas::match(), an empty array should be ret…

…urned instead of NULL
  • Loading branch information...
1 parent d37884b commit 3856bc4827a71c53ef0962c3e5ee7dd65048c199 @ppadron committed Nov 18, 2009
Showing with 7 additions and 7 deletions.
  1. +7 −7 augeas.c
View
14 augeas.c
@@ -322,16 +322,16 @@ PHP_METHOD(Augeas, match)
retval = aug_match(aug->augeas, path, &matches);
- if (retval == 0) {
- RETURN_NULL();
- }
-
array_init(return_value);
-
- for (i=0; i<retval; i++) {
- add_next_index_string(return_value, matches[i], 1);
+
+ if (retval > 0) {
+ for (i=0; i<retval; i++) {
+ add_next_index_string(return_value, matches[i], 1);
+ }
}
+ /* if no matches were found, an empty array (return_value) is returned */
+
}
/* }}} */

0 comments on commit 3856bc4

Please sign in to comment.
Something went wrong with that request. Please try again.