ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/cfperl.xs
(Generate patch)

Comparing deliantra/server/server/cfperl.xs (file contents):
Revision 1.41 by root, Sun Sep 3 22:45:57 2006 UTC vs.
Revision 1.42 by root, Mon Sep 4 11:08:00 2006 UTC

469{ 469{
470 static const char eof[] = "\n\n\n\0\0\0"; 470 static const char eof[] = "\n\n\n\0\0\0";
471 471
472 av = 0; 472 av = 0;
473 text = 0; 473 text = 0;
474 line = 0;
474 475
475 if (filename) 476 if (filename)
476 { 477 {
477 dSP; 478 dSP;
478 ENTER; 479 ENTER;
499 char *sv_ = SvPVbyte (sv, len); 500 char *sv_ = SvPVbyte (sv, len);
500 text = newSV (len + sizeof (eof)); 501 text = newSV (len + sizeof (eof));
501 SvCUR_set (text, len); 502 SvCUR_set (text, len);
502 memcpy (SvPVX (text), sv_, len); 503 memcpy (SvPVX (text), sv_, len);
503 memcpy (SvEND (text), eof, sizeof (eof)); // just to be sure 504 memcpy (SvEND (text), eof, sizeof (eof)); // just to be sure
505
506 line = SvPVX (text);
504 } 507 }
505 } 508 }
506 509
507 PUTBACK; 510 PUTBACK;
508 FREETMPS; 511 FREETMPS;
509 LEAVE; 512 LEAVE;
510 } 513 }
511
512 if (!text)
513 text = newSVpvn (eof, sizeof (eof));
514
515 line = SvPVX (text);
516} 514}
517 515
518void object_thawer::get (data_type type, void *obj, attachable_base *ext, int oid) 516void object_thawer::get (data_type type, void *obj, attachable_base *ext, int oid)
519{ 517{
520 if (!av || oid < 0) // this is actually an error of sorts 518 if (!av || oid < 0) // this is actually an error of sorts
546char *fgets (char *s, int n, object_thawer &thawer) 544char *fgets (char *s, int n, object_thawer &thawer)
547{ 545{
548 char *p = thawer.line; 546 char *p = thawer.line;
549 char *q = s; 547 char *q = s;
550 548
549 if (!p)
550 return 0;
551
551 while (--n) 552 while (--n)
552 { 553 {
553 if (!*p) 554 if (!*p)
554 break; 555 break;
555 556
565 return s == q ? 0 : s; 566 return s == q ? 0 : s;
566} 567}
567 568
568keyword object_thawer::get_kv () 569keyword object_thawer::get_kv ()
569{ 570{
571 if (!line)
572 return KW_EOF;
573
570 for (;;) 574 for (;;)
571 { 575 {
572 char *p = line; 576 char *p = line;
573 577
574 if (!*p) 578 if (!*p)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines