]> granicus.if.org Git - php/commitdiff
- Allow to get number of entries of a glob stream
authorMarcus Boerger <helly@php.net>
Sat, 3 Mar 2007 23:04:57 +0000 (23:04 +0000)
committerMarcus Boerger <helly@php.net>
Sat, 3 Mar 2007 23:04:57 +0000 (23:04 +0000)
main/streams/glob_wrapper.c
main/streams/php_stream_glob_wrapper.h

index b1d523a792a223e3d9459de2b45ce263785f2640..a9f1e3b5e46b467f004cafcc25ea74f6ba4534c3 100755 (executable)
@@ -90,6 +90,14 @@ PHPAPI char* _php_glob_stream_get_pattern(php_stream *stream, int copy, int *ple
 }
 /* }}} */
 
+PHPAPI int _php_glob_stream_get_count(php_stream *stream STREAMS_DC TSRMLS_DC) /* {{{ */
+{
+       glob_s_t *pglob = (glob_s_t *)stream->abstract;
+       
+       return pglob ? pglob->glob.gl_pathc : 0;
+}
+/* }}} */
+
 static void php_glob_stream_path_split(glob_s_t *pglob, char *path, int get_path, char **p_file TSRMLS_DC) /* {{{ */
 {
        char *pos, *gpath = path;
index d61d2da255813250f4c8866ed395f4f10831a6d6..0306fecb24e900e640cefb7c4e4eaa3b683669ff 100755 (executable)
@@ -29,6 +29,9 @@ PHPAPI char* _php_glob_stream_get_path(php_stream *stream, int copy, int *plen S
 PHPAPI char* _php_glob_stream_get_pattern(php_stream *stream, int copy, int *plen STREAMS_DC TSRMLS_DC);
 #define php_glob_stream_get_pattern(stream, copy, plen)        _php_glob_stream_get_pattern((stream), (copy), (plen) STREAMS_CC TSRMLS_CC)
 
+PHPAPI int   _php_glob_stream_get_count(php_stream *stream STREAMS_DC TSRMLS_DC);
+#define php_glob_stream_get_count(stream)      _php_glob_stream_get_count((stream) STREAMS_CC TSRMLS_CC)
+
 END_EXTERN_C()
 
 /*