common: Use generic teardown code unless necessary.

master
Solomon Peachy 4 years ago
parent 14794e37a2
commit 473f86b0d5
  1. 10
      backend_canonselphy.c
  2. 10
      backend_canonselphyneo.c
  3. 15
      backend_common.c
  4. 2
      backend_common.h
  5. 10
      backend_kodak1400.c
  6. 10
      backend_kodak605.c
  7. 10
      backend_kodak6800.c
  8. 10
      backend_magicard.c
  9. 10
      backend_mitsud90.c
  10. 10
      backend_mitsup95d.c
  11. 10
      backend_shinkos1245.c
  12. 10
      backend_shinkos2145.c
  13. 10
      backend_shinkos6245.c
  14. 10
      backend_sonyupd.c
  15. 10
      backend_sonyupdneo.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,

@ -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,

@ -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");
}

@ -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,

@ -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,

@ -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,

@ -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,

@ -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,

@ -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,

@ -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,

@ -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,

@ -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,

@ -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,

@ -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,

@ -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,

Loading…
Cancel
Save