Skip to content
Snippets Groups Projects
Commit baa6f184 authored by Roman Tsisyk's avatar Roman Tsisyk
Browse files

Fix modulename.functioname syntax for C procedures

parent 8fd9c4f1
No related branches found
No related tags found
No related merge requests found
......@@ -90,16 +90,16 @@ func_load(struct func *func)
* Extract package name from function name.
* E.g. name = foo.bar.baz, function = baz, package = foo.bar
*/
const char *sym;
const char *package = func->def.name;
const char *package_end = NULL;
const char *sym = package;
while ((sym = strchr(sym, '.')))
package_end = sym;
if (package_end == NULL) {
const char *package_end = strrchr(package, '.');
if (package_end != NULL) {
/* module.submodule.function => module.submodule, function */
sym = package_end + 1;
} else {
/* package == function => function, function */
sym = package;
package_end = package + strlen(package);
} else {
sym = package_end + 1;
}
/* First argument of searchpath: name */
......
#include "tarantool.h"
#include <stdio.h>
int
function1(struct request *request, struct port *port)
{
say_info("-- function1 - called --");
printf("ok - function1\n");
return 0;
}
int
test(struct request *request, struct port *port)
{
say_info("-- test - called --");
printf("ok - test\n");
return 0;
}
ok - function1
ok - test
......@@ -15,8 +15,11 @@ net = require('net.box')
box.schema.func.create('function1', {language = "C"})
box.schema.user.grant('guest', 'execute', 'function', 'function1')
box.schema.func.create('function1.test', {language = "C"})
box.schema.user.grant('guest', 'execute', 'function', 'function1.test')
c = net:new(os.getenv("LISTEN"))
c:call('function1')
c:call('function1.test')
os.exit(0)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment