summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2019-05-22 20:42:12 -0400
committerSolomon Peachy <pizza@shaftnet.org>2019-05-22 20:42:12 -0400
commitb8520aa3021b89d751fbebd184d700b4c9c78173 (patch)
treefa20bb924a832c09a65aac68df8053580139c1a9
parent891fc9cb5d3cd37f8b456245f702d550bbc2b9d9 (diff)
downloadselphy_print-b8520aa3021b89d751fbebd184d700b4c9c78173.tar.gz
selphy_print-b8520aa3021b89d751fbebd184d700b4c9c78173.tar.bz2
selphy_print-b8520aa3021b89d751fbebd184d700b4c9c78173.zip
common: Use generic teardown code unless necessary.
-rw-r--r--backend_canonselphy.c10
-rw-r--r--backend_canonselphyneo.c10
-rw-r--r--backend_common.c15
-rw-r--r--backend_common.h2
-rw-r--r--backend_kodak1400.c10
-rw-r--r--backend_kodak605.c10
-rw-r--r--backend_kodak6800.c10
-rw-r--r--backend_magicard.c10
-rw-r--r--backend_mitsud90.c10
-rw-r--r--backend_mitsup95d.c10
-rw-r--r--backend_shinkos1245.c10
-rw-r--r--backend_shinkos2145.c10
-rw-r--r--backend_shinkos6245.c10
-rw-r--r--backend_sonyupd.c10
-rw-r--r--backend_sonyupdneo.c10
15 files changed, 15 insertions, 132 deletions
diff --git a/backend_canonselphy.c b/backend_canonselphy.c
index 86b49c4..ee0190e 100644
--- a/backend_canonselphy.c
+++ b/backend_canonselphy.c
@@ -692,15 +692,6 @@ static void canonselphy_cleanup_job(const void *vjob) {
free((void*)job);
}
-static void canonselphy_teardown(void *vctx) {
- struct canonselphy_ctx *ctx = vctx;
-
- if (!ctx)
- return;
-
- free(ctx);
-}
-
static int canonselphy_read_parse(void *vctx, const void **vjob, int data_fd, int copies)
{
struct canonselphy_ctx *ctx = vctx;
@@ -1166,7 +1157,6 @@ struct dyesub_backend canonselphy_backend = {
.cmdline_arg = canonselphy_cmdline_arg,
.init = canonselphy_init,
.attach = canonselphy_attach,
- .teardown = canonselphy_teardown,
.read_parse = canonselphy_read_parse,
.cleanup_job = canonselphy_cleanup_job,
.main_loop = canonselphy_main_loop,
diff --git a/backend_canonselphyneo.c b/backend_canonselphyneo.c
index 2ad8b16..521dc50 100644
--- a/backend_canonselphyneo.c
+++ b/backend_canonselphyneo.c
@@ -252,15 +252,6 @@ static void selphyneo_cleanup_job(const void *vjob) {
free((void*)job);
}
-static void selphyneo_teardown(void *vctx) {
- struct selphyneo_ctx *ctx = vctx;
-
- if (!ctx)
- return;
-
- free(ctx);
-}
-
static int selphyneo_read_parse(void *vctx, const void **vjob, int data_fd, int copies)
{
struct selphyneo_ctx *ctx = vctx;
@@ -548,7 +539,6 @@ struct dyesub_backend canonselphyneo_backend = {
.init = selphyneo_init,
.attach = selphyneo_attach,
.cleanup_job = selphyneo_cleanup_job,
- .teardown = selphyneo_teardown,
.read_parse = selphyneo_read_parse,
.main_loop = selphyneo_main_loop,
.query_markers = selphyneo_query_markers,
diff --git a/backend_common.c b/backend_common.c
index d62ed5b..2365d11 100644
--- a/backend_common.c
+++ b/backend_common.c
@@ -30,7 +30,7 @@
#include "backend_common.h"
#include <errno.h>
-#define BACKEND_VERSION "0.93"
+#define BACKEND_VERSION "0.94"
#ifndef URI_PREFIX
#error "Must Define URI_PREFIX"
#endif
@@ -667,6 +667,14 @@ abort:
return found;
}
+void generic_teardown(void *vctx)
+{
+ if (!vctx)
+ return;
+
+ free(vctx);
+}
+
extern struct dyesub_backend sonyupd_backend;
extern struct dyesub_backend sonyupdneo_backend;
extern struct dyesub_backend kodak6800_backend;
@@ -1349,7 +1357,10 @@ done_close:
done:
if (backend && backend_ctx) {
- backend->teardown(backend_ctx);
+ if (backend->teardown)
+ backend->teardown(backend_ctx);
+ else
+ generic_teardown(backend_ctx);
// STATE("-org.gutenprint-attached-to-device");
}
diff --git a/backend_common.h b/backend_common.h
index 2a8249a..1c52c18 100644
--- a/backend_common.h
+++ b/backend_common.h
@@ -230,6 +230,8 @@ int dyesub_read_file(char *filename, void *databuf, int datalen,
uint16_t uint16_to_packed_bcd(uint16_t val);
uint32_t packed_bcd_to_uint32(char *in, int len);
+void generic_teardown(void *vctx);
+
/* USB enumeration and attachment */
#define NUM_CLAIM_ATTEMPTS 10
int backend_claim_interface(struct libusb_device_handle *dev, int iface,
diff --git a/backend_kodak1400.c b/backend_kodak1400.c
index 60cbb8e..cd5cc49 100644
--- a/backend_kodak1400.c
+++ b/backend_kodak1400.c
@@ -329,15 +329,6 @@ static void kodak1400_cleanup_job(const void *vjob)
free((void*)job);
}
-static void kodak1400_teardown(void *vctx) {
- struct kodak1400_ctx *ctx = vctx;
-
- if (!ctx)
- return;
-
- free(ctx);
-}
-
static int kodak1400_read_parse(void *vctx, const void **vjob, int data_fd, int copies) {
struct kodak1400_ctx *ctx = vctx;
int i, ret;
@@ -662,7 +653,6 @@ struct dyesub_backend kodak1400_backend = {
.cmdline_arg = kodak1400_cmdline_arg,
.init = kodak1400_init,
.attach = kodak1400_attach,
- .teardown = kodak1400_teardown,
.cleanup_job = kodak1400_cleanup_job,
.read_parse = kodak1400_read_parse,
.main_loop = kodak1400_main_loop,
diff --git a/backend_kodak605.c b/backend_kodak605.c
index 4f410ec..b4b1c31 100644
--- a/backend_kodak605.c
+++ b/backend_kodak605.c
@@ -400,15 +400,6 @@ static int kodak605_attach(void *vctx, struct libusb_device_handle *dev, int typ
return CUPS_BACKEND_OK;
}
-static void kodak605_teardown(void *vctx) {
- struct kodak605_ctx *ctx = vctx;
-
- if (!ctx)
- return;
-
- free(ctx);
-}
-
static int kodak605_read_parse(void *vctx, const void **vjob, int data_fd, int copies) {
struct kodak605_ctx *ctx = vctx;
int ret;
@@ -892,7 +883,6 @@ struct dyesub_backend kodak605_backend = {
.cmdline_arg = kodak605_cmdline_arg,
.init = kodak605_init,
.attach = kodak605_attach,
- .teardown = kodak605_teardown,
.cleanup_job = sinfonia_cleanup_job,
.read_parse = kodak605_read_parse,
.main_loop = kodak605_main_loop,
diff --git a/backend_kodak6800.c b/backend_kodak6800.c
index 6dbe4b2..4b2eceb 100644
--- a/backend_kodak6800.c
+++ b/backend_kodak6800.c
@@ -789,15 +789,6 @@ static int kodak6800_attach(void *vctx, struct libusb_device_handle *dev, int ty
return CUPS_BACKEND_OK;
}
-static void kodak6800_teardown(void *vctx) {
- struct kodak6800_ctx *ctx = vctx;
-
- if (!ctx)
- return;
-
- free(ctx);
-}
-
static int kodak6800_read_parse(void *vctx, const void **vjob, int data_fd, int copies) {
struct kodak6800_ctx *ctx = vctx;
int ret;
@@ -1095,7 +1086,6 @@ struct dyesub_backend kodak6800_backend = {
.cmdline_arg = kodak6800_cmdline_arg,
.init = kodak6800_init,
.attach = kodak6800_attach,
- .teardown = kodak6800_teardown,
.cleanup_job = sinfonia_cleanup_job,
.read_parse = kodak6800_read_parse,
.main_loop = kodak6800_main_loop,
diff --git a/backend_magicard.c b/backend_magicard.c
index ae20e73..e12fdb8 100644
--- a/backend_magicard.c
+++ b/backend_magicard.c
@@ -476,15 +476,6 @@ static void magicard_cleanup_job(const void *vjob)
free((void*)job);
}
-static void magicard_teardown(void *vctx) {
- struct magicard_ctx *ctx = vctx;
-
- if (!ctx)
- return;
-
- free(ctx);
-}
-
static void downscale_and_extract(int gamma, uint32_t pixels,
uint8_t *y_i, uint8_t *m_i, uint8_t *c_i,
uint8_t *y_o, uint8_t *m_o, uint8_t *c_o, uint8_t *k_o)
@@ -963,7 +954,6 @@ struct dyesub_backend magicard_backend = {
.cmdline_usage = magicard_cmdline,
.init = magicard_init,
.attach = magicard_attach,
- .teardown = magicard_teardown,
.cleanup_job = magicard_cleanup_job,
.read_parse = magicard_read_parse,
.main_loop = magicard_main_loop,
diff --git a/backend_mitsud90.c b/backend_mitsud90.c
index 1f8b508..850eb14 100644
--- a/backend_mitsud90.c
+++ b/backend_mitsud90.c
@@ -560,15 +560,6 @@ static void mitsud90_cleanup_job(const void *vjob)
free((void*)job);
}
-static void mitsud90_teardown(void *vctx) {
- struct mitsud90_ctx *ctx = vctx;
-
- if (!ctx)
- return;
-
- free(ctx);
-}
-
static int mitsud90_read_parse(void *vctx, const void **vjob, int data_fd, int copies) {
struct mitsud90_ctx *ctx = vctx;
int i, remain;
@@ -1233,7 +1224,6 @@ struct dyesub_backend mitsud90_backend = {
.init = mitsud90_init,
.attach = mitsud90_attach,
.cleanup_job = mitsud90_cleanup_job,
- .teardown = mitsud90_teardown,
.read_parse = mitsud90_read_parse,
.main_loop = mitsud90_main_loop,
.query_markers = mitsud90_query_markers,
diff --git a/backend_mitsup95d.c b/backend_mitsup95d.c
index aa75aef..bd7f041 100644
--- a/backend_mitsup95d.c
+++ b/backend_mitsup95d.c
@@ -170,15 +170,6 @@ static void mitsup95d_cleanup_job(const void *vjob)
free((void*)job);
}
-static void mitsup95d_teardown(void *vctx) {
- struct mitsup95d_ctx *ctx = vctx;
-
- if (!ctx)
- return;
-
- free(ctx);
-}
-
static int mitsup95d_read_parse(void *vctx, const void **vjob, int data_fd, int copies) {
struct mitsup95d_ctx *ctx = vctx;
uint8_t buf[2]; /* Enough to read in any header */
@@ -615,7 +606,6 @@ struct dyesub_backend mitsup95d_backend = {
.cmdline_usage = mitsup95d_cmdline,
.init = mitsup95d_init,
.attach = mitsup95d_attach,
- .teardown = mitsup95d_teardown,
.cleanup_job = mitsup95d_cleanup_job,
.read_parse = mitsup95d_read_parse,
.main_loop = mitsup95d_main_loop,
diff --git a/backend_shinkos1245.c b/backend_shinkos1245.c
index 80d6dbd..752971c 100644
--- a/backend_shinkos1245.c
+++ b/backend_shinkos1245.c
@@ -999,15 +999,6 @@ static int shinkos1245_attach(void *vctx, struct libusb_device_handle *dev, int
return CUPS_BACKEND_OK;
}
-static void shinkos1245_teardown(void *vctx) {
- struct shinkos1245_ctx *ctx = vctx;
-
- if (!ctx)
- return;
-
- free(ctx);
-}
-
static int shinkos1245_read_parse(void *vctx, const void **vjob, int data_fd, int copies) {
struct shinkos1245_ctx *ctx = vctx;
int ret;
@@ -1296,7 +1287,6 @@ struct dyesub_backend shinkos1245_backend = {
.cmdline_arg = shinkos1245_cmdline_arg,
.init = shinkos1245_init,
.attach = shinkos1245_attach,
- .teardown = shinkos1245_teardown,
.cleanup_job = sinfonia_cleanup_job,
.read_parse = shinkos1245_read_parse,
.main_loop = shinkos1245_main_loop,
diff --git a/backend_shinkos2145.c b/backend_shinkos2145.c
index e197a6e..984ac35 100644
--- a/backend_shinkos2145.c
+++ b/backend_shinkos2145.c
@@ -1059,15 +1059,6 @@ static int shinkos2145_attach(void *vctx, struct libusb_device_handle *dev, int
return CUPS_BACKEND_OK;
}
-static void shinkos2145_teardown(void *vctx) {
- struct shinkos2145_ctx *ctx = vctx;
-
- if (!ctx)
- return;
-
- free(ctx);
-}
-
static int shinkos2145_read_parse(void *vctx, const void **vjob, int data_fd, int copies) {
struct shinkos2145_ctx *ctx = vctx;
struct sinfonia_printjob *job = NULL;
@@ -1350,7 +1341,6 @@ struct dyesub_backend shinkos2145_backend = {
.cmdline_arg = shinkos2145_cmdline_arg,
.init = shinkos2145_init,
.attach = shinkos2145_attach,
- .teardown = shinkos2145_teardown,
.cleanup_job = sinfonia_cleanup_job,
.read_parse = shinkos2145_read_parse,
.main_loop = shinkos2145_main_loop,
diff --git a/backend_shinkos6245.c b/backend_shinkos6245.c
index 8e2b8c4..9285d87 100644
--- a/backend_shinkos6245.c
+++ b/backend_shinkos6245.c
@@ -1087,15 +1087,6 @@ static int shinkos6245_attach(void *vctx, struct libusb_device_handle *dev, int
return CUPS_BACKEND_OK;
}
-static void shinkos6245_teardown(void *vctx) {
- struct shinkos6245_ctx *ctx = vctx;
-
- if (!ctx)
- return;
-
- free(ctx);
-}
-
static int shinkos6245_read_parse(void *vctx, const void **vjob, int data_fd, int copies) {
struct shinkos6245_ctx *ctx = vctx;
struct sinfonia_printjob *job = NULL;
@@ -1431,7 +1422,6 @@ struct dyesub_backend shinkos6245_backend = {
.cmdline_arg = shinkos6245_cmdline_arg,
.init = shinkos6245_init,
.attach = shinkos6245_attach,
- .teardown = shinkos6245_teardown,
.cleanup_job = sinfonia_cleanup_job,
.read_parse = shinkos6245_read_parse,
.main_loop = shinkos6245_main_loop,
diff --git a/backend_sonyupd.c b/backend_sonyupd.c
index 37d6bc9..80e22e6 100644
--- a/backend_sonyupd.c
+++ b/backend_sonyupd.c
@@ -145,15 +145,6 @@ static void upd_cleanup_job(const void *vjob)
free((void*)job);
}
-static void upd_teardown(void *vctx) {
- struct upd_ctx *ctx = vctx;
-
- if (!ctx)
- return;
-
- free(ctx);
-}
-
// UP-DR200
// 2UPC-R203 3.5x5 (770)
// 2UPC-R204 4x6 (700)
@@ -630,7 +621,6 @@ struct dyesub_backend sonyupd_backend = {
.cmdline_usage = upd_cmdline,
.init = upd_init,
.attach = upd_attach,
- .teardown = upd_teardown,
.cleanup_job = upd_cleanup_job,
.read_parse = upd_read_parse,
.main_loop = upd_main_loop,
diff --git a/backend_sonyupdneo.c b/backend_sonyupdneo.c
index 542b79c..a9201dd 100644
--- a/backend_sonyupdneo.c
+++ b/backend_sonyupdneo.c
@@ -115,15 +115,6 @@ static void updneo_cleanup_job(const void *vjob)
free((void*)job);
}
-static void updneo_teardown(void *vctx) {
- struct updneo_ctx *ctx = vctx;
-
- if (!ctx)
- return;
-
- free(ctx);
-}
-
#define MAX_PRINTJOB_LEN (3400*2392*3 + 2048)
static int updneo_read_parse(void *vctx, const void **vjob, int data_fd, int copies) {
@@ -344,7 +335,6 @@ struct dyesub_backend sonyupdneo_backend = {
.cmdline_arg = updneo_cmdline_arg,
.init = updneo_init,
.attach = updneo_attach,
- .teardown = updneo_teardown,
.cleanup_job = updneo_cleanup_job,
.read_parse = updneo_read_parse,
.main_loop = updneo_main_loop,