/* * Copyright (c) 2005 Sendmail, Inc. and its suppliers. * All rights reserved. * * By using this file, you agree to the terms and conditions set * forth in the LICENSE file which can be found at the top level of * the sendmail distribution. */ #include "sm/generic.h" SM_RCSID("@(#)$Id: hdrmodins.c,v 1.4 2006/12/29 01:21:43 ca Exp $") #include "sm/assert.h" #include "sm/error.h" #include "sm/hdrmod.h" /* ** SM_HDRMOD_INS -- insert hdrmod entry at right place in list ** ** Parameters: ** sm_hdrmodhd -- head of header modification list ** sm_hdrmod -- header modification entry to remove ** ** Returns: ** SM_SUCCESS */ sm_ret_T sm_hdrmod_insert(sm_hdrmodhd_P sm_hdrmodhd, sm_hdrmod_P sm_hdrmod) { SM_ASSERT(sm_hdrmodhd != NULL); SM_ASSERT(sm_hdrmod != NULL); if (!HDRMODL_EMPTY(sm_hdrmodhd)) { sm_hdrmod_P sm_hdrmod_h; for (sm_hdrmod_h = HDRMODL_FIRST(sm_hdrmodhd); sm_hdrmod_h != HDRMODL_END(sm_hdrmodhd); sm_hdrmod_h = HDRMODL_NEXT(sm_hdrmod_h)) { if (sm_hdrmod->sm_hm_type < sm_hdrmod_h->sm_hm_type || (SM_HM_USE_POS(sm_hdrmod->sm_hm_type) && SM_HM_USE_POS(sm_hdrmod_h->sm_hm_type) && sm_hdrmod->sm_hm_pos < sm_hdrmod_h->sm_hm_pos)) { HDRMODL_INS_BEFORE(sm_hdrmodhd, sm_hdrmod, sm_hdrmod_h); return SM_SUCCESS; } } } HDRMODL_APP(sm_hdrmodhd, sm_hdrmod); return SM_SUCCESS; }