Ticket #416: util.i.mk2.patch

File util.i.mk2.patch, 624 bytes (added by Olly Betts, 15 years ago)

Cleaned up patch

  • util.i

     
    140140    }
    141141}
    142142
     143%typemap(out) const std::map<std::string, Xapian::doccount> & {
     144    if (array_init($result) == FAILURE) {
     145        SWIG_PHP_Error(E_ERROR, "array_init failed");
     146    }
     147
     148    map<string, Xapian::doccount>::iterator i;
     149    for (i = $1->begin(); i != $1->end(); ++i) {
     150        const string & term = i->first;
     151        char *p = const_cast<char*>(term.data());
     152        add_assoc_long_ex($result, p, term.length(), i->second);
     153    }
     154}
     155
    143156/* vim:set syntax=cpp:set noexpandtab: */