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.431 by root, Sat Dec 1 20:22:13 2018 UTC vs.
Revision 1.432 by root, Wed Dec 5 19:03:27 2018 UTC

441SvPTR_nc (SV *sv) 441SvPTR_nc (SV *sv)
442{ 442{
443 sv = SvRV (sv); 443 sv = SvRV (sv);
444 444
445 // very important shortcut 445 // very important shortcut
446 if (expect_true (SvMAGIC (sv) && SvMAGIC (sv)->mg_type == PERL_MAGIC_ext)) 446 if (ecb_expect_true (SvMAGIC (sv) && SvMAGIC (sv)->mg_type == PERL_MAGIC_ext))
447 return (long)SvMAGIC (sv)->mg_ptr; 447 return (long)SvMAGIC (sv)->mg_ptr;
448 448
449 if (MAGIC *mg = mg_find (sv, PERL_MAGIC_ext)) 449 if (MAGIC *mg = mg_find (sv, PERL_MAGIC_ext))
450 return (long)mg->mg_ptr; 450 return (long)mg->mg_ptr;
451 451
462} 462}
463 463
464ecb_noinline static long 464ecb_noinline static long
465SvPTR_ornull (SV *sv, const char *klass) 465SvPTR_ornull (SV *sv, const char *klass)
466{ 466{
467 if (expect_false (!SvOK (sv))) return 0; 467 if (ecb_expect_false (!SvOK (sv))) return 0;
468 468
469 return SvPTR (sv, klass); 469 return SvPTR (sv, klass);
470} 470}
471 471
472ecb_noinline static long 472ecb_noinline static long
473SvPTR_ornull_client (SV *sv) 473SvPTR_ornull_client (SV *sv)
474{ 474{
475 if (expect_false (!SvOK (sv))) return 0; 475 if (ecb_expect_false (!SvOK (sv))) return 0;
476 476
477 if (!SvROK (sv) 477 if (!SvROK (sv)
478 || (SvSTASH (SvRV (sv)) != stash_cf_client_wrap 478 || (SvSTASH (SvRV (sv)) != stash_cf_client_wrap
479 && !sv_derived_from (sv, "cf::client"))) 479 && !sv_derived_from (sv, "cf::client")))
480 croak ("object of type cf::client expected"); 480 croak ("object of type cf::client expected");
483} 483}
484 484
485ecb_noinline static long 485ecb_noinline static long
486SvPTR_ornull_object (SV *sv) 486SvPTR_ornull_object (SV *sv)
487{ 487{
488 if (expect_false (!SvOK (sv))) return 0; 488 if (ecb_expect_false (!SvOK (sv))) return 0;
489 489
490 if (!SvROK (sv) 490 if (!SvROK (sv)
491 || (SvSTASH (SvRV (sv)) != stash_cf_object_wrap 491 || (SvSTASH (SvRV (sv)) != stash_cf_object_wrap
492 && SvSTASH (SvRV (sv)) != stash_cf_object_player_wrap 492 && SvSTASH (SvRV (sv)) != stash_cf_object_player_wrap
493 && SvSTASH (SvRV (sv)) != stash_cf_arch_wrap 493 && SvSTASH (SvRV (sv)) != stash_cf_arch_wrap
498} 498}
499 499
500ecb_noinline static long 500ecb_noinline static long
501SvPTR_ornull_maptile (SV *sv) 501SvPTR_ornull_maptile (SV *sv)
502{ 502{
503 if (expect_false (!SvOK (sv))) return 0; 503 if (ecb_expect_false (!SvOK (sv))) return 0;
504 504
505 if (!SvROK (sv) 505 if (!SvROK (sv)
506 || (SvSTASH (SvRV (sv)) != stash_cf_map_wrap 506 || (SvSTASH (SvRV (sv)) != stash_cf_map_wrap
507 && SvSTASH (SvRV (sv)) != stash_ext_map_world 507 && SvSTASH (SvRV (sv)) != stash_ext_map_world
508 && !sv_derived_from (sv, "cf::map"))) 508 && !sv_derived_from (sv, "cf::map")))
512} 512}
513 513
514ecb_noinline static long 514ecb_noinline static long
515SvPTR_ornull_player (SV *sv) 515SvPTR_ornull_player (SV *sv)
516{ 516{
517 if (expect_false (!SvOK (sv))) return 0; 517 if (ecb_expect_false (!SvOK (sv))) return 0;
518 518
519 if (!SvROK (sv) 519 if (!SvROK (sv)
520 || (SvSTASH (SvRV (sv)) != stash_cf_player_wrap 520 || (SvSTASH (SvRV (sv)) != stash_cf_player_wrap
521 && !sv_derived_from (sv, "cf::player"))) 521 && !sv_derived_from (sv, "cf::player")))
522 croak ("object of type cf::player expected"); 522 croak ("object of type cf::player expected");
733template<class type> 733template<class type>
734ecb_noinline static void 734ecb_noinline static void
735cf_obj_to (SV *arg, type &var) 735cf_obj_to (SV *arg, type &var)
736{ 736{
737 sv_to (arg, var); 737 sv_to (arg, var);
738 if (expect_false (!var)) 738 if (ecb_expect_false (!var))
739 croak ("must not pass invalid/null cf_obj here"); 739 croak ("must not pass invalid/null cf_obj here");
740} 740}
741 741
742template<class object> 742template<class object>
743ecb_noinline static void 743ecb_noinline static void
744cf_obj_ornull_to (SV *arg, object *&var) 744cf_obj_ornull_to (SV *arg, object *&var)
745{ 745{
746 if (SvOK (arg)) 746 if (SvOK (arg))
747 { 747 {
748 sv_to (arg, var); 748 sv_to (arg, var);
749 if (expect_false (!var)) 749 if (ecb_expect_false (!var))
750 croak ("unable to convert perl object to C++ object"); 750 croak ("unable to convert perl object to C++ object");
751 } 751 }
752 else 752 else
753 var = 0; 753 var = 0;
754} 754}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines