Skip to content

Commit 8827f8e

Browse files
author
Stefan Esser
committed
renamed ftp_async_* into ftp_nb_*
1 parent aadb0c9 commit 8827f8e

File tree

4 files changed

+58
-58
lines changed

4 files changed

+58
-58
lines changed

ext/ftp/ftp.c

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ ftp_open(const char *host, short port, long timeout_sec TSRMLS_DC)
138138

139139
/* Default Settings */
140140
ftp->timeout_sec = timeout_sec;
141-
ftp->async = 0;
141+
ftp->nb = 0;
142142

143143
size = sizeof(ftp->localaddr);
144144
memset(&ftp->localaddr, 0, size);
@@ -250,7 +250,7 @@ ftp_reinit(ftpbuf_t *ftp)
250250

251251
ftp_gc(ftp);
252252

253-
ftp->async = 0;
253+
ftp->nb = 0;
254254

255255
if (!ftp_putcmd(ftp, "REIN", NULL))
256256
return 0;
@@ -1381,10 +1381,10 @@ ftp_genlist(ftpbuf_t *ftp, const char *cmd, const char *path)
13811381
}
13821382
/* }}} */
13831383

1384-
/* {{{ ftp_async_get
1384+
/* {{{ ftp_nb_get
13851385
*/
13861386
int
1387-
ftp_async_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type, int resumepos)
1387+
ftp_nb_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type, int resumepos)
13881388
{
13891389
databuf_t *data = NULL;
13901390
char arg[11];
@@ -1425,20 +1425,20 @@ ftp_async_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t
14251425
ftp->data = data;
14261426
ftp->stream = outstream;
14271427
ftp->lastch = 0;
1428-
ftp->async = 1;
1428+
ftp->nb = 1;
14291429

1430-
return (ftp_async_continue_read(ftp));
1430+
return (ftp_nb_continue_read(ftp));
14311431

14321432
bail:
14331433
data_close(data);
14341434
return PHP_FTP_FAILED;
14351435
}
14361436
/* }}} */
14371437

1438-
/* {{{ ftp_aget
1438+
/* {{{ ftp_nb_continue_read
14391439
*/
14401440
int
1441-
ftp_async_continue_read(ftpbuf_t *ftp)
1441+
ftp_nb_continue_read(ftpbuf_t *ftp)
14421442
{
14431443
databuf_t *data = NULL;
14441444
char *ptr;
@@ -1489,19 +1489,19 @@ ftp_async_continue_read(ftpbuf_t *ftp)
14891489
goto bail;
14901490
}
14911491

1492-
ftp->async = 0;
1492+
ftp->nb = 0;
14931493
return PHP_FTP_FINISHED;
14941494
bail:
1495-
ftp->async = 0;
1495+
ftp->nb = 0;
14961496
data_close(data);
14971497
return PHP_FTP_FAILED;
14981498
}
14991499
/* }}} */
15001500

1501-
/* {{{ ftp_async_put
1501+
/* {{{ ftp_nb_put
15021502
*/
15031503
int
1504-
ftp_async_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, int startpos)
1504+
ftp_nb_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, int startpos)
15051505
{
15061506
databuf_t *data = NULL;
15071507
char arg[11];
@@ -1537,9 +1537,9 @@ ftp_async_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t t
15371537
ftp->data = data;
15381538
ftp->stream = instream;
15391539
ftp->lastch = 0;
1540-
ftp->async = 1;
1540+
ftp->nb = 1;
15411541

1542-
return (ftp_async_continue_write(ftp));
1542+
return (ftp_nb_continue_write(ftp));
15431543

15441544
bail:
15451545
data_close(data);
@@ -1549,10 +1549,10 @@ ftp_async_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t t
15491549
/* }}} */
15501550

15511551

1552-
/* {{{ ftp_async_continue_write
1552+
/* {{{ ftp_nb_continue_write
15531553
*/
15541554
int
1555-
ftp_async_continue_write(ftpbuf_t *ftp)
1555+
ftp_nb_continue_write(ftpbuf_t *ftp)
15561556
{
15571557
int size;
15581558
char *ptr;
@@ -1594,11 +1594,11 @@ ftp_async_continue_write(ftpbuf_t *ftp)
15941594
if (!ftp_getresp(ftp) || (ftp->resp != 226 && ftp->resp != 250))
15951595
goto bail;
15961596

1597-
ftp->async = 0;
1597+
ftp->nb = 0;
15981598
return PHP_FTP_FINISHED;
15991599
bail:
16001600
data_close(ftp->data);
1601-
ftp->async = 0;
1601+
ftp->nb = 0;
16021602
return PHP_FTP_FAILED;
16031603
}
16041604
/* }}} */

ext/ftp/ftp.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ typedef struct ftpbuf
6868
long timeout_sec; /* User configureable timeout (seconds) */
6969
int autoseek; /* User configureable autoseek flag */
7070

71-
int async; /* asyncronous transfer in progress */
72-
databuf_t *data; /* Data connection for asyncrounous transfers */
73-
php_stream *stream; /* output stream for asyncrounous transfers */
71+
int nb; /* "nonblocking" transfer in progress */
72+
databuf_t *data; /* Data connection for "nonblocking" transfers */
73+
php_stream *stream; /* output stream for "nonblocking" transfers */
7474
int lastch; /* last char of previous call */
7575
int direction; /* recv = 0 / send = 1 */
7676
int closestream;/* close or not close stream */
@@ -170,21 +170,21 @@ int ftp_site(ftpbuf_t *ftp, const char *cmd);
170170
/* retrieves part of a file and saves its contents to outfp
171171
* returns true on success, false on error
172172
*/
173-
int ftp_async_get(ftpbuf_t *ftp, php_stream *outstream, const char *path,
173+
int ftp_nb_get(ftpbuf_t *ftp, php_stream *outstream, const char *path,
174174
ftptype_t type, int resumepos);
175175

176176
/* stores the data from a file, socket, or process as a file on the remote server
177177
* returns true on success, false on error
178178
*/
179-
int ftp_async_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, int startpos);
179+
int ftp_nb_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, int startpos);
180180

181-
/* continues a previous async_(f)get command
181+
/* continues a previous nb_(f)get command
182182
*/
183-
int ftp_async_continue_read(ftpbuf_t *ftp);
183+
int ftp_nb_continue_read(ftpbuf_t *ftp);
184184

185-
/* continues a previous async_(f)put command
185+
/* continues a previous nb_(f)put command
186186
*/
187-
int ftp_async_continue_write(ftpbuf_t *ftp);
187+
int ftp_nb_continue_write(ftpbuf_t *ftp);
188188

189189

190190
#endif

ext/ftp/php_ftp.c

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,11 @@ function_entry php_ftp_functions[] = {
7171
PHP_FE(ftp_close, NULL)
7272
PHP_FE(ftp_set_option, NULL)
7373
PHP_FE(ftp_get_option, NULL)
74-
PHP_FE(ftp_async_fget, NULL)
75-
PHP_FE(ftp_async_get, NULL)
76-
PHP_FE(ftp_async_continue, NULL)
77-
PHP_FE(ftp_async_put, NULL)
78-
PHP_FE(ftp_async_fput, NULL)
74+
PHP_FE(ftp_nb_fget, NULL)
75+
PHP_FE(ftp_nb_get, NULL)
76+
PHP_FE(ftp_nb_continue, NULL)
77+
PHP_FE(ftp_nb_put, NULL)
78+
PHP_FE(ftp_nb_fput, NULL)
7979
PHP_FALIAS(ftp_quit, ftp_close, NULL)
8080
{NULL, NULL, NULL}
8181
};
@@ -460,9 +460,9 @@ PHP_FUNCTION(ftp_fget)
460460
}
461461
/* }}} */
462462

463-
/* {{{ proto bool ftp_async_fget(resource stream, resource fp, string remote_file, int mode[, int resumepos])
463+
/* {{{ proto bool ftp_nb_fget(resource stream, resource fp, string remote_file, int mode[, int resumepos])
464464
Retrieves a file from the FTP server asynchronly and writes it to an open file */
465-
PHP_FUNCTION(ftp_async_fget)
465+
PHP_FUNCTION(ftp_nb_fget)
466466
{
467467
zval *z_ftp, *z_file;
468468
ftpbuf_t *ftp;
@@ -498,7 +498,7 @@ PHP_FUNCTION(ftp_async_fget)
498498
ftp->direction = 0; /* recv */
499499
ftp->closestream = 0; /* do not close */
500500

501-
if ((ret = ftp_async_get(ftp, stream, file, xtype, resumepos)) == PHP_FTP_FAILED) {
501+
if ((ret = ftp_nb_get(ftp, stream, file, xtype, resumepos)) == PHP_FTP_FAILED) {
502502
php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ftp->inbuf);
503503
RETURN_LONG(ret);
504504
}
@@ -585,9 +585,9 @@ PHP_FUNCTION(ftp_get)
585585
}
586586
/* }}} */
587587

588-
/* {{{ proto int ftp_async_get(resource stream, string local_file, string remote_file, int mode[, int resume_pos])
589-
Retrieves a file from the FTP server asynchronly and writes it to a local file */
590-
PHP_FUNCTION(ftp_async_get)
588+
/* {{{ proto int ftp_nb_get(resource stream, string local_file, string remote_file, int mode[, int resume_pos])
589+
Retrieves a file from the FTP server nbhronly and writes it to a local file */
590+
PHP_FUNCTION(ftp_nb_get)
591591
{
592592
zval *z_ftp;
593593
ftpbuf_t *ftp;
@@ -635,7 +635,7 @@ PHP_FUNCTION(ftp_async_get)
635635
ftp->direction = 0; /* recv */
636636
ftp->closestream = 1; /* do close */
637637

638-
if ((ret = ftp_async_get(ftp, outstream, remote, xtype, resumepos)) == PHP_FTP_FAILED) {
638+
if ((ret = ftp_nb_get(ftp, outstream, remote, xtype, resumepos)) == PHP_FTP_FAILED) {
639639
php_stream_close(outstream);
640640
php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ftp->inbuf);
641641
RETURN_LONG(PHP_FTP_FAILED);
@@ -649,9 +649,9 @@ PHP_FUNCTION(ftp_async_get)
649649
}
650650
/* }}} */
651651

652-
/* {{{ proto int ftp_async_continue(resource stream)
653-
Continues retrieving/sending a file asyncronously */
654-
PHP_FUNCTION(ftp_async_continue)
652+
/* {{{ proto int ftp_nb_continue(resource stream)
653+
Continues retrieving/sending a file nbronously */
654+
PHP_FUNCTION(ftp_nb_continue)
655655
{
656656
zval *z_ftp;
657657
ftpbuf_t *ftp;
@@ -663,15 +663,15 @@ PHP_FUNCTION(ftp_async_continue)
663663

664664
ZEND_FETCH_RESOURCE(ftp, ftpbuf_t*, &z_ftp, -1, le_ftpbuf_name, le_ftpbuf);
665665

666-
if (!ftp->async) {
667-
php_error_docref(NULL TSRMLS_CC, E_WARNING, "no asyncronous transfer to continue.");
666+
if (!ftp->nb) {
667+
php_error_docref(NULL TSRMLS_CC, E_WARNING, "no nbronous transfer to continue.");
668668
RETURN_LONG(PHP_FTP_FAILED);
669669
}
670670

671671
if (ftp->direction) {
672-
ret=ftp_async_continue_write(ftp);
672+
ret=ftp_nb_continue_write(ftp);
673673
} else {
674-
ret=ftp_async_continue_read(ftp);
674+
ret=ftp_nb_continue_read(ftp);
675675
}
676676

677677
if (ret != PHP_FTP_MOREDATA && ftp->closestream) {
@@ -732,9 +732,9 @@ PHP_FUNCTION(ftp_fput)
732732
}
733733
/* }}} */
734734

735-
/* {{{ proto bool ftp_async_fput(resource stream, string remote_file, resource fp, int mode[, int startpos])
736-
Stores a file from an open file to the FTP server asyncronly */
737-
PHP_FUNCTION(ftp_async_fput)
735+
/* {{{ proto bool ftp_nb_fput(resource stream, string remote_file, resource fp, int mode[, int startpos])
736+
Stores a file from an open file to the FTP server nbronly */
737+
PHP_FUNCTION(ftp_nb_fput)
738738
{
739739
zval *z_ftp, *z_file;
740740
ftpbuf_t *ftp;
@@ -773,7 +773,7 @@ PHP_FUNCTION(ftp_async_fput)
773773
ftp->direction = 1; /* send */
774774
ftp->closestream = 0; /* do not close */
775775

776-
if (((ret = ftp_async_put(ftp, remote, stream, xtype, startpos)) == PHP_FTP_FAILED)) {
776+
if (((ret = ftp_nb_put(ftp, remote, stream, xtype, startpos)) == PHP_FTP_FAILED)) {
777777
php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ftp->inbuf);
778778
RETURN_LONG(ret);
779779
}
@@ -837,9 +837,9 @@ PHP_FUNCTION(ftp_put)
837837
/* }}} */
838838

839839

840-
/* {{{ proto bool ftp_async_put(resource stream, string remote_file, string local_file, int mode[, int startpos])
840+
/* {{{ proto bool ftp_nb_put(resource stream, string remote_file, string local_file, int mode[, int startpos])
841841
Stores a file on the FTP server */
842-
PHP_FUNCTION(ftp_async_put)
842+
PHP_FUNCTION(ftp_nb_put)
843843
{
844844
zval *z_ftp;
845845
ftpbuf_t *ftp;
@@ -883,7 +883,7 @@ PHP_FUNCTION(ftp_async_put)
883883
ftp->direction = 1; /* send */
884884
ftp->closestream = 1; /* do close */
885885

886-
ret = ftp_async_put(ftp, remote, instream, xtype, startpos);
886+
ret = ftp_nb_put(ftp, remote, instream, xtype, startpos);
887887

888888
if (ret != PHP_FTP_MOREDATA) {
889889
php_stream_close(instream);

ext/ftp/php_ftp.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,11 @@ PHP_FUNCTION(ftp_site);
5858
PHP_FUNCTION(ftp_close);
5959
PHP_FUNCTION(ftp_set_option);
6060
PHP_FUNCTION(ftp_get_option);
61-
PHP_FUNCTION(ftp_async_get);
62-
PHP_FUNCTION(ftp_async_fget);
63-
PHP_FUNCTION(ftp_async_put);
64-
PHP_FUNCTION(ftp_async_fput);
65-
PHP_FUNCTION(ftp_async_continue);
61+
PHP_FUNCTION(ftp_nb_get);
62+
PHP_FUNCTION(ftp_nb_fget);
63+
PHP_FUNCTION(ftp_nb_put);
64+
PHP_FUNCTION(ftp_nb_fput);
65+
PHP_FUNCTION(ftp_nb_continue);
6666

6767
#define phpext_ftp_ptr php_ftp_module_ptr
6868

0 commit comments

Comments
 (0)