summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id>2021-07-22 17:04:07 +0800
committerꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id>2021-07-22 17:06:42 +0800
commitf686ef14951df5f4c2a82bc6075bfd520e05c3de (patch)
tree84cf5267c0f490c9c0d297c10a11cc774913f4fd
parent628a1be7997f13cf7c44dc3df215557e32d4e74f (diff)
pikul_codes shouldn't be needed
-rw-r--r--pikul.c15
-rw-r--r--pikul.h1
-rw-r--r--pikul.i16
3 files changed, 0 insertions, 32 deletions
diff --git a/pikul.c b/pikul.c
index 0a170b7..27c4cde 100644
--- a/pikul.c
+++ b/pikul.c
@@ -227,21 +227,6 @@ char *pikul_html(const char *origin, const char *destination, double weight,
return html;
}
-char **pikul_codes(const char *origin, const char *destination, double weight)
-{
- char **codes = malloc(sizeof(char *));
- codes[0] = NULL;
- struct pikul_services *services = pikul_services(origin, destination, weight);
- if (!services || !services->length)
- return codes;
- codes = realloc(codes, (services->length + 1) * sizeof(char *));
- size_t i = 0;
- for (i = 0; i < services->length; i++)
- codes[i] = services->list[i]->code;
- codes[i] = NULL;
- return codes;
-}
-
double pikul_cost(const char *origin, const char *destination, double weight, const char *code)
{
struct pikul_services *services = pikul_services(origin, destination, weight);
diff --git a/pikul.h b/pikul.h
index 7d46197..3581695 100644
--- a/pikul.h
+++ b/pikul.h
@@ -27,7 +27,6 @@ void pikul_free_services(struct pikul_services *services);
char *pikul_html(const char *origin, const char *destination, double weight,
const char *widget, const char *extra, const char *name, const char *value,
char *code_prefixes[], char *name_prefixes[]);
-char **pikul_codes(const char *origin, const char *destination, double weight);
double pikul_cost(const char *origin, const char *destination, double weight, const char *service);
char *pikul_order(const char *order_number, const char *service, const char *sender_name,
const char *sender_phone, const char *origin, const char *sender_address,
diff --git a/pikul.i b/pikul.i
index d217982..c39c6a3 100644
--- a/pikul.i
+++ b/pikul.i
@@ -17,21 +17,6 @@
%typemap(freearg) char *[] {
free($1);
}
-%typemap(out) char ** {
- int len = 0;
- while ($1[len])
- len++;
- SV **svs = malloc(len * sizeof(SV *));
- for (int i = 0; i < len; i++) {
- svs[i] = sv_newmortal();
- sv_setpv((SV *)svs[i], $1[i]);
- };
- AV *myav = av_make(len, svs);
- free(svs);
- $result = newRV_noinc((SV *)myav);
- sv_2mortal($result);
- argvi++;
-}
%typemap(in) char **[] {
AV *items = (AV *)SvRV($input);
@@ -60,7 +45,6 @@
void pikul_init(enum pikul_company, char *[]);
char *pikul_html(const char *, const char *, double, const char *, const char *, const char *, const char *,
char *[], char *[]);
-char **pikul_codes(const char *, const char *, double);
double pikul_cost(const char *, const char *, double, const char *);
char *pikul_order(const char *, const char *, const char *, const char *, const char *, const char *,
const char *, const char *, const char *, const char *, const char *, const char *, int,