/** * @brief Add a video filter * (or change the parameter/value pairs of an existing one). * * @param vf video filter to be added or changed * @param argvf pointer to an array of (new) parameter/value pairs */ static void add_vf(const char *vf, const char *const *argvf) { if (vf_settings) { int i = 0; while (vf_settings[i].name) { if (strcmp(vf_settings[i].name, vf) == 0) break; i++; } if (vf_settings[i].name) { listFree(&vf_settings[i].attribs); vf_settings[i].attribs = listDup(argvf); } else { void *settings = realloc(vf_settings, (i + 2) * sizeof(*vf_settings)); if (!settings) return; vf_settings = settings; vf_settings[i].name = strdup(vf); vf_settings[i].attribs = listDup(argvf); memset(&vf_settings[i + 1], 0, sizeof(*vf_settings)); } } else { vf_settings = calloc(2, sizeof(*vf_settings)); if (!vf_settings) return; vf_settings[0].name = strdup(vf); vf_settings[0].attribs = listDup(argvf); } mp_msg(MSGT_GPLAYER, MSGL_INFO, MSGTR_GUI_MSG_AddingVideoFilter, vf); }
void dup_list() { listNode *node; list *orig=found_list(&node); list *ll; if(orig){ ll=listDup(orig); printf("输入复制过后的链表名称:"); scanf("%s",(ll->name)); listall=listAddNodeTail(listall,ll); printf("复制成功\n"); }else{ printf("没有这个链表\n"); } }
void syncCommand(redisClient *c) { /* ignore SYNC if aleady slave or in monitor mode */ if (c->flags & REDIS_SLAVE) return; /* Refuse SYNC requests if we are a slave but the link with our master * is not ok... */ if (server.masterhost && server.replstate != REDIS_REPL_CONNECTED) { addReplyError(c,"Can't SYNC while not connected with my master"); return; } /* SYNC can't be issued when the server has pending data to send to * the client about already issued commands. We need a fresh reply * buffer registering the differences between the BGSAVE and the current * dataset, so that we can copy to other slaves if needed. */ if (listLength(c->reply) != 0) { addReplyError(c,"SYNC is invalid with pending input"); return; } redisLog(REDIS_NOTICE,"Slave ask for synchronization"); /* Here we need to check if there is a background saving operation * in progress, or if it is required to start one */ if (server.bgsavechildpid != -1) { /* Ok a background save is in progress. Let's check if it is a good * one for replication, i.e. if there is another slave that is * registering differences since the server forked to save */ redisClient *slave; listNode *ln; listIter li; listRewind(server.slaves,&li); while((ln = listNext(&li))) { slave = ln->value; if (slave->replstate == REDIS_REPL_WAIT_BGSAVE_END) break; } if (ln) { /* Perfect, the server is already registering differences for * another slave. Set the right state, and copy the buffer. */ listRelease(c->reply); c->reply = listDup(slave->reply); c->replstate = REDIS_REPL_WAIT_BGSAVE_END; redisLog(REDIS_NOTICE,"Waiting for end of BGSAVE for SYNC"); } else { /* No way, we need to wait for the next BGSAVE in order to * register differences */ c->replstate = REDIS_REPL_WAIT_BGSAVE_START; redisLog(REDIS_NOTICE,"Waiting for next BGSAVE for SYNC"); } } else { /* Ok we don't have a BGSAVE in progress, let's start one */ redisLog(REDIS_NOTICE,"Starting BGSAVE for SYNC"); if (rdbSaveBackground(server.dbfilename) != REDIS_OK) { redisLog(REDIS_NOTICE,"Replication failed, can't BGSAVE"); addReplyError(c,"Unable to perform background save"); return; } c->replstate = REDIS_REPL_WAIT_BGSAVE_END; } c->repldbfd = -1; c->flags |= REDIS_SLAVE; c->slaveseldb = 0; listAddNodeTail(server.slaves,c); return; }